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 */
134 ALC269_ASUS_EEEPC_P703,
135 ALC269_ASUS_EEEPC_P901,
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
216 ALC883_TARGA_2ch_DIG,
217 ALC883_TARGA_8ch_DIG,
220 ALC888_ACER_ASPIRE_4930G,
221 ALC888_ACER_ASPIRE_6530G,
222 ALC888_ACER_ASPIRE_8930G,
226 ALC883_LENOVO_101E_2ch,
227 ALC883_LENOVO_NB0763,
228 ALC888_LENOVO_MS7195_DIG,
235 ALC883_FUJITSU_PI2515,
236 ALC888_FUJITSU_XA3530,
237 ALC883_3ST_6ch_INTEL,
250 #define GPIO_MASK 0x03
252 /* extra amp-initialization sequence types */
261 struct alc_mic_route {
263 unsigned char mux_idx;
264 unsigned char amix_idx;
267 #define MUX_IDX_UNDEF ((unsigned char)-1)
270 /* codec parameterization */
271 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
272 unsigned int num_mixers;
273 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
274 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
276 const struct hda_verb *init_verbs[5]; /* initialization verbs
280 unsigned int num_init_verbs;
282 char stream_name_analog[32]; /* analog PCM stream */
283 struct hda_pcm_stream *stream_analog_playback;
284 struct hda_pcm_stream *stream_analog_capture;
285 struct hda_pcm_stream *stream_analog_alt_playback;
286 struct hda_pcm_stream *stream_analog_alt_capture;
288 char stream_name_digital[32]; /* digital PCM stream */
289 struct hda_pcm_stream *stream_digital_playback;
290 struct hda_pcm_stream *stream_digital_capture;
293 struct hda_multi_out multiout; /* playback set-up
294 * max_channels, dacs must be set
295 * dig_out_nid and hp_nid are optional
297 hda_nid_t alt_dac_nid;
298 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
302 unsigned int num_adc_nids;
304 hda_nid_t *capsrc_nids;
305 hda_nid_t dig_in_nid; /* digital-in NID; optional */
308 unsigned int num_mux_defs;
309 const struct hda_input_mux *input_mux;
310 unsigned int cur_mux[3];
311 struct alc_mic_route ext_mic;
312 struct alc_mic_route int_mic;
315 const struct hda_channel_mode *channel_mode;
316 int num_channel_mode;
318 int const_channel_count;
319 int ext_channel_count;
321 /* PCM information */
322 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
324 /* dynamic controls, init_verbs and input_mux */
325 struct auto_pin_cfg autocfg;
326 struct snd_array kctls;
327 struct hda_input_mux private_imux[3];
328 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
329 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
330 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
333 void (*init_hook)(struct hda_codec *codec);
334 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
336 /* for pin sensing */
337 unsigned int sense_updated: 1;
338 unsigned int jack_present: 1;
339 unsigned int master_sw: 1;
340 unsigned int auto_mic:1;
343 unsigned int no_analog :1; /* digital I/O only */
346 /* for virtual master */
347 hda_nid_t vmaster_nid;
348 #ifdef CONFIG_SND_HDA_POWER_SAVE
349 struct hda_loopback_check loopback;
354 unsigned int pll_coef_idx, pll_coef_bit;
358 * configuration template - to be copied to the spec instance
360 struct alc_config_preset {
361 struct snd_kcontrol_new *mixers[5]; /* should be identical size
364 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
365 const struct hda_verb *init_verbs[5];
366 unsigned int num_dacs;
368 hda_nid_t dig_out_nid; /* optional */
369 hda_nid_t hp_nid; /* optional */
370 hda_nid_t *slave_dig_outs;
371 unsigned int num_adc_nids;
373 hda_nid_t *capsrc_nids;
374 hda_nid_t dig_in_nid;
375 unsigned int num_channel_mode;
376 const struct hda_channel_mode *channel_mode;
378 int const_channel_count;
379 unsigned int num_mux_defs;
380 const struct hda_input_mux *input_mux;
381 void (*unsol_event)(struct hda_codec *, unsigned int);
382 void (*init_hook)(struct hda_codec *);
383 #ifdef CONFIG_SND_HDA_POWER_SAVE
384 struct hda_amp_list *loopbacks;
392 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
393 struct snd_ctl_elem_info *uinfo)
395 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
396 struct alc_spec *spec = codec->spec;
397 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
398 if (mux_idx >= spec->num_mux_defs)
400 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
403 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
404 struct snd_ctl_elem_value *ucontrol)
406 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
407 struct alc_spec *spec = codec->spec;
408 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
410 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
414 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
415 struct snd_ctl_elem_value *ucontrol)
417 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
418 struct alc_spec *spec = codec->spec;
419 const struct hda_input_mux *imux;
420 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
421 unsigned int mux_idx;
422 hda_nid_t nid = spec->capsrc_nids ?
423 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
426 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
427 imux = &spec->input_mux[mux_idx];
429 type = get_wcaps_type(get_wcaps(codec, nid));
430 if (type == AC_WID_AUD_MIX) {
431 /* Matrix-mixer style (e.g. ALC882) */
432 unsigned int *cur_val = &spec->cur_mux[adc_idx];
435 idx = ucontrol->value.enumerated.item[0];
436 if (idx >= imux->num_items)
437 idx = imux->num_items - 1;
440 for (i = 0; i < imux->num_items; i++) {
441 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
442 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
443 imux->items[i].index,
449 /* MUX style (e.g. ALC880) */
450 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
451 &spec->cur_mux[adc_idx]);
456 * channel mode setting
458 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_info *uinfo)
461 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
462 struct alc_spec *spec = codec->spec;
463 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
464 spec->num_channel_mode);
467 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
468 struct snd_ctl_elem_value *ucontrol)
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
471 struct alc_spec *spec = codec->spec;
472 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
473 spec->num_channel_mode,
474 spec->ext_channel_count);
477 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 &spec->ext_channel_count);
485 if (err >= 0 && !spec->const_channel_count) {
486 spec->multiout.max_channels = spec->ext_channel_count;
487 if (spec->need_dac_fix)
488 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
494 * Control the mode of pin widget settings via the mixer. "pc" is used
495 * instead of "%" to avoid consequences of accidently treating the % as
496 * being part of a format specifier. Maximum allowed length of a value is
497 * 63 characters plus NULL terminator.
499 * Note: some retasking pin complexes seem to ignore requests for input
500 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
501 * are requested. Therefore order this list so that this behaviour will not
502 * cause problems when mixer clients move through the enum sequentially.
503 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
506 static char *alc_pin_mode_names[] = {
507 "Mic 50pc bias", "Mic 80pc bias",
508 "Line in", "Line out", "Headphone out",
510 static unsigned char alc_pin_mode_values[] = {
511 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
513 /* The control can present all 5 options, or it can limit the options based
514 * in the pin being assumed to be exclusively an input or an output pin. In
515 * addition, "input" pins may or may not process the mic bias option
516 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
517 * accept requests for bias as of chip versions up to March 2006) and/or
518 * wiring in the computer.
520 #define ALC_PIN_DIR_IN 0x00
521 #define ALC_PIN_DIR_OUT 0x01
522 #define ALC_PIN_DIR_INOUT 0x02
523 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
524 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
526 /* Info about the pin modes supported by the different pin direction modes.
527 * For each direction the minimum and maximum values are given.
529 static signed char alc_pin_mode_dir_info[5][2] = {
530 { 0, 2 }, /* ALC_PIN_DIR_IN */
531 { 3, 4 }, /* ALC_PIN_DIR_OUT */
532 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
533 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
534 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
536 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
537 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
538 #define alc_pin_mode_n_items(_dir) \
539 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
541 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
542 struct snd_ctl_elem_info *uinfo)
544 unsigned int item_num = uinfo->value.enumerated.item;
545 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
547 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
549 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
551 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
552 item_num = alc_pin_mode_min(dir);
553 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
557 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
558 struct snd_ctl_elem_value *ucontrol)
561 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
562 hda_nid_t nid = kcontrol->private_value & 0xffff;
563 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
564 long *valp = ucontrol->value.integer.value;
565 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
566 AC_VERB_GET_PIN_WIDGET_CONTROL,
569 /* Find enumerated value for current pinctl setting */
570 i = alc_pin_mode_min(dir);
571 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
573 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
577 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
578 struct snd_ctl_elem_value *ucontrol)
581 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
582 hda_nid_t nid = kcontrol->private_value & 0xffff;
583 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
584 long val = *ucontrol->value.integer.value;
585 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
586 AC_VERB_GET_PIN_WIDGET_CONTROL,
589 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
590 val = alc_pin_mode_min(dir);
592 change = pinctl != alc_pin_mode_values[val];
594 /* Set pin mode to that requested */
595 snd_hda_codec_write_cache(codec, nid, 0,
596 AC_VERB_SET_PIN_WIDGET_CONTROL,
597 alc_pin_mode_values[val]);
599 /* Also enable the retasking pin's input/output as required
600 * for the requested pin mode. Enum values of 2 or less are
603 * Dynamically switching the input/output buffers probably
604 * reduces noise slightly (particularly on input) so we'll
605 * do it. However, having both input and output buffers
606 * enabled simultaneously doesn't seem to be problematic if
607 * this turns out to be necessary in the future.
610 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
611 HDA_AMP_MUTE, HDA_AMP_MUTE);
612 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
615 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
616 HDA_AMP_MUTE, HDA_AMP_MUTE);
617 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
624 #define ALC_PIN_MODE(xname, nid, dir) \
625 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
626 .info = alc_pin_mode_info, \
627 .get = alc_pin_mode_get, \
628 .put = alc_pin_mode_put, \
629 .private_value = nid | (dir<<16) }
631 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
632 * together using a mask with more than one bit set. This control is
633 * currently used only by the ALC260 test model. At this stage they are not
634 * needed for any "production" models.
636 #ifdef CONFIG_SND_DEBUG
637 #define alc_gpio_data_info snd_ctl_boolean_mono_info
639 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
642 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
643 hda_nid_t nid = kcontrol->private_value & 0xffff;
644 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
645 long *valp = ucontrol->value.integer.value;
646 unsigned int val = snd_hda_codec_read(codec, nid, 0,
647 AC_VERB_GET_GPIO_DATA, 0x00);
649 *valp = (val & mask) != 0;
652 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
653 struct snd_ctl_elem_value *ucontrol)
656 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
657 hda_nid_t nid = kcontrol->private_value & 0xffff;
658 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
659 long val = *ucontrol->value.integer.value;
660 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
661 AC_VERB_GET_GPIO_DATA,
664 /* Set/unset the masked GPIO bit(s) as needed */
665 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
670 snd_hda_codec_write_cache(codec, nid, 0,
671 AC_VERB_SET_GPIO_DATA, gpio_data);
675 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
676 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
677 .info = alc_gpio_data_info, \
678 .get = alc_gpio_data_get, \
679 .put = alc_gpio_data_put, \
680 .private_value = nid | (mask<<16) }
681 #endif /* CONFIG_SND_DEBUG */
683 /* A switch control to allow the enabling of the digital IO pins on the
684 * ALC260. This is incredibly simplistic; the intention of this control is
685 * to provide something in the test model allowing digital outputs to be
686 * identified if present. If models are found which can utilise these
687 * outputs a more complete mixer control can be devised for those models if
690 #ifdef CONFIG_SND_DEBUG
691 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
693 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
694 struct snd_ctl_elem_value *ucontrol)
696 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
697 hda_nid_t nid = kcontrol->private_value & 0xffff;
698 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
699 long *valp = ucontrol->value.integer.value;
700 unsigned int val = snd_hda_codec_read(codec, nid, 0,
701 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
703 *valp = (val & mask) != 0;
706 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
710 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
711 hda_nid_t nid = kcontrol->private_value & 0xffff;
712 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
713 long val = *ucontrol->value.integer.value;
714 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
715 AC_VERB_GET_DIGI_CONVERT_1,
718 /* Set/unset the masked control bit(s) as needed */
719 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
724 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
729 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
730 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
731 .info = alc_spdif_ctrl_info, \
732 .get = alc_spdif_ctrl_get, \
733 .put = alc_spdif_ctrl_put, \
734 .private_value = nid | (mask<<16) }
735 #endif /* CONFIG_SND_DEBUG */
737 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
738 * Again, this is only used in the ALC26x test models to help identify when
739 * the EAPD line must be asserted for features to work.
741 #ifdef CONFIG_SND_DEBUG
742 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
744 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
745 struct snd_ctl_elem_value *ucontrol)
747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
748 hda_nid_t nid = kcontrol->private_value & 0xffff;
749 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
750 long *valp = ucontrol->value.integer.value;
751 unsigned int val = snd_hda_codec_read(codec, nid, 0,
752 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
754 *valp = (val & mask) != 0;
758 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
759 struct snd_ctl_elem_value *ucontrol)
762 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
763 hda_nid_t nid = kcontrol->private_value & 0xffff;
764 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
765 long val = *ucontrol->value.integer.value;
766 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
767 AC_VERB_GET_EAPD_BTLENABLE,
770 /* Set/unset the masked control bit(s) as needed */
771 change = (!val ? 0 : mask) != (ctrl_data & mask);
776 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
782 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
783 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
784 .info = alc_eapd_ctrl_info, \
785 .get = alc_eapd_ctrl_get, \
786 .put = alc_eapd_ctrl_put, \
787 .private_value = nid | (mask<<16) }
788 #endif /* CONFIG_SND_DEBUG */
791 * set up the input pin config (depending on the given auto-pin type)
793 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
796 unsigned int val = PIN_IN;
798 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
800 pincap = snd_hda_query_pin_caps(codec, nid);
801 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
802 if (pincap & AC_PINCAP_VREF_80)
804 else if (pincap & AC_PINCAP_VREF_50)
806 else if (pincap & AC_PINCAP_VREF_100)
808 else if (pincap & AC_PINCAP_VREF_GRD)
811 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
816 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
818 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
820 spec->mixers[spec->num_mixers++] = mix;
823 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
825 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
827 spec->init_verbs[spec->num_init_verbs++] = verb;
830 #ifdef CONFIG_PROC_FS
834 static void print_realtek_coef(struct snd_info_buffer *buffer,
835 struct hda_codec *codec, hda_nid_t nid)
841 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
842 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
843 coeff = snd_hda_codec_read(codec, nid, 0,
844 AC_VERB_GET_COEF_INDEX, 0);
845 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
848 #define print_realtek_coef NULL
852 * set up from the preset table
854 static void setup_preset(struct alc_spec *spec,
855 const struct alc_config_preset *preset)
859 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
860 add_mixer(spec, preset->mixers[i]);
861 spec->cap_mixer = preset->cap_mixer;
862 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
864 add_verb(spec, preset->init_verbs[i]);
866 spec->channel_mode = preset->channel_mode;
867 spec->num_channel_mode = preset->num_channel_mode;
868 spec->need_dac_fix = preset->need_dac_fix;
869 spec->const_channel_count = preset->const_channel_count;
871 if (preset->const_channel_count)
872 spec->multiout.max_channels = preset->const_channel_count;
874 spec->multiout.max_channels = spec->channel_mode[0].channels;
875 spec->ext_channel_count = spec->channel_mode[0].channels;
877 spec->multiout.num_dacs = preset->num_dacs;
878 spec->multiout.dac_nids = preset->dac_nids;
879 spec->multiout.dig_out_nid = preset->dig_out_nid;
880 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
881 spec->multiout.hp_nid = preset->hp_nid;
883 spec->num_mux_defs = preset->num_mux_defs;
884 if (!spec->num_mux_defs)
885 spec->num_mux_defs = 1;
886 spec->input_mux = preset->input_mux;
888 spec->num_adc_nids = preset->num_adc_nids;
889 spec->adc_nids = preset->adc_nids;
890 spec->capsrc_nids = preset->capsrc_nids;
891 spec->dig_in_nid = preset->dig_in_nid;
893 spec->unsol_event = preset->unsol_event;
894 spec->init_hook = preset->init_hook;
895 #ifdef CONFIG_SND_HDA_POWER_SAVE
896 spec->loopback.amplist = preset->loopbacks;
900 /* Enable GPIO mask and set output */
901 static struct hda_verb alc_gpio1_init_verbs[] = {
902 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
903 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
904 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
908 static struct hda_verb alc_gpio2_init_verbs[] = {
909 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
910 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
911 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
915 static struct hda_verb alc_gpio3_init_verbs[] = {
916 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
917 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
918 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
923 * Fix hardware PLL issue
924 * On some codecs, the analog PLL gating control must be off while
925 * the default value is 1.
927 static void alc_fix_pll(struct hda_codec *codec)
929 struct alc_spec *spec = codec->spec;
934 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
936 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
937 AC_VERB_GET_PROC_COEF, 0);
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
940 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
941 val & ~(1 << spec->pll_coef_bit));
944 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
945 unsigned int coef_idx, unsigned int coef_bit)
947 struct alc_spec *spec = codec->spec;
949 spec->pll_coef_idx = coef_idx;
950 spec->pll_coef_bit = coef_bit;
954 static void alc_automute_pin(struct hda_codec *codec)
956 struct alc_spec *spec = codec->spec;
957 unsigned int present, pincap;
958 unsigned int nid = spec->autocfg.hp_pins[0];
961 pincap = snd_hda_query_pin_caps(codec, nid);
962 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
963 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
964 present = snd_hda_codec_read(codec, nid, 0,
965 AC_VERB_GET_PIN_SENSE, 0);
966 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
967 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
968 nid = spec->autocfg.speaker_pins[i];
971 snd_hda_codec_write(codec, nid, 0,
972 AC_VERB_SET_PIN_WIDGET_CONTROL,
973 spec->jack_present ? 0 : PIN_OUT);
977 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
980 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
983 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
984 for (i = 0; i < nums; i++)
990 static int set_mic_mux_idx(struct hda_codec *codec, hda_nid_t cap,
991 struct alc_mic_route *mic)
993 int idx = get_connection_index(codec, cap, mic->pin);
995 return 1; /* invalid */
1000 static void alc_mic_automute(struct hda_codec *codec)
1002 struct alc_spec *spec = codec->spec;
1003 struct alc_mic_route *dead, *alive;
1004 unsigned int present, type;
1007 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1009 if (snd_BUG_ON(!spec->adc_nids))
1012 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1014 present = snd_hda_codec_read(codec, spec->ext_mic.pin, 0,
1015 AC_VERB_GET_PIN_SENSE, 0);
1016 present &= AC_PINSENSE_PRESENCE;
1018 alive = &spec->ext_mic;
1019 dead = &spec->int_mic;
1021 alive = &spec->int_mic;
1022 dead = &spec->ext_mic;
1025 if (alive->mux_idx == MUX_IDX_UNDEF &&
1026 set_mic_mux_idx(codec, cap_nid, alive))
1028 if (dead->mux_idx == MUX_IDX_UNDEF &&
1029 set_mic_mux_idx(codec, cap_nid, dead))
1032 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1033 if (type == AC_WID_AUD_MIX) {
1034 /* Matrix-mixer style (e.g. ALC882) */
1035 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1040 HDA_AMP_MUTE, HDA_AMP_MUTE);
1042 /* MUX style (e.g. ALC880) */
1043 snd_hda_codec_write_cache(codec, cap_nid, 0,
1044 AC_VERB_SET_CONNECT_SEL,
1048 /* FIXME: analog mixer */
1051 /* unsolicited event for HP jack sensing */
1052 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1054 if (codec->vendor_id == 0x10ec0880)
1059 case ALC880_HP_EVENT:
1060 alc_automute_pin(codec);
1062 case ALC880_MIC_EVENT:
1063 alc_mic_automute(codec);
1068 static void alc_inithook(struct hda_codec *codec)
1070 alc_automute_pin(codec);
1071 alc_mic_automute(codec);
1074 /* additional initialization for ALC888 variants */
1075 static void alc888_coef_init(struct hda_codec *codec)
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1080 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1081 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1082 if ((tmp & 0xf0) == 0x20)
1084 snd_hda_codec_read(codec, 0x20, 0,
1085 AC_VERB_SET_PROC_COEF, 0x830);
1088 snd_hda_codec_read(codec, 0x20, 0,
1089 AC_VERB_SET_PROC_COEF, 0x3030);
1092 static void alc889_coef_init(struct hda_codec *codec)
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1098 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1099 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1102 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1107 case ALC_INIT_GPIO1:
1108 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1110 case ALC_INIT_GPIO2:
1111 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1113 case ALC_INIT_GPIO3:
1114 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1116 case ALC_INIT_DEFAULT:
1117 switch (codec->vendor_id) {
1119 snd_hda_codec_write(codec, 0x0f, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1121 snd_hda_codec_write(codec, 0x10, 0,
1122 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 snd_hda_codec_write(codec, 0x14, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1136 snd_hda_codec_write(codec, 0x15, 0,
1137 AC_VERB_SET_EAPD_BTLENABLE, 2);
1140 switch (codec->vendor_id) {
1142 snd_hda_codec_write(codec, 0x1a, 0,
1143 AC_VERB_SET_COEF_INDEX, 7);
1144 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1145 AC_VERB_GET_PROC_COEF, 0);
1146 snd_hda_codec_write(codec, 0x1a, 0,
1147 AC_VERB_SET_COEF_INDEX, 7);
1148 snd_hda_codec_write(codec, 0x1a, 0,
1149 AC_VERB_SET_PROC_COEF,
1159 alc889_coef_init(codec);
1162 alc888_coef_init(codec);
1166 snd_hda_codec_write(codec, 0x20, 0,
1167 AC_VERB_SET_COEF_INDEX, 7);
1168 tmp = snd_hda_codec_read(codec, 0x20, 0,
1169 AC_VERB_GET_PROC_COEF, 0);
1170 snd_hda_codec_write(codec, 0x20, 0,
1171 AC_VERB_SET_COEF_INDEX, 7);
1172 snd_hda_codec_write(codec, 0x20, 0,
1173 AC_VERB_SET_PROC_COEF,
1181 static void alc_init_auto_hp(struct hda_codec *codec)
1183 struct alc_spec *spec = codec->spec;
1185 if (!spec->autocfg.hp_pins[0])
1188 if (!spec->autocfg.speaker_pins[0]) {
1189 if (spec->autocfg.line_out_pins[0] &&
1190 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1191 spec->autocfg.speaker_pins[0] =
1192 spec->autocfg.line_out_pins[0];
1197 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1198 spec->autocfg.hp_pins[0]);
1199 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1200 AC_VERB_SET_UNSOLICITED_ENABLE,
1201 AC_USRSP_EN | ALC880_HP_EVENT);
1202 spec->unsol_event = alc_sku_unsol_event;
1205 static void alc_init_auto_mic(struct hda_codec *codec)
1207 struct alc_spec *spec = codec->spec;
1208 struct auto_pin_cfg *cfg = &spec->autocfg;
1209 hda_nid_t fixed, ext;
1212 /* there must be only two mic inputs exclusively */
1213 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1214 if (cfg->input_pins[i])
1218 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1219 hda_nid_t nid = cfg->input_pins[i];
1220 unsigned int defcfg;
1223 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1224 switch (get_defcfg_connect(defcfg)) {
1225 case AC_JACK_PORT_FIXED:
1227 return; /* already occupied */
1230 case AC_JACK_PORT_COMPLEX:
1232 return; /* already occupied */
1236 return; /* invalid entry */
1239 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1240 return; /* no unsol support */
1241 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1243 spec->ext_mic.pin = ext;
1244 spec->int_mic.pin = fixed;
1245 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1246 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1248 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1249 AC_VERB_SET_UNSOLICITED_ENABLE,
1250 AC_USRSP_EN | ALC880_MIC_EVENT);
1251 spec->unsol_event = alc_sku_unsol_event;
1254 /* check subsystem ID and set up device-specific initialization;
1255 * return 1 if initialized, 0 if invalid SSID
1257 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1258 * 31 ~ 16 : Manufacture ID
1260 * 7 ~ 0 : Assembly ID
1261 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1263 static int alc_subsystem_id(struct hda_codec *codec,
1264 hda_nid_t porta, hda_nid_t porte,
1267 unsigned int ass, tmp, i;
1269 struct alc_spec *spec = codec->spec;
1271 ass = codec->subsystem_id & 0xffff;
1272 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1275 /* invalid SSID, check the special NID pin defcfg instead */
1277 * 31~30 : port connectivity
1280 * 19~16 : Check sum (15:1)
1285 if (codec->vendor_id == 0x10ec0260)
1287 ass = snd_hda_codec_get_pincfg(codec, nid);
1288 snd_printd("realtek: No valid SSID, "
1289 "checking pincfg 0x%08x for NID 0x%x\n",
1291 if (!(ass & 1) && !(ass & 0x100000))
1293 if ((ass >> 30) != 1) /* no physical connection */
1298 for (i = 1; i < 16; i++) {
1302 if (((ass >> 16) & 0xf) != tmp)
1305 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1306 ass & 0xffff, codec->vendor_id);
1310 * 2 : 0 --> Desktop, 1 --> Laptop
1311 * 3~5 : External Amplifier control
1314 tmp = (ass & 0x38) >> 3; /* external Amp control */
1317 spec->init_amp = ALC_INIT_GPIO1;
1320 spec->init_amp = ALC_INIT_GPIO2;
1323 spec->init_amp = ALC_INIT_GPIO3;
1326 spec->init_amp = ALC_INIT_DEFAULT;
1330 /* is laptop or Desktop and enable the function "Mute internal speaker
1331 * when the external headphone out jack is plugged"
1333 if (!(ass & 0x8000))
1336 * 10~8 : Jack location
1337 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1339 * 15 : 1 --> enable the function "Mute internal speaker
1340 * when the external headphone out jack is plugged"
1342 if (!spec->autocfg.hp_pins[0]) {
1343 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1345 spec->autocfg.hp_pins[0] = porta;
1347 spec->autocfg.hp_pins[0] = porte;
1349 spec->autocfg.hp_pins[0] = portd;
1354 alc_init_auto_hp(codec);
1355 alc_init_auto_mic(codec);
1359 static void alc_ssid_check(struct hda_codec *codec,
1360 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1362 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1363 struct alc_spec *spec = codec->spec;
1364 snd_printd("realtek: "
1365 "Enable default setup for auto mode as fallback\n");
1366 spec->init_amp = ALC_INIT_DEFAULT;
1367 alc_init_auto_hp(codec);
1368 alc_init_auto_mic(codec);
1373 * Fix-up pin default configurations
1381 static void alc_fix_pincfg(struct hda_codec *codec,
1382 const struct snd_pci_quirk *quirk,
1383 const struct alc_pincfg **pinfix)
1385 const struct alc_pincfg *cfg;
1387 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1391 cfg = pinfix[quirk->value];
1392 for (; cfg->nid; cfg++)
1393 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1403 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1404 /* Mic-in jack as mic in */
1405 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1406 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1407 /* Line-in jack as Line in */
1408 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1409 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1410 /* Line-Out as Front */
1411 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1418 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1419 /* Mic-in jack as mic in */
1420 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1421 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1422 /* Line-in jack as Surround */
1423 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1424 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1425 /* Line-Out as Front */
1426 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1433 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1434 /* Mic-in jack as CLFE */
1435 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1436 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1437 /* Line-in jack as Surround */
1438 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1439 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1440 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1441 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1448 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1449 /* Mic-in jack as CLFE */
1450 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1451 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1452 /* Line-in jack as Surround */
1453 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1454 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1455 /* Line-Out as Side */
1456 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1460 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1461 { 2, alc888_4ST_ch2_intel_init },
1462 { 4, alc888_4ST_ch4_intel_init },
1463 { 6, alc888_4ST_ch6_intel_init },
1464 { 8, alc888_4ST_ch8_intel_init },
1468 * ALC888 Fujitsu Siemens Amillo xa3530
1471 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1472 /* Front Mic: set to PIN_IN (empty by default) */
1473 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1474 /* Connect Internal HP to Front */
1475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1476 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1477 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1478 /* Connect Bass HP to Front */
1479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1482 /* Connect Line-Out side jack (SPDIF) to Side */
1483 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1484 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1485 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1486 /* Connect Mic jack to CLFE */
1487 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1488 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1489 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1490 /* Connect Line-in jack to Surround */
1491 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1492 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1493 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1494 /* Connect HP out jack to Front */
1495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1496 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1497 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1498 /* Enable unsolicited event for HP jack and Line-out jack */
1499 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1500 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1504 static void alc_automute_amp(struct hda_codec *codec)
1506 struct alc_spec *spec = codec->spec;
1507 unsigned int val, mute, pincap;
1511 spec->jack_present = 0;
1512 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1513 nid = spec->autocfg.hp_pins[i];
1516 pincap = snd_hda_query_pin_caps(codec, nid);
1517 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1518 snd_hda_codec_read(codec, nid, 0,
1519 AC_VERB_SET_PIN_SENSE, 0);
1520 val = snd_hda_codec_read(codec, nid, 0,
1521 AC_VERB_GET_PIN_SENSE, 0);
1522 if (val & AC_PINSENSE_PRESENCE) {
1523 spec->jack_present = 1;
1528 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1529 /* Toggle internal speakers muting */
1530 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1531 nid = spec->autocfg.speaker_pins[i];
1534 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1535 HDA_AMP_MUTE, mute);
1539 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1542 if (codec->vendor_id == 0x10ec0880)
1546 if (res == ALC880_HP_EVENT)
1547 alc_automute_amp(codec);
1550 static void alc889_automute_init(struct hda_codec *codec)
1552 struct alc_spec *spec = codec->spec;
1554 spec->autocfg.hp_pins[0] = 0x15;
1555 spec->autocfg.speaker_pins[0] = 0x14;
1556 spec->autocfg.speaker_pins[1] = 0x16;
1557 spec->autocfg.speaker_pins[2] = 0x17;
1558 spec->autocfg.speaker_pins[3] = 0x19;
1559 spec->autocfg.speaker_pins[4] = 0x1a;
1560 alc_automute_amp(codec);
1563 static void alc889_intel_init_hook(struct hda_codec *codec)
1565 alc889_coef_init(codec);
1566 alc889_automute_init(codec);
1569 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1571 struct alc_spec *spec = codec->spec;
1573 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1574 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1575 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1576 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1577 alc_automute_amp(codec);
1581 * ALC888 Acer Aspire 4930G model
1584 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1585 /* Front Mic: set to PIN_IN (empty by default) */
1586 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1587 /* Unselect Front Mic by default in input mixer 3 */
1588 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1589 /* Enable unsolicited event for HP jack */
1590 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1591 /* Connect Internal HP to front */
1592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1593 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1594 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1595 /* Connect HP out to front */
1596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1598 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1603 * ALC888 Acer Aspire 6530G model
1606 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1607 /* Bias voltage on for external mic port */
1608 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1609 /* Front Mic: set to PIN_IN (empty by default) */
1610 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1611 /* Unselect Front Mic by default in input mixer 3 */
1612 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1613 /* Enable unsolicited event for HP jack */
1614 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1615 /* Enable speaker output */
1616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1618 /* Enable headphone output */
1619 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1620 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1626 * ALC889 Acer Aspire 8930G model
1629 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1630 /* Front Mic: set to PIN_IN (empty by default) */
1631 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1632 /* Unselect Front Mic by default in input mixer 3 */
1633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1634 /* Enable unsolicited event for HP jack */
1635 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1636 /* Connect Internal Front to Front */
1637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1639 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1640 /* Connect Internal Rear to Rear */
1641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1643 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1644 /* Connect Internal CLFE to CLFE */
1645 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1646 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1647 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1648 /* Connect HP out to Front */
1649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1652 /* Enable all DACs */
1653 /* DAC DISABLE/MUTE 1? */
1654 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1655 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1656 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1657 /* DAC DISABLE/MUTE 2? */
1658 /* some bit here disables the other DACs. Init=0x4900 */
1659 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1660 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1661 /* Enable amplifiers */
1662 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1663 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1665 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1666 * which makes the stereo useless. However, either the mic or the ALC889
1667 * makes the signal become a difference/sum signal instead of standard
1668 * stereo, which is annoying. So instead we flip this bit which makes the
1669 * codec replicate the sum signal to both channels, turning it into a
1672 /* DMIC_CONTROL? Init value = 0x0001 */
1673 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1674 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1678 static struct hda_input_mux alc888_2_capture_sources[2] = {
1679 /* Front mic only available on one ADC */
1686 { "Front Mic", 0xb },
1699 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1700 /* Interal mic only available on one ADC */
1707 { "Input Mix", 0xa },
1717 { "Input Mix", 0xa },
1722 static struct hda_input_mux alc889_capture_sources[3] = {
1723 /* Digital mic only available on first "ADC" */
1730 { "Front Mic", 0xb },
1731 { "Input Mix", 0xa },
1740 { "Input Mix", 0xa },
1749 { "Input Mix", 0xa },
1754 static struct snd_kcontrol_new alc888_base_mixer[] = {
1755 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1756 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1757 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1758 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1759 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1761 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1764 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1767 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1768 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1769 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1776 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1778 struct alc_spec *spec = codec->spec;
1780 spec->autocfg.hp_pins[0] = 0x15;
1781 spec->autocfg.speaker_pins[0] = 0x14;
1782 alc_automute_amp(codec);
1785 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1787 struct alc_spec *spec = codec->spec;
1789 spec->autocfg.hp_pins[0] = 0x15;
1790 spec->autocfg.speaker_pins[0] = 0x14;
1791 spec->autocfg.speaker_pins[1] = 0x16;
1792 spec->autocfg.speaker_pins[2] = 0x17;
1793 alc_automute_amp(codec);
1796 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1798 struct alc_spec *spec = codec->spec;
1800 spec->autocfg.hp_pins[0] = 0x15;
1801 spec->autocfg.speaker_pins[0] = 0x14;
1802 spec->autocfg.speaker_pins[1] = 0x16;
1803 spec->autocfg.speaker_pins[2] = 0x1b;
1804 alc_automute_amp(codec);
1808 * ALC880 3-stack model
1810 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1811 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1812 * F-Mic = 0x1b, HP = 0x19
1815 static hda_nid_t alc880_dac_nids[4] = {
1816 /* front, rear, clfe, rear_surr */
1817 0x02, 0x05, 0x04, 0x03
1820 static hda_nid_t alc880_adc_nids[3] = {
1825 /* The datasheet says the node 0x07 is connected from inputs,
1826 * but it shows zero connection in the real implementation on some devices.
1827 * Note: this is a 915GAV bug, fixed on 915GLV
1829 static hda_nid_t alc880_adc_nids_alt[2] = {
1834 #define ALC880_DIGOUT_NID 0x06
1835 #define ALC880_DIGIN_NID 0x0a
1837 static struct hda_input_mux alc880_capture_source = {
1841 { "Front Mic", 0x3 },
1847 /* channel source setting (2/6 channel selection for 3-stack) */
1849 static struct hda_verb alc880_threestack_ch2_init[] = {
1850 /* set line-in to input, mute it */
1851 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1852 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1853 /* set mic-in to input vref 80%, mute it */
1854 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1855 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1860 static struct hda_verb alc880_threestack_ch6_init[] = {
1861 /* set line-in to output, unmute it */
1862 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1863 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1864 /* set mic-in to output, unmute it */
1865 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1866 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1870 static struct hda_channel_mode alc880_threestack_modes[2] = {
1871 { 2, alc880_threestack_ch2_init },
1872 { 6, alc880_threestack_ch6_init },
1875 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1876 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1877 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1878 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1879 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1880 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1881 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1882 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1883 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1884 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1885 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1887 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1889 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1890 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1891 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1894 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1895 .name = "Channel Mode",
1896 .info = alc_ch_mode_info,
1897 .get = alc_ch_mode_get,
1898 .put = alc_ch_mode_put,
1903 /* capture mixer elements */
1904 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1905 struct snd_ctl_elem_info *uinfo)
1907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1908 struct alc_spec *spec = codec->spec;
1911 mutex_lock(&codec->control_mutex);
1912 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1914 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1915 mutex_unlock(&codec->control_mutex);
1919 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1920 unsigned int size, unsigned int __user *tlv)
1922 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1923 struct alc_spec *spec = codec->spec;
1926 mutex_lock(&codec->control_mutex);
1927 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1929 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1930 mutex_unlock(&codec->control_mutex);
1934 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1935 struct snd_ctl_elem_value *ucontrol);
1937 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1938 struct snd_ctl_elem_value *ucontrol,
1941 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1942 struct alc_spec *spec = codec->spec;
1943 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1946 mutex_lock(&codec->control_mutex);
1947 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1949 err = func(kcontrol, ucontrol);
1950 mutex_unlock(&codec->control_mutex);
1954 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1955 struct snd_ctl_elem_value *ucontrol)
1957 return alc_cap_getput_caller(kcontrol, ucontrol,
1958 snd_hda_mixer_amp_volume_get);
1961 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1962 struct snd_ctl_elem_value *ucontrol)
1964 return alc_cap_getput_caller(kcontrol, ucontrol,
1965 snd_hda_mixer_amp_volume_put);
1968 /* capture mixer elements */
1969 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1971 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1972 struct snd_ctl_elem_value *ucontrol)
1974 return alc_cap_getput_caller(kcontrol, ucontrol,
1975 snd_hda_mixer_amp_switch_get);
1978 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1979 struct snd_ctl_elem_value *ucontrol)
1981 return alc_cap_getput_caller(kcontrol, ucontrol,
1982 snd_hda_mixer_amp_switch_put);
1985 #define _DEFINE_CAPMIX(num) \
1987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1988 .name = "Capture Switch", \
1989 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1991 .info = alc_cap_sw_info, \
1992 .get = alc_cap_sw_get, \
1993 .put = alc_cap_sw_put, \
1996 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1997 .name = "Capture Volume", \
1998 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1999 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2000 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2002 .info = alc_cap_vol_info, \
2003 .get = alc_cap_vol_get, \
2004 .put = alc_cap_vol_put, \
2005 .tlv = { .c = alc_cap_vol_tlv }, \
2008 #define _DEFINE_CAPSRC(num) \
2010 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2011 /* .name = "Capture Source", */ \
2012 .name = "Input Source", \
2014 .info = alc_mux_enum_info, \
2015 .get = alc_mux_enum_get, \
2016 .put = alc_mux_enum_put, \
2019 #define DEFINE_CAPMIX(num) \
2020 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2021 _DEFINE_CAPMIX(num), \
2022 _DEFINE_CAPSRC(num), \
2026 #define DEFINE_CAPMIX_NOSRC(num) \
2027 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2028 _DEFINE_CAPMIX(num), \
2032 /* up to three ADCs */
2036 DEFINE_CAPMIX_NOSRC(1);
2037 DEFINE_CAPMIX_NOSRC(2);
2038 DEFINE_CAPMIX_NOSRC(3);
2041 * ALC880 5-stack model
2043 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2045 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2046 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2049 /* additional mixers to alc880_three_stack_mixer */
2050 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2051 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2052 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2056 /* channel source setting (6/8 channel selection for 5-stack) */
2058 static struct hda_verb alc880_fivestack_ch6_init[] = {
2059 /* set line-in to input, mute it */
2060 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2061 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2066 static struct hda_verb alc880_fivestack_ch8_init[] = {
2067 /* set line-in to output, unmute it */
2068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2073 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2074 { 6, alc880_fivestack_ch6_init },
2075 { 8, alc880_fivestack_ch8_init },
2080 * ALC880 6-stack model
2082 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2083 * Side = 0x05 (0x0f)
2084 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2085 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2088 static hda_nid_t alc880_6st_dac_nids[4] = {
2089 /* front, rear, clfe, rear_surr */
2090 0x02, 0x03, 0x04, 0x05
2093 static struct hda_input_mux alc880_6stack_capture_source = {
2097 { "Front Mic", 0x1 },
2103 /* fixed 8-channels */
2104 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2108 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2110 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2111 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2112 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2113 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2114 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2115 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2116 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2117 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2129 .name = "Channel Mode",
2130 .info = alc_ch_mode_info,
2131 .get = alc_ch_mode_get,
2132 .put = alc_ch_mode_put,
2141 * W810 has rear IO for:
2144 * Center/LFE (DAC 04)
2147 * The system also has a pair of internal speakers, and a headphone jack.
2148 * These are both connected to Line2 on the codec, hence to DAC 02.
2150 * There is a variable resistor to control the speaker or headphone
2151 * volume. This is a hardware-only device without a software API.
2153 * Plugging headphones in will disable the internal speakers. This is
2154 * implemented in hardware, not via the driver using jack sense. In
2155 * a similar fashion, plugging into the rear socket marked "front" will
2156 * disable both the speakers and headphones.
2158 * For input, there's a microphone jack, and an "audio in" jack.
2159 * These may not do anything useful with this driver yet, because I
2160 * haven't setup any initialization verbs for these yet...
2163 static hda_nid_t alc880_w810_dac_nids[3] = {
2164 /* front, rear/surround, clfe */
2168 /* fixed 6 channels */
2169 static struct hda_channel_mode alc880_w810_modes[1] = {
2173 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2174 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2177 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2178 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2179 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2180 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2181 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2182 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2191 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2192 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2196 static hda_nid_t alc880_z71v_dac_nids[1] = {
2199 #define ALC880_Z71V_HP_DAC 0x03
2201 /* fixed 2 channels */
2202 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2206 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2210 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2214 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2220 * ALC880 F1734 model
2222 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2223 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2226 static hda_nid_t alc880_f1734_dac_nids[1] = {
2229 #define ALC880_F1734_HP_DAC 0x02
2231 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2233 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2235 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2236 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2237 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2238 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2239 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2243 static struct hda_input_mux alc880_f1734_capture_source = {
2255 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2256 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2257 * Mic = 0x18, Line = 0x1a
2260 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2261 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2263 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2265 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2266 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2267 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2268 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2269 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2270 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2271 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2272 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2273 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2275 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2276 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2277 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2280 .name = "Channel Mode",
2281 .info = alc_ch_mode_info,
2282 .get = alc_ch_mode_get,
2283 .put = alc_ch_mode_put,
2289 * ALC880 ASUS W1V model
2291 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2292 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2293 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2296 /* additional mixers to alc880_asus_mixer */
2297 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2298 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2299 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2304 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2306 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2307 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2308 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2309 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2310 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2312 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2313 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2318 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2319 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2320 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2321 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2322 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2323 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2324 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2325 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2326 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2327 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2328 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2329 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2330 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2334 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2336 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2337 .name = "Channel Mode",
2338 .info = alc_ch_mode_info,
2339 .get = alc_ch_mode_get,
2340 .put = alc_ch_mode_put,
2345 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2347 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2348 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2349 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2350 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2351 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2353 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2355 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2359 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2363 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2370 * virtual master controls
2374 * slave controls for virtual master
2376 static const char *alc_slave_vols[] = {
2377 "Front Playback Volume",
2378 "Surround Playback Volume",
2379 "Center Playback Volume",
2380 "LFE Playback Volume",
2381 "Side Playback Volume",
2382 "Headphone Playback Volume",
2383 "Speaker Playback Volume",
2384 "Mono Playback Volume",
2385 "Line-Out Playback Volume",
2386 "PCM Playback Volume",
2390 static const char *alc_slave_sws[] = {
2391 "Front Playback Switch",
2392 "Surround Playback Switch",
2393 "Center Playback Switch",
2394 "LFE Playback Switch",
2395 "Side Playback Switch",
2396 "Headphone Playback Switch",
2397 "Speaker Playback Switch",
2398 "Mono Playback Switch",
2399 "IEC958 Playback Switch",
2404 * build control elements
2407 static void alc_free_kctls(struct hda_codec *codec);
2409 /* additional beep mixers; the actual parameters are overwritten at build */
2410 static struct snd_kcontrol_new alc_beep_mixer[] = {
2411 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2412 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2416 static int alc_build_controls(struct hda_codec *codec)
2418 struct alc_spec *spec = codec->spec;
2422 for (i = 0; i < spec->num_mixers; i++) {
2423 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2427 if (spec->cap_mixer) {
2428 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2432 if (spec->multiout.dig_out_nid) {
2433 err = snd_hda_create_spdif_out_ctls(codec,
2434 spec->multiout.dig_out_nid);
2437 if (!spec->no_analog) {
2438 err = snd_hda_create_spdif_share_sw(codec,
2442 spec->multiout.share_spdif = 1;
2445 if (spec->dig_in_nid) {
2446 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2451 /* create beep controls if needed */
2452 if (spec->beep_amp) {
2453 struct snd_kcontrol_new *knew;
2454 for (knew = alc_beep_mixer; knew->name; knew++) {
2455 struct snd_kcontrol *kctl;
2456 kctl = snd_ctl_new1(knew, codec);
2459 kctl->private_value = spec->beep_amp;
2460 err = snd_hda_ctl_add(codec, kctl);
2466 /* if we have no master control, let's create it */
2467 if (!spec->no_analog &&
2468 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2469 unsigned int vmaster_tlv[4];
2470 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2471 HDA_OUTPUT, vmaster_tlv);
2472 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2473 vmaster_tlv, alc_slave_vols);
2477 if (!spec->no_analog &&
2478 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2479 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2480 NULL, alc_slave_sws);
2485 alc_free_kctls(codec); /* no longer needed */
2491 * initialize the codec volumes, etc
2495 * generic initialization of ADC, input mixers and output mixers
2497 static struct hda_verb alc880_volume_init_verbs[] = {
2499 * Unmute ADC0-2 and set the default input to mic-in
2501 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2503 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2505 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2508 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2510 * Note: PASD motherboards uses the Line In 2 as the input for front
2513 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2519 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2520 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2523 * Set up output mixers (0x0c - 0x0f)
2525 /* set vol=0 to output mixers */
2526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2528 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2530 /* set up input amps for analog loopback */
2531 /* Amp Indices: DAC = 0, mixer = 1 */
2532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2535 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2536 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2537 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2538 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2539 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2545 * 3-stack pin configuration:
2546 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2548 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2550 * preset connection lists of input pins
2551 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2553 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2554 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2555 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2558 * Set pin mode and muting
2560 /* set front pin widgets 0x14 for output */
2561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2562 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2563 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2564 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2565 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2566 /* Mic2 (as headphone out) for HP output */
2567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2568 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2569 /* Line In pin widget for input */
2570 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2571 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2572 /* Line2 (as front mic) pin widget for input and vref at 80% */
2573 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2574 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 /* CD pin widget for input */
2576 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2582 * 5-stack pin configuration:
2583 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2584 * line-in/side = 0x1a, f-mic = 0x1b
2586 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2588 * preset connection lists of input pins
2589 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2591 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2592 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2595 * Set pin mode and muting
2597 /* set pin widgets 0x14-0x17 for output */
2598 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2599 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2600 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2601 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2602 /* unmute pins for output (no gain on this amp) */
2603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2605 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2606 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2608 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2609 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2610 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2611 /* Mic2 (as headphone out) for HP output */
2612 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2614 /* Line In pin widget for input */
2615 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2616 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2617 /* Line2 (as front mic) pin widget for input and vref at 80% */
2618 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2619 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2620 /* CD pin widget for input */
2621 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2627 * W810 pin configuration:
2628 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2630 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2631 /* hphone/speaker input selector: front DAC */
2632 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2634 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2635 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2638 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2639 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2641 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2642 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2648 * Z71V pin configuration:
2649 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2651 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2652 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2653 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2657 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2659 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2660 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2666 * 6-stack pin configuration:
2667 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2668 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2670 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2671 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2673 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2674 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2676 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2678 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2679 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2680 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2682 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2684 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2685 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2688 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2689 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2696 * Uniwill pin configuration:
2697 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2700 static struct hda_verb alc880_uniwill_init_verbs[] = {
2701 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2703 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2706 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2707 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2708 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2709 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2718 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2719 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2722 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2723 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2724 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2725 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2726 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2729 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2736 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2738 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2739 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2745 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2746 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2754 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2756 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2757 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2761 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2762 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2767 static struct hda_verb alc880_beep_init_verbs[] = {
2768 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2772 /* auto-toggle front mic */
2773 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2775 unsigned int present;
2778 present = snd_hda_codec_read(codec, 0x18, 0,
2779 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2780 bits = present ? HDA_AMP_MUTE : 0;
2781 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2784 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2786 struct alc_spec *spec = codec->spec;
2788 spec->autocfg.hp_pins[0] = 0x14;
2789 spec->autocfg.speaker_pins[0] = 0x15;
2790 spec->autocfg.speaker_pins[0] = 0x16;
2791 alc_automute_amp(codec);
2792 alc880_uniwill_mic_automute(codec);
2795 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2798 /* Looks like the unsol event is incompatible with the standard
2799 * definition. 4bit tag is placed at 28 bit!
2801 switch (res >> 28) {
2802 case ALC880_MIC_EVENT:
2803 alc880_uniwill_mic_automute(codec);
2806 alc_automute_amp_unsol_event(codec, res);
2811 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2813 struct alc_spec *spec = codec->spec;
2815 spec->autocfg.hp_pins[0] = 0x14;
2816 spec->autocfg.speaker_pins[0] = 0x15;
2817 alc_automute_amp(codec);
2820 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2822 unsigned int present;
2824 present = snd_hda_codec_read(codec, 0x21, 0,
2825 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2826 present &= HDA_AMP_VOLMASK;
2827 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2828 HDA_AMP_VOLMASK, present);
2829 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2830 HDA_AMP_VOLMASK, present);
2833 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2836 /* Looks like the unsol event is incompatible with the standard
2837 * definition. 4bit tag is placed at 28 bit!
2839 if ((res >> 28) == ALC880_DCVOL_EVENT)
2840 alc880_uniwill_p53_dcvol_automute(codec);
2842 alc_automute_amp_unsol_event(codec, res);
2846 * F1734 pin configuration:
2847 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2849 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2850 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2851 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2852 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2853 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2854 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2856 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2857 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2858 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2859 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2861 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2863 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2864 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2865 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2868 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2869 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2871 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2872 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2878 * ASUS pin configuration:
2879 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2881 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2882 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2883 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2884 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2885 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2888 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2890 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2891 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2893 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2894 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2896 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2897 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2898 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2899 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2900 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2901 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2902 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2903 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2904 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2909 /* Enable GPIO mask and set output */
2910 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2911 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2912 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2914 /* Clevo m520g init */
2915 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2916 /* headphone output */
2917 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2920 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2922 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2923 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2925 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2926 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2927 /* Mic1 (rear panel) */
2928 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2929 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2930 /* Mic2 (front panel) */
2931 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2932 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2936 /* change to EAPD mode */
2937 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2938 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2943 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2944 /* change to EAPD mode */
2945 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2946 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2948 /* Headphone output */
2949 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2951 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2952 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2954 /* Line In pin widget for input */
2955 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2956 /* CD pin widget for input */
2957 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2958 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2961 /* change to EAPD mode */
2962 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2963 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2969 * LG m1 express dual
2972 * Rear Line-In/Out (blue): 0x14
2973 * Build-in Mic-In: 0x15
2975 * HP-Out (green): 0x1b
2976 * Mic-In/Out (red): 0x19
2980 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2981 static hda_nid_t alc880_lg_dac_nids[3] = {
2985 /* seems analog CD is not working */
2986 static struct hda_input_mux alc880_lg_capture_source = {
2991 { "Internal Mic", 0x6 },
2995 /* 2,4,6 channel modes */
2996 static struct hda_verb alc880_lg_ch2_init[] = {
2997 /* set line-in and mic-in to input */
2998 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2999 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3003 static struct hda_verb alc880_lg_ch4_init[] = {
3004 /* set line-in to out and mic-in to input */
3005 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3006 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3010 static struct hda_verb alc880_lg_ch6_init[] = {
3011 /* set line-in and mic-in to output */
3012 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3013 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3017 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3018 { 2, alc880_lg_ch2_init },
3019 { 4, alc880_lg_ch4_init },
3020 { 6, alc880_lg_ch6_init },
3023 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3024 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3025 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3026 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3027 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3028 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3029 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3030 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3031 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3034 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3035 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3036 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3037 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3039 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3040 .name = "Channel Mode",
3041 .info = alc_ch_mode_info,
3042 .get = alc_ch_mode_get,
3043 .put = alc_ch_mode_put,
3048 static struct hda_verb alc880_lg_init_verbs[] = {
3049 /* set capture source to mic-in */
3050 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3051 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3052 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3053 /* mute all amp mixer inputs */
3054 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3055 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3056 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3057 /* line-in to input */
3058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3059 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3065 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 /* mic-in to input */
3067 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3071 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3072 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3075 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3079 /* toggle speaker-output according to the hp-jack state */
3080 static void alc880_lg_init_hook(struct hda_codec *codec)
3082 struct alc_spec *spec = codec->spec;
3084 spec->autocfg.hp_pins[0] = 0x1b;
3085 spec->autocfg.speaker_pins[0] = 0x17;
3086 alc_automute_amp(codec);
3095 * Built-in Mic-In: 0x19
3101 static struct hda_input_mux alc880_lg_lw_capture_source = {
3105 { "Internal Mic", 0x1 },
3110 #define alc880_lg_lw_modes alc880_threestack_modes
3112 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3113 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3114 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3115 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3116 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3117 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3118 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3119 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3125 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3126 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3128 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3129 .name = "Channel Mode",
3130 .info = alc_ch_mode_info,
3131 .get = alc_ch_mode_get,
3132 .put = alc_ch_mode_put,
3137 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3138 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3139 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3140 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3142 /* set capture source to mic-in */
3143 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3144 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3146 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3151 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3152 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3153 /* mic-in to input */
3154 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3155 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3157 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3158 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3160 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3164 /* toggle speaker-output according to the hp-jack state */
3165 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3167 struct alc_spec *spec = codec->spec;
3169 spec->autocfg.hp_pins[0] = 0x1b;
3170 spec->autocfg.speaker_pins[0] = 0x14;
3171 alc_automute_amp(codec);
3174 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3175 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3176 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3179 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3180 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3184 static struct hda_input_mux alc880_medion_rim_capture_source = {
3188 { "Internal Mic", 0x1 },
3192 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3193 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3195 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3196 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3198 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3200 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3201 /* Mic2 (as headphone out) for HP output */
3202 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3203 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3204 /* Internal Speaker */
3205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3206 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3208 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3209 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3211 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3215 /* toggle speaker-output according to the hp-jack state */
3216 static void alc880_medion_rim_automute(struct hda_codec *codec)
3218 struct alc_spec *spec = codec->spec;
3219 alc_automute_amp(codec);
3221 if (spec->jack_present)
3222 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3224 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3227 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3230 /* Looks like the unsol event is incompatible with the standard
3231 * definition. 4bit tag is placed at 28 bit!
3233 if ((res >> 28) == ALC880_HP_EVENT)
3234 alc880_medion_rim_automute(codec);
3237 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3239 struct alc_spec *spec = codec->spec;
3241 spec->autocfg.hp_pins[0] = 0x14;
3242 spec->autocfg.speaker_pins[0] = 0x1b;
3243 alc880_medion_rim_automute(codec);
3246 #ifdef CONFIG_SND_HDA_POWER_SAVE
3247 static struct hda_amp_list alc880_loopbacks[] = {
3248 { 0x0b, HDA_INPUT, 0 },
3249 { 0x0b, HDA_INPUT, 1 },
3250 { 0x0b, HDA_INPUT, 2 },
3251 { 0x0b, HDA_INPUT, 3 },
3252 { 0x0b, HDA_INPUT, 4 },
3256 static struct hda_amp_list alc880_lg_loopbacks[] = {
3257 { 0x0b, HDA_INPUT, 1 },
3258 { 0x0b, HDA_INPUT, 6 },
3259 { 0x0b, HDA_INPUT, 7 },
3268 static int alc_init(struct hda_codec *codec)
3270 struct alc_spec *spec = codec->spec;
3274 alc_auto_init_amp(codec, spec->init_amp);
3276 for (i = 0; i < spec->num_init_verbs; i++)
3277 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3279 if (spec->init_hook)
3280 spec->init_hook(codec);
3285 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3287 struct alc_spec *spec = codec->spec;
3289 if (spec->unsol_event)
3290 spec->unsol_event(codec, res);
3293 #ifdef CONFIG_SND_HDA_POWER_SAVE
3294 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3296 struct alc_spec *spec = codec->spec;
3297 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3302 * Analog playback callbacks
3304 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3305 struct hda_codec *codec,
3306 struct snd_pcm_substream *substream)
3308 struct alc_spec *spec = codec->spec;
3309 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3313 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3314 struct hda_codec *codec,
3315 unsigned int stream_tag,
3316 unsigned int format,
3317 struct snd_pcm_substream *substream)
3319 struct alc_spec *spec = codec->spec;
3320 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3321 stream_tag, format, substream);
3324 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3325 struct hda_codec *codec,
3326 struct snd_pcm_substream *substream)
3328 struct alc_spec *spec = codec->spec;
3329 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3335 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3336 struct hda_codec *codec,
3337 struct snd_pcm_substream *substream)
3339 struct alc_spec *spec = codec->spec;
3340 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3343 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3344 struct hda_codec *codec,
3345 unsigned int stream_tag,
3346 unsigned int format,
3347 struct snd_pcm_substream *substream)
3349 struct alc_spec *spec = codec->spec;
3350 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3351 stream_tag, format, substream);
3354 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3355 struct hda_codec *codec,
3356 struct snd_pcm_substream *substream)
3358 struct alc_spec *spec = codec->spec;
3359 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3362 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3363 struct hda_codec *codec,
3364 struct snd_pcm_substream *substream)
3366 struct alc_spec *spec = codec->spec;
3367 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3373 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3374 struct hda_codec *codec,
3375 unsigned int stream_tag,
3376 unsigned int format,
3377 struct snd_pcm_substream *substream)
3379 struct alc_spec *spec = codec->spec;
3381 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3382 stream_tag, 0, format);
3386 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3387 struct hda_codec *codec,
3388 struct snd_pcm_substream *substream)
3390 struct alc_spec *spec = codec->spec;
3392 snd_hda_codec_cleanup_stream(codec,
3393 spec->adc_nids[substream->number + 1]);
3400 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3404 /* NID is set in alc_build_pcms */
3406 .open = alc880_playback_pcm_open,
3407 .prepare = alc880_playback_pcm_prepare,
3408 .cleanup = alc880_playback_pcm_cleanup
3412 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3416 /* NID is set in alc_build_pcms */
3419 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3423 /* NID is set in alc_build_pcms */
3426 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3427 .substreams = 2, /* can be overridden */
3430 /* NID is set in alc_build_pcms */
3432 .prepare = alc880_alt_capture_pcm_prepare,
3433 .cleanup = alc880_alt_capture_pcm_cleanup
3437 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3441 /* NID is set in alc_build_pcms */
3443 .open = alc880_dig_playback_pcm_open,
3444 .close = alc880_dig_playback_pcm_close,
3445 .prepare = alc880_dig_playback_pcm_prepare,
3446 .cleanup = alc880_dig_playback_pcm_cleanup
3450 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3454 /* NID is set in alc_build_pcms */
3457 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3458 static struct hda_pcm_stream alc_pcm_null_stream = {
3464 static int alc_build_pcms(struct hda_codec *codec)
3466 struct alc_spec *spec = codec->spec;
3467 struct hda_pcm *info = spec->pcm_rec;
3470 codec->num_pcms = 1;
3471 codec->pcm_info = info;
3473 if (spec->no_analog)
3476 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3477 "%s Analog", codec->chip_name);
3478 info->name = spec->stream_name_analog;
3480 if (spec->stream_analog_playback) {
3481 if (snd_BUG_ON(!spec->multiout.dac_nids))
3483 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3484 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3486 if (spec->stream_analog_capture) {
3487 if (snd_BUG_ON(!spec->adc_nids))
3489 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3490 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3493 if (spec->channel_mode) {
3494 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3495 for (i = 0; i < spec->num_channel_mode; i++) {
3496 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3497 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3503 /* SPDIF for stream index #1 */
3504 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3505 snprintf(spec->stream_name_digital,
3506 sizeof(spec->stream_name_digital),
3507 "%s Digital", codec->chip_name);
3508 codec->num_pcms = 2;
3509 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3510 info = spec->pcm_rec + 1;
3511 info->name = spec->stream_name_digital;
3512 if (spec->dig_out_type)
3513 info->pcm_type = spec->dig_out_type;
3515 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3516 if (spec->multiout.dig_out_nid &&
3517 spec->stream_digital_playback) {
3518 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3519 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3521 if (spec->dig_in_nid &&
3522 spec->stream_digital_capture) {
3523 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3524 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3526 /* FIXME: do we need this for all Realtek codec models? */
3527 codec->spdif_status_reset = 1;
3530 if (spec->no_analog)
3533 /* If the use of more than one ADC is requested for the current
3534 * model, configure a second analog capture-only PCM.
3536 /* Additional Analaog capture for index #2 */
3537 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3538 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3539 codec->num_pcms = 3;
3540 info = spec->pcm_rec + 2;
3541 info->name = spec->stream_name_analog;
3542 if (spec->alt_dac_nid) {
3543 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3544 *spec->stream_analog_alt_playback;
3545 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3548 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3549 alc_pcm_null_stream;
3550 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3552 if (spec->num_adc_nids > 1) {
3553 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3554 *spec->stream_analog_alt_capture;
3555 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3557 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3558 spec->num_adc_nids - 1;
3560 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3561 alc_pcm_null_stream;
3562 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3569 static void alc_free_kctls(struct hda_codec *codec)
3571 struct alc_spec *spec = codec->spec;
3573 if (spec->kctls.list) {
3574 struct snd_kcontrol_new *kctl = spec->kctls.list;
3576 for (i = 0; i < spec->kctls.used; i++)
3577 kfree(kctl[i].name);
3579 snd_array_free(&spec->kctls);
3582 static void alc_free(struct hda_codec *codec)
3584 struct alc_spec *spec = codec->spec;
3589 alc_free_kctls(codec);
3591 snd_hda_detach_beep_device(codec);
3594 #ifdef SND_HDA_NEEDS_RESUME
3595 static int alc_resume(struct hda_codec *codec)
3597 codec->patch_ops.init(codec);
3598 snd_hda_codec_resume_amp(codec);
3599 snd_hda_codec_resume_cache(codec);
3606 static struct hda_codec_ops alc_patch_ops = {
3607 .build_controls = alc_build_controls,
3608 .build_pcms = alc_build_pcms,
3611 .unsol_event = alc_unsol_event,
3612 #ifdef SND_HDA_NEEDS_RESUME
3613 .resume = alc_resume,
3615 #ifdef CONFIG_SND_HDA_POWER_SAVE
3616 .check_power_status = alc_check_power_status,
3622 * Test configuration for debugging
3624 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3627 #ifdef CONFIG_SND_DEBUG
3628 static hda_nid_t alc880_test_dac_nids[4] = {
3629 0x02, 0x03, 0x04, 0x05
3632 static struct hda_input_mux alc880_test_capture_source = {
3641 { "Surround", 0x6 },
3645 static struct hda_channel_mode alc880_test_modes[4] = {
3652 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3653 struct snd_ctl_elem_info *uinfo)
3655 static char *texts[] = {
3656 "N/A", "Line Out", "HP Out",
3657 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3659 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3661 uinfo->value.enumerated.items = 8;
3662 if (uinfo->value.enumerated.item >= 8)
3663 uinfo->value.enumerated.item = 7;
3664 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3668 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3669 struct snd_ctl_elem_value *ucontrol)
3671 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3672 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3673 unsigned int pin_ctl, item = 0;
3675 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3676 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3677 if (pin_ctl & AC_PINCTL_OUT_EN) {
3678 if (pin_ctl & AC_PINCTL_HP_EN)
3682 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3683 switch (pin_ctl & AC_PINCTL_VREFEN) {
3684 case AC_PINCTL_VREF_HIZ: item = 3; break;
3685 case AC_PINCTL_VREF_50: item = 4; break;
3686 case AC_PINCTL_VREF_GRD: item = 5; break;
3687 case AC_PINCTL_VREF_80: item = 6; break;
3688 case AC_PINCTL_VREF_100: item = 7; break;
3691 ucontrol->value.enumerated.item[0] = item;
3695 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3696 struct snd_ctl_elem_value *ucontrol)
3698 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3699 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3700 static unsigned int ctls[] = {
3701 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3702 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3703 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3704 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3705 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3706 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3708 unsigned int old_ctl, new_ctl;
3710 old_ctl = snd_hda_codec_read(codec, nid, 0,
3711 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3712 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3713 if (old_ctl != new_ctl) {
3715 snd_hda_codec_write_cache(codec, nid, 0,
3716 AC_VERB_SET_PIN_WIDGET_CONTROL,
3718 val = ucontrol->value.enumerated.item[0] >= 3 ?
3720 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3727 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3728 struct snd_ctl_elem_info *uinfo)
3730 static char *texts[] = {
3731 "Front", "Surround", "CLFE", "Side"
3733 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3735 uinfo->value.enumerated.items = 4;
3736 if (uinfo->value.enumerated.item >= 4)
3737 uinfo->value.enumerated.item = 3;
3738 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3742 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3743 struct snd_ctl_elem_value *ucontrol)
3745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3746 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3749 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3750 ucontrol->value.enumerated.item[0] = sel & 3;
3754 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3755 struct snd_ctl_elem_value *ucontrol)
3757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3758 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3761 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3762 if (ucontrol->value.enumerated.item[0] != sel) {
3763 sel = ucontrol->value.enumerated.item[0] & 3;
3764 snd_hda_codec_write_cache(codec, nid, 0,
3765 AC_VERB_SET_CONNECT_SEL, sel);
3771 #define PIN_CTL_TEST(xname,nid) { \
3772 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3774 .info = alc_test_pin_ctl_info, \
3775 .get = alc_test_pin_ctl_get, \
3776 .put = alc_test_pin_ctl_put, \
3777 .private_value = nid \
3780 #define PIN_SRC_TEST(xname,nid) { \
3781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3783 .info = alc_test_pin_src_info, \
3784 .get = alc_test_pin_src_get, \
3785 .put = alc_test_pin_src_put, \
3786 .private_value = nid \
3789 static struct snd_kcontrol_new alc880_test_mixer[] = {
3790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3791 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3792 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3793 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3794 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3795 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3796 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3797 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3798 PIN_CTL_TEST("Front Pin Mode", 0x14),
3799 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3800 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3801 PIN_CTL_TEST("Side Pin Mode", 0x17),
3802 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3803 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3804 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3805 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3806 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3807 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3808 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3809 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3810 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3811 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3812 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3813 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3814 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3815 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3816 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3817 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3818 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3819 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3821 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3822 .name = "Channel Mode",
3823 .info = alc_ch_mode_info,
3824 .get = alc_ch_mode_get,
3825 .put = alc_ch_mode_put,
3830 static struct hda_verb alc880_test_init_verbs[] = {
3831 /* Unmute inputs of 0x0c - 0x0f */
3832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3834 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3835 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3836 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3837 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3838 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3839 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3840 /* Vol output for 0x0c-0x0f */
3841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3845 /* Set output pins 0x14-0x17 */
3846 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3847 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3848 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3849 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3850 /* Unmute output pins 0x14-0x17 */
3851 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3853 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3854 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3855 /* Set input pins 0x18-0x1c */
3856 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3857 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3861 /* Mute input pins 0x18-0x1b */
3862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3864 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3865 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3867 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3868 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3870 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3872 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3873 /* Analog input/passthru */
3874 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3875 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3886 static const char *alc880_models[ALC880_MODEL_LAST] = {
3887 [ALC880_3ST] = "3stack",
3888 [ALC880_TCL_S700] = "tcl",
3889 [ALC880_3ST_DIG] = "3stack-digout",
3890 [ALC880_CLEVO] = "clevo",
3891 [ALC880_5ST] = "5stack",
3892 [ALC880_5ST_DIG] = "5stack-digout",
3893 [ALC880_W810] = "w810",
3894 [ALC880_Z71V] = "z71v",
3895 [ALC880_6ST] = "6stack",
3896 [ALC880_6ST_DIG] = "6stack-digout",
3897 [ALC880_ASUS] = "asus",
3898 [ALC880_ASUS_W1V] = "asus-w1v",
3899 [ALC880_ASUS_DIG] = "asus-dig",
3900 [ALC880_ASUS_DIG2] = "asus-dig2",
3901 [ALC880_UNIWILL_DIG] = "uniwill",
3902 [ALC880_UNIWILL_P53] = "uniwill-p53",
3903 [ALC880_FUJITSU] = "fujitsu",
3904 [ALC880_F1734] = "F1734",
3906 [ALC880_LG_LW] = "lg-lw",
3907 [ALC880_MEDION_RIM] = "medion",
3908 #ifdef CONFIG_SND_DEBUG
3909 [ALC880_TEST] = "test",
3911 [ALC880_AUTO] = "auto",
3914 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3915 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3916 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3917 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3918 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3919 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3920 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3921 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3922 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3923 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3924 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3925 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3926 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3927 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3928 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3929 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3930 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3931 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3932 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3933 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3934 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3935 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3936 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3937 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3938 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3939 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3940 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3941 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3942 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3943 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3944 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3945 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3946 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3947 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3948 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3949 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3950 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3951 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3952 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3953 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3954 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3955 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3956 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3957 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3958 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3959 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3960 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3961 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3962 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3963 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3964 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3965 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3966 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3967 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3968 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3969 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3970 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3971 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3972 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3973 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3974 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3975 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3976 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3977 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3978 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3979 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3980 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3981 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3982 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3984 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3985 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3986 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3991 * ALC880 codec presets
3993 static struct alc_config_preset alc880_presets[] = {
3995 .mixers = { alc880_three_stack_mixer },
3996 .init_verbs = { alc880_volume_init_verbs,
3997 alc880_pin_3stack_init_verbs },
3998 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3999 .dac_nids = alc880_dac_nids,
4000 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4001 .channel_mode = alc880_threestack_modes,
4003 .input_mux = &alc880_capture_source,
4005 [ALC880_3ST_DIG] = {
4006 .mixers = { alc880_three_stack_mixer },
4007 .init_verbs = { alc880_volume_init_verbs,
4008 alc880_pin_3stack_init_verbs },
4009 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4010 .dac_nids = alc880_dac_nids,
4011 .dig_out_nid = ALC880_DIGOUT_NID,
4012 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4013 .channel_mode = alc880_threestack_modes,
4015 .input_mux = &alc880_capture_source,
4017 [ALC880_TCL_S700] = {
4018 .mixers = { alc880_tcl_s700_mixer },
4019 .init_verbs = { alc880_volume_init_verbs,
4020 alc880_pin_tcl_S700_init_verbs,
4021 alc880_gpio2_init_verbs },
4022 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4023 .dac_nids = alc880_dac_nids,
4024 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4025 .num_adc_nids = 1, /* single ADC */
4027 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4028 .channel_mode = alc880_2_jack_modes,
4029 .input_mux = &alc880_capture_source,
4032 .mixers = { alc880_three_stack_mixer,
4033 alc880_five_stack_mixer},
4034 .init_verbs = { alc880_volume_init_verbs,
4035 alc880_pin_5stack_init_verbs },
4036 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4037 .dac_nids = alc880_dac_nids,
4038 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4039 .channel_mode = alc880_fivestack_modes,
4040 .input_mux = &alc880_capture_source,
4042 [ALC880_5ST_DIG] = {
4043 .mixers = { alc880_three_stack_mixer,
4044 alc880_five_stack_mixer },
4045 .init_verbs = { alc880_volume_init_verbs,
4046 alc880_pin_5stack_init_verbs },
4047 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4048 .dac_nids = alc880_dac_nids,
4049 .dig_out_nid = ALC880_DIGOUT_NID,
4050 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4051 .channel_mode = alc880_fivestack_modes,
4052 .input_mux = &alc880_capture_source,
4055 .mixers = { alc880_six_stack_mixer },
4056 .init_verbs = { alc880_volume_init_verbs,
4057 alc880_pin_6stack_init_verbs },
4058 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4059 .dac_nids = alc880_6st_dac_nids,
4060 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4061 .channel_mode = alc880_sixstack_modes,
4062 .input_mux = &alc880_6stack_capture_source,
4064 [ALC880_6ST_DIG] = {
4065 .mixers = { alc880_six_stack_mixer },
4066 .init_verbs = { alc880_volume_init_verbs,
4067 alc880_pin_6stack_init_verbs },
4068 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4069 .dac_nids = alc880_6st_dac_nids,
4070 .dig_out_nid = ALC880_DIGOUT_NID,
4071 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4072 .channel_mode = alc880_sixstack_modes,
4073 .input_mux = &alc880_6stack_capture_source,
4076 .mixers = { alc880_w810_base_mixer },
4077 .init_verbs = { alc880_volume_init_verbs,
4078 alc880_pin_w810_init_verbs,
4079 alc880_gpio2_init_verbs },
4080 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4081 .dac_nids = alc880_w810_dac_nids,
4082 .dig_out_nid = ALC880_DIGOUT_NID,
4083 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4084 .channel_mode = alc880_w810_modes,
4085 .input_mux = &alc880_capture_source,
4088 .mixers = { alc880_z71v_mixer },
4089 .init_verbs = { alc880_volume_init_verbs,
4090 alc880_pin_z71v_init_verbs },
4091 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4092 .dac_nids = alc880_z71v_dac_nids,
4093 .dig_out_nid = ALC880_DIGOUT_NID,
4095 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4096 .channel_mode = alc880_2_jack_modes,
4097 .input_mux = &alc880_capture_source,
4100 .mixers = { alc880_f1734_mixer },
4101 .init_verbs = { alc880_volume_init_verbs,
4102 alc880_pin_f1734_init_verbs },
4103 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4104 .dac_nids = alc880_f1734_dac_nids,
4106 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4107 .channel_mode = alc880_2_jack_modes,
4108 .input_mux = &alc880_f1734_capture_source,
4109 .unsol_event = alc880_uniwill_p53_unsol_event,
4110 .init_hook = alc880_uniwill_p53_init_hook,
4113 .mixers = { alc880_asus_mixer },
4114 .init_verbs = { alc880_volume_init_verbs,
4115 alc880_pin_asus_init_verbs,
4116 alc880_gpio1_init_verbs },
4117 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4118 .dac_nids = alc880_asus_dac_nids,
4119 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4120 .channel_mode = alc880_asus_modes,
4122 .input_mux = &alc880_capture_source,
4124 [ALC880_ASUS_DIG] = {
4125 .mixers = { alc880_asus_mixer },
4126 .init_verbs = { alc880_volume_init_verbs,
4127 alc880_pin_asus_init_verbs,
4128 alc880_gpio1_init_verbs },
4129 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4130 .dac_nids = alc880_asus_dac_nids,
4131 .dig_out_nid = ALC880_DIGOUT_NID,
4132 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4133 .channel_mode = alc880_asus_modes,
4135 .input_mux = &alc880_capture_source,
4137 [ALC880_ASUS_DIG2] = {
4138 .mixers = { alc880_asus_mixer },
4139 .init_verbs = { alc880_volume_init_verbs,
4140 alc880_pin_asus_init_verbs,
4141 alc880_gpio2_init_verbs }, /* use GPIO2 */
4142 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4143 .dac_nids = alc880_asus_dac_nids,
4144 .dig_out_nid = ALC880_DIGOUT_NID,
4145 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4146 .channel_mode = alc880_asus_modes,
4148 .input_mux = &alc880_capture_source,
4150 [ALC880_ASUS_W1V] = {
4151 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_asus_init_verbs,
4154 alc880_gpio1_init_verbs },
4155 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4156 .dac_nids = alc880_asus_dac_nids,
4157 .dig_out_nid = ALC880_DIGOUT_NID,
4158 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4159 .channel_mode = alc880_asus_modes,
4161 .input_mux = &alc880_capture_source,
4163 [ALC880_UNIWILL_DIG] = {
4164 .mixers = { alc880_asus_mixer },
4165 .init_verbs = { alc880_volume_init_verbs,
4166 alc880_pin_asus_init_verbs },
4167 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4168 .dac_nids = alc880_asus_dac_nids,
4169 .dig_out_nid = ALC880_DIGOUT_NID,
4170 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4171 .channel_mode = alc880_asus_modes,
4173 .input_mux = &alc880_capture_source,
4175 [ALC880_UNIWILL] = {
4176 .mixers = { alc880_uniwill_mixer },
4177 .init_verbs = { alc880_volume_init_verbs,
4178 alc880_uniwill_init_verbs },
4179 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4180 .dac_nids = alc880_asus_dac_nids,
4181 .dig_out_nid = ALC880_DIGOUT_NID,
4182 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4183 .channel_mode = alc880_threestack_modes,
4185 .input_mux = &alc880_capture_source,
4186 .unsol_event = alc880_uniwill_unsol_event,
4187 .init_hook = alc880_uniwill_init_hook,
4189 [ALC880_UNIWILL_P53] = {
4190 .mixers = { alc880_uniwill_p53_mixer },
4191 .init_verbs = { alc880_volume_init_verbs,
4192 alc880_uniwill_p53_init_verbs },
4193 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4194 .dac_nids = alc880_asus_dac_nids,
4195 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4196 .channel_mode = alc880_threestack_modes,
4197 .input_mux = &alc880_capture_source,
4198 .unsol_event = alc880_uniwill_p53_unsol_event,
4199 .init_hook = alc880_uniwill_p53_init_hook,
4201 [ALC880_FUJITSU] = {
4202 .mixers = { alc880_fujitsu_mixer },
4203 .init_verbs = { alc880_volume_init_verbs,
4204 alc880_uniwill_p53_init_verbs,
4205 alc880_beep_init_verbs },
4206 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4207 .dac_nids = alc880_dac_nids,
4208 .dig_out_nid = ALC880_DIGOUT_NID,
4209 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4210 .channel_mode = alc880_2_jack_modes,
4211 .input_mux = &alc880_capture_source,
4212 .unsol_event = alc880_uniwill_p53_unsol_event,
4213 .init_hook = alc880_uniwill_p53_init_hook,
4216 .mixers = { alc880_three_stack_mixer },
4217 .init_verbs = { alc880_volume_init_verbs,
4218 alc880_pin_clevo_init_verbs },
4219 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4220 .dac_nids = alc880_dac_nids,
4222 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4223 .channel_mode = alc880_threestack_modes,
4225 .input_mux = &alc880_capture_source,
4228 .mixers = { alc880_lg_mixer },
4229 .init_verbs = { alc880_volume_init_verbs,
4230 alc880_lg_init_verbs },
4231 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4232 .dac_nids = alc880_lg_dac_nids,
4233 .dig_out_nid = ALC880_DIGOUT_NID,
4234 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4235 .channel_mode = alc880_lg_ch_modes,
4237 .input_mux = &alc880_lg_capture_source,
4238 .unsol_event = alc_automute_amp_unsol_event,
4239 .init_hook = alc880_lg_init_hook,
4240 #ifdef CONFIG_SND_HDA_POWER_SAVE
4241 .loopbacks = alc880_lg_loopbacks,
4245 .mixers = { alc880_lg_lw_mixer },
4246 .init_verbs = { alc880_volume_init_verbs,
4247 alc880_lg_lw_init_verbs },
4248 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4249 .dac_nids = alc880_dac_nids,
4250 .dig_out_nid = ALC880_DIGOUT_NID,
4251 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4252 .channel_mode = alc880_lg_lw_modes,
4253 .input_mux = &alc880_lg_lw_capture_source,
4254 .unsol_event = alc_automute_amp_unsol_event,
4255 .init_hook = alc880_lg_lw_init_hook,
4257 [ALC880_MEDION_RIM] = {
4258 .mixers = { alc880_medion_rim_mixer },
4259 .init_verbs = { alc880_volume_init_verbs,
4260 alc880_medion_rim_init_verbs,
4261 alc_gpio2_init_verbs },
4262 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4263 .dac_nids = alc880_dac_nids,
4264 .dig_out_nid = ALC880_DIGOUT_NID,
4265 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4266 .channel_mode = alc880_2_jack_modes,
4267 .input_mux = &alc880_medion_rim_capture_source,
4268 .unsol_event = alc880_medion_rim_unsol_event,
4269 .init_hook = alc880_medion_rim_init_hook,
4271 #ifdef CONFIG_SND_DEBUG
4273 .mixers = { alc880_test_mixer },
4274 .init_verbs = { alc880_test_init_verbs },
4275 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4276 .dac_nids = alc880_test_dac_nids,
4277 .dig_out_nid = ALC880_DIGOUT_NID,
4278 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4279 .channel_mode = alc880_test_modes,
4280 .input_mux = &alc880_test_capture_source,
4286 * Automatic parse of I/O pins from the BIOS configuration
4291 ALC_CTL_WIDGET_MUTE,
4294 static struct snd_kcontrol_new alc880_control_templates[] = {
4295 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4296 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4297 HDA_BIND_MUTE(NULL, 0, 0, 0),
4300 /* add dynamic controls */
4301 static int add_control(struct alc_spec *spec, int type, const char *name,
4304 struct snd_kcontrol_new *knew;
4306 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4307 knew = snd_array_new(&spec->kctls);
4310 *knew = alc880_control_templates[type];
4311 knew->name = kstrdup(name, GFP_KERNEL);
4314 knew->private_value = val;
4318 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4319 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4320 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4321 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4322 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4323 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4324 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4325 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4326 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4327 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4328 #define ALC880_PIN_CD_NID 0x1c
4330 /* fill in the dac_nids table from the parsed pin configuration */
4331 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4332 const struct auto_pin_cfg *cfg)
4338 memset(assigned, 0, sizeof(assigned));
4339 spec->multiout.dac_nids = spec->private_dac_nids;
4341 /* check the pins hardwired to audio widget */
4342 for (i = 0; i < cfg->line_outs; i++) {
4343 nid = cfg->line_out_pins[i];
4344 if (alc880_is_fixed_pin(nid)) {
4345 int idx = alc880_fixed_pin_idx(nid);
4346 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4350 /* left pins can be connect to any audio widget */
4351 for (i = 0; i < cfg->line_outs; i++) {
4352 nid = cfg->line_out_pins[i];
4353 if (alc880_is_fixed_pin(nid))
4355 /* search for an empty channel */
4356 for (j = 0; j < cfg->line_outs; j++) {
4358 spec->multiout.dac_nids[i] =
4359 alc880_idx_to_dac(j);
4365 spec->multiout.num_dacs = cfg->line_outs;
4369 /* add playback controls from the parsed DAC table */
4370 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4371 const struct auto_pin_cfg *cfg)
4374 static const char *chname[4] = {
4375 "Front", "Surround", NULL /*CLFE*/, "Side"
4380 for (i = 0; i < cfg->line_outs; i++) {
4381 if (!spec->multiout.dac_nids[i])
4383 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4386 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4387 "Center Playback Volume",
4388 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4392 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4393 "LFE Playback Volume",
4394 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4398 err = add_control(spec, ALC_CTL_BIND_MUTE,
4399 "Center Playback Switch",
4400 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4404 err = add_control(spec, ALC_CTL_BIND_MUTE,
4405 "LFE Playback Switch",
4406 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4411 sprintf(name, "%s Playback Volume", chname[i]);
4412 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4413 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4417 sprintf(name, "%s Playback Switch", chname[i]);
4418 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4419 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4428 /* add playback controls for speaker and HP outputs */
4429 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4439 if (alc880_is_fixed_pin(pin)) {
4440 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4441 /* specify the DAC as the extra output */
4442 if (!spec->multiout.hp_nid)
4443 spec->multiout.hp_nid = nid;
4445 spec->multiout.extra_out_nid[0] = nid;
4446 /* control HP volume/switch on the output mixer amp */
4447 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4448 sprintf(name, "%s Playback Volume", pfx);
4449 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4450 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4453 sprintf(name, "%s Playback Switch", pfx);
4454 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4455 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4458 } else if (alc880_is_multi_pin(pin)) {
4459 /* set manual connection */
4460 /* we have only a switch on HP-out PIN */
4461 sprintf(name, "%s Playback Switch", pfx);
4462 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4463 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4470 /* create input playback/capture controls for the given pin */
4471 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4472 const char *ctlname,
4473 int idx, hda_nid_t mix_nid)
4478 sprintf(name, "%s Playback Volume", ctlname);
4479 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4480 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4483 sprintf(name, "%s Playback Switch", ctlname);
4484 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4485 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4491 /* create playback/capture controls for input pins */
4492 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4493 const struct auto_pin_cfg *cfg)
4495 struct hda_input_mux *imux = &spec->private_imux[0];
4498 for (i = 0; i < AUTO_PIN_LAST; i++) {
4499 if (alc880_is_input_pin(cfg->input_pins[i])) {
4500 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4501 err = new_analog_input(spec, cfg->input_pins[i],
4502 auto_pin_cfg_labels[i],
4506 imux->items[imux->num_items].label =
4507 auto_pin_cfg_labels[i];
4508 imux->items[imux->num_items].index =
4509 alc880_input_pin_idx(cfg->input_pins[i]);
4516 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4517 unsigned int pin_type)
4519 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4522 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4526 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4527 hda_nid_t nid, int pin_type,
4530 alc_set_pin_output(codec, nid, pin_type);
4531 /* need the manual connection? */
4532 if (alc880_is_multi_pin(nid)) {
4533 struct alc_spec *spec = codec->spec;
4534 int idx = alc880_multi_pin_idx(nid);
4535 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4536 AC_VERB_SET_CONNECT_SEL,
4537 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4541 static int get_pin_type(int line_out_type)
4543 if (line_out_type == AUTO_PIN_HP_OUT)
4549 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4551 struct alc_spec *spec = codec->spec;
4554 for (i = 0; i < spec->autocfg.line_outs; i++) {
4555 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4556 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4557 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4561 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4563 struct alc_spec *spec = codec->spec;
4566 pin = spec->autocfg.speaker_pins[0];
4567 if (pin) /* connect to front */
4568 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4569 pin = spec->autocfg.hp_pins[0];
4570 if (pin) /* connect to front */
4571 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4574 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4576 struct alc_spec *spec = codec->spec;
4579 for (i = 0; i < AUTO_PIN_LAST; i++) {
4580 hda_nid_t nid = spec->autocfg.input_pins[i];
4581 if (alc880_is_input_pin(nid)) {
4582 alc_set_input_pin(codec, nid, i);
4583 if (nid != ALC880_PIN_CD_NID &&
4584 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4585 snd_hda_codec_write(codec, nid, 0,
4586 AC_VERB_SET_AMP_GAIN_MUTE,
4592 /* parse the BIOS configuration and set up the alc_spec */
4593 /* return 1 if successful, 0 if the proper config is not found,
4594 * or a negative error code
4596 static int alc880_parse_auto_config(struct hda_codec *codec)
4598 struct alc_spec *spec = codec->spec;
4600 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4602 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4606 if (!spec->autocfg.line_outs)
4607 return 0; /* can't find valid BIOS pin config */
4609 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4612 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4615 err = alc880_auto_create_extra_out(spec,
4616 spec->autocfg.speaker_pins[0],
4620 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4624 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4628 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4630 /* check multiple SPDIF-out (for recent codecs) */
4631 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4633 err = snd_hda_get_connections(codec,
4634 spec->autocfg.dig_out_pins[i],
4639 spec->multiout.dig_out_nid = dig_nid;
4641 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4642 spec->slave_dig_outs[i - 1] = dig_nid;
4643 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4647 if (spec->autocfg.dig_in_pin)
4648 spec->dig_in_nid = ALC880_DIGIN_NID;
4650 if (spec->kctls.list)
4651 add_mixer(spec, spec->kctls.list);
4653 add_verb(spec, alc880_volume_init_verbs);
4655 spec->num_mux_defs = 1;
4656 spec->input_mux = &spec->private_imux[0];
4658 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4663 /* additional initialization for auto-configuration model */
4664 static void alc880_auto_init(struct hda_codec *codec)
4666 struct alc_spec *spec = codec->spec;
4667 alc880_auto_init_multi_out(codec);
4668 alc880_auto_init_extra_out(codec);
4669 alc880_auto_init_analog_input(codec);
4670 if (spec->unsol_event)
4671 alc_inithook(codec);
4674 static void set_capture_mixer(struct alc_spec *spec)
4676 static struct snd_kcontrol_new *caps[2][3] = {
4677 { alc_capture_mixer_nosrc1,
4678 alc_capture_mixer_nosrc2,
4679 alc_capture_mixer_nosrc3 },
4680 { alc_capture_mixer1,
4682 alc_capture_mixer3 },
4684 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4686 if (spec->input_mux && spec->input_mux->num_items > 1 &&
4691 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4695 #define set_beep_amp(spec, nid, idx, dir) \
4696 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4699 * OK, here we have finally the patch for ALC880
4702 static int patch_alc880(struct hda_codec *codec)
4704 struct alc_spec *spec;
4708 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4714 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4717 if (board_config < 0) {
4718 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4720 board_config = ALC880_AUTO;
4723 if (board_config == ALC880_AUTO) {
4724 /* automatic parse from the BIOS config */
4725 err = alc880_parse_auto_config(codec);
4731 "hda_codec: Cannot set up configuration "
4732 "from BIOS. Using 3-stack mode...\n");
4733 board_config = ALC880_3ST;
4737 err = snd_hda_attach_beep_device(codec, 0x1);
4743 if (board_config != ALC880_AUTO)
4744 setup_preset(spec, &alc880_presets[board_config]);
4746 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4747 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4748 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4750 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4751 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4753 if (!spec->adc_nids && spec->input_mux) {
4754 /* check whether NID 0x07 is valid */
4755 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4757 wcap = get_wcaps_type(wcap);
4758 if (wcap != AC_WID_AUD_IN) {
4759 spec->adc_nids = alc880_adc_nids_alt;
4760 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4762 spec->adc_nids = alc880_adc_nids;
4763 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4766 set_capture_mixer(spec);
4767 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4769 spec->vmaster_nid = 0x0c;
4771 codec->patch_ops = alc_patch_ops;
4772 if (board_config == ALC880_AUTO)
4773 spec->init_hook = alc880_auto_init;
4774 #ifdef CONFIG_SND_HDA_POWER_SAVE
4775 if (!spec->loopback.amplist)
4776 spec->loopback.amplist = alc880_loopbacks;
4778 codec->proc_widget_hook = print_realtek_coef;
4788 static hda_nid_t alc260_dac_nids[1] = {
4793 static hda_nid_t alc260_adc_nids[1] = {
4798 static hda_nid_t alc260_adc_nids_alt[1] = {
4803 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4804 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4806 static hda_nid_t alc260_dual_adc_nids[2] = {
4811 #define ALC260_DIGOUT_NID 0x03
4812 #define ALC260_DIGIN_NID 0x06
4814 static struct hda_input_mux alc260_capture_source = {
4818 { "Front Mic", 0x1 },
4824 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4825 * headphone jack and the internal CD lines since these are the only pins at
4826 * which audio can appear. For flexibility, also allow the option of
4827 * recording the mixer output on the second ADC (ADC0 doesn't have a
4828 * connection to the mixer output).
4830 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4834 { "Mic/Line", 0x0 },
4836 { "Headphone", 0x2 },
4842 { "Mic/Line", 0x0 },
4844 { "Headphone", 0x2 },
4851 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4852 * the Fujitsu S702x, but jacks are marked differently.
4854 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4861 { "Headphone", 0x5 },
4870 { "Headphone", 0x6 },
4876 /* Maxdata Favorit 100XS */
4877 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4881 { "Line/Mic", 0x0 },
4888 { "Line/Mic", 0x0 },
4896 * This is just place-holder, so there's something for alc_build_pcms to look
4897 * at when it calculates the maximum number of channels. ALC260 has no mixer
4898 * element which allows changing the channel mode, so the verb list is
4901 static struct hda_channel_mode alc260_modes[1] = {
4906 /* Mixer combinations
4908 * basic: base_output + input + pc_beep + capture
4909 * HP: base_output + input + capture_alt
4910 * HP_3013: hp_3013 + input + capture
4911 * fujitsu: fujitsu + capture
4912 * acer: acer + capture
4915 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4916 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4917 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4918 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4919 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4920 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4921 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4925 static struct snd_kcontrol_new alc260_input_mixer[] = {
4926 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4927 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4928 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4929 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4931 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4932 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4937 /* update HP, line and mono out pins according to the master switch */
4938 static void alc260_hp_master_update(struct hda_codec *codec,
4939 hda_nid_t hp, hda_nid_t line,
4942 struct alc_spec *spec = codec->spec;
4943 unsigned int val = spec->master_sw ? PIN_HP : 0;
4944 /* change HP and line-out pins */
4945 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4947 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4949 /* mono (speaker) depending on the HP jack sense */
4950 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4951 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4955 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4956 struct snd_ctl_elem_value *ucontrol)
4958 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4959 struct alc_spec *spec = codec->spec;
4960 *ucontrol->value.integer.value = spec->master_sw;
4964 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4965 struct snd_ctl_elem_value *ucontrol)
4967 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4968 struct alc_spec *spec = codec->spec;
4969 int val = !!*ucontrol->value.integer.value;
4970 hda_nid_t hp, line, mono;
4972 if (val == spec->master_sw)
4974 spec->master_sw = val;
4975 hp = (kcontrol->private_value >> 16) & 0xff;
4976 line = (kcontrol->private_value >> 8) & 0xff;
4977 mono = kcontrol->private_value & 0xff;
4978 alc260_hp_master_update(codec, hp, line, mono);
4982 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4984 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4985 .name = "Master Playback Switch",
4986 .info = snd_ctl_boolean_mono_info,
4987 .get = alc260_hp_master_sw_get,
4988 .put = alc260_hp_master_sw_put,
4989 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4991 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4992 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4993 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4994 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4995 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4997 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5001 static struct hda_verb alc260_hp_unsol_verbs[] = {
5002 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5006 static void alc260_hp_automute(struct hda_codec *codec)
5008 struct alc_spec *spec = codec->spec;
5009 unsigned int present;
5011 present = snd_hda_codec_read(codec, 0x10, 0,
5012 AC_VERB_GET_PIN_SENSE, 0);
5013 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5014 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5017 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5019 if ((res >> 26) == ALC880_HP_EVENT)
5020 alc260_hp_automute(codec);
5023 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5025 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5026 .name = "Master Playback Switch",
5027 .info = snd_ctl_boolean_mono_info,
5028 .get = alc260_hp_master_sw_get,
5029 .put = alc260_hp_master_sw_put,
5030 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5032 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5033 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5034 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5035 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5036 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5038 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5039 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5043 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5044 .ops = &snd_hda_bind_vol,
5046 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5047 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5048 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5053 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5054 .ops = &snd_hda_bind_sw,
5056 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5057 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5062 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5063 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5064 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5065 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5070 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5071 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5075 static void alc260_hp_3013_automute(struct hda_codec *codec)
5077 struct alc_spec *spec = codec->spec;
5078 unsigned int present;
5080 present = snd_hda_codec_read(codec, 0x15, 0,
5081 AC_VERB_GET_PIN_SENSE, 0);
5082 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
5083 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5086 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5089 if ((res >> 26) == ALC880_HP_EVENT)
5090 alc260_hp_3013_automute(codec);
5093 static void alc260_hp_3012_automute(struct hda_codec *codec)
5095 unsigned int present, bits;
5097 present = snd_hda_codec_read(codec, 0x10, 0,
5098 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
5100 bits = present ? 0 : PIN_OUT;
5101 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5103 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5105 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5109 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5112 if ((res >> 26) == ALC880_HP_EVENT)
5113 alc260_hp_3012_automute(codec);
5116 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5117 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5119 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5120 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5121 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5122 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5123 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5124 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5125 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5126 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5127 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5128 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5129 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5133 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5134 * versions of the ALC260 don't act on requests to enable mic bias from NID
5135 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5136 * datasheet doesn't mention this restriction. At this stage it's not clear
5137 * whether this behaviour is intentional or is a hardware bug in chip
5138 * revisions available in early 2006. Therefore for now allow the
5139 * "Headphone Jack Mode" control to span all choices, but if it turns out
5140 * that the lack of mic bias for this NID is intentional we could change the
5141 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5143 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5144 * don't appear to make the mic bias available from the "line" jack, even
5145 * though the NID used for this jack (0x14) can supply it. The theory is
5146 * that perhaps Acer have included blocking capacitors between the ALC260
5147 * and the output jack. If this turns out to be the case for all such
5148 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5149 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5151 * The C20x Tablet series have a mono internal speaker which is controlled
5152 * via the chip's Mono sum widget and pin complex, so include the necessary
5153 * controls for such models. On models without a "mono speaker" the control
5154 * won't do anything.
5156 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5157 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5158 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5159 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5160 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5162 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5164 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5165 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5167 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5168 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5169 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5170 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5171 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5175 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5177 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5178 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5179 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5180 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5181 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5182 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5183 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5187 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5188 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5190 static struct snd_kcontrol_new alc260_will_mixer[] = {
5191 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5192 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5194 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5195 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5196 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5197 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5198 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5199 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5200 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5204 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5205 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5207 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5208 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5209 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5211 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5212 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5213 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5214 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5215 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5216 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5217 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5222 * initialization verbs
5224 static struct hda_verb alc260_init_verbs[] = {
5225 /* Line In pin widget for input */
5226 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5227 /* CD pin widget for input */
5228 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5229 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5230 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5231 /* Mic2 (front panel) pin widget for input and vref at 80% */
5232 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5233 /* LINE-2 is used for line-out in rear */
5234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5235 /* select line-out */
5236 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5238 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5240 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5242 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5243 /* mute capture amp left and right */
5244 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5245 /* set connection select to line in (default select for this ADC) */
5246 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5247 /* mute capture amp left and right */
5248 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5249 /* set connection select to line in (default select for this ADC) */
5250 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5251 /* set vol=0 Line-Out mixer amp left and right */
5252 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5253 /* unmute pin widget amp left and right (no gain on this amp) */
5254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5255 /* set vol=0 HP mixer amp left and right */
5256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5257 /* unmute pin widget amp left and right (no gain on this amp) */
5258 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5259 /* set vol=0 Mono mixer amp left and right */
5260 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5261 /* unmute pin widget amp left and right (no gain on this amp) */
5262 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5263 /* unmute LINE-2 out pin */
5264 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5265 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5268 /* mute analog inputs */
5269 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5274 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5275 /* mute Front out path */
5276 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5277 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5278 /* mute Headphone out path */
5279 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5280 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5281 /* mute Mono out path */
5282 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5283 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5287 #if 0 /* should be identical with alc260_init_verbs? */
5288 static struct hda_verb alc260_hp_init_verbs[] = {
5289 /* Headphone and output */
5290 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5292 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5293 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5294 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5295 /* Mic2 (front panel) pin widget for input and vref at 80% */
5296 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5297 /* Line In pin widget for input */
5298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5299 /* Line-2 pin widget for output */
5300 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5301 /* CD pin widget for input */
5302 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5303 /* unmute amp left and right */
5304 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5305 /* set connection select to line in (default select for this ADC) */
5306 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5307 /* unmute Line-Out mixer amp left and right (volume = 0) */
5308 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5309 /* mute pin widget amp left and right (no gain on this amp) */
5310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5311 /* unmute HP mixer amp left and right (volume = 0) */
5312 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5313 /* mute pin widget amp left and right (no gain on this amp) */
5314 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5315 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5318 /* mute analog inputs */
5319 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5320 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5321 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5324 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5325 /* Unmute Front out path */
5326 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5328 /* Unmute Headphone out path */
5329 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5331 /* Unmute Mono out path */
5332 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5333 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5338 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5339 /* Line out and output */
5340 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5342 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5343 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5344 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5345 /* Mic2 (front panel) pin widget for input and vref at 80% */
5346 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5347 /* Line In pin widget for input */
5348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5349 /* Headphone pin widget for output */
5350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5351 /* CD pin widget for input */
5352 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5353 /* unmute amp left and right */
5354 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5355 /* set connection select to line in (default select for this ADC) */
5356 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5357 /* unmute Line-Out mixer amp left and right (volume = 0) */
5358 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5359 /* mute pin widget amp left and right (no gain on this amp) */
5360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5361 /* unmute HP mixer amp left and right (volume = 0) */
5362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5363 /* mute pin widget amp left and right (no gain on this amp) */
5364 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5365 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5368 /* mute analog inputs */
5369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5370 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5374 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5375 /* Unmute Front out path */
5376 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5378 /* Unmute Headphone out path */
5379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5381 /* Unmute Mono out path */
5382 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5387 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5388 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5389 * audio = 0x16, internal speaker = 0x10.
5391 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5392 /* Disable all GPIOs */
5393 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5394 /* Internal speaker is connected to headphone pin */
5395 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5396 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5398 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5399 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5400 /* Ensure all other unused pins are disabled and muted. */
5401 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5402 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5403 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5404 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5405 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5406 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5407 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5410 /* Disable digital (SPDIF) pins */
5411 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5412 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5414 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5415 * when acting as an output.
5417 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5419 /* Start with output sum widgets muted and their output gains at min */
5420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5426 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5427 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5428 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5430 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5431 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5432 /* Unmute Line1 pin widget output buffer since it starts as an output.
5433 * If the pin mode is changed by the user the pin mode control will
5434 * take care of enabling the pin's input/output buffers as needed.
5435 * Therefore there's no need to enable the input buffer at this
5438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5439 /* Unmute input buffer of pin widget used for Line-in (no equiv
5442 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5444 /* Mute capture amp left and right */
5445 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5446 /* Set ADC connection select to match default mixer setting - line
5449 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5451 /* Do the same for the second ADC: mute capture input amp and
5452 * set ADC connection to line in (on mic1 pin)
5454 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5455 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5457 /* Mute all inputs to mixer widget (even unconnected ones) */
5458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5464 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5465 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5470 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5471 * similar laptops (adapted from Fujitsu init verbs).
5473 static struct hda_verb alc260_acer_init_verbs[] = {
5474 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5475 * the headphone jack. Turn this on and rely on the standard mute
5476 * methods whenever the user wants to turn these outputs off.
5478 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5479 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5480 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5481 /* Internal speaker/Headphone jack is connected to Line-out pin */
5482 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5483 /* Internal microphone/Mic jack is connected to Mic1 pin */
5484 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5485 /* Line In jack is connected to Line1 pin */
5486 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5487 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5488 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5489 /* Ensure all other unused pins are disabled and muted. */
5490 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5491 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5492 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5493 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 /* Disable digital (SPDIF) pins */
5497 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5498 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5500 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5501 * bus when acting as outputs.
5503 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5504 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5506 /* Start with output sum widgets muted and their output gains at min */
5507 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5509 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5511 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5513 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5514 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5515 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5517 /* Unmute Line-out pin widget amp left and right
5518 * (no equiv mixer ctrl)
5520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5521 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5522 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5523 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5524 * inputs. If the pin mode is changed by the user the pin mode control
5525 * will take care of enabling the pin's input/output buffers as needed.
5526 * Therefore there's no need to enable the input buffer at this
5529 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5532 /* Mute capture amp left and right */
5533 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5534 /* Set ADC connection select to match default mixer setting - mic
5537 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5539 /* Do similar with the second ADC: mute capture input amp and
5540 * set ADC connection to mic to match ALSA's default state.
5542 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5545 /* Mute all inputs to mixer widget (even unconnected ones) */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5551 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5552 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5553 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5558 /* Initialisation sequence for Maxdata Favorit 100XS
5559 * (adapted from Acer init verbs).
5561 static struct hda_verb alc260_favorit100_init_verbs[] = {
5562 /* GPIO 0 enables the output jack.
5563 * Turn this on and rely on the standard mute
5564 * methods whenever the user wants to turn these outputs off.
5566 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5567 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5568 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5569 /* Line/Mic input jack is connected to Mic1 pin */
5570 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5571 /* Ensure all other unused pins are disabled and muted. */
5572 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5573 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5574 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5575 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5577 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5579 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5582 /* Disable digital (SPDIF) pins */
5583 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5584 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5586 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5587 * bus when acting as outputs.
5589 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5590 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5592 /* Start with output sum widgets muted and their output gains at min */
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5603 /* Unmute Line-out pin widget amp left and right
5604 * (no equiv mixer ctrl)
5606 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5607 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5608 * inputs. If the pin mode is changed by the user the pin mode control
5609 * will take care of enabling the pin's input/output buffers as needed.
5610 * Therefore there's no need to enable the input buffer at this
5613 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5615 /* Mute capture amp left and right */
5616 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5617 /* Set ADC connection select to match default mixer setting - mic
5620 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5622 /* Do similar with the second ADC: mute capture input amp and
5623 * set ADC connection to mic to match ALSA's default state.
5625 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5626 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5628 /* Mute all inputs to mixer widget (even unconnected ones) */
5629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5641 static struct hda_verb alc260_will_verbs[] = {
5642 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5643 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5644 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5645 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5646 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5647 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5651 static struct hda_verb alc260_replacer_672v_verbs[] = {
5652 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5653 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5654 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5656 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5657 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5658 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5660 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5664 /* toggle speaker-output according to the hp-jack state */
5665 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5667 unsigned int present;
5669 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5670 present = snd_hda_codec_read(codec, 0x0f, 0,
5671 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5673 snd_hda_codec_write_cache(codec, 0x01, 0,
5674 AC_VERB_SET_GPIO_DATA, 1);
5675 snd_hda_codec_write_cache(codec, 0x0f, 0,
5676 AC_VERB_SET_PIN_WIDGET_CONTROL,
5679 snd_hda_codec_write_cache(codec, 0x01, 0,
5680 AC_VERB_SET_GPIO_DATA, 0);
5681 snd_hda_codec_write_cache(codec, 0x0f, 0,
5682 AC_VERB_SET_PIN_WIDGET_CONTROL,
5687 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5690 if ((res >> 26) == ALC880_HP_EVENT)
5691 alc260_replacer_672v_automute(codec);
5694 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5695 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5697 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5698 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5699 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5701 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5702 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5703 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5704 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5708 /* Test configuration for debugging, modelled after the ALC880 test
5711 #ifdef CONFIG_SND_DEBUG
5712 static hda_nid_t alc260_test_dac_nids[1] = {
5715 static hda_nid_t alc260_test_adc_nids[2] = {
5718 /* For testing the ALC260, each input MUX needs its own definition since
5719 * the signal assignments are different. This assumes that the first ADC
5722 static struct hda_input_mux alc260_test_capture_sources[2] = {
5726 { "MIC1 pin", 0x0 },
5727 { "MIC2 pin", 0x1 },
5728 { "LINE1 pin", 0x2 },
5729 { "LINE2 pin", 0x3 },
5731 { "LINE-OUT pin", 0x5 },
5732 { "HP-OUT pin", 0x6 },
5738 { "MIC1 pin", 0x0 },
5739 { "MIC2 pin", 0x1 },
5740 { "LINE1 pin", 0x2 },
5741 { "LINE2 pin", 0x3 },
5744 { "LINE-OUT pin", 0x6 },
5745 { "HP-OUT pin", 0x7 },
5749 static struct snd_kcontrol_new alc260_test_mixer[] = {
5750 /* Output driver widgets */
5751 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5752 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5753 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5754 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5755 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5756 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5758 /* Modes for retasking pin widgets
5759 * Note: the ALC260 doesn't seem to act on requests to enable mic
5760 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5761 * mention this restriction. At this stage it's not clear whether
5762 * this behaviour is intentional or is a hardware bug in chip
5763 * revisions available at least up until early 2006. Therefore for
5764 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5765 * choices, but if it turns out that the lack of mic bias for these
5766 * NIDs is intentional we could change their modes from
5767 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5769 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5770 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5771 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5772 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5773 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5774 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5776 /* Loopback mixer controls */
5777 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5778 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5779 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5780 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5781 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5782 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5783 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5784 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5785 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5786 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5787 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5788 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5789 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5790 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5792 /* Controls for GPIO pins, assuming they are configured as outputs */
5793 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5794 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5795 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5796 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5798 /* Switches to allow the digital IO pins to be enabled. The datasheet
5799 * is ambigious as to which NID is which; testing on laptops which
5800 * make this output available should provide clarification.
5802 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5803 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5805 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5806 * this output to turn on an external amplifier.
5808 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5809 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5813 static struct hda_verb alc260_test_init_verbs[] = {
5814 /* Enable all GPIOs as outputs with an initial value of 0 */
5815 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5816 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5817 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5819 /* Enable retasking pins as output, initially without power amp */
5820 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5821 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5822 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5824 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5825 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5827 /* Disable digital (SPDIF) pins initially, but users can enable
5828 * them via a mixer switch. In the case of SPDIF-out, this initverb
5829 * payload also sets the generation to 0, output to be in "consumer"
5830 * PCM format, copyright asserted, no pre-emphasis and no validity
5833 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5834 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5836 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5837 * OUT1 sum bus when acting as an output.
5839 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5840 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5841 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5842 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5844 /* Start with output sum widgets muted and their output gains at min */
5845 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5846 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5847 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5848 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5849 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5850 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5851 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5852 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5853 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5855 /* Unmute retasking pin widget output buffers since the default
5856 * state appears to be output. As the pin mode is changed by the
5857 * user the pin mode control will take care of enabling the pin's
5858 * input/output buffers as needed.
5860 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5861 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5864 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5865 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5866 /* Also unmute the mono-out pin widget */
5867 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5869 /* Mute capture amp left and right */
5870 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 /* Set ADC connection select to match default mixer setting (mic1
5874 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5876 /* Do the same for the second ADC: mute capture input amp and
5877 * set ADC connection to mic1 pin
5879 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5880 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5882 /* Mute all inputs to mixer widget (even unconnected ones) */
5883 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5884 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5885 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5886 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5887 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5888 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5889 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5890 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5896 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5897 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5899 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5900 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5903 * for BIOS auto-configuration
5906 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5907 const char *pfx, int *vol_bits)
5910 unsigned long vol_val, sw_val;
5914 if (nid >= 0x0f && nid < 0x11) {
5915 nid_vol = nid - 0x7;
5916 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5917 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5918 } else if (nid == 0x11) {
5919 nid_vol = nid - 0x7;
5920 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5921 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5922 } else if (nid >= 0x12 && nid <= 0x15) {
5924 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5925 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5929 if (!(*vol_bits & (1 << nid_vol))) {
5930 /* first control for the volume widget */
5931 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5932 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5935 *vol_bits |= (1 << nid_vol);
5937 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5938 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5944 /* add playback controls from the parsed DAC table */
5945 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5946 const struct auto_pin_cfg *cfg)
5952 spec->multiout.num_dacs = 1;
5953 spec->multiout.dac_nids = spec->private_dac_nids;
5954 spec->multiout.dac_nids[0] = 0x02;
5956 nid = cfg->line_out_pins[0];
5958 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5963 nid = cfg->speaker_pins[0];
5965 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5970 nid = cfg->hp_pins[0];
5972 err = alc260_add_playback_controls(spec, nid, "Headphone",
5980 /* create playback/capture controls for input pins */
5981 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5982 const struct auto_pin_cfg *cfg)
5984 struct hda_input_mux *imux = &spec->private_imux[0];
5987 for (i = 0; i < AUTO_PIN_LAST; i++) {
5988 if (cfg->input_pins[i] >= 0x12) {
5989 idx = cfg->input_pins[i] - 0x12;
5990 err = new_analog_input(spec, cfg->input_pins[i],
5991 auto_pin_cfg_labels[i], idx,
5995 imux->items[imux->num_items].label =
5996 auto_pin_cfg_labels[i];
5997 imux->items[imux->num_items].index = idx;
6000 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
6001 idx = cfg->input_pins[i] - 0x09;
6002 err = new_analog_input(spec, cfg->input_pins[i],
6003 auto_pin_cfg_labels[i], idx,
6007 imux->items[imux->num_items].label =
6008 auto_pin_cfg_labels[i];
6009 imux->items[imux->num_items].index = idx;
6016 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6017 hda_nid_t nid, int pin_type,
6020 alc_set_pin_output(codec, nid, pin_type);
6021 /* need the manual connection? */
6023 int idx = nid - 0x12;
6024 snd_hda_codec_write(codec, idx + 0x0b, 0,
6025 AC_VERB_SET_CONNECT_SEL, sel_idx);
6029 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6031 struct alc_spec *spec = codec->spec;
6034 nid = spec->autocfg.line_out_pins[0];
6036 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6037 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6040 nid = spec->autocfg.speaker_pins[0];
6042 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6044 nid = spec->autocfg.hp_pins[0];
6046 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6049 #define ALC260_PIN_CD_NID 0x16
6050 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6052 struct alc_spec *spec = codec->spec;
6055 for (i = 0; i < AUTO_PIN_LAST; i++) {
6056 hda_nid_t nid = spec->autocfg.input_pins[i];
6058 alc_set_input_pin(codec, nid, i);
6059 if (nid != ALC260_PIN_CD_NID &&
6060 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6061 snd_hda_codec_write(codec, nid, 0,
6062 AC_VERB_SET_AMP_GAIN_MUTE,
6069 * generic initialization of ADC, input mixers and output mixers
6071 static struct hda_verb alc260_volume_init_verbs[] = {
6073 * Unmute ADC0-1 and set the default input to mic-in
6075 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6076 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6077 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6078 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6080 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6082 * Note: PASD motherboards uses the Line In 2 as the input for
6083 * front panel mic (mic 2)
6085 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6086 /* mute analog inputs */
6087 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6088 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6089 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6090 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6091 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6094 * Set up output mixers (0x08 - 0x0a)
6096 /* set vol=0 to output mixers */
6097 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6099 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6100 /* set up input amps for analog loopback */
6101 /* Amp Indices: DAC = 0, mixer = 1 */
6102 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6104 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6105 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6106 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6107 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6112 static int alc260_parse_auto_config(struct hda_codec *codec)
6114 struct alc_spec *spec = codec->spec;
6116 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6118 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6122 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6125 if (!spec->kctls.list)
6126 return 0; /* can't find valid BIOS pin config */
6127 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
6131 spec->multiout.max_channels = 2;
6133 if (spec->autocfg.dig_outs)
6134 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6135 if (spec->kctls.list)
6136 add_mixer(spec, spec->kctls.list);
6138 add_verb(spec, alc260_volume_init_verbs);
6140 spec->num_mux_defs = 1;
6141 spec->input_mux = &spec->private_imux[0];
6143 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6148 /* additional initialization for auto-configuration model */
6149 static void alc260_auto_init(struct hda_codec *codec)
6151 struct alc_spec *spec = codec->spec;
6152 alc260_auto_init_multi_out(codec);
6153 alc260_auto_init_analog_input(codec);
6154 if (spec->unsol_event)
6155 alc_inithook(codec);
6158 #ifdef CONFIG_SND_HDA_POWER_SAVE
6159 static struct hda_amp_list alc260_loopbacks[] = {
6160 { 0x07, HDA_INPUT, 0 },
6161 { 0x07, HDA_INPUT, 1 },
6162 { 0x07, HDA_INPUT, 2 },
6163 { 0x07, HDA_INPUT, 3 },
6164 { 0x07, HDA_INPUT, 4 },
6170 * ALC260 configurations
6172 static const char *alc260_models[ALC260_MODEL_LAST] = {
6173 [ALC260_BASIC] = "basic",
6175 [ALC260_HP_3013] = "hp-3013",
6176 [ALC260_HP_DC7600] = "hp-dc7600",
6177 [ALC260_FUJITSU_S702X] = "fujitsu",
6178 [ALC260_ACER] = "acer",
6179 [ALC260_WILL] = "will",
6180 [ALC260_REPLACER_672V] = "replacer",
6181 [ALC260_FAVORIT100] = "favorit100",
6182 #ifdef CONFIG_SND_DEBUG
6183 [ALC260_TEST] = "test",
6185 [ALC260_AUTO] = "auto",
6188 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6189 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6190 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6191 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6192 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6193 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6194 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6195 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6196 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6197 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6198 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6199 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6200 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6201 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6202 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6203 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6204 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6205 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6206 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6207 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6211 static struct alc_config_preset alc260_presets[] = {
6213 .mixers = { alc260_base_output_mixer,
6214 alc260_input_mixer },
6215 .init_verbs = { alc260_init_verbs },
6216 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6217 .dac_nids = alc260_dac_nids,
6218 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6219 .adc_nids = alc260_adc_nids,
6220 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6221 .channel_mode = alc260_modes,
6222 .input_mux = &alc260_capture_source,
6225 .mixers = { alc260_hp_output_mixer,
6226 alc260_input_mixer },
6227 .init_verbs = { alc260_init_verbs,
6228 alc260_hp_unsol_verbs },
6229 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6230 .dac_nids = alc260_dac_nids,
6231 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6232 .adc_nids = alc260_adc_nids_alt,
6233 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6234 .channel_mode = alc260_modes,
6235 .input_mux = &alc260_capture_source,
6236 .unsol_event = alc260_hp_unsol_event,
6237 .init_hook = alc260_hp_automute,
6239 [ALC260_HP_DC7600] = {
6240 .mixers = { alc260_hp_dc7600_mixer,
6241 alc260_input_mixer },
6242 .init_verbs = { alc260_init_verbs,
6243 alc260_hp_dc7600_verbs },
6244 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6245 .dac_nids = alc260_dac_nids,
6246 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6247 .adc_nids = alc260_adc_nids_alt,
6248 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6249 .channel_mode = alc260_modes,
6250 .input_mux = &alc260_capture_source,
6251 .unsol_event = alc260_hp_3012_unsol_event,
6252 .init_hook = alc260_hp_3012_automute,
6254 [ALC260_HP_3013] = {
6255 .mixers = { alc260_hp_3013_mixer,
6256 alc260_input_mixer },
6257 .init_verbs = { alc260_hp_3013_init_verbs,
6258 alc260_hp_3013_unsol_verbs },
6259 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6260 .dac_nids = alc260_dac_nids,
6261 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6262 .adc_nids = alc260_adc_nids_alt,
6263 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6264 .channel_mode = alc260_modes,
6265 .input_mux = &alc260_capture_source,
6266 .unsol_event = alc260_hp_3013_unsol_event,
6267 .init_hook = alc260_hp_3013_automute,
6269 [ALC260_FUJITSU_S702X] = {
6270 .mixers = { alc260_fujitsu_mixer },
6271 .init_verbs = { alc260_fujitsu_init_verbs },
6272 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6273 .dac_nids = alc260_dac_nids,
6274 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6275 .adc_nids = alc260_dual_adc_nids,
6276 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6277 .channel_mode = alc260_modes,
6278 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6279 .input_mux = alc260_fujitsu_capture_sources,
6282 .mixers = { alc260_acer_mixer },
6283 .init_verbs = { alc260_acer_init_verbs },
6284 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6285 .dac_nids = alc260_dac_nids,
6286 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6287 .adc_nids = alc260_dual_adc_nids,
6288 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6289 .channel_mode = alc260_modes,
6290 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6291 .input_mux = alc260_acer_capture_sources,
6293 [ALC260_FAVORIT100] = {
6294 .mixers = { alc260_favorit100_mixer },
6295 .init_verbs = { alc260_favorit100_init_verbs },
6296 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6297 .dac_nids = alc260_dac_nids,
6298 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6299 .adc_nids = alc260_dual_adc_nids,
6300 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6301 .channel_mode = alc260_modes,
6302 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6303 .input_mux = alc260_favorit100_capture_sources,
6306 .mixers = { alc260_will_mixer },
6307 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6308 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6309 .dac_nids = alc260_dac_nids,
6310 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6311 .adc_nids = alc260_adc_nids,
6312 .dig_out_nid = ALC260_DIGOUT_NID,
6313 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6314 .channel_mode = alc260_modes,
6315 .input_mux = &alc260_capture_source,
6317 [ALC260_REPLACER_672V] = {
6318 .mixers = { alc260_replacer_672v_mixer },
6319 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6320 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6321 .dac_nids = alc260_dac_nids,
6322 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6323 .adc_nids = alc260_adc_nids,
6324 .dig_out_nid = ALC260_DIGOUT_NID,
6325 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6326 .channel_mode = alc260_modes,
6327 .input_mux = &alc260_capture_source,
6328 .unsol_event = alc260_replacer_672v_unsol_event,
6329 .init_hook = alc260_replacer_672v_automute,
6331 #ifdef CONFIG_SND_DEBUG
6333 .mixers = { alc260_test_mixer },
6334 .init_verbs = { alc260_test_init_verbs },
6335 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6336 .dac_nids = alc260_test_dac_nids,
6337 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6338 .adc_nids = alc260_test_adc_nids,
6339 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6340 .channel_mode = alc260_modes,
6341 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6342 .input_mux = alc260_test_capture_sources,
6347 static int patch_alc260(struct hda_codec *codec)
6349 struct alc_spec *spec;
6350 int err, board_config;
6352 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6358 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6361 if (board_config < 0) {
6362 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6364 board_config = ALC260_AUTO;
6367 if (board_config == ALC260_AUTO) {
6368 /* automatic parse from the BIOS config */
6369 err = alc260_parse_auto_config(codec);
6375 "hda_codec: Cannot set up configuration "
6376 "from BIOS. Using base mode...\n");
6377 board_config = ALC260_BASIC;
6381 err = snd_hda_attach_beep_device(codec, 0x1);
6387 if (board_config != ALC260_AUTO)
6388 setup_preset(spec, &alc260_presets[board_config]);
6390 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6391 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6393 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6394 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6396 if (!spec->adc_nids && spec->input_mux) {
6397 /* check whether NID 0x04 is valid */
6398 unsigned int wcap = get_wcaps(codec, 0x04);
6399 wcap = get_wcaps_type(wcap);
6401 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6402 spec->adc_nids = alc260_adc_nids_alt;
6403 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6405 spec->adc_nids = alc260_adc_nids;
6406 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6409 set_capture_mixer(spec);
6410 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6412 spec->vmaster_nid = 0x08;
6414 codec->patch_ops = alc_patch_ops;
6415 if (board_config == ALC260_AUTO)
6416 spec->init_hook = alc260_auto_init;
6417 #ifdef CONFIG_SND_HDA_POWER_SAVE
6418 if (!spec->loopback.amplist)
6419 spec->loopback.amplist = alc260_loopbacks;
6421 codec->proc_widget_hook = print_realtek_coef;
6428 * ALC882/883/885/888/889 support
6430 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6431 * configuration. Each pin widget can choose any input DACs and a mixer.
6432 * Each ADC is connected from a mixer of all inputs. This makes possible
6433 * 6-channel independent captures.
6435 * In addition, an independent DAC for the multi-playback (not used in this
6438 #define ALC882_DIGOUT_NID 0x06
6439 #define ALC882_DIGIN_NID 0x0a
6440 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6441 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6442 #define ALC1200_DIGOUT_NID 0x10
6445 static struct hda_channel_mode alc882_ch_modes[1] = {
6450 static hda_nid_t alc882_dac_nids[4] = {
6451 /* front, rear, clfe, rear_surr */
6452 0x02, 0x03, 0x04, 0x05
6454 #define alc883_dac_nids alc882_dac_nids
6457 #define alc882_adc_nids alc880_adc_nids
6458 #define alc882_adc_nids_alt alc880_adc_nids_alt
6459 #define alc883_adc_nids alc882_adc_nids_alt
6460 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6461 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6462 #define alc889_adc_nids alc880_adc_nids
6464 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6465 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6466 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6467 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6468 #define alc889_capsrc_nids alc882_capsrc_nids
6471 /* FIXME: should be a matrix-type input source selection */
6473 static struct hda_input_mux alc882_capture_source = {
6477 { "Front Mic", 0x1 },
6483 #define alc883_capture_source alc882_capture_source
6485 static struct hda_input_mux alc889_capture_source = {
6488 { "Front Mic", 0x0 },
6494 static struct hda_input_mux mb5_capture_source = {
6503 static struct hda_input_mux alc883_3stack_6ch_intel = {
6507 { "Front Mic", 0x0 },
6513 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6521 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6531 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6539 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6543 { "Front Mic", 0x1 },
6548 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6556 static struct hda_input_mux alc889A_mb31_capture_source = {
6560 /* Front Mic (0x01) unused */
6562 /* Line 2 (0x03) unused */
6563 /* CD (0x04) unsused? */
6570 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6577 static struct hda_verb alc882_3ST_ch2_init[] = {
6578 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6579 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6580 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6581 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6588 static struct hda_verb alc882_3ST_ch4_init[] = {
6589 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6590 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6591 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6592 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6593 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6600 static struct hda_verb alc882_3ST_ch6_init[] = {
6601 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6602 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6603 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6604 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6605 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6606 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6610 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6611 { 2, alc882_3ST_ch2_init },
6612 { 4, alc882_3ST_ch4_init },
6613 { 6, alc882_3ST_ch6_init },
6616 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6621 static struct hda_verb alc882_sixstack_ch6_init[] = {
6622 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6623 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6624 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6625 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6632 static struct hda_verb alc882_sixstack_ch8_init[] = {
6633 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6634 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6635 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6636 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6640 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6641 { 6, alc882_sixstack_ch6_init },
6642 { 8, alc882_sixstack_ch8_init },
6646 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6652 static struct hda_verb alc885_mbp_ch2_init[] = {
6653 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6654 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6655 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6662 static struct hda_verb alc885_mbp_ch6_init[] = {
6663 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6664 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6665 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6666 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6667 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6671 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6672 { 2, alc885_mbp_ch2_init },
6673 { 6, alc885_mbp_ch6_init },
6678 * Speakers/Woofer/HP = Front
6681 static struct hda_verb alc885_mb5_ch2_init[] = {
6682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6689 * Speakers/HP = Front
6693 static struct hda_verb alc885_mb5_ch6_init[] = {
6694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6696 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6700 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6701 { 2, alc885_mb5_ch2_init },
6702 { 6, alc885_mb5_ch6_init },
6709 static struct hda_verb alc883_4ST_ch2_init[] = {
6710 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6711 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6712 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6713 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6714 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6715 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6722 static struct hda_verb alc883_4ST_ch4_init[] = {
6723 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6724 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6729 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6736 static struct hda_verb alc883_4ST_ch6_init[] = {
6737 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6738 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6739 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6740 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6741 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6742 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6743 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6744 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6751 static struct hda_verb alc883_4ST_ch8_init[] = {
6752 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6753 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6754 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6755 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6756 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6757 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6758 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6759 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6760 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6764 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6765 { 2, alc883_4ST_ch2_init },
6766 { 4, alc883_4ST_ch4_init },
6767 { 6, alc883_4ST_ch6_init },
6768 { 8, alc883_4ST_ch8_init },
6775 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6776 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6777 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6778 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6779 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6786 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6787 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6788 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6789 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6790 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6791 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6798 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6799 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6800 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6801 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6802 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6803 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6804 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6808 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6809 { 2, alc883_3ST_ch2_intel_init },
6810 { 4, alc883_3ST_ch4_intel_init },
6811 { 6, alc883_3ST_ch6_intel_init },
6817 static struct hda_verb alc889_ch2_intel_init[] = {
6818 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6819 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
6820 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
6821 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
6822 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6823 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6830 static struct hda_verb alc889_ch6_intel_init[] = {
6831 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6832 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6833 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6834 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6835 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6836 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6843 static struct hda_verb alc889_ch8_intel_init[] = {
6844 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
6845 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
6846 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
6847 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6848 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
6849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6854 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
6855 { 2, alc889_ch2_intel_init },
6856 { 6, alc889_ch6_intel_init },
6857 { 8, alc889_ch8_intel_init },
6863 static struct hda_verb alc883_sixstack_ch6_init[] = {
6864 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6865 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6866 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6867 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6874 static struct hda_verb alc883_sixstack_ch8_init[] = {
6875 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6876 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6877 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6882 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6883 { 6, alc883_sixstack_ch6_init },
6884 { 8, alc883_sixstack_ch8_init },
6888 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6889 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6891 static struct snd_kcontrol_new alc882_base_mixer[] = {
6892 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6893 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6894 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6895 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6896 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6897 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6898 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6899 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6900 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6901 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6904 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6905 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6906 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6908 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6909 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6910 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6911 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6916 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6918 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6919 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6920 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6922 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6924 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6925 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6926 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6930 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6931 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6932 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6933 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6934 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6935 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6936 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6937 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6938 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6940 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6942 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6943 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6944 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6948 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6949 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6950 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6956 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6957 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6961 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6971 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6972 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6973 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6974 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6978 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6979 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6981 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6982 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6983 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6984 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6985 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6986 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6987 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6988 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6989 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6990 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6991 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6998 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6999 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7000 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7001 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7004 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7005 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7007 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7008 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7012 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7014 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7015 .name = "Channel Mode",
7016 .info = alc_ch_mode_info,
7017 .get = alc_ch_mode_get,
7018 .put = alc_ch_mode_put,
7023 static struct hda_verb alc882_base_init_verbs[] = {
7024 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7027 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7029 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7034 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7035 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7038 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7039 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7041 /* mute analog input loopbacks */
7042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7048 /* Front Pin: output 0 (0x0c) */
7049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7051 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7052 /* Rear Pin: output 1 (0x0d) */
7053 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7054 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7055 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7056 /* CLFE Pin: output 2 (0x0e) */
7057 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7058 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7059 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7060 /* Side Pin: output 3 (0x0f) */
7061 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7062 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7063 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7064 /* Mic (rear) pin: input vref at 80% */
7065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7067 /* Front Mic pin: input vref at 80% */
7068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7070 /* Line In pin: input */
7071 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7073 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7075 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7076 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7077 /* CD pin widget for input */
7078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7080 /* FIXME: use matrix-type input source selection */
7081 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7083 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7085 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7086 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7092 /* ADC2: mute amp left and right */
7093 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7094 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7095 /* ADC3: mute amp left and right */
7096 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7097 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7102 static struct hda_verb alc882_adc1_init_verbs[] = {
7103 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7104 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7105 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7108 /* ADC1: mute amp left and right */
7109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7110 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7114 static struct hda_verb alc882_eapd_verbs[] = {
7115 /* change to EAPD mode */
7116 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7117 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7121 static struct hda_verb alc889_eapd_verbs[] = {
7122 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7123 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7127 static struct hda_verb alc_hp15_unsol_verbs[] = {
7128 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7129 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7133 static struct hda_verb alc885_init_verbs[] = {
7134 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7135 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7140 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7141 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7143 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7144 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7145 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7147 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7148 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7149 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7151 /* mute analog input loopbacks */
7152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7156 /* Front HP Pin: output 0 (0x0c) */
7157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7158 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7159 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7160 /* Front Pin: output 0 (0x0c) */
7161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7162 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7163 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7164 /* Rear Pin: output 1 (0x0d) */
7165 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7166 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7167 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7168 /* CLFE Pin: output 2 (0x0e) */
7169 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7170 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7171 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7172 /* Side Pin: output 3 (0x0f) */
7173 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7174 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7175 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7176 /* Mic (rear) pin: input vref at 80% */
7177 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7178 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7179 /* Front Mic pin: input vref at 80% */
7180 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7181 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7182 /* Line In pin: input */
7183 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7184 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7186 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7188 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7189 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7190 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7192 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7193 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7194 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7196 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7197 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7198 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7199 /* ADC2: mute amp left and right */
7200 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7201 /* ADC3: mute amp left and right */
7202 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7207 static struct hda_verb alc885_init_input_verbs[] = {
7208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7210 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7215 /* Unmute Selector 24h and set the default input to front mic */
7216 static struct hda_verb alc889_init_input_verbs[] = {
7217 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7223 #define alc883_init_verbs alc882_base_init_verbs
7226 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7228 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7229 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7232 /* FIXME: this looks suspicious...
7233 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
7234 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
7239 static struct hda_verb alc882_macpro_init_verbs[] = {
7240 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7241 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7244 /* Front Pin: output 0 (0x0c) */
7245 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7246 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7247 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7248 /* Front Mic pin: input vref at 80% */
7249 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7251 /* Speaker: output */
7252 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7254 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7255 /* Headphone output (output 0 - 0x0c) */
7256 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7257 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7258 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7260 /* FIXME: use matrix-type input source selection */
7261 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7262 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7268 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7269 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7270 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7271 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7273 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7274 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7275 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7276 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7277 /* ADC1: mute amp left and right */
7278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7279 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7280 /* ADC2: mute amp left and right */
7281 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7282 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7283 /* ADC3: mute amp left and right */
7284 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7285 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7291 static struct hda_verb alc885_mb5_init_verbs[] = {
7293 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7294 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7295 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7296 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7298 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7301 /* Surround mixer */
7302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7304 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7306 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7308 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7310 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7311 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7312 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7313 /* Front Pin (0x0c) */
7314 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7316 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7317 /* LFE Pin (0x0e) */
7318 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7320 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7323 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7324 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7325 /* Front Mic pin: input vref at 80% */
7326 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7332 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7339 /* Macbook Pro rev3 */
7340 static struct hda_verb alc885_mbp3_init_verbs[] = {
7341 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7342 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7349 /* Front Pin: output 0 (0x0c) */
7350 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7351 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7352 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7353 /* HP Pin: output 0 (0x0d) */
7354 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7355 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7356 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7357 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7358 /* Mic (rear) pin: input vref at 80% */
7359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7361 /* Front Mic pin: input vref at 80% */
7362 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7363 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7364 /* Line In pin: use output 1 when in LineOut mode */
7365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7366 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7367 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7369 /* FIXME: use matrix-type input source selection */
7370 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7371 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7373 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7374 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7375 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7379 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7380 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7386 /* ADC1: mute amp left and right */
7387 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7388 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7389 /* ADC2: mute amp left and right */
7390 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7391 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7392 /* ADC3: mute amp left and right */
7393 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7394 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7399 /* iMac 24 mixer. */
7400 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7401 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7402 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7406 /* iMac 24 init verbs. */
7407 static struct hda_verb alc885_imac24_init_verbs[] = {
7408 /* Internal speakers: output 0 (0x0c) */
7409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7411 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7412 /* Internal speakers: output 0 (0x0c) */
7413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7415 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7416 /* Headphone: output 0 (0x0c) */
7417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7419 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7420 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7421 /* Front Mic: input vref at 80% */
7422 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7423 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7427 /* Toggle speaker-output according to the hp-jack state */
7428 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7430 struct alc_spec *spec = codec->spec;
7432 spec->autocfg.hp_pins[0] = 0x14;
7433 spec->autocfg.speaker_pins[0] = 0x18;
7434 spec->autocfg.speaker_pins[1] = 0x1a;
7435 alc_automute_amp(codec);
7438 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7440 struct alc_spec *spec = codec->spec;
7442 spec->autocfg.hp_pins[0] = 0x15;
7443 spec->autocfg.speaker_pins[0] = 0x14;
7444 alc_automute_amp(codec);
7448 static struct hda_verb alc882_targa_verbs[] = {
7449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7453 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7456 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7457 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7459 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7463 /* toggle speaker-output according to the hp-jack state */
7464 static void alc882_targa_automute(struct hda_codec *codec)
7466 struct alc_spec *spec = codec->spec;
7467 alc_automute_amp(codec);
7468 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7469 spec->jack_present ? 1 : 3);
7472 static void alc882_targa_init_hook(struct hda_codec *codec)
7474 struct alc_spec *spec = codec->spec;
7476 spec->autocfg.hp_pins[0] = 0x14;
7477 spec->autocfg.speaker_pins[0] = 0x1b;
7478 alc882_targa_automute(codec);
7481 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7483 if ((res >> 26) == ALC880_HP_EVENT)
7484 alc882_targa_automute(codec);
7487 static struct hda_verb alc882_asus_a7j_verbs[] = {
7488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7491 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7493 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7495 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7496 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7497 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7499 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7500 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7501 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7505 static struct hda_verb alc882_asus_a7m_verbs[] = {
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7513 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7514 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7515 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7517 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7518 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7523 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7525 unsigned int gpiostate, gpiomask, gpiodir;
7527 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7528 AC_VERB_GET_GPIO_DATA, 0);
7531 gpiostate |= (1 << pin);
7533 gpiostate &= ~(1 << pin);
7535 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7536 AC_VERB_GET_GPIO_MASK, 0);
7537 gpiomask |= (1 << pin);
7539 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7540 AC_VERB_GET_GPIO_DIRECTION, 0);
7541 gpiodir |= (1 << pin);
7544 snd_hda_codec_write(codec, codec->afg, 0,
7545 AC_VERB_SET_GPIO_MASK, gpiomask);
7546 snd_hda_codec_write(codec, codec->afg, 0,
7547 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7551 snd_hda_codec_write(codec, codec->afg, 0,
7552 AC_VERB_SET_GPIO_DATA, gpiostate);
7555 /* set up GPIO at initialization */
7556 static void alc885_macpro_init_hook(struct hda_codec *codec)
7558 alc882_gpio_mute(codec, 0, 0);
7559 alc882_gpio_mute(codec, 1, 0);
7562 /* set up GPIO and update auto-muting at initialization */
7563 static void alc885_imac24_init_hook(struct hda_codec *codec)
7565 alc885_macpro_init_hook(codec);
7566 alc885_imac24_automute_init_hook(codec);
7570 * generic initialization of ADC, input mixers and output mixers
7572 static struct hda_verb alc883_auto_init_verbs[] = {
7574 * Unmute ADC0-2 and set the default input to mic-in
7576 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7577 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7578 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7581 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7583 * Note: PASD motherboards uses the Line In 2 as the input for
7584 * front panel mic (mic 2)
7586 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7594 * Set up output mixers (0x0c - 0x0f)
7596 /* set vol=0 to output mixers */
7597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7599 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7600 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7601 /* set up input amps for analog loopback */
7602 /* Amp Indices: DAC = 0, mixer = 1 */
7603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7608 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7609 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7610 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7611 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7612 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
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, (0x7000 | (0x00 << 8))},
7618 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7620 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7630 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7631 static struct hda_verb alc889A_mb31_ch2_init[] = {
7632 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7639 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7640 static struct hda_verb alc889A_mb31_ch4_init[] = {
7641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7642 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7644 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7648 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7649 static struct hda_verb alc889A_mb31_ch5_init[] = {
7650 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7651 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7652 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7653 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7657 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7658 static struct hda_verb alc889A_mb31_ch6_init[] = {
7659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7660 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7661 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7662 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7666 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7667 { 2, alc889A_mb31_ch2_init },
7668 { 4, alc889A_mb31_ch4_init },
7669 { 5, alc889A_mb31_ch5_init },
7670 { 6, alc889A_mb31_ch6_init },
7673 static struct hda_verb alc883_medion_eapd_verbs[] = {
7674 /* eanable EAPD on medion laptop */
7675 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7676 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7680 #define alc883_base_mixer alc882_base_mixer
7682 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7683 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7684 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7685 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7686 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7689 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7690 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7693 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7694 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7695 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7699 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7700 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7701 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7702 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7703 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7704 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7705 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7706 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7709 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7713 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7714 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7715 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7716 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7717 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7719 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7721 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7722 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7723 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7727 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7729 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7736 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7737 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7738 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7739 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7744 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7745 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7746 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7747 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7748 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7749 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7750 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7751 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7752 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7754 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7755 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7756 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7757 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7758 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7759 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7761 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7762 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7763 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7767 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7770 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7771 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7772 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7777 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7778 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7779 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7780 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7781 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7783 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7784 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7785 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7786 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7787 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7791 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
7792 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7793 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7794 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7795 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7796 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7798 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7799 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7800 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7801 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7802 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
7803 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7804 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7805 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7806 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
7807 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
7808 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7810 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7815 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7816 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7817 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7818 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7819 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7820 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7821 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7822 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7823 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7824 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7825 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7826 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7827 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7828 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7829 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7830 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7831 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7833 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7834 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7838 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7839 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7840 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7841 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7842 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7843 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7844 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7845 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7846 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7847 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7848 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7849 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7854 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7858 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7859 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7861 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7862 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7863 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7867 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7868 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7869 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7873 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7874 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7875 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7876 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7877 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7878 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7880 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7885 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7886 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7887 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7888 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7889 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7890 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7893 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7894 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7898 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7899 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7901 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7902 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7903 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7904 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7905 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7906 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7907 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7911 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7912 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7913 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7914 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7915 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7916 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7918 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7919 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7923 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7924 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7925 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7926 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7927 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7930 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7931 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7932 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7933 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7934 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7938 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7939 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7940 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7942 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7943 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7944 0x0d, 1, 0x0, HDA_OUTPUT),
7945 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7946 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7947 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7949 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7950 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7951 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7952 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7953 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7963 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7965 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7966 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7968 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7969 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7971 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7972 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7974 /* Output switches */
7975 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7976 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7977 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7984 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7985 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7989 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
7990 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7991 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7992 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7999 static struct hda_bind_ctls alc883_bind_cap_vol = {
8000 .ops = &snd_hda_bind_vol,
8002 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8003 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8008 static struct hda_bind_ctls alc883_bind_cap_switch = {
8009 .ops = &snd_hda_bind_sw,
8011 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8012 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8017 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8018 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8019 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8020 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8021 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8022 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8029 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8030 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8031 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8033 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8034 /* .name = "Capture Source", */
8035 .name = "Input Source",
8037 .info = alc_mux_enum_info,
8038 .get = alc_mux_enum_get,
8039 .put = alc_mux_enum_put,
8044 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8047 .name = "Channel Mode",
8048 .info = alc_ch_mode_info,
8049 .get = alc_ch_mode_get,
8050 .put = alc_ch_mode_put,
8055 /* toggle speaker-output according to the hp-jack state */
8056 static void alc883_mitac_init_hook(struct hda_codec *codec)
8058 struct alc_spec *spec = codec->spec;
8060 spec->autocfg.hp_pins[0] = 0x15;
8061 spec->autocfg.speaker_pins[0] = 0x14;
8062 spec->autocfg.speaker_pins[1] = 0x17;
8063 alc_automute_amp(codec);
8066 /* auto-toggle front mic */
8068 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8070 unsigned int present;
8073 present = snd_hda_codec_read(codec, 0x18, 0,
8074 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8075 bits = present ? HDA_AMP_MUTE : 0;
8076 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8080 static struct hda_verb alc883_mitac_verbs[] = {
8082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8083 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8085 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8086 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8088 /* enable unsolicited event */
8089 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8090 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8095 static struct hda_verb alc883_clevo_m720_verbs[] = {
8097 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8100 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8101 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8103 /* enable unsolicited event */
8104 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8105 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8110 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8112 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8113 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8115 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8118 /* enable unsolicited event */
8119 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8124 static struct hda_verb alc883_targa_verbs[] = {
8125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8128 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8129 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8131 /* Connect Line-Out side jack (SPDIF) to Side */
8132 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8133 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8134 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8135 /* Connect Mic jack to CLFE */
8136 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8137 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8138 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8139 /* Connect Line-in jack to Surround */
8140 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8141 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8142 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8143 /* Connect HP out jack to Front */
8144 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8145 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8146 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8148 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8153 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8155 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8156 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8160 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8162 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8163 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8168 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8169 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8170 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8171 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8172 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8173 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8177 static struct hda_verb alc883_haier_w66_verbs[] = {
8178 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8181 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8183 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8185 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8186 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8190 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8191 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8192 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8193 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8194 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8195 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8196 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8197 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8198 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8202 static struct hda_verb alc888_6st_dell_verbs[] = {
8203 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8207 static struct hda_verb alc883_vaiott_verbs[] = {
8209 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8212 /* enable unsolicited event */
8213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8218 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8220 struct alc_spec *spec = codec->spec;
8222 spec->autocfg.hp_pins[0] = 0x1b;
8223 spec->autocfg.speaker_pins[0] = 0x14;
8224 spec->autocfg.speaker_pins[1] = 0x16;
8225 spec->autocfg.speaker_pins[2] = 0x18;
8226 alc_automute_amp(codec);
8229 static struct hda_verb alc888_3st_hp_verbs[] = {
8230 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8231 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8232 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8233 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8240 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8241 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8242 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8243 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8244 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8251 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8252 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8253 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8254 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8255 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8256 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8263 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8264 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8265 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8266 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8267 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8268 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8269 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8273 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8274 { 2, alc888_3st_hp_2ch_init },
8275 { 4, alc888_3st_hp_4ch_init },
8276 { 6, alc888_3st_hp_6ch_init },
8279 /* toggle front-jack and RCA according to the hp-jack state */
8280 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8282 unsigned int present;
8284 present = snd_hda_codec_read(codec, 0x1b, 0,
8285 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8286 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8287 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8288 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8289 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8292 /* toggle RCA according to the front-jack state */
8293 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8295 unsigned int present;
8297 present = snd_hda_codec_read(codec, 0x14, 0,
8298 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8299 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8300 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8303 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8306 if ((res >> 26) == ALC880_HP_EVENT)
8307 alc888_lenovo_ms7195_front_automute(codec);
8308 if ((res >> 26) == ALC880_FRONT_EVENT)
8309 alc888_lenovo_ms7195_rca_automute(codec);
8312 static struct hda_verb alc883_medion_md2_verbs[] = {
8313 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8314 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8316 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8318 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8322 /* toggle speaker-output according to the hp-jack state */
8323 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8325 struct alc_spec *spec = codec->spec;
8327 spec->autocfg.hp_pins[0] = 0x14;
8328 spec->autocfg.speaker_pins[0] = 0x15;
8329 alc_automute_amp(codec);
8332 /* toggle speaker-output according to the hp-jack state */
8333 #define alc883_targa_init_hook alc882_targa_init_hook
8334 #define alc883_targa_unsol_event alc882_targa_unsol_event
8336 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8338 unsigned int present;
8340 present = snd_hda_codec_read(codec, 0x18, 0,
8341 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8342 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8343 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8346 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8348 struct alc_spec *spec = codec->spec;
8350 spec->autocfg.hp_pins[0] = 0x15;
8351 spec->autocfg.speaker_pins[0] = 0x14;
8352 alc_automute_amp(codec);
8353 alc883_clevo_m720_mic_automute(codec);
8356 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8359 switch (res >> 26) {
8360 case ALC880_MIC_EVENT:
8361 alc883_clevo_m720_mic_automute(codec);
8364 alc_automute_amp_unsol_event(codec, res);
8369 /* toggle speaker-output according to the hp-jack state */
8370 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8372 struct alc_spec *spec = codec->spec;
8374 spec->autocfg.hp_pins[0] = 0x14;
8375 spec->autocfg.speaker_pins[0] = 0x15;
8376 alc_automute_amp(codec);
8379 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8381 struct alc_spec *spec = codec->spec;
8383 spec->autocfg.hp_pins[0] = 0x1b;
8384 spec->autocfg.speaker_pins[0] = 0x14;
8385 alc_automute_amp(codec);
8388 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8390 unsigned int present;
8393 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8394 & AC_PINSENSE_PRESENCE;
8395 bits = present ? HDA_AMP_MUTE : 0;
8396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8397 HDA_AMP_MUTE, bits);
8400 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8402 unsigned int present;
8405 present = snd_hda_codec_read(codec, 0x1b, 0,
8406 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8407 bits = present ? HDA_AMP_MUTE : 0;
8408 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8409 HDA_AMP_MUTE, bits);
8410 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8411 HDA_AMP_MUTE, bits);
8414 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8417 if ((res >> 26) == ALC880_HP_EVENT)
8418 alc883_lenovo_101e_all_automute(codec);
8419 if ((res >> 26) == ALC880_FRONT_EVENT)
8420 alc883_lenovo_101e_ispeaker_automute(codec);
8423 /* toggle speaker-output according to the hp-jack state */
8424 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8426 struct alc_spec *spec = codec->spec;
8428 spec->autocfg.hp_pins[0] = 0x14;
8429 spec->autocfg.speaker_pins[0] = 0x15;
8430 spec->autocfg.speaker_pins[1] = 0x16;
8431 alc_automute_amp(codec);
8434 static struct hda_verb alc883_acer_eapd_verbs[] = {
8435 /* HP Pin: output 0 (0x0c) */
8436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8439 /* Front Pin: output 0 (0x0c) */
8440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8441 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8442 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8443 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8444 /* eanable EAPD on medion laptop */
8445 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8446 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8447 /* enable unsolicited event */
8448 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8452 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8454 struct alc_spec *spec = codec->spec;
8456 spec->autocfg.hp_pins[0] = 0x1b;
8457 spec->autocfg.speaker_pins[0] = 0x14;
8458 spec->autocfg.speaker_pins[1] = 0x15;
8459 spec->autocfg.speaker_pins[2] = 0x16;
8460 spec->autocfg.speaker_pins[3] = 0x17;
8461 alc_automute_amp(codec);
8464 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8466 struct alc_spec *spec = codec->spec;
8468 spec->autocfg.hp_pins[0] = 0x1b;
8469 spec->autocfg.speaker_pins[0] = 0x14;
8470 spec->autocfg.speaker_pins[1] = 0x15;
8471 spec->autocfg.speaker_pins[2] = 0x16;
8472 spec->autocfg.speaker_pins[3] = 0x17;
8473 spec->autocfg.speaker_pins[4] = 0x1a;
8474 alc_automute_amp(codec);
8477 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8479 struct alc_spec *spec = codec->spec;
8481 spec->autocfg.hp_pins[0] = 0x15;
8482 spec->autocfg.speaker_pins[0] = 0x14;
8483 spec->autocfg.speaker_pins[1] = 0x17;
8484 alc_automute_amp(codec);
8487 static struct hda_verb alc888_asus_m90v_verbs[] = {
8488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8489 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8490 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8491 /* enable unsolicited event */
8492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8493 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8497 static void alc883_nb_mic_automute(struct hda_codec *codec)
8499 unsigned int present;
8501 present = snd_hda_codec_read(codec, 0x18, 0,
8502 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8503 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8504 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8505 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8506 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8509 static void alc883_M90V_init_hook(struct hda_codec *codec)
8511 struct alc_spec *spec = codec->spec;
8513 spec->autocfg.hp_pins[0] = 0x1b;
8514 spec->autocfg.speaker_pins[0] = 0x14;
8515 spec->autocfg.speaker_pins[1] = 0x15;
8516 spec->autocfg.speaker_pins[2] = 0x16;
8517 alc_automute_pin(codec);
8520 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8523 switch (res >> 26) {
8524 case ALC880_MIC_EVENT:
8525 alc883_nb_mic_automute(codec);
8528 alc_sku_unsol_event(codec, res);
8533 static void alc883_mode2_inithook(struct hda_codec *codec)
8535 alc883_M90V_init_hook(codec);
8536 alc883_nb_mic_automute(codec);
8539 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8545 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8546 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8547 /* enable unsolicited event */
8548 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8552 static void alc883_eee1601_inithook(struct hda_codec *codec)
8554 struct alc_spec *spec = codec->spec;
8556 spec->autocfg.hp_pins[0] = 0x14;
8557 spec->autocfg.speaker_pins[0] = 0x1b;
8558 alc_automute_pin(codec);
8561 static struct hda_verb alc889A_mb31_verbs[] = {
8562 /* Init rear pin (used as headphone output) */
8563 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8565 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8566 /* Init line pin (used as output in 4ch and 6ch mode) */
8567 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8568 /* Init line 2 pin (used as headphone out by default) */
8569 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8570 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8574 /* Mute speakers according to the headphone jack state */
8575 static void alc889A_mb31_automute(struct hda_codec *codec)
8577 unsigned int present;
8579 /* Mute only in 2ch or 4ch mode */
8580 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8582 present = snd_hda_codec_read(codec, 0x15, 0,
8583 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8584 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8586 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8587 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8591 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8593 if ((res >> 26) == ALC880_HP_EVENT)
8594 alc889A_mb31_automute(codec);
8598 #ifdef CONFIG_SND_HDA_POWER_SAVE
8599 #define alc882_loopbacks alc880_loopbacks
8602 /* pcm configuration: identical with ALC880 */
8603 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8604 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8605 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8606 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8608 static hda_nid_t alc883_slave_dig_outs[] = {
8609 ALC1200_DIGOUT_NID, 0,
8612 static hda_nid_t alc1200_slave_dig_outs[] = {
8613 ALC883_DIGOUT_NID, 0,
8617 * configuration and preset
8619 static const char *alc882_models[ALC882_MODEL_LAST] = {
8620 [ALC882_3ST_DIG] = "3stack-dig",
8621 [ALC882_6ST_DIG] = "6stack-dig",
8622 [ALC882_ARIMA] = "arima",
8623 [ALC882_W2JC] = "w2jc",
8624 [ALC882_TARGA] = "targa",
8625 [ALC882_ASUS_A7J] = "asus-a7j",
8626 [ALC882_ASUS_A7M] = "asus-a7m",
8627 [ALC885_MACPRO] = "macpro",
8628 [ALC885_MB5] = "mb5",
8629 [ALC885_MBP3] = "mbp3",
8630 [ALC885_IMAC24] = "imac24",
8631 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8632 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8633 [ALC883_3ST_6ch] = "3stack-6ch",
8634 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8635 [ALC883_TARGA_DIG] = "targa-dig",
8636 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8637 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8638 [ALC883_ACER] = "acer",
8639 [ALC883_ACER_ASPIRE] = "acer-aspire",
8640 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8641 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8642 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8643 [ALC883_MEDION] = "medion",
8644 [ALC883_MEDION_MD2] = "medion-md2",
8645 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8646 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8647 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8648 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8649 [ALC888_LENOVO_SKY] = "lenovo-sky",
8650 [ALC883_HAIER_W66] = "haier-w66",
8651 [ALC888_3ST_HP] = "3stack-hp",
8652 [ALC888_6ST_DELL] = "6stack-dell",
8653 [ALC883_MITAC] = "mitac",
8654 [ALC883_CLEVO_M720] = "clevo-m720",
8655 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8656 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8657 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8658 [ALC889A_INTEL] = "intel-alc889a",
8659 [ALC889_INTEL] = "intel-x58",
8660 [ALC1200_ASUS_P5Q] = "asus-p5q",
8661 [ALC889A_MB31] = "mb31",
8662 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8663 [ALC882_AUTO] = "auto",
8666 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8667 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8669 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8670 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8671 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8672 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8673 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8674 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8675 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8676 ALC888_ACER_ASPIRE_4930G),
8677 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8678 ALC888_ACER_ASPIRE_4930G),
8679 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8680 ALC888_ACER_ASPIRE_8930G),
8681 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8682 ALC888_ACER_ASPIRE_8930G),
8683 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8684 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8685 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8686 ALC888_ACER_ASPIRE_6530G),
8687 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8688 ALC888_ACER_ASPIRE_6530G),
8689 /* default Acer -- disabled as it causes more problems.
8690 * model=auto should work fine now
8692 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8694 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8696 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8697 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8698 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8699 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8700 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8701 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8703 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8704 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8705 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8706 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8707 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8708 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8709 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8710 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8711 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8712 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8713 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8715 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8716 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8717 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8718 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8719 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8720 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8721 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8722 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8723 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8725 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8726 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8727 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8728 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8729 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8730 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8731 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8732 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8733 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8734 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8735 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8736 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8737 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8738 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8739 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
8740 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8741 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8742 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8743 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8744 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8745 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8746 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8747 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8748 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8749 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8750 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8751 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8752 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8753 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
8755 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8756 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8757 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8758 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8759 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8760 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8761 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8762 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8763 ALC883_FUJITSU_PI2515),
8764 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8765 ALC888_FUJITSU_XA3530),
8766 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8767 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8768 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8769 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8770 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8771 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8772 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8773 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8774 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8776 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8777 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8778 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8779 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
8780 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
8781 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
8782 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8787 /* codec SSID table for Intel Mac */
8788 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8789 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8790 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8791 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8792 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8793 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8794 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8795 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8796 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8797 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8798 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8799 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8800 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8801 * no perfect solution yet
8803 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8807 static struct alc_config_preset alc882_presets[] = {
8808 [ALC882_3ST_DIG] = {
8809 .mixers = { alc882_base_mixer },
8810 .init_verbs = { alc882_base_init_verbs,
8811 alc882_adc1_init_verbs },
8812 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8813 .dac_nids = alc882_dac_nids,
8814 .dig_out_nid = ALC882_DIGOUT_NID,
8815 .dig_in_nid = ALC882_DIGIN_NID,
8816 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8817 .channel_mode = alc882_ch_modes,
8819 .input_mux = &alc882_capture_source,
8821 [ALC882_6ST_DIG] = {
8822 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8823 .init_verbs = { alc882_base_init_verbs,
8824 alc882_adc1_init_verbs },
8825 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8826 .dac_nids = alc882_dac_nids,
8827 .dig_out_nid = ALC882_DIGOUT_NID,
8828 .dig_in_nid = ALC882_DIGIN_NID,
8829 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8830 .channel_mode = alc882_sixstack_modes,
8831 .input_mux = &alc882_capture_source,
8834 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8835 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8836 alc882_eapd_verbs },
8837 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8838 .dac_nids = alc882_dac_nids,
8839 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8840 .channel_mode = alc882_sixstack_modes,
8841 .input_mux = &alc882_capture_source,
8844 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8845 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8846 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8847 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8848 .dac_nids = alc882_dac_nids,
8849 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8850 .channel_mode = alc880_threestack_modes,
8852 .input_mux = &alc882_capture_source,
8853 .dig_out_nid = ALC882_DIGOUT_NID,
8856 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8857 .init_verbs = { alc885_mbp3_init_verbs,
8858 alc880_gpio1_init_verbs },
8859 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8860 .dac_nids = alc882_dac_nids,
8861 .channel_mode = alc885_mbp_6ch_modes,
8862 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8863 .input_mux = &alc882_capture_source,
8864 .dig_out_nid = ALC882_DIGOUT_NID,
8865 .dig_in_nid = ALC882_DIGIN_NID,
8866 .unsol_event = alc_automute_amp_unsol_event,
8867 .init_hook = alc885_mbp3_init_hook,
8870 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8871 .init_verbs = { alc885_mb5_init_verbs,
8872 alc880_gpio1_init_verbs },
8873 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8874 .dac_nids = alc882_dac_nids,
8875 .channel_mode = alc885_mb5_6ch_modes,
8876 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8877 .input_mux = &mb5_capture_source,
8878 .dig_out_nid = ALC882_DIGOUT_NID,
8879 .dig_in_nid = ALC882_DIGIN_NID,
8882 .mixers = { alc882_macpro_mixer },
8883 .init_verbs = { alc882_macpro_init_verbs },
8884 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8885 .dac_nids = alc882_dac_nids,
8886 .dig_out_nid = ALC882_DIGOUT_NID,
8887 .dig_in_nid = ALC882_DIGIN_NID,
8888 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8889 .channel_mode = alc882_ch_modes,
8890 .input_mux = &alc882_capture_source,
8891 .init_hook = alc885_macpro_init_hook,
8894 .mixers = { alc885_imac24_mixer },
8895 .init_verbs = { alc885_imac24_init_verbs },
8896 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8897 .dac_nids = alc882_dac_nids,
8898 .dig_out_nid = ALC882_DIGOUT_NID,
8899 .dig_in_nid = ALC882_DIGIN_NID,
8900 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8901 .channel_mode = alc882_ch_modes,
8902 .input_mux = &alc882_capture_source,
8903 .unsol_event = alc_automute_amp_unsol_event,
8904 .init_hook = alc885_imac24_init_hook,
8907 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8908 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8909 alc880_gpio3_init_verbs, alc882_targa_verbs},
8910 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8911 .dac_nids = alc882_dac_nids,
8912 .dig_out_nid = ALC882_DIGOUT_NID,
8913 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8914 .adc_nids = alc882_adc_nids,
8915 .capsrc_nids = alc882_capsrc_nids,
8916 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8917 .channel_mode = alc882_3ST_6ch_modes,
8919 .input_mux = &alc882_capture_source,
8920 .unsol_event = alc882_targa_unsol_event,
8921 .init_hook = alc882_targa_init_hook,
8923 [ALC882_ASUS_A7J] = {
8924 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8925 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8926 alc882_asus_a7j_verbs},
8927 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8928 .dac_nids = alc882_dac_nids,
8929 .dig_out_nid = ALC882_DIGOUT_NID,
8930 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8931 .adc_nids = alc882_adc_nids,
8932 .capsrc_nids = alc882_capsrc_nids,
8933 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8934 .channel_mode = alc882_3ST_6ch_modes,
8936 .input_mux = &alc882_capture_source,
8938 [ALC882_ASUS_A7M] = {
8939 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8940 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8941 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8942 alc882_asus_a7m_verbs },
8943 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8944 .dac_nids = alc882_dac_nids,
8945 .dig_out_nid = ALC882_DIGOUT_NID,
8946 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8947 .channel_mode = alc880_threestack_modes,
8949 .input_mux = &alc882_capture_source,
8951 [ALC883_3ST_2ch_DIG] = {
8952 .mixers = { alc883_3ST_2ch_mixer },
8953 .init_verbs = { alc883_init_verbs },
8954 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8955 .dac_nids = alc883_dac_nids,
8956 .dig_out_nid = ALC883_DIGOUT_NID,
8957 .dig_in_nid = ALC883_DIGIN_NID,
8958 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8959 .channel_mode = alc883_3ST_2ch_modes,
8960 .input_mux = &alc883_capture_source,
8962 [ALC883_3ST_6ch_DIG] = {
8963 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8964 .init_verbs = { alc883_init_verbs },
8965 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8966 .dac_nids = alc883_dac_nids,
8967 .dig_out_nid = ALC883_DIGOUT_NID,
8968 .dig_in_nid = ALC883_DIGIN_NID,
8969 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8970 .channel_mode = alc883_3ST_6ch_modes,
8972 .input_mux = &alc883_capture_source,
8974 [ALC883_3ST_6ch] = {
8975 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8976 .init_verbs = { alc883_init_verbs },
8977 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8978 .dac_nids = alc883_dac_nids,
8979 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8980 .channel_mode = alc883_3ST_6ch_modes,
8982 .input_mux = &alc883_capture_source,
8984 [ALC883_3ST_6ch_INTEL] = {
8985 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8986 .init_verbs = { alc883_init_verbs },
8987 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8988 .dac_nids = alc883_dac_nids,
8989 .dig_out_nid = ALC883_DIGOUT_NID,
8990 .dig_in_nid = ALC883_DIGIN_NID,
8991 .slave_dig_outs = alc883_slave_dig_outs,
8992 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8993 .channel_mode = alc883_3ST_6ch_intel_modes,
8995 .input_mux = &alc883_3stack_6ch_intel,
8998 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
8999 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9000 alc_hp15_unsol_verbs },
9001 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9002 .dac_nids = alc883_dac_nids,
9003 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9004 .adc_nids = alc889_adc_nids,
9005 .dig_out_nid = ALC883_DIGOUT_NID,
9006 .dig_in_nid = ALC883_DIGIN_NID,
9007 .slave_dig_outs = alc883_slave_dig_outs,
9008 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9009 .channel_mode = alc889_8ch_intel_modes,
9010 .capsrc_nids = alc889_capsrc_nids,
9011 .input_mux = &alc889_capture_source,
9012 .init_hook = alc889_automute_init,
9013 .unsol_event = alc_automute_amp_unsol_event,
9017 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9018 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9019 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9020 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9021 .dac_nids = alc883_dac_nids,
9022 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9023 .adc_nids = alc889_adc_nids,
9024 .dig_out_nid = ALC883_DIGOUT_NID,
9025 .dig_in_nid = ALC883_DIGIN_NID,
9026 .slave_dig_outs = alc883_slave_dig_outs,
9027 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9028 .channel_mode = alc889_8ch_intel_modes,
9029 .capsrc_nids = alc889_capsrc_nids,
9030 .input_mux = &alc889_capture_source,
9031 .init_hook = alc889_intel_init_hook,
9032 .unsol_event = alc_automute_amp_unsol_event,
9035 [ALC883_6ST_DIG] = {
9036 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9037 .init_verbs = { alc883_init_verbs },
9038 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9039 .dac_nids = alc883_dac_nids,
9040 .dig_out_nid = ALC883_DIGOUT_NID,
9041 .dig_in_nid = ALC883_DIGIN_NID,
9042 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9043 .channel_mode = alc883_sixstack_modes,
9044 .input_mux = &alc883_capture_source,
9046 [ALC883_TARGA_DIG] = {
9047 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9048 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9049 alc883_targa_verbs},
9050 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9051 .dac_nids = alc883_dac_nids,
9052 .dig_out_nid = ALC883_DIGOUT_NID,
9053 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9054 .channel_mode = alc883_3ST_6ch_modes,
9056 .input_mux = &alc883_capture_source,
9057 .unsol_event = alc883_targa_unsol_event,
9058 .init_hook = alc883_targa_init_hook,
9060 [ALC883_TARGA_2ch_DIG] = {
9061 .mixers = { alc883_targa_2ch_mixer},
9062 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9063 alc883_targa_verbs},
9064 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9065 .dac_nids = alc883_dac_nids,
9066 .adc_nids = alc883_adc_nids_alt,
9067 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9068 .dig_out_nid = ALC883_DIGOUT_NID,
9069 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9070 .channel_mode = alc883_3ST_2ch_modes,
9071 .input_mux = &alc883_capture_source,
9072 .unsol_event = alc883_targa_unsol_event,
9073 .init_hook = alc883_targa_init_hook,
9075 [ALC883_TARGA_8ch_DIG] = {
9076 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9077 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9078 alc883_targa_verbs },
9079 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9080 .dac_nids = alc883_dac_nids,
9081 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9082 .adc_nids = alc883_adc_nids_rev,
9083 .capsrc_nids = alc883_capsrc_nids_rev,
9084 .dig_out_nid = ALC883_DIGOUT_NID,
9085 .dig_in_nid = ALC883_DIGIN_NID,
9086 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9087 .channel_mode = alc883_4ST_8ch_modes,
9089 .input_mux = &alc883_capture_source,
9090 .unsol_event = alc883_targa_unsol_event,
9091 .init_hook = alc883_targa_init_hook,
9094 .mixers = { alc883_base_mixer },
9095 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9096 * and the headphone jack. Turn this on and rely on the
9097 * standard mute methods whenever the user wants to turn
9098 * these outputs off.
9100 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9101 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9102 .dac_nids = alc883_dac_nids,
9103 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9104 .channel_mode = alc883_3ST_2ch_modes,
9105 .input_mux = &alc883_capture_source,
9107 [ALC883_ACER_ASPIRE] = {
9108 .mixers = { alc883_acer_aspire_mixer },
9109 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9110 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9111 .dac_nids = alc883_dac_nids,
9112 .dig_out_nid = ALC883_DIGOUT_NID,
9113 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9114 .channel_mode = alc883_3ST_2ch_modes,
9115 .input_mux = &alc883_capture_source,
9116 .unsol_event = alc_automute_amp_unsol_event,
9117 .init_hook = alc883_acer_aspire_init_hook,
9119 [ALC888_ACER_ASPIRE_4930G] = {
9120 .mixers = { alc888_base_mixer,
9121 alc883_chmode_mixer },
9122 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9123 alc888_acer_aspire_4930g_verbs },
9124 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9125 .dac_nids = alc883_dac_nids,
9126 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9127 .adc_nids = alc883_adc_nids_rev,
9128 .capsrc_nids = alc883_capsrc_nids_rev,
9129 .dig_out_nid = ALC883_DIGOUT_NID,
9130 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9131 .channel_mode = alc883_3ST_6ch_modes,
9134 ARRAY_SIZE(alc888_2_capture_sources),
9135 .input_mux = alc888_2_capture_sources,
9136 .unsol_event = alc_automute_amp_unsol_event,
9137 .init_hook = alc888_acer_aspire_4930g_init_hook,
9139 [ALC888_ACER_ASPIRE_6530G] = {
9140 .mixers = { alc888_acer_aspire_6530_mixer },
9141 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9142 alc888_acer_aspire_6530g_verbs },
9143 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9144 .dac_nids = alc883_dac_nids,
9145 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9146 .adc_nids = alc883_adc_nids_rev,
9147 .capsrc_nids = alc883_capsrc_nids_rev,
9148 .dig_out_nid = ALC883_DIGOUT_NID,
9149 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9150 .channel_mode = alc883_3ST_2ch_modes,
9152 ARRAY_SIZE(alc888_2_capture_sources),
9153 .input_mux = alc888_acer_aspire_6530_sources,
9154 .unsol_event = alc_automute_amp_unsol_event,
9155 .init_hook = alc888_acer_aspire_6530g_init_hook,
9157 [ALC888_ACER_ASPIRE_8930G] = {
9158 .mixers = { alc888_base_mixer,
9159 alc883_chmode_mixer },
9160 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9161 alc889_acer_aspire_8930g_verbs },
9162 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9163 .dac_nids = alc883_dac_nids,
9164 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9165 .adc_nids = alc889_adc_nids,
9166 .capsrc_nids = alc889_capsrc_nids,
9167 .dig_out_nid = ALC883_DIGOUT_NID,
9168 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9169 .channel_mode = alc883_3ST_6ch_modes,
9171 .const_channel_count = 6,
9173 ARRAY_SIZE(alc889_capture_sources),
9174 .input_mux = alc889_capture_sources,
9175 .unsol_event = alc_automute_amp_unsol_event,
9176 .init_hook = alc889_acer_aspire_8930g_init_hook,
9179 .mixers = { alc883_fivestack_mixer,
9180 alc883_chmode_mixer },
9181 .init_verbs = { alc883_init_verbs,
9182 alc883_medion_eapd_verbs },
9183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9184 .dac_nids = alc883_dac_nids,
9185 .adc_nids = alc883_adc_nids_alt,
9186 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9187 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9188 .channel_mode = alc883_sixstack_modes,
9189 .input_mux = &alc883_capture_source,
9191 [ALC883_MEDION_MD2] = {
9192 .mixers = { alc883_medion_md2_mixer},
9193 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9194 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9195 .dac_nids = alc883_dac_nids,
9196 .dig_out_nid = ALC883_DIGOUT_NID,
9197 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9198 .channel_mode = alc883_3ST_2ch_modes,
9199 .input_mux = &alc883_capture_source,
9200 .unsol_event = alc_automute_amp_unsol_event,
9201 .init_hook = alc883_medion_md2_init_hook,
9203 [ALC883_LAPTOP_EAPD] = {
9204 .mixers = { alc883_base_mixer },
9205 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9206 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9207 .dac_nids = alc883_dac_nids,
9208 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9209 .channel_mode = alc883_3ST_2ch_modes,
9210 .input_mux = &alc883_capture_source,
9212 [ALC883_CLEVO_M720] = {
9213 .mixers = { alc883_clevo_m720_mixer },
9214 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9215 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9216 .dac_nids = alc883_dac_nids,
9217 .dig_out_nid = ALC883_DIGOUT_NID,
9218 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9219 .channel_mode = alc883_3ST_2ch_modes,
9220 .input_mux = &alc883_capture_source,
9221 .unsol_event = alc883_clevo_m720_unsol_event,
9222 .init_hook = alc883_clevo_m720_init_hook,
9224 [ALC883_LENOVO_101E_2ch] = {
9225 .mixers = { alc883_lenovo_101e_2ch_mixer},
9226 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9228 .dac_nids = alc883_dac_nids,
9229 .adc_nids = alc883_adc_nids_alt,
9230 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9231 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9232 .channel_mode = alc883_3ST_2ch_modes,
9233 .input_mux = &alc883_lenovo_101e_capture_source,
9234 .unsol_event = alc883_lenovo_101e_unsol_event,
9235 .init_hook = alc883_lenovo_101e_all_automute,
9237 [ALC883_LENOVO_NB0763] = {
9238 .mixers = { alc883_lenovo_nb0763_mixer },
9239 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9240 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9241 .dac_nids = alc883_dac_nids,
9242 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9243 .channel_mode = alc883_3ST_2ch_modes,
9245 .input_mux = &alc883_lenovo_nb0763_capture_source,
9246 .unsol_event = alc_automute_amp_unsol_event,
9247 .init_hook = alc883_medion_md2_init_hook,
9249 [ALC888_LENOVO_MS7195_DIG] = {
9250 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9251 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9252 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9253 .dac_nids = alc883_dac_nids,
9254 .dig_out_nid = ALC883_DIGOUT_NID,
9255 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9256 .channel_mode = alc883_3ST_6ch_modes,
9258 .input_mux = &alc883_capture_source,
9259 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9260 .init_hook = alc888_lenovo_ms7195_front_automute,
9262 [ALC883_HAIER_W66] = {
9263 .mixers = { alc883_targa_2ch_mixer},
9264 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9265 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9266 .dac_nids = alc883_dac_nids,
9267 .dig_out_nid = ALC883_DIGOUT_NID,
9268 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9269 .channel_mode = alc883_3ST_2ch_modes,
9270 .input_mux = &alc883_capture_source,
9271 .unsol_event = alc_automute_amp_unsol_event,
9272 .init_hook = alc883_haier_w66_init_hook,
9275 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9276 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9277 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9278 .dac_nids = alc883_dac_nids,
9279 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9280 .channel_mode = alc888_3st_hp_modes,
9282 .input_mux = &alc883_capture_source,
9283 .unsol_event = alc_automute_amp_unsol_event,
9284 .init_hook = alc888_3st_hp_init_hook,
9286 [ALC888_6ST_DELL] = {
9287 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9288 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9289 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9290 .dac_nids = alc883_dac_nids,
9291 .dig_out_nid = ALC883_DIGOUT_NID,
9292 .dig_in_nid = ALC883_DIGIN_NID,
9293 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9294 .channel_mode = alc883_sixstack_modes,
9295 .input_mux = &alc883_capture_source,
9296 .unsol_event = alc_automute_amp_unsol_event,
9297 .init_hook = alc888_6st_dell_init_hook,
9300 .mixers = { alc883_mitac_mixer },
9301 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9302 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9303 .dac_nids = alc883_dac_nids,
9304 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9305 .channel_mode = alc883_3ST_2ch_modes,
9306 .input_mux = &alc883_capture_source,
9307 .unsol_event = alc_automute_amp_unsol_event,
9308 .init_hook = alc883_mitac_init_hook,
9310 [ALC883_FUJITSU_PI2515] = {
9311 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9312 .init_verbs = { alc883_init_verbs,
9313 alc883_2ch_fujitsu_pi2515_verbs},
9314 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9315 .dac_nids = alc883_dac_nids,
9316 .dig_out_nid = ALC883_DIGOUT_NID,
9317 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9318 .channel_mode = alc883_3ST_2ch_modes,
9319 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9320 .unsol_event = alc_automute_amp_unsol_event,
9321 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9323 [ALC888_FUJITSU_XA3530] = {
9324 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9325 .init_verbs = { alc883_init_verbs,
9326 alc888_fujitsu_xa3530_verbs },
9327 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9328 .dac_nids = alc883_dac_nids,
9329 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9330 .adc_nids = alc883_adc_nids_rev,
9331 .capsrc_nids = alc883_capsrc_nids_rev,
9332 .dig_out_nid = ALC883_DIGOUT_NID,
9333 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9334 .channel_mode = alc888_4ST_8ch_intel_modes,
9336 ARRAY_SIZE(alc888_2_capture_sources),
9337 .input_mux = alc888_2_capture_sources,
9338 .unsol_event = alc_automute_amp_unsol_event,
9339 .init_hook = alc888_fujitsu_xa3530_init_hook,
9341 [ALC888_LENOVO_SKY] = {
9342 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9343 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9344 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9345 .dac_nids = alc883_dac_nids,
9346 .dig_out_nid = ALC883_DIGOUT_NID,
9347 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9348 .channel_mode = alc883_sixstack_modes,
9350 .input_mux = &alc883_lenovo_sky_capture_source,
9351 .unsol_event = alc_automute_amp_unsol_event,
9352 .init_hook = alc888_lenovo_sky_init_hook,
9354 [ALC888_ASUS_M90V] = {
9355 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9356 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9357 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9358 .dac_nids = alc883_dac_nids,
9359 .dig_out_nid = ALC883_DIGOUT_NID,
9360 .dig_in_nid = ALC883_DIGIN_NID,
9361 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9362 .channel_mode = alc883_3ST_6ch_modes,
9364 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9365 .unsol_event = alc883_mode2_unsol_event,
9366 .init_hook = alc883_mode2_inithook,
9368 [ALC888_ASUS_EEE1601] = {
9369 .mixers = { alc883_asus_eee1601_mixer },
9370 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9371 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9372 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9373 .dac_nids = alc883_dac_nids,
9374 .dig_out_nid = ALC883_DIGOUT_NID,
9375 .dig_in_nid = ALC883_DIGIN_NID,
9376 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9377 .channel_mode = alc883_3ST_2ch_modes,
9379 .input_mux = &alc883_asus_eee1601_capture_source,
9380 .unsol_event = alc_sku_unsol_event,
9381 .init_hook = alc883_eee1601_inithook,
9383 [ALC1200_ASUS_P5Q] = {
9384 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9385 .init_verbs = { alc883_init_verbs },
9386 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9387 .dac_nids = alc883_dac_nids,
9388 .dig_out_nid = ALC1200_DIGOUT_NID,
9389 .dig_in_nid = ALC883_DIGIN_NID,
9390 .slave_dig_outs = alc1200_slave_dig_outs,
9391 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9392 .channel_mode = alc883_sixstack_modes,
9393 .input_mux = &alc883_capture_source,
9396 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9397 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9398 alc880_gpio1_init_verbs },
9399 .adc_nids = alc883_adc_nids,
9400 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9401 .dac_nids = alc883_dac_nids,
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .channel_mode = alc889A_mb31_6ch_modes,
9404 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9405 .input_mux = &alc889A_mb31_capture_source,
9406 .dig_out_nid = ALC883_DIGOUT_NID,
9407 .unsol_event = alc889A_mb31_unsol_event,
9408 .init_hook = alc889A_mb31_automute,
9410 [ALC883_SONY_VAIO_TT] = {
9411 .mixers = { alc883_vaiott_mixer },
9412 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9413 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9414 .dac_nids = alc883_dac_nids,
9415 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9416 .channel_mode = alc883_3ST_2ch_modes,
9417 .input_mux = &alc883_capture_source,
9418 .unsol_event = alc_automute_amp_unsol_event,
9419 .init_hook = alc883_vaiott_init_hook,
9428 PINFIX_ABIT_AW9D_MAX
9431 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9432 { 0x15, 0x01080104 }, /* side */
9433 { 0x16, 0x01011012 }, /* rear */
9434 { 0x17, 0x01016011 }, /* clfe */
9438 static const struct alc_pincfg *alc882_pin_fixes[] = {
9439 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9442 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9443 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9448 * BIOS auto configuration
9450 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9451 hda_nid_t nid, int pin_type,
9455 struct alc_spec *spec = codec->spec;
9458 alc_set_pin_output(codec, nid, pin_type);
9459 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9462 idx = spec->multiout.dac_nids[dac_idx] - 2;
9463 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9467 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9469 struct alc_spec *spec = codec->spec;
9472 for (i = 0; i <= HDA_SIDE; i++) {
9473 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9474 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9476 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9481 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9483 struct alc_spec *spec = codec->spec;
9486 pin = spec->autocfg.hp_pins[0];
9487 if (pin) /* connect to front */
9489 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9490 pin = spec->autocfg.speaker_pins[0];
9492 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9495 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9497 struct alc_spec *spec = codec->spec;
9500 for (i = 0; i < AUTO_PIN_LAST; i++) {
9501 hda_nid_t nid = spec->autocfg.input_pins[i];
9504 alc_set_input_pin(codec, nid, i);
9505 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9506 snd_hda_codec_write(codec, nid, 0,
9507 AC_VERB_SET_AMP_GAIN_MUTE,
9512 static void alc882_auto_init_input_src(struct hda_codec *codec)
9514 struct alc_spec *spec = codec->spec;
9517 for (c = 0; c < spec->num_adc_nids; c++) {
9518 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9519 hda_nid_t nid = spec->capsrc_nids[c];
9520 unsigned int mux_idx;
9521 const struct hda_input_mux *imux;
9522 int conns, mute, idx, item;
9524 conns = snd_hda_get_connections(codec, nid, conn_list,
9525 ARRAY_SIZE(conn_list));
9528 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9529 imux = &spec->input_mux[mux_idx];
9530 for (idx = 0; idx < conns; idx++) {
9531 /* if the current connection is the selected one,
9532 * unmute it as default - otherwise mute it
9534 mute = AMP_IN_MUTE(idx);
9535 for (item = 0; item < imux->num_items; item++) {
9536 if (imux->items[item].index == idx) {
9537 if (spec->cur_mux[c] == item)
9538 mute = AMP_IN_UNMUTE(idx);
9542 /* check if we have a selector or mixer
9543 * we could check for the widget type instead, but
9544 * just check for Amp-In presence (in case of mixer
9545 * without amp-in there is something wrong, this
9546 * function shouldn't be used or capsrc nid is wrong)
9548 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9549 snd_hda_codec_write(codec, nid, 0,
9550 AC_VERB_SET_AMP_GAIN_MUTE,
9552 else if (mute != AMP_IN_MUTE(idx))
9553 snd_hda_codec_write(codec, nid, 0,
9554 AC_VERB_SET_CONNECT_SEL,
9560 /* add mic boosts if needed */
9561 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9563 struct alc_spec *spec = codec->spec;
9567 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9568 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9569 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9571 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9575 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9576 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9577 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9579 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9586 /* almost identical with ALC880 parser... */
9587 static int alc882_parse_auto_config(struct hda_codec *codec)
9589 struct alc_spec *spec = codec->spec;
9590 struct auto_pin_cfg *autocfg = &spec->autocfg;
9593 int err = alc880_parse_auto_config(codec);
9598 return 0; /* no config found */
9600 err = alc_auto_add_mic_boost(codec);
9604 /* hack - override the init verbs */
9605 spec->init_verbs[0] = alc883_auto_init_verbs;
9606 /* if ADC 0x07 is available, initialize it, too */
9607 wcap = get_wcaps(codec, 0x07);
9608 wcap = get_wcaps_type(wcap);
9609 if (wcap == AC_WID_AUD_IN)
9610 add_verb(spec, alc882_adc1_init_verbs);
9612 /* digital-mic input pin is excluded in alc880_auto_create..()
9613 * because it's under 0x18
9615 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9616 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9617 struct hda_input_mux *imux = &spec->private_imux[0];
9618 for (i = 1; i < 3; i++)
9619 memcpy(&spec->private_imux[i],
9620 &spec->private_imux[0],
9621 sizeof(spec->private_imux[0]));
9622 imux->items[imux->num_items].label = "Int DMic";
9623 imux->items[imux->num_items].index = 0x0b;
9625 spec->num_mux_defs = 3;
9626 spec->input_mux = spec->private_imux;
9629 return 1; /* config found */
9632 /* additional initialization for auto-configuration model */
9633 static void alc882_auto_init(struct hda_codec *codec)
9635 struct alc_spec *spec = codec->spec;
9636 alc882_auto_init_multi_out(codec);
9637 alc882_auto_init_hp_out(codec);
9638 alc882_auto_init_analog_input(codec);
9639 alc882_auto_init_input_src(codec);
9640 if (spec->unsol_event)
9641 alc_inithook(codec);
9644 static int patch_alc882(struct hda_codec *codec)
9646 struct alc_spec *spec;
9647 int err, board_config;
9649 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9655 switch (codec->vendor_id) {
9660 /* ALC883 and variants */
9661 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9665 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9669 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9670 board_config = snd_hda_check_board_codec_sid_config(codec,
9671 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9673 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9674 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
9676 board_config = ALC882_AUTO;
9679 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9681 if (board_config == ALC882_AUTO) {
9682 /* automatic parse from the BIOS config */
9683 err = alc882_parse_auto_config(codec);
9689 "hda_codec: Cannot set up configuration "
9690 "from BIOS. Using base mode...\n");
9691 board_config = ALC882_3ST_DIG;
9695 err = snd_hda_attach_beep_device(codec, 0x1);
9701 if (board_config != ALC882_AUTO)
9702 setup_preset(spec, &alc882_presets[board_config]);
9704 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9705 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9706 /* FIXME: setup DAC5 */
9707 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9708 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9710 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9711 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9713 if (codec->vendor_id == 0x10ec0888)
9714 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9716 if (!spec->adc_nids && spec->input_mux) {
9718 spec->num_adc_nids = 0;
9719 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9721 hda_nid_t nid = alc882_adc_nids[i];
9722 unsigned int wcap = get_wcaps(codec, nid);
9724 wcap = get_wcaps_type(wcap);
9725 if (wcap != AC_WID_AUD_IN)
9727 spec->private_adc_nids[spec->num_adc_nids] = nid;
9728 err = snd_hda_get_connections(codec, nid, &cap, 1);
9731 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9732 spec->num_adc_nids++;
9734 spec->adc_nids = spec->private_adc_nids;
9735 spec->capsrc_nids = spec->private_capsrc_nids;
9738 set_capture_mixer(spec);
9739 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9741 spec->vmaster_nid = 0x0c;
9743 codec->patch_ops = alc_patch_ops;
9744 if (board_config == ALC882_AUTO)
9745 spec->init_hook = alc882_auto_init;
9746 #ifdef CONFIG_SND_HDA_POWER_SAVE
9747 if (!spec->loopback.amplist)
9748 spec->loopback.amplist = alc882_loopbacks;
9750 codec->proc_widget_hook = print_realtek_coef;
9760 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9761 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9763 #define alc262_dac_nids alc260_dac_nids
9764 #define alc262_adc_nids alc882_adc_nids
9765 #define alc262_adc_nids_alt alc882_adc_nids_alt
9766 #define alc262_capsrc_nids alc882_capsrc_nids
9767 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9769 #define alc262_modes alc260_modes
9770 #define alc262_capture_source alc882_capture_source
9772 static hda_nid_t alc262_dmic_adc_nids[1] = {
9777 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9779 static struct snd_kcontrol_new alc262_base_mixer[] = {
9780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9781 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9782 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9783 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9784 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9785 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9786 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9787 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9789 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9791 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9792 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9793 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9794 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9795 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9799 /* update HP, line and mono-out pins according to the master switch */
9800 static void alc262_hp_master_update(struct hda_codec *codec)
9802 struct alc_spec *spec = codec->spec;
9803 int val = spec->master_sw;
9806 snd_hda_codec_write_cache(codec, 0x1b, 0,
9807 AC_VERB_SET_PIN_WIDGET_CONTROL,
9809 snd_hda_codec_write_cache(codec, 0x15, 0,
9810 AC_VERB_SET_PIN_WIDGET_CONTROL,
9812 /* mono (speaker) depending on the HP jack sense */
9813 val = val && !spec->jack_present;
9814 snd_hda_codec_write_cache(codec, 0x16, 0,
9815 AC_VERB_SET_PIN_WIDGET_CONTROL,
9819 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9821 struct alc_spec *spec = codec->spec;
9822 unsigned int presence;
9823 presence = snd_hda_codec_read(codec, 0x1b, 0,
9824 AC_VERB_GET_PIN_SENSE, 0);
9825 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9826 alc262_hp_master_update(codec);
9829 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9831 if ((res >> 26) != ALC880_HP_EVENT)
9833 alc262_hp_bpc_automute(codec);
9836 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9838 struct alc_spec *spec = codec->spec;
9839 unsigned int presence;
9840 presence = snd_hda_codec_read(codec, 0x15, 0,
9841 AC_VERB_GET_PIN_SENSE, 0);
9842 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9843 alc262_hp_master_update(codec);
9846 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9849 if ((res >> 26) != ALC880_HP_EVENT)
9851 alc262_hp_wildwest_automute(codec);
9854 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9856 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9857 struct snd_ctl_elem_value *ucontrol)
9859 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9860 struct alc_spec *spec = codec->spec;
9861 int val = !!*ucontrol->value.integer.value;
9863 if (val == spec->master_sw)
9865 spec->master_sw = val;
9866 alc262_hp_master_update(codec);
9870 #define ALC262_HP_MASTER_SWITCH \
9872 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9873 .name = "Master Playback Switch", \
9874 .info = snd_ctl_boolean_mono_info, \
9875 .get = alc262_hp_master_sw_get, \
9876 .put = alc262_hp_master_sw_put, \
9879 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9880 ALC262_HP_MASTER_SWITCH,
9881 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9882 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9883 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9884 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9886 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9888 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9889 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9891 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9892 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9893 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9896 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9897 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9898 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9899 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9903 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9904 ALC262_HP_MASTER_SWITCH,
9905 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9906 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9907 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9908 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9909 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9911 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9913 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9914 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9915 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9916 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9917 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9918 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9919 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9923 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9924 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9925 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9926 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9930 /* mute/unmute internal speaker according to the hp jack and mute state */
9931 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9933 struct alc_spec *spec = codec->spec;
9935 spec->autocfg.hp_pins[0] = 0x15;
9936 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9937 alc_automute_amp(codec);
9940 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9942 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9943 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9945 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9946 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9947 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9951 static struct hda_verb alc262_hp_t5735_verbs[] = {
9952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9959 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9960 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9961 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9962 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9963 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9964 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9965 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9969 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9970 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9971 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9972 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9973 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9975 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9983 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9990 /* bind hp and internal speaker mute (with plug check) as master switch */
9991 static void alc262_hippo_master_update(struct hda_codec *codec)
9993 struct alc_spec *spec = codec->spec;
9994 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9995 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9996 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10000 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10001 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10002 HDA_AMP_MUTE, mute);
10003 /* mute internal speaker per jack sense */
10004 if (spec->jack_present)
10005 mute = HDA_AMP_MUTE;
10007 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10008 HDA_AMP_MUTE, mute);
10009 if (speaker_nid && speaker_nid != line_nid)
10010 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10011 HDA_AMP_MUTE, mute);
10014 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10016 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10017 struct snd_ctl_elem_value *ucontrol)
10019 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10020 struct alc_spec *spec = codec->spec;
10021 int val = !!*ucontrol->value.integer.value;
10023 if (val == spec->master_sw)
10025 spec->master_sw = val;
10026 alc262_hippo_master_update(codec);
10030 #define ALC262_HIPPO_MASTER_SWITCH \
10032 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10033 .name = "Master Playback Switch", \
10034 .info = snd_ctl_boolean_mono_info, \
10035 .get = alc262_hippo_master_sw_get, \
10036 .put = alc262_hippo_master_sw_put, \
10039 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10040 ALC262_HIPPO_MASTER_SWITCH,
10041 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10042 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10043 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10044 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10045 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10046 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10047 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10049 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10050 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10051 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10052 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10056 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10057 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10058 ALC262_HIPPO_MASTER_SWITCH,
10059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10062 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10065 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10066 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10068 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10072 /* mute/unmute internal speaker according to the hp jack and mute state */
10073 static void alc262_hippo_automute(struct hda_codec *codec)
10075 struct alc_spec *spec = codec->spec;
10076 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10077 unsigned int present;
10079 /* need to execute and sync at first */
10080 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10081 present = snd_hda_codec_read(codec, hp_nid, 0,
10082 AC_VERB_GET_PIN_SENSE, 0);
10083 spec->jack_present = (present & 0x80000000) != 0;
10084 alc262_hippo_master_update(codec);
10087 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10089 if ((res >> 26) != ALC880_HP_EVENT)
10091 alc262_hippo_automute(codec);
10094 static void alc262_hippo_init_hook(struct hda_codec *codec)
10096 struct alc_spec *spec = codec->spec;
10098 spec->autocfg.hp_pins[0] = 0x15;
10099 spec->autocfg.speaker_pins[0] = 0x14;
10100 alc262_hippo_automute(codec);
10103 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10105 struct alc_spec *spec = codec->spec;
10107 spec->autocfg.hp_pins[0] = 0x1b;
10108 spec->autocfg.speaker_pins[0] = 0x14;
10109 alc262_hippo_automute(codec);
10113 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10114 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10115 ALC262_HIPPO_MASTER_SWITCH,
10116 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10117 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10118 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10119 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10123 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10124 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10125 ALC262_HIPPO_MASTER_SWITCH,
10126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10129 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10130 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10134 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10135 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10136 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10137 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10138 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10144 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10145 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10150 static struct hda_verb alc262_tyan_verbs[] = {
10151 /* Headphone automute */
10152 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10153 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10156 /* P11 AUX_IN, white 4-pin connector */
10157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10158 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10159 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10160 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10165 /* unsolicited event for HP jack sensing */
10166 static void alc262_tyan_init_hook(struct hda_codec *codec)
10168 struct alc_spec *spec = codec->spec;
10170 spec->autocfg.hp_pins[0] = 0x1b;
10171 spec->autocfg.speaker_pins[0] = 0x15;
10172 alc_automute_amp(codec);
10176 #define alc262_capture_mixer alc882_capture_mixer
10177 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10180 * generic initialization of ADC, input mixers and output mixers
10182 static struct hda_verb alc262_init_verbs[] = {
10184 * Unmute ADC0-2 and set the default input to mic-in
10186 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10188 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10190 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10191 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10193 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10195 * Note: PASD motherboards uses the Line In 2 as the input for
10196 * front panel mic (mic 2)
10198 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10199 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10200 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10201 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10202 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10206 * Set up output mixers (0x0c - 0x0e)
10208 /* set vol=0 to output mixers */
10209 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10210 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10212 /* set up input amps for analog loopback */
10213 /* Amp Indices: DAC = 0, mixer = 1 */
10214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10216 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10217 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10218 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10219 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10221 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10224 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10225 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10226 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10228 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10230 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10231 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10234 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10235 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10237 /* FIXME: use matrix-type input source selection */
10238 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10239 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10242 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10243 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10250 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10251 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10258 static struct hda_verb alc262_eapd_verbs[] = {
10259 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10260 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10264 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10265 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10266 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10267 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10269 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10274 static struct hda_verb alc262_sony_unsol_verbs[] = {
10275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10276 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10279 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10284 static struct hda_input_mux alc262_dmic_capture_source = {
10287 { "Int DMic", 0x9 },
10292 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10293 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10294 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10301 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10302 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10305 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10306 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10308 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10309 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10313 static void alc262_dmic_automute(struct hda_codec *codec)
10315 unsigned int present;
10317 present = snd_hda_codec_read(codec, 0x18, 0,
10318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10319 snd_hda_codec_write(codec, 0x22, 0,
10320 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10324 /* unsolicited event for HP jack sensing */
10325 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10328 if ((res >> 26) == ALC880_MIC_EVENT)
10329 alc262_dmic_automute(codec);
10331 alc_sku_unsol_event(codec, res);
10334 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10336 struct alc_spec *spec = codec->spec;
10338 spec->autocfg.hp_pins[0] = 0x15;
10339 spec->autocfg.speaker_pins[0] = 0x14;
10340 alc_automute_pin(codec);
10341 alc262_dmic_automute(codec);
10347 * 0x16 = internal speaker
10348 * 0x18 = external mic
10351 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10352 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10353 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10357 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10364 static struct hda_verb alc262_nec_verbs[] = {
10365 /* Unmute Speaker */
10366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10370 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10372 /* External mic to headphone */
10373 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10374 /* External mic to speaker */
10375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10381 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10382 * 0x1b = port replicator headphone out
10385 #define ALC_HP_EVENT 0x37
10387 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10388 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10389 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10390 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10391 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10395 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10396 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10397 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10401 static struct hda_input_mux alc262_fujitsu_capture_source = {
10405 { "Int Mic", 0x1 },
10410 static struct hda_input_mux alc262_HP_capture_source = {
10414 { "Front Mic", 0x1 },
10421 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10425 { "Front Mic", 0x2 },
10431 /* mute/unmute internal speaker according to the hp jacks and mute state */
10432 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10434 struct alc_spec *spec = codec->spec;
10437 if (force || !spec->sense_updated) {
10438 unsigned int present;
10439 /* need to execute and sync at first */
10440 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10441 /* check laptop HP jack */
10442 present = snd_hda_codec_read(codec, 0x14, 0,
10443 AC_VERB_GET_PIN_SENSE, 0);
10444 /* need to execute and sync at first */
10445 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10446 /* check docking HP jack */
10447 present |= snd_hda_codec_read(codec, 0x1b, 0,
10448 AC_VERB_GET_PIN_SENSE, 0);
10449 if (present & AC_PINSENSE_PRESENCE)
10450 spec->jack_present = 1;
10452 spec->jack_present = 0;
10453 spec->sense_updated = 1;
10455 /* unmute internal speaker only if both HPs are unplugged and
10456 * master switch is on
10458 if (spec->jack_present)
10459 mute = HDA_AMP_MUTE;
10461 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10462 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10463 HDA_AMP_MUTE, mute);
10466 /* unsolicited event for HP jack sensing */
10467 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10470 if ((res >> 26) != ALC_HP_EVENT)
10472 alc262_fujitsu_automute(codec, 1);
10475 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10477 alc262_fujitsu_automute(codec, 1);
10480 /* bind volumes of both NID 0x0c and 0x0d */
10481 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10482 .ops = &snd_hda_bind_vol,
10484 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10485 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10490 /* mute/unmute internal speaker according to the hp jack and mute state */
10491 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10493 struct alc_spec *spec = codec->spec;
10496 if (force || !spec->sense_updated) {
10497 unsigned int present_int_hp;
10498 /* need to execute and sync at first */
10499 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10500 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10501 AC_VERB_GET_PIN_SENSE, 0);
10502 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10503 spec->sense_updated = 1;
10505 if (spec->jack_present) {
10506 /* mute internal speaker */
10507 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10508 HDA_AMP_MUTE, HDA_AMP_MUTE);
10509 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10510 HDA_AMP_MUTE, HDA_AMP_MUTE);
10512 /* unmute internal speaker if necessary */
10513 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10514 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10515 HDA_AMP_MUTE, mute);
10516 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10517 HDA_AMP_MUTE, mute);
10521 /* unsolicited event for HP jack sensing */
10522 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10525 if ((res >> 26) != ALC_HP_EVENT)
10527 alc262_lenovo_3000_automute(codec, 1);
10530 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10531 int dir, int idx, long *valp)
10535 for (i = 0; i < 2; i++, valp++)
10536 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10538 *valp ? 0 : HDA_AMP_MUTE);
10542 /* bind hp and internal speaker mute (with plug check) */
10543 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10544 struct snd_ctl_elem_value *ucontrol)
10546 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10547 long *valp = ucontrol->value.integer.value;
10550 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10551 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10553 alc262_fujitsu_automute(codec, 0);
10557 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10558 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10560 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10561 .name = "Master Playback Switch",
10562 .info = snd_hda_mixer_amp_switch_info,
10563 .get = snd_hda_mixer_amp_switch_get,
10564 .put = alc262_fujitsu_master_sw_put,
10565 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10567 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10568 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10569 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10570 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10571 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10572 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10573 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10574 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10578 /* bind hp and internal speaker mute (with plug check) */
10579 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10580 struct snd_ctl_elem_value *ucontrol)
10582 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10583 long *valp = ucontrol->value.integer.value;
10586 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10588 alc262_lenovo_3000_automute(codec, 0);
10592 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10593 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10596 .name = "Master Playback Switch",
10597 .info = snd_hda_mixer_amp_switch_info,
10598 .get = snd_hda_mixer_amp_switch_get,
10599 .put = alc262_lenovo_3000_master_sw_put,
10600 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10602 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10603 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10604 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10608 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10609 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10613 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10614 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10615 ALC262_HIPPO_MASTER_SWITCH,
10616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10618 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10619 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10620 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10621 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10625 /* additional init verbs for Benq laptops */
10626 static struct hda_verb alc262_EAPD_verbs[] = {
10627 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10628 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10632 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10633 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10634 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10636 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10637 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10641 /* Samsung Q1 Ultra Vista model setup */
10642 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10643 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10644 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10646 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10647 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10648 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10652 static struct hda_verb alc262_ultra_verbs[] = {
10654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10656 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10658 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10659 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10663 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10666 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10667 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10669 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10670 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10671 /* ADC, choose mic */
10672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10673 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10674 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10675 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10676 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10677 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10678 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10679 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10680 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10681 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10685 /* mute/unmute internal speaker according to the hp jack and mute state */
10686 static void alc262_ultra_automute(struct hda_codec *codec)
10688 struct alc_spec *spec = codec->spec;
10692 /* auto-mute only when HP is used as HP */
10693 if (!spec->cur_mux[0]) {
10694 unsigned int present;
10695 /* need to execute and sync at first */
10696 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10697 present = snd_hda_codec_read(codec, 0x15, 0,
10698 AC_VERB_GET_PIN_SENSE, 0);
10699 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10700 if (spec->jack_present)
10701 mute = HDA_AMP_MUTE;
10703 /* mute/unmute internal speaker */
10704 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10705 HDA_AMP_MUTE, mute);
10706 /* mute/unmute HP */
10707 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10708 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10711 /* unsolicited event for HP jack sensing */
10712 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10715 if ((res >> 26) != ALC880_HP_EVENT)
10717 alc262_ultra_automute(codec);
10720 static struct hda_input_mux alc262_ultra_capture_source = {
10724 { "Headphone", 0x7 },
10728 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10729 struct snd_ctl_elem_value *ucontrol)
10731 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10732 struct alc_spec *spec = codec->spec;
10735 ret = alc_mux_enum_put(kcontrol, ucontrol);
10738 /* reprogram the HP pin as mic or HP according to the input source */
10739 snd_hda_codec_write_cache(codec, 0x15, 0,
10740 AC_VERB_SET_PIN_WIDGET_CONTROL,
10741 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10742 alc262_ultra_automute(codec); /* mute/unmute HP */
10746 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10747 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10748 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10750 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10751 .name = "Capture Source",
10752 .info = alc_mux_enum_info,
10753 .get = alc_mux_enum_get,
10754 .put = alc262_ultra_mux_enum_put,
10759 /* add playback controls from the parsed DAC table */
10760 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10761 const struct auto_pin_cfg *cfg)
10766 spec->multiout.num_dacs = 1; /* only use one dac */
10767 spec->multiout.dac_nids = spec->private_dac_nids;
10768 spec->multiout.dac_nids[0] = 2;
10770 nid = cfg->line_out_pins[0];
10772 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10773 "Front Playback Volume",
10774 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10777 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10778 "Front Playback Switch",
10779 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10784 nid = cfg->speaker_pins[0];
10787 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10788 "Speaker Playback Volume",
10789 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10793 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10794 "Speaker Playback Switch",
10795 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10800 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10801 "Speaker Playback Switch",
10802 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10808 nid = cfg->hp_pins[0];
10810 /* spec->multiout.hp_nid = 2; */
10812 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10813 "Headphone Playback Volume",
10814 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10818 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10819 "Headphone Playback Switch",
10820 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10825 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10826 "Headphone Playback Switch",
10827 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10836 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10837 const struct auto_pin_cfg *cfg)
10841 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10844 /* digital-mic input pin is excluded in alc880_auto_create..()
10845 * because it's under 0x18
10847 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10848 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10849 struct hda_input_mux *imux = &spec->private_imux[0];
10850 imux->items[imux->num_items].label = "Int Mic";
10851 imux->items[imux->num_items].index = 0x09;
10859 * generic initialization of ADC, input mixers and output mixers
10861 static struct hda_verb alc262_volume_init_verbs[] = {
10863 * Unmute ADC0-2 and set the default input to mic-in
10865 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10866 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10867 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10869 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10872 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10874 * Note: PASD motherboards uses the Line In 2 as the input for
10875 * front panel mic (mic 2)
10877 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10885 * Set up output mixers (0x0c - 0x0f)
10887 /* set vol=0 to output mixers */
10888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10889 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10890 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10892 /* set up input amps for analog loopback */
10893 /* Amp Indices: DAC = 0, mixer = 1 */
10894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10896 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10897 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10898 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10899 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10901 /* FIXME: use matrix-type input source selection */
10902 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10903 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10910 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10911 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10912 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10915 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10916 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10917 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10922 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10924 * Unmute ADC0-2 and set the default input to mic-in
10926 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10928 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10929 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10930 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10933 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10935 * Note: PASD motherboards uses the Line In 2 as the input for
10936 * front panel mic (mic 2)
10938 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10944 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10948 * Set up output mixers (0x0c - 0x0e)
10950 /* set vol=0 to output mixers */
10951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10953 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10955 /* set up input amps for analog loopback */
10956 /* Amp Indices: DAC = 0, mixer = 1 */
10957 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10958 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10959 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10962 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10964 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10968 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10971 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10972 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10975 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10976 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10978 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10980 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10981 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10982 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10983 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10984 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10985 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10988 /* FIXME: use matrix-type input source selection */
10989 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10990 /* Input mixer1: only unmute Mic */
10991 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10992 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10993 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10994 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10995 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10996 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10997 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10998 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10999 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11001 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11004 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11005 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11006 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11007 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11009 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11012 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11013 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11014 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11015 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11016 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11017 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11018 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11019 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11021 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11026 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11028 * Unmute ADC0-2 and set the default input to mic-in
11030 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11031 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11032 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11033 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11034 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11035 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11037 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11039 * Note: PASD motherboards uses the Line In 2 as the input for front
11040 * panel mic (mic 2)
11042 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11045 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11052 * Set up output mixers (0x0c - 0x0e)
11054 /* set vol=0 to output mixers */
11055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11059 /* set up input amps for analog loopback */
11060 /* Amp Indices: DAC = 0, mixer = 1 */
11061 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11062 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11063 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11064 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11065 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11066 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11069 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11070 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11071 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11072 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11073 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11074 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11075 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11077 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11081 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11083 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11084 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11085 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11087 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11088 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11090 /* FIXME: use matrix-type input source selection */
11091 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11092 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11096 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11097 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11098 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11099 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11101 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11102 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11103 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11104 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11105 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11106 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11107 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11109 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11110 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11111 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11112 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11114 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11115 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11117 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11122 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11126 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11128 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11129 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11130 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11131 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11134 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11135 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11140 #ifdef CONFIG_SND_HDA_POWER_SAVE
11141 #define alc262_loopbacks alc880_loopbacks
11144 /* pcm configuration: identical with ALC880 */
11145 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11146 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11147 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11148 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11151 * BIOS auto configuration
11153 static int alc262_parse_auto_config(struct hda_codec *codec)
11155 struct alc_spec *spec = codec->spec;
11157 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11159 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11163 if (!spec->autocfg.line_outs) {
11164 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11165 spec->multiout.max_channels = 2;
11166 spec->no_analog = 1;
11169 return 0; /* can't find valid BIOS pin config */
11171 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11174 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11178 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11181 if (spec->autocfg.dig_outs) {
11182 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11183 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11185 if (spec->autocfg.dig_in_pin)
11186 spec->dig_in_nid = ALC262_DIGIN_NID;
11188 if (spec->kctls.list)
11189 add_mixer(spec, spec->kctls.list);
11191 add_verb(spec, alc262_volume_init_verbs);
11192 spec->num_mux_defs = 1;
11193 spec->input_mux = &spec->private_imux[0];
11195 err = alc_auto_add_mic_boost(codec);
11199 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11204 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11205 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11206 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11207 #define alc262_auto_init_input_src alc882_auto_init_input_src
11210 /* init callback for auto-configuration model -- overriding the default init */
11211 static void alc262_auto_init(struct hda_codec *codec)
11213 struct alc_spec *spec = codec->spec;
11214 alc262_auto_init_multi_out(codec);
11215 alc262_auto_init_hp_out(codec);
11216 alc262_auto_init_analog_input(codec);
11217 alc262_auto_init_input_src(codec);
11218 if (spec->unsol_event)
11219 alc_inithook(codec);
11223 * configuration and preset
11225 static const char *alc262_models[ALC262_MODEL_LAST] = {
11226 [ALC262_BASIC] = "basic",
11227 [ALC262_HIPPO] = "hippo",
11228 [ALC262_HIPPO_1] = "hippo_1",
11229 [ALC262_FUJITSU] = "fujitsu",
11230 [ALC262_HP_BPC] = "hp-bpc",
11231 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11232 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11233 [ALC262_HP_RP5700] = "hp-rp5700",
11234 [ALC262_BENQ_ED8] = "benq",
11235 [ALC262_BENQ_T31] = "benq-t31",
11236 [ALC262_SONY_ASSAMD] = "sony-assamd",
11237 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11238 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11239 [ALC262_ULTRA] = "ultra",
11240 [ALC262_LENOVO_3000] = "lenovo-3000",
11241 [ALC262_NEC] = "nec",
11242 [ALC262_TYAN] = "tyan",
11243 [ALC262_AUTO] = "auto",
11246 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11247 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11248 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11249 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11251 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11253 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11255 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11256 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11257 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11258 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11259 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11260 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11261 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11262 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11263 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11264 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11265 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11266 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11267 ALC262_HP_TC_T5735),
11268 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11269 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11270 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11271 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11272 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11273 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11274 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11275 ALC262_SONY_ASSAMD),
11276 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11277 ALC262_TOSHIBA_RX1),
11278 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11279 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11280 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11281 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11282 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11284 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11285 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11286 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11287 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11288 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11292 static struct alc_config_preset alc262_presets[] = {
11294 .mixers = { alc262_base_mixer },
11295 .init_verbs = { alc262_init_verbs },
11296 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11297 .dac_nids = alc262_dac_nids,
11299 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11300 .channel_mode = alc262_modes,
11301 .input_mux = &alc262_capture_source,
11304 .mixers = { alc262_hippo_mixer },
11305 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11306 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11307 .dac_nids = alc262_dac_nids,
11309 .dig_out_nid = ALC262_DIGOUT_NID,
11310 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11311 .channel_mode = alc262_modes,
11312 .input_mux = &alc262_capture_source,
11313 .unsol_event = alc262_hippo_unsol_event,
11314 .init_hook = alc262_hippo_init_hook,
11316 [ALC262_HIPPO_1] = {
11317 .mixers = { alc262_hippo1_mixer },
11318 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11319 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11320 .dac_nids = alc262_dac_nids,
11322 .dig_out_nid = ALC262_DIGOUT_NID,
11323 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11324 .channel_mode = alc262_modes,
11325 .input_mux = &alc262_capture_source,
11326 .unsol_event = alc262_hippo_unsol_event,
11327 .init_hook = alc262_hippo1_init_hook,
11329 [ALC262_FUJITSU] = {
11330 .mixers = { alc262_fujitsu_mixer },
11331 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11332 alc262_fujitsu_unsol_verbs },
11333 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11334 .dac_nids = alc262_dac_nids,
11336 .dig_out_nid = ALC262_DIGOUT_NID,
11337 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11338 .channel_mode = alc262_modes,
11339 .input_mux = &alc262_fujitsu_capture_source,
11340 .unsol_event = alc262_fujitsu_unsol_event,
11341 .init_hook = alc262_fujitsu_init_hook,
11343 [ALC262_HP_BPC] = {
11344 .mixers = { alc262_HP_BPC_mixer },
11345 .init_verbs = { alc262_HP_BPC_init_verbs },
11346 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11347 .dac_nids = alc262_dac_nids,
11349 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11350 .channel_mode = alc262_modes,
11351 .input_mux = &alc262_HP_capture_source,
11352 .unsol_event = alc262_hp_bpc_unsol_event,
11353 .init_hook = alc262_hp_bpc_automute,
11355 [ALC262_HP_BPC_D7000_WF] = {
11356 .mixers = { alc262_HP_BPC_WildWest_mixer },
11357 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11358 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11359 .dac_nids = alc262_dac_nids,
11361 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11362 .channel_mode = alc262_modes,
11363 .input_mux = &alc262_HP_D7000_capture_source,
11364 .unsol_event = alc262_hp_wildwest_unsol_event,
11365 .init_hook = alc262_hp_wildwest_automute,
11367 [ALC262_HP_BPC_D7000_WL] = {
11368 .mixers = { alc262_HP_BPC_WildWest_mixer,
11369 alc262_HP_BPC_WildWest_option_mixer },
11370 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11371 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11372 .dac_nids = alc262_dac_nids,
11374 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11375 .channel_mode = alc262_modes,
11376 .input_mux = &alc262_HP_D7000_capture_source,
11377 .unsol_event = alc262_hp_wildwest_unsol_event,
11378 .init_hook = alc262_hp_wildwest_automute,
11380 [ALC262_HP_TC_T5735] = {
11381 .mixers = { alc262_hp_t5735_mixer },
11382 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11383 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11384 .dac_nids = alc262_dac_nids,
11386 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11387 .channel_mode = alc262_modes,
11388 .input_mux = &alc262_capture_source,
11389 .unsol_event = alc_automute_amp_unsol_event,
11390 .init_hook = alc262_hp_t5735_init_hook,
11392 [ALC262_HP_RP5700] = {
11393 .mixers = { alc262_hp_rp5700_mixer },
11394 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11395 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11396 .dac_nids = alc262_dac_nids,
11397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11398 .channel_mode = alc262_modes,
11399 .input_mux = &alc262_hp_rp5700_capture_source,
11401 [ALC262_BENQ_ED8] = {
11402 .mixers = { alc262_base_mixer },
11403 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11404 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11405 .dac_nids = alc262_dac_nids,
11407 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11408 .channel_mode = alc262_modes,
11409 .input_mux = &alc262_capture_source,
11411 [ALC262_SONY_ASSAMD] = {
11412 .mixers = { alc262_sony_mixer },
11413 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11414 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11415 .dac_nids = alc262_dac_nids,
11417 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11418 .channel_mode = alc262_modes,
11419 .input_mux = &alc262_capture_source,
11420 .unsol_event = alc262_hippo_unsol_event,
11421 .init_hook = alc262_hippo_init_hook,
11423 [ALC262_BENQ_T31] = {
11424 .mixers = { alc262_benq_t31_mixer },
11425 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11426 alc_hp15_unsol_verbs },
11427 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11428 .dac_nids = alc262_dac_nids,
11430 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11431 .channel_mode = alc262_modes,
11432 .input_mux = &alc262_capture_source,
11433 .unsol_event = alc262_hippo_unsol_event,
11434 .init_hook = alc262_hippo_init_hook,
11437 .mixers = { alc262_ultra_mixer },
11438 .cap_mixer = alc262_ultra_capture_mixer,
11439 .init_verbs = { alc262_ultra_verbs },
11440 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11441 .dac_nids = alc262_dac_nids,
11442 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11443 .channel_mode = alc262_modes,
11444 .input_mux = &alc262_ultra_capture_source,
11445 .adc_nids = alc262_adc_nids, /* ADC0 */
11446 .capsrc_nids = alc262_capsrc_nids,
11447 .num_adc_nids = 1, /* single ADC */
11448 .unsol_event = alc262_ultra_unsol_event,
11449 .init_hook = alc262_ultra_automute,
11451 [ALC262_LENOVO_3000] = {
11452 .mixers = { alc262_lenovo_3000_mixer },
11453 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11454 alc262_lenovo_3000_unsol_verbs },
11455 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11456 .dac_nids = alc262_dac_nids,
11458 .dig_out_nid = ALC262_DIGOUT_NID,
11459 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11460 .channel_mode = alc262_modes,
11461 .input_mux = &alc262_fujitsu_capture_source,
11462 .unsol_event = alc262_lenovo_3000_unsol_event,
11465 .mixers = { alc262_nec_mixer },
11466 .init_verbs = { alc262_nec_verbs },
11467 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11468 .dac_nids = alc262_dac_nids,
11470 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11471 .channel_mode = alc262_modes,
11472 .input_mux = &alc262_capture_source,
11474 [ALC262_TOSHIBA_S06] = {
11475 .mixers = { alc262_toshiba_s06_mixer },
11476 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11477 alc262_eapd_verbs },
11478 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11479 .capsrc_nids = alc262_dmic_capsrc_nids,
11480 .dac_nids = alc262_dac_nids,
11481 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11482 .num_adc_nids = 1, /* single ADC */
11483 .dig_out_nid = ALC262_DIGOUT_NID,
11484 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11485 .channel_mode = alc262_modes,
11486 .input_mux = &alc262_dmic_capture_source,
11487 .unsol_event = alc262_toshiba_s06_unsol_event,
11488 .init_hook = alc262_toshiba_s06_init_hook,
11490 [ALC262_TOSHIBA_RX1] = {
11491 .mixers = { alc262_toshiba_rx1_mixer },
11492 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11493 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11494 .dac_nids = alc262_dac_nids,
11496 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11497 .channel_mode = alc262_modes,
11498 .input_mux = &alc262_capture_source,
11499 .unsol_event = alc262_hippo_unsol_event,
11500 .init_hook = alc262_hippo_init_hook,
11503 .mixers = { alc262_tyan_mixer },
11504 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11505 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11506 .dac_nids = alc262_dac_nids,
11508 .dig_out_nid = ALC262_DIGOUT_NID,
11509 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11510 .channel_mode = alc262_modes,
11511 .input_mux = &alc262_capture_source,
11512 .unsol_event = alc_automute_amp_unsol_event,
11513 .init_hook = alc262_tyan_init_hook,
11517 static int patch_alc262(struct hda_codec *codec)
11519 struct alc_spec *spec;
11523 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11527 codec->spec = spec;
11529 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11534 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11535 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11536 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11537 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11541 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11543 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11547 if (board_config < 0) {
11548 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11550 board_config = ALC262_AUTO;
11553 if (board_config == ALC262_AUTO) {
11554 /* automatic parse from the BIOS config */
11555 err = alc262_parse_auto_config(codec);
11561 "hda_codec: Cannot set up configuration "
11562 "from BIOS. Using base mode...\n");
11563 board_config = ALC262_BASIC;
11567 if (!spec->no_analog) {
11568 err = snd_hda_attach_beep_device(codec, 0x1);
11575 if (board_config != ALC262_AUTO)
11576 setup_preset(spec, &alc262_presets[board_config]);
11578 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11579 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11581 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11582 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11584 if (!spec->adc_nids && spec->input_mux) {
11586 /* check whether the digital-mic has to be supported */
11587 for (i = 0; i < spec->input_mux->num_items; i++) {
11588 if (spec->input_mux->items[i].index >= 9)
11591 if (i < spec->input_mux->num_items) {
11592 /* use only ADC0 */
11593 spec->adc_nids = alc262_dmic_adc_nids;
11594 spec->num_adc_nids = 1;
11595 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11597 /* all analog inputs */
11598 /* check whether NID 0x07 is valid */
11599 unsigned int wcap = get_wcaps(codec, 0x07);
11602 wcap = get_wcaps_type(wcap);
11603 if (wcap != AC_WID_AUD_IN) {
11604 spec->adc_nids = alc262_adc_nids_alt;
11605 spec->num_adc_nids =
11606 ARRAY_SIZE(alc262_adc_nids_alt);
11607 spec->capsrc_nids = alc262_capsrc_nids_alt;
11609 spec->adc_nids = alc262_adc_nids;
11610 spec->num_adc_nids =
11611 ARRAY_SIZE(alc262_adc_nids);
11612 spec->capsrc_nids = alc262_capsrc_nids;
11616 if (!spec->cap_mixer && !spec->no_analog)
11617 set_capture_mixer(spec);
11618 if (!spec->no_analog)
11619 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11621 spec->vmaster_nid = 0x0c;
11623 codec->patch_ops = alc_patch_ops;
11624 if (board_config == ALC262_AUTO)
11625 spec->init_hook = alc262_auto_init;
11626 #ifdef CONFIG_SND_HDA_POWER_SAVE
11627 if (!spec->loopback.amplist)
11628 spec->loopback.amplist = alc262_loopbacks;
11630 codec->proc_widget_hook = print_realtek_coef;
11636 * ALC268 channel source setting (2 channel)
11638 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11639 #define alc268_modes alc260_modes
11641 static hda_nid_t alc268_dac_nids[2] = {
11646 static hda_nid_t alc268_adc_nids[2] = {
11651 static hda_nid_t alc268_adc_nids_alt[1] = {
11656 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11658 static struct snd_kcontrol_new alc268_base_mixer[] = {
11659 /* output mixer control */
11660 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11661 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11662 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11664 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11665 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11666 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11670 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11671 /* output mixer control */
11672 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11673 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11674 ALC262_HIPPO_MASTER_SWITCH,
11675 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11676 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11677 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11681 /* bind Beep switches of both NID 0x0f and 0x10 */
11682 static struct hda_bind_ctls alc268_bind_beep_sw = {
11683 .ops = &snd_hda_bind_sw,
11685 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11686 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11691 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11692 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11693 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11697 static struct hda_verb alc268_eapd_verbs[] = {
11698 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11699 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11703 /* Toshiba specific */
11704 static struct hda_verb alc268_toshiba_verbs[] = {
11705 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11709 static struct hda_input_mux alc268_acer_lc_capture_source = {
11717 /* Acer specific */
11718 /* bind volumes of both NID 0x02 and 0x03 */
11719 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11720 .ops = &snd_hda_bind_vol,
11722 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11723 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11728 /* mute/unmute internal speaker according to the hp jack and mute state */
11729 static void alc268_acer_automute(struct hda_codec *codec, int force)
11731 struct alc_spec *spec = codec->spec;
11734 if (force || !spec->sense_updated) {
11735 unsigned int present;
11736 present = snd_hda_codec_read(codec, 0x14, 0,
11737 AC_VERB_GET_PIN_SENSE, 0);
11738 spec->jack_present = (present & 0x80000000) != 0;
11739 spec->sense_updated = 1;
11741 if (spec->jack_present)
11742 mute = HDA_AMP_MUTE; /* mute internal speaker */
11743 else /* unmute internal speaker if necessary */
11744 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11745 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11746 HDA_AMP_MUTE, mute);
11750 /* bind hp and internal speaker mute (with plug check) */
11751 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11752 struct snd_ctl_elem_value *ucontrol)
11754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11755 long *valp = ucontrol->value.integer.value;
11758 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11760 alc268_acer_automute(codec, 0);
11764 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11765 /* output mixer control */
11766 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11768 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11769 .name = "Master Playback Switch",
11770 .info = snd_hda_mixer_amp_switch_info,
11771 .get = snd_hda_mixer_amp_switch_get,
11772 .put = alc268_acer_master_sw_put,
11773 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11775 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11779 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11780 /* output mixer control */
11781 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11783 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11784 .name = "Master Playback Switch",
11785 .info = snd_hda_mixer_amp_switch_info,
11786 .get = snd_hda_mixer_amp_switch_get,
11787 .put = alc268_acer_master_sw_put,
11788 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11790 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11791 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11792 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11796 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11797 /* output mixer control */
11798 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11800 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11801 .name = "Master Playback Switch",
11802 .info = snd_hda_mixer_amp_switch_info,
11803 .get = snd_hda_mixer_amp_switch_get,
11804 .put = alc268_acer_master_sw_put,
11805 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11807 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11808 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11812 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11813 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11814 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11816 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11817 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11822 static struct hda_verb alc268_acer_verbs[] = {
11823 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11824 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11825 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11827 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11829 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11833 /* unsolicited event for HP jack sensing */
11834 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11835 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11837 static void alc268_acer_unsol_event(struct hda_codec *codec,
11840 if ((res >> 26) != ALC880_HP_EVENT)
11842 alc268_acer_automute(codec, 1);
11845 static void alc268_acer_init_hook(struct hda_codec *codec)
11847 alc268_acer_automute(codec, 1);
11850 /* toggle speaker-output according to the hp-jack state */
11851 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11853 unsigned int present;
11854 unsigned char bits;
11856 present = snd_hda_codec_read(codec, 0x15, 0,
11857 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11858 bits = present ? AMP_IN_MUTE(0) : 0;
11859 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11860 AMP_IN_MUTE(0), bits);
11861 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11862 AMP_IN_MUTE(0), bits);
11866 static void alc268_acer_mic_automute(struct hda_codec *codec)
11868 unsigned int present;
11870 present = snd_hda_codec_read(codec, 0x18, 0,
11871 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11872 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11873 present ? 0x0 : 0x6);
11876 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11879 if ((res >> 26) == ALC880_HP_EVENT)
11880 alc268_aspire_one_speaker_automute(codec);
11881 if ((res >> 26) == ALC880_MIC_EVENT)
11882 alc268_acer_mic_automute(codec);
11885 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11887 alc268_aspire_one_speaker_automute(codec);
11888 alc268_acer_mic_automute(codec);
11891 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11892 /* output mixer control */
11893 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11894 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11895 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11896 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11897 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11898 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11902 static struct hda_verb alc268_dell_verbs[] = {
11903 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11905 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11909 /* mute/unmute internal speaker according to the hp jack and mute state */
11910 static void alc268_dell_init_hook(struct hda_codec *codec)
11912 struct alc_spec *spec = codec->spec;
11914 spec->autocfg.hp_pins[0] = 0x15;
11915 spec->autocfg.speaker_pins[0] = 0x14;
11916 alc_automute_pin(codec);
11919 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11920 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11921 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11922 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11924 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11925 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11926 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11927 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11931 static struct hda_verb alc267_quanta_il1_verbs[] = {
11932 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11933 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11937 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11939 unsigned int present;
11941 present = snd_hda_codec_read(codec, 0x18, 0,
11942 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11943 snd_hda_codec_write(codec, 0x23, 0,
11944 AC_VERB_SET_CONNECT_SEL,
11945 present ? 0x00 : 0x01);
11948 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11950 struct alc_spec *spec = codec->spec;
11952 spec->autocfg.hp_pins[0] = 0x15;
11953 spec->autocfg.speaker_pins[0] = 0x14;
11954 alc_automute_pin(codec);
11955 alc267_quanta_il1_mic_automute(codec);
11958 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11961 switch (res >> 26) {
11962 case ALC880_MIC_EVENT:
11963 alc267_quanta_il1_mic_automute(codec);
11966 alc_sku_unsol_event(codec, res);
11972 * generic initialization of ADC, input mixers and output mixers
11974 static struct hda_verb alc268_base_init_verbs[] = {
11975 /* Unmute DAC0-1 and set vol = 0 */
11976 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11977 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11980 * Set up output mixers (0x0c - 0x0e)
11982 /* set vol=0 to output mixers */
11983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11984 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11986 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11987 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11989 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11991 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11994 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11995 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11996 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12001 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12002 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12004 /* set PCBEEP vol = 0, mute connections */
12005 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12006 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12007 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12009 /* Unmute Selector 23h,24h and set the default input to mic-in */
12011 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12012 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12013 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12014 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12020 * generic initialization of ADC, input mixers and output mixers
12022 static struct hda_verb alc268_volume_init_verbs[] = {
12023 /* set output DAC */
12024 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12025 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12027 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12029 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12030 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12031 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12035 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12037 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12038 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12040 /* set PCBEEP vol = 0, mute connections */
12041 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12042 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12043 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12048 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12049 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12050 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12052 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12053 /* The multiple "Capture Source" controls confuse alsamixer
12054 * So call somewhat different..
12056 /* .name = "Capture Source", */
12057 .name = "Input Source",
12059 .info = alc_mux_enum_info,
12060 .get = alc_mux_enum_get,
12061 .put = alc_mux_enum_put,
12066 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12067 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12068 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12069 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12070 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12072 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12073 /* The multiple "Capture Source" controls confuse alsamixer
12074 * So call somewhat different..
12076 /* .name = "Capture Source", */
12077 .name = "Input Source",
12079 .info = alc_mux_enum_info,
12080 .get = alc_mux_enum_get,
12081 .put = alc_mux_enum_put,
12086 static struct hda_input_mux alc268_capture_source = {
12090 { "Front Mic", 0x1 },
12096 static struct hda_input_mux alc268_acer_capture_source = {
12100 { "Internal Mic", 0x1 },
12105 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12109 { "Internal Mic", 0x6 },
12114 #ifdef CONFIG_SND_DEBUG
12115 static struct snd_kcontrol_new alc268_test_mixer[] = {
12116 /* Volume widgets */
12117 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12118 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12119 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12120 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12121 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12122 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12123 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12124 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12125 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12126 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12127 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12128 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12129 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12130 /* The below appears problematic on some hardwares */
12131 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12132 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12133 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12134 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12135 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12137 /* Modes for retasking pin widgets */
12138 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12139 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12140 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12141 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12143 /* Controls for GPIO pins, assuming they are configured as outputs */
12144 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12145 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12146 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12147 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12149 /* Switches to allow the digital SPDIF output pin to be enabled.
12150 * The ALC268 does not have an SPDIF input.
12152 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12154 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12155 * this output to turn on an external amplifier.
12157 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12158 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12164 /* create input playback/capture controls for the given pin */
12165 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12166 const char *ctlname, int idx)
12172 sprintf(name, "%s Playback Volume", ctlname);
12184 if (spec->multiout.dac_nids[0] != dac &&
12185 spec->multiout.dac_nids[1] != dac) {
12186 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12187 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12191 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12194 sprintf(name, "%s Playback Switch", ctlname);
12196 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12197 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12199 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12200 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12206 /* add playback controls from the parsed DAC table */
12207 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12208 const struct auto_pin_cfg *cfg)
12213 spec->multiout.dac_nids = spec->private_dac_nids;
12215 nid = cfg->line_out_pins[0];
12218 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12222 err = alc268_new_analog_output(spec, nid, name, 0);
12227 nid = cfg->speaker_pins[0];
12229 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12230 "Speaker Playback Volume",
12231 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12235 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12239 nid = cfg->hp_pins[0];
12241 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12246 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12248 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12249 "Mono Playback Switch",
12250 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12257 /* create playback/capture controls for input pins */
12258 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12259 const struct auto_pin_cfg *cfg)
12261 struct hda_input_mux *imux = &spec->private_imux[0];
12264 for (i = 0; i < AUTO_PIN_LAST; i++) {
12265 switch(cfg->input_pins[i]) {
12267 idx1 = 0; /* Mic 1 */
12270 idx1 = 1; /* Mic 2 */
12273 idx1 = 2; /* Line In */
12280 idx1 = 6; /* digital mics */
12285 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12286 imux->items[imux->num_items].index = idx1;
12292 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12294 struct alc_spec *spec = codec->spec;
12295 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12296 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12297 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12298 unsigned int dac_vol1, dac_vol2;
12301 snd_hda_codec_write(codec, speaker_nid, 0,
12302 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12303 snd_hda_codec_write(codec, 0x0f, 0,
12304 AC_VERB_SET_AMP_GAIN_MUTE,
12306 snd_hda_codec_write(codec, 0x10, 0,
12307 AC_VERB_SET_AMP_GAIN_MUTE,
12310 snd_hda_codec_write(codec, 0x0f, 0,
12311 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12312 snd_hda_codec_write(codec, 0x10, 0,
12313 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12316 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12317 if (line_nid == 0x14)
12318 dac_vol2 = AMP_OUT_ZERO;
12319 else if (line_nid == 0x15)
12320 dac_vol1 = AMP_OUT_ZERO;
12321 if (hp_nid == 0x14)
12322 dac_vol2 = AMP_OUT_ZERO;
12323 else if (hp_nid == 0x15)
12324 dac_vol1 = AMP_OUT_ZERO;
12325 if (line_nid != 0x16 || hp_nid != 0x16 ||
12326 spec->autocfg.line_out_pins[1] != 0x16 ||
12327 spec->autocfg.line_out_pins[2] != 0x16)
12328 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12330 snd_hda_codec_write(codec, 0x02, 0,
12331 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12332 snd_hda_codec_write(codec, 0x03, 0,
12333 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12336 /* pcm configuration: identical with ALC880 */
12337 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12338 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12339 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12340 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12343 * BIOS auto configuration
12345 static int alc268_parse_auto_config(struct hda_codec *codec)
12347 struct alc_spec *spec = codec->spec;
12349 static hda_nid_t alc268_ignore[] = { 0 };
12351 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12355 if (!spec->autocfg.line_outs) {
12356 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12357 spec->multiout.max_channels = 2;
12358 spec->no_analog = 1;
12361 return 0; /* can't find valid BIOS pin config */
12363 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12366 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12370 spec->multiout.max_channels = 2;
12373 /* digital only support output */
12374 if (spec->autocfg.dig_outs) {
12375 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12376 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12378 if (spec->kctls.list)
12379 add_mixer(spec, spec->kctls.list);
12381 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12382 add_mixer(spec, alc268_beep_mixer);
12384 add_verb(spec, alc268_volume_init_verbs);
12385 spec->num_mux_defs = 1;
12386 spec->input_mux = &spec->private_imux[0];
12388 err = alc_auto_add_mic_boost(codec);
12392 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12397 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12398 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12399 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12401 /* init callback for auto-configuration model -- overriding the default init */
12402 static void alc268_auto_init(struct hda_codec *codec)
12404 struct alc_spec *spec = codec->spec;
12405 alc268_auto_init_multi_out(codec);
12406 alc268_auto_init_hp_out(codec);
12407 alc268_auto_init_mono_speaker_out(codec);
12408 alc268_auto_init_analog_input(codec);
12409 if (spec->unsol_event)
12410 alc_inithook(codec);
12414 * configuration and preset
12416 static const char *alc268_models[ALC268_MODEL_LAST] = {
12417 [ALC267_QUANTA_IL1] = "quanta-il1",
12418 [ALC268_3ST] = "3stack",
12419 [ALC268_TOSHIBA] = "toshiba",
12420 [ALC268_ACER] = "acer",
12421 [ALC268_ACER_DMIC] = "acer-dmic",
12422 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12423 [ALC268_DELL] = "dell",
12424 [ALC268_ZEPTO] = "zepto",
12425 #ifdef CONFIG_SND_DEBUG
12426 [ALC268_TEST] = "test",
12428 [ALC268_AUTO] = "auto",
12431 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12432 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12433 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12434 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12435 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12436 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12437 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12438 ALC268_ACER_ASPIRE_ONE),
12439 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12440 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12441 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12443 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12444 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12445 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12447 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12448 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12449 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12450 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12454 static struct alc_config_preset alc268_presets[] = {
12455 [ALC267_QUANTA_IL1] = {
12456 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12457 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12458 alc267_quanta_il1_verbs },
12459 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12460 .dac_nids = alc268_dac_nids,
12461 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12462 .adc_nids = alc268_adc_nids_alt,
12464 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12465 .channel_mode = alc268_modes,
12466 .input_mux = &alc268_capture_source,
12467 .unsol_event = alc267_quanta_il1_unsol_event,
12468 .init_hook = alc267_quanta_il1_init_hook,
12471 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12472 alc268_beep_mixer },
12473 .init_verbs = { alc268_base_init_verbs },
12474 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12475 .dac_nids = alc268_dac_nids,
12476 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12477 .adc_nids = alc268_adc_nids_alt,
12478 .capsrc_nids = alc268_capsrc_nids,
12480 .dig_out_nid = ALC268_DIGOUT_NID,
12481 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12482 .channel_mode = alc268_modes,
12483 .input_mux = &alc268_capture_source,
12485 [ALC268_TOSHIBA] = {
12486 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12487 alc268_beep_mixer },
12488 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12489 alc268_toshiba_verbs },
12490 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12491 .dac_nids = alc268_dac_nids,
12492 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12493 .adc_nids = alc268_adc_nids_alt,
12494 .capsrc_nids = alc268_capsrc_nids,
12496 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12497 .channel_mode = alc268_modes,
12498 .input_mux = &alc268_capture_source,
12499 .unsol_event = alc268_toshiba_unsol_event,
12500 .init_hook = alc268_toshiba_init_hook,
12503 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12504 alc268_beep_mixer },
12505 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12506 alc268_acer_verbs },
12507 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12508 .dac_nids = alc268_dac_nids,
12509 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12510 .adc_nids = alc268_adc_nids_alt,
12511 .capsrc_nids = alc268_capsrc_nids,
12513 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12514 .channel_mode = alc268_modes,
12515 .input_mux = &alc268_acer_capture_source,
12516 .unsol_event = alc268_acer_unsol_event,
12517 .init_hook = alc268_acer_init_hook,
12519 [ALC268_ACER_DMIC] = {
12520 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12521 alc268_beep_mixer },
12522 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12523 alc268_acer_verbs },
12524 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12525 .dac_nids = alc268_dac_nids,
12526 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12527 .adc_nids = alc268_adc_nids_alt,
12528 .capsrc_nids = alc268_capsrc_nids,
12530 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12531 .channel_mode = alc268_modes,
12532 .input_mux = &alc268_acer_dmic_capture_source,
12533 .unsol_event = alc268_acer_unsol_event,
12534 .init_hook = alc268_acer_init_hook,
12536 [ALC268_ACER_ASPIRE_ONE] = {
12537 .mixers = { alc268_acer_aspire_one_mixer,
12539 alc268_capture_alt_mixer },
12540 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12541 alc268_acer_aspire_one_verbs },
12542 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12543 .dac_nids = alc268_dac_nids,
12544 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12545 .adc_nids = alc268_adc_nids_alt,
12546 .capsrc_nids = alc268_capsrc_nids,
12548 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12549 .channel_mode = alc268_modes,
12550 .input_mux = &alc268_acer_lc_capture_source,
12551 .unsol_event = alc268_acer_lc_unsol_event,
12552 .init_hook = alc268_acer_lc_init_hook,
12555 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12556 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12557 alc268_dell_verbs },
12558 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12559 .dac_nids = alc268_dac_nids,
12561 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12562 .channel_mode = alc268_modes,
12563 .unsol_event = alc_sku_unsol_event,
12564 .init_hook = alc268_dell_init_hook,
12565 .input_mux = &alc268_capture_source,
12568 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12569 alc268_beep_mixer },
12570 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12571 alc268_toshiba_verbs },
12572 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12573 .dac_nids = alc268_dac_nids,
12574 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12575 .adc_nids = alc268_adc_nids_alt,
12576 .capsrc_nids = alc268_capsrc_nids,
12578 .dig_out_nid = ALC268_DIGOUT_NID,
12579 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12580 .channel_mode = alc268_modes,
12581 .input_mux = &alc268_capture_source,
12582 .unsol_event = alc268_toshiba_unsol_event,
12583 .init_hook = alc268_toshiba_init_hook
12585 #ifdef CONFIG_SND_DEBUG
12587 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12588 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12589 alc268_volume_init_verbs },
12590 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12591 .dac_nids = alc268_dac_nids,
12592 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12593 .adc_nids = alc268_adc_nids_alt,
12594 .capsrc_nids = alc268_capsrc_nids,
12596 .dig_out_nid = ALC268_DIGOUT_NID,
12597 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12598 .channel_mode = alc268_modes,
12599 .input_mux = &alc268_capture_source,
12604 static int patch_alc268(struct hda_codec *codec)
12606 struct alc_spec *spec;
12608 int i, has_beep, err;
12610 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12614 codec->spec = spec;
12616 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12620 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12621 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12623 board_config = ALC268_AUTO;
12626 if (board_config == ALC268_AUTO) {
12627 /* automatic parse from the BIOS config */
12628 err = alc268_parse_auto_config(codec);
12634 "hda_codec: Cannot set up configuration "
12635 "from BIOS. Using base mode...\n");
12636 board_config = ALC268_3ST;
12640 if (board_config != ALC268_AUTO)
12641 setup_preset(spec, &alc268_presets[board_config]);
12643 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12644 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12645 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12647 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12650 for (i = 0; i < spec->num_mixers; i++) {
12651 if (spec->mixers[i] == alc268_beep_mixer) {
12658 err = snd_hda_attach_beep_device(codec, 0x1);
12663 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12664 /* override the amp caps for beep generator */
12665 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12666 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12667 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12668 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12669 (0 << AC_AMPCAP_MUTE_SHIFT));
12672 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12673 /* check whether NID 0x07 is valid */
12674 unsigned int wcap = get_wcaps(codec, 0x07);
12678 wcap = get_wcaps_type(wcap);
12679 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12680 spec->adc_nids = alc268_adc_nids_alt;
12681 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12682 add_mixer(spec, alc268_capture_alt_mixer);
12684 spec->adc_nids = alc268_adc_nids;
12685 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12686 add_mixer(spec, alc268_capture_mixer);
12688 spec->capsrc_nids = alc268_capsrc_nids;
12689 /* set default input source */
12690 for (i = 0; i < spec->num_adc_nids; i++)
12691 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12692 0, AC_VERB_SET_CONNECT_SEL,
12693 spec->input_mux->items[0].index);
12696 spec->vmaster_nid = 0x02;
12698 codec->patch_ops = alc_patch_ops;
12699 if (board_config == ALC268_AUTO)
12700 spec->init_hook = alc268_auto_init;
12702 codec->proc_widget_hook = print_realtek_coef;
12708 * ALC269 channel source setting (2 channel)
12710 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12712 #define alc269_dac_nids alc260_dac_nids
12714 static hda_nid_t alc269_adc_nids[1] = {
12719 static hda_nid_t alc269_capsrc_nids[1] = {
12723 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12727 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12735 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12743 #define alc269_modes alc260_modes
12744 #define alc269_capture_source alc880_lg_lw_capture_source
12746 static struct snd_kcontrol_new alc269_base_mixer[] = {
12747 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12748 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12749 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12750 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12753 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12754 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12755 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12756 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12757 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12758 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12762 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12763 /* output mixer control */
12764 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12766 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12767 .name = "Master Playback Switch",
12768 .info = snd_hda_mixer_amp_switch_info,
12769 .get = snd_hda_mixer_amp_switch_get,
12770 .put = alc268_acer_master_sw_put,
12771 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12776 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12777 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12778 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12782 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12783 /* output mixer control */
12784 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12787 .name = "Master Playback Switch",
12788 .info = snd_hda_mixer_amp_switch_info,
12789 .get = snd_hda_mixer_amp_switch_get,
12790 .put = alc268_acer_master_sw_put,
12791 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12793 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12795 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12796 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12797 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12798 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12799 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12800 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12801 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12805 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12806 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12807 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12808 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12809 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12813 /* capture mixer elements */
12814 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12815 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12816 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12822 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12824 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12825 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12826 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12827 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12828 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12829 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12830 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12834 static struct hda_verb alc269_lifebook_verbs[] = {
12835 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12836 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12837 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12839 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12840 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12841 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12842 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12843 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12844 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12848 /* toggle speaker-output according to the hp-jack state */
12849 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12851 unsigned int present;
12852 unsigned char bits;
12854 present = snd_hda_codec_read(codec, 0x15, 0,
12855 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12856 bits = present ? AMP_IN_MUTE(0) : 0;
12857 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12858 AMP_IN_MUTE(0), bits);
12859 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12860 AMP_IN_MUTE(0), bits);
12862 snd_hda_codec_write(codec, 0x20, 0,
12863 AC_VERB_SET_COEF_INDEX, 0x0c);
12864 snd_hda_codec_write(codec, 0x20, 0,
12865 AC_VERB_SET_PROC_COEF, 0x680);
12867 snd_hda_codec_write(codec, 0x20, 0,
12868 AC_VERB_SET_COEF_INDEX, 0x0c);
12869 snd_hda_codec_write(codec, 0x20, 0,
12870 AC_VERB_SET_PROC_COEF, 0x480);
12873 /* toggle speaker-output according to the hp-jacks state */
12874 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12876 unsigned int present;
12877 unsigned char bits;
12879 /* Check laptop headphone socket */
12880 present = snd_hda_codec_read(codec, 0x15, 0,
12881 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12883 /* Check port replicator headphone socket */
12884 present |= snd_hda_codec_read(codec, 0x1a, 0,
12885 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12887 bits = present ? AMP_IN_MUTE(0) : 0;
12888 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12889 AMP_IN_MUTE(0), bits);
12890 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12891 AMP_IN_MUTE(0), bits);
12893 snd_hda_codec_write(codec, 0x20, 0,
12894 AC_VERB_SET_COEF_INDEX, 0x0c);
12895 snd_hda_codec_write(codec, 0x20, 0,
12896 AC_VERB_SET_PROC_COEF, 0x680);
12898 snd_hda_codec_write(codec, 0x20, 0,
12899 AC_VERB_SET_COEF_INDEX, 0x0c);
12900 snd_hda_codec_write(codec, 0x20, 0,
12901 AC_VERB_SET_PROC_COEF, 0x480);
12904 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12906 unsigned int present;
12908 present = snd_hda_codec_read(codec, 0x18, 0,
12909 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12910 snd_hda_codec_write(codec, 0x23, 0,
12911 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12914 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12916 unsigned int present_laptop;
12917 unsigned int present_dock;
12919 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12920 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12922 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12923 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12925 /* Laptop mic port overrides dock mic port, design decision */
12927 snd_hda_codec_write(codec, 0x23, 0,
12928 AC_VERB_SET_CONNECT_SEL, 0x3);
12929 if (present_laptop)
12930 snd_hda_codec_write(codec, 0x23, 0,
12931 AC_VERB_SET_CONNECT_SEL, 0x0);
12932 if (!present_dock && !present_laptop)
12933 snd_hda_codec_write(codec, 0x23, 0,
12934 AC_VERB_SET_CONNECT_SEL, 0x1);
12937 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12940 if ((res >> 26) == ALC880_HP_EVENT)
12941 alc269_quanta_fl1_speaker_automute(codec);
12942 if ((res >> 26) == ALC880_MIC_EVENT)
12943 alc269_quanta_fl1_mic_automute(codec);
12946 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12949 if ((res >> 26) == ALC880_HP_EVENT)
12950 alc269_lifebook_speaker_automute(codec);
12951 if ((res >> 26) == ALC880_MIC_EVENT)
12952 alc269_lifebook_mic_autoswitch(codec);
12955 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12957 alc269_quanta_fl1_speaker_automute(codec);
12958 alc269_quanta_fl1_mic_automute(codec);
12961 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12963 alc269_lifebook_speaker_automute(codec);
12964 alc269_lifebook_mic_autoswitch(codec);
12967 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12968 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12969 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12970 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12971 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12972 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12973 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12974 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12978 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12979 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12980 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12981 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12982 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12983 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12988 /* toggle speaker-output according to the hp-jack state */
12989 static void alc269_speaker_automute(struct hda_codec *codec)
12991 unsigned int present;
12992 unsigned char bits;
12994 present = snd_hda_codec_read(codec, 0x15, 0,
12995 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12996 bits = present ? AMP_IN_MUTE(0) : 0;
12997 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12998 AMP_IN_MUTE(0), bits);
12999 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13000 AMP_IN_MUTE(0), bits);
13003 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13005 unsigned int present;
13007 present = snd_hda_codec_read(codec, 0x18, 0,
13008 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13009 snd_hda_codec_write(codec, 0x23, 0,
13010 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13013 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13015 unsigned int present;
13017 present = snd_hda_codec_read(codec, 0x18, 0,
13018 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13019 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13020 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13021 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13022 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13025 /* unsolicited event for HP jack sensing */
13026 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13029 if ((res >> 26) == ALC880_HP_EVENT)
13030 alc269_speaker_automute(codec);
13032 if ((res >> 26) == ALC880_MIC_EVENT)
13033 alc269_eeepc_dmic_automute(codec);
13036 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13038 alc269_speaker_automute(codec);
13039 alc269_eeepc_dmic_automute(codec);
13042 /* unsolicited event for HP jack sensing */
13043 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13046 if ((res >> 26) == ALC880_HP_EVENT)
13047 alc269_speaker_automute(codec);
13049 if ((res >> 26) == ALC880_MIC_EVENT)
13050 alc269_eeepc_amic_automute(codec);
13053 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13055 alc269_speaker_automute(codec);
13056 alc269_eeepc_amic_automute(codec);
13060 * generic initialization of ADC, input mixers and output mixers
13062 static struct hda_verb alc269_init_verbs[] = {
13064 * Unmute ADC0 and set the default input to mic-in
13066 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13068 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13069 * analog-loopback mixer widget
13070 * Note: PASD motherboards uses the Line In 2 as the input for
13071 * front panel mic (mic 2)
13073 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13074 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13075 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13076 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13077 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13078 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13081 * Set up output mixers (0x0c - 0x0e)
13083 /* set vol=0 to output mixers */
13084 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13085 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13087 /* set up input amps for analog loopback */
13088 /* Amp Indices: DAC = 0, mixer = 1 */
13089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13091 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13092 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13093 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13094 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13096 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13097 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13099 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13100 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13101 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13102 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13104 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13105 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13106 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13107 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13108 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13109 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13110 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13112 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13113 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13115 /* FIXME: use matrix-type input source selection */
13116 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13117 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13118 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13119 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13120 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13121 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13124 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13125 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13129 /* add playback controls from the parsed DAC table */
13130 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13131 const struct auto_pin_cfg *cfg)
13136 spec->multiout.num_dacs = 1; /* only use one dac */
13137 spec->multiout.dac_nids = spec->private_dac_nids;
13138 spec->multiout.dac_nids[0] = 2;
13140 nid = cfg->line_out_pins[0];
13142 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13143 "Front Playback Volume",
13144 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13147 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13148 "Front Playback Switch",
13149 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13154 nid = cfg->speaker_pins[0];
13156 if (!cfg->line_out_pins[0]) {
13157 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13158 "Speaker Playback Volume",
13159 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13165 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13166 "Speaker Playback Switch",
13167 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13172 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13173 "Speaker Playback Switch",
13174 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13180 nid = cfg->hp_pins[0];
13182 /* spec->multiout.hp_nid = 2; */
13183 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13184 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13185 "Headphone Playback Volume",
13186 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13192 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13193 "Headphone Playback Switch",
13194 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13199 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13200 "Headphone Playback Switch",
13201 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13210 #define alc269_auto_create_analog_input_ctls \
13211 alc262_auto_create_analog_input_ctls
13213 #ifdef CONFIG_SND_HDA_POWER_SAVE
13214 #define alc269_loopbacks alc880_loopbacks
13217 /* pcm configuration: identical with ALC880 */
13218 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13219 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13220 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13221 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13223 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13227 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13228 /* NID is set in alc_build_pcms */
13230 .open = alc880_playback_pcm_open,
13231 .prepare = alc880_playback_pcm_prepare,
13232 .cleanup = alc880_playback_pcm_cleanup
13236 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13240 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13241 /* NID is set in alc_build_pcms */
13245 * BIOS auto configuration
13247 static int alc269_parse_auto_config(struct hda_codec *codec)
13249 struct alc_spec *spec = codec->spec;
13251 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13253 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13258 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13261 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13265 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13267 if (spec->autocfg.dig_outs)
13268 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13270 if (spec->kctls.list)
13271 add_mixer(spec, spec->kctls.list);
13273 add_verb(spec, alc269_init_verbs);
13274 spec->num_mux_defs = 1;
13275 spec->input_mux = &spec->private_imux[0];
13276 /* set default input source */
13277 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13278 0, AC_VERB_SET_CONNECT_SEL,
13279 spec->input_mux->items[0].index);
13281 err = alc_auto_add_mic_boost(codec);
13285 if (!spec->cap_mixer && !spec->no_analog)
13286 set_capture_mixer(spec);
13288 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13293 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13294 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13295 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13298 /* init callback for auto-configuration model -- overriding the default init */
13299 static void alc269_auto_init(struct hda_codec *codec)
13301 struct alc_spec *spec = codec->spec;
13302 alc269_auto_init_multi_out(codec);
13303 alc269_auto_init_hp_out(codec);
13304 alc269_auto_init_analog_input(codec);
13305 if (spec->unsol_event)
13306 alc_inithook(codec);
13310 * configuration and preset
13312 static const char *alc269_models[ALC269_MODEL_LAST] = {
13313 [ALC269_BASIC] = "basic",
13314 [ALC269_QUANTA_FL1] = "quanta",
13315 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13316 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13317 [ALC269_FUJITSU] = "fujitsu",
13318 [ALC269_LIFEBOOK] = "lifebook"
13321 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13322 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13323 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13324 ALC269_ASUS_EEEPC_P703),
13325 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13326 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13327 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13328 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13329 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13330 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13331 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13332 ALC269_ASUS_EEEPC_P901),
13333 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13334 ALC269_ASUS_EEEPC_P901),
13335 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13336 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13337 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13341 static struct alc_config_preset alc269_presets[] = {
13343 .mixers = { alc269_base_mixer },
13344 .init_verbs = { alc269_init_verbs },
13345 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13346 .dac_nids = alc269_dac_nids,
13348 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13349 .channel_mode = alc269_modes,
13350 .input_mux = &alc269_capture_source,
13352 [ALC269_QUANTA_FL1] = {
13353 .mixers = { alc269_quanta_fl1_mixer },
13354 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13355 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13356 .dac_nids = alc269_dac_nids,
13358 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13359 .channel_mode = alc269_modes,
13360 .input_mux = &alc269_capture_source,
13361 .unsol_event = alc269_quanta_fl1_unsol_event,
13362 .init_hook = alc269_quanta_fl1_init_hook,
13364 [ALC269_ASUS_EEEPC_P703] = {
13365 .mixers = { alc269_eeepc_mixer },
13366 .cap_mixer = alc269_epc_capture_mixer,
13367 .init_verbs = { alc269_init_verbs,
13368 alc269_eeepc_amic_init_verbs },
13369 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13370 .dac_nids = alc269_dac_nids,
13372 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13373 .channel_mode = alc269_modes,
13374 .input_mux = &alc269_eeepc_amic_capture_source,
13375 .unsol_event = alc269_eeepc_amic_unsol_event,
13376 .init_hook = alc269_eeepc_amic_inithook,
13378 [ALC269_ASUS_EEEPC_P901] = {
13379 .mixers = { alc269_eeepc_mixer },
13380 .cap_mixer = alc269_epc_capture_mixer,
13381 .init_verbs = { alc269_init_verbs,
13382 alc269_eeepc_dmic_init_verbs },
13383 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13384 .dac_nids = alc269_dac_nids,
13386 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13387 .channel_mode = alc269_modes,
13388 .input_mux = &alc269_eeepc_dmic_capture_source,
13389 .unsol_event = alc269_eeepc_dmic_unsol_event,
13390 .init_hook = alc269_eeepc_dmic_inithook,
13392 [ALC269_FUJITSU] = {
13393 .mixers = { alc269_fujitsu_mixer },
13394 .cap_mixer = alc269_epc_capture_mixer,
13395 .init_verbs = { alc269_init_verbs,
13396 alc269_eeepc_dmic_init_verbs },
13397 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13398 .dac_nids = alc269_dac_nids,
13400 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13401 .channel_mode = alc269_modes,
13402 .input_mux = &alc269_eeepc_dmic_capture_source,
13403 .unsol_event = alc269_eeepc_dmic_unsol_event,
13404 .init_hook = alc269_eeepc_dmic_inithook,
13406 [ALC269_LIFEBOOK] = {
13407 .mixers = { alc269_lifebook_mixer },
13408 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13409 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13410 .dac_nids = alc269_dac_nids,
13412 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13413 .channel_mode = alc269_modes,
13414 .input_mux = &alc269_capture_source,
13415 .unsol_event = alc269_lifebook_unsol_event,
13416 .init_hook = alc269_lifebook_init_hook,
13420 static int patch_alc269(struct hda_codec *codec)
13422 struct alc_spec *spec;
13426 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13430 codec->spec = spec;
13432 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13434 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13438 if (board_config < 0) {
13439 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13441 board_config = ALC269_AUTO;
13444 if (board_config == ALC269_AUTO) {
13445 /* automatic parse from the BIOS config */
13446 err = alc269_parse_auto_config(codec);
13452 "hda_codec: Cannot set up configuration "
13453 "from BIOS. Using base mode...\n");
13454 board_config = ALC269_BASIC;
13458 err = snd_hda_attach_beep_device(codec, 0x1);
13464 if (board_config != ALC269_AUTO)
13465 setup_preset(spec, &alc269_presets[board_config]);
13467 if (codec->subsystem_id == 0x17aa3bf8) {
13468 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13469 * fix the sample rate of analog I/O to 44.1kHz
13471 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13472 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13474 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13475 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13477 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13478 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13480 spec->adc_nids = alc269_adc_nids;
13481 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13482 spec->capsrc_nids = alc269_capsrc_nids;
13483 if (!spec->cap_mixer)
13484 set_capture_mixer(spec);
13485 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13487 spec->vmaster_nid = 0x02;
13489 codec->patch_ops = alc_patch_ops;
13490 if (board_config == ALC269_AUTO)
13491 spec->init_hook = alc269_auto_init;
13492 #ifdef CONFIG_SND_HDA_POWER_SAVE
13493 if (!spec->loopback.amplist)
13494 spec->loopback.amplist = alc269_loopbacks;
13496 codec->proc_widget_hook = print_realtek_coef;
13502 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13506 * set the path ways for 2 channel output
13507 * need to set the codec line out and mic 1 pin widgets to inputs
13509 static struct hda_verb alc861_threestack_ch2_init[] = {
13510 /* set pin widget 1Ah (line in) for input */
13511 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13512 /* set pin widget 18h (mic1/2) for input, for mic also enable
13515 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13517 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13519 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13520 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13526 * need to set the codec line out and mic 1 pin widgets to outputs
13528 static struct hda_verb alc861_threestack_ch6_init[] = {
13529 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13530 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13531 /* set pin widget 18h (mic1) for output (CLFE)*/
13532 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13534 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13535 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13537 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13539 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13540 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13545 static struct hda_channel_mode alc861_threestack_modes[2] = {
13546 { 2, alc861_threestack_ch2_init },
13547 { 6, alc861_threestack_ch6_init },
13549 /* Set mic1 as input and unmute the mixer */
13550 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13551 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13552 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13555 /* Set mic1 as output and mute mixer */
13556 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13557 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13558 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13562 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13563 { 2, alc861_uniwill_m31_ch2_init },
13564 { 4, alc861_uniwill_m31_ch4_init },
13567 /* Set mic1 and line-in as input and unmute the mixer */
13568 static struct hda_verb alc861_asus_ch2_init[] = {
13569 /* set pin widget 1Ah (line in) for input */
13570 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13571 /* set pin widget 18h (mic1/2) for input, for mic also enable
13574 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13576 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13578 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13579 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13583 /* Set mic1 nad line-in as output and mute mixer */
13584 static struct hda_verb alc861_asus_ch6_init[] = {
13585 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13586 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13587 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13588 /* set pin widget 18h (mic1) for output (CLFE)*/
13589 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13590 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13591 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13592 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13594 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13596 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13597 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13602 static struct hda_channel_mode alc861_asus_modes[2] = {
13603 { 2, alc861_asus_ch2_init },
13604 { 6, alc861_asus_ch6_init },
13609 static struct snd_kcontrol_new alc861_base_mixer[] = {
13610 /* output mixer control */
13611 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13612 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13613 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13615 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13617 /*Input mixer control */
13618 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13619 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13620 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13621 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13622 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13623 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13625 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13632 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13633 /* output mixer control */
13634 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13635 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13636 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13637 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13638 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13640 /* Input mixer control */
13641 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13642 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13643 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13644 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13645 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13646 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13647 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13648 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13649 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13650 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13654 .name = "Channel Mode",
13655 .info = alc_ch_mode_info,
13656 .get = alc_ch_mode_get,
13657 .put = alc_ch_mode_put,
13658 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13663 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13664 /* output mixer control */
13665 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13667 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13672 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13673 /* output mixer control */
13674 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13675 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13676 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13677 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13678 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13680 /* Input mixer control */
13681 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13682 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13683 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13684 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13685 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13686 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13687 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13688 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13689 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13693 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13694 .name = "Channel Mode",
13695 .info = alc_ch_mode_info,
13696 .get = alc_ch_mode_get,
13697 .put = alc_ch_mode_put,
13698 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13703 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13704 /* output mixer control */
13705 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13706 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13707 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13708 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13709 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13711 /* Input mixer control */
13712 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13713 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13714 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13715 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13716 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13717 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13719 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13720 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13721 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13725 .name = "Channel Mode",
13726 .info = alc_ch_mode_info,
13727 .get = alc_ch_mode_get,
13728 .put = alc_ch_mode_put,
13729 .private_value = ARRAY_SIZE(alc861_asus_modes),
13734 /* additional mixer */
13735 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13736 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13737 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13742 * generic initialization of ADC, input mixers and output mixers
13744 static struct hda_verb alc861_base_init_verbs[] = {
13746 * Unmute ADC0 and set the default input to mic-in
13748 /* port-A for surround (rear panel) */
13749 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13750 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13751 /* port-B for mic-in (rear panel) with vref */
13752 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13753 /* port-C for line-in (rear panel) */
13754 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13755 /* port-D for Front */
13756 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13757 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13758 /* port-E for HP out (front panel) */
13759 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13760 /* route front PCM to HP */
13761 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13762 /* port-F for mic-in (front panel) with vref */
13763 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13764 /* port-G for CLFE (rear panel) */
13765 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13766 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13767 /* port-H for side (rear panel) */
13768 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13769 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13771 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13772 /* route front mic to ADC1*/
13773 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13774 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13776 /* Unmute DAC0~3 & spdif out*/
13777 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13778 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13779 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13780 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13781 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13783 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13784 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13785 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13786 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13787 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13789 /* Unmute Stereo Mixer 15 */
13790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13793 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13795 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13797 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13800 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13803 /* hp used DAC 3 (Front) */
13804 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13810 static struct hda_verb alc861_threestack_init_verbs[] = {
13812 * Unmute ADC0 and set the default input to mic-in
13814 /* port-A for surround (rear panel) */
13815 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13816 /* port-B for mic-in (rear panel) with vref */
13817 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13818 /* port-C for line-in (rear panel) */
13819 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13820 /* port-D for Front */
13821 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13822 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13823 /* port-E for HP out (front panel) */
13824 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13825 /* route front PCM to HP */
13826 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13827 /* port-F for mic-in (front panel) with vref */
13828 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13829 /* port-G for CLFE (rear panel) */
13830 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13831 /* port-H for side (rear panel) */
13832 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13834 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13835 /* route front mic to ADC1*/
13836 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13837 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13838 /* Unmute DAC0~3 & spdif out*/
13839 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13840 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13841 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13842 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13845 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13846 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13847 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13848 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13849 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13851 /* Unmute Stereo Mixer 15 */
13852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13855 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13857 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13858 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13859 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13860 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13861 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13862 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13864 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13865 /* hp used DAC 3 (Front) */
13866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13871 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13873 * Unmute ADC0 and set the default input to mic-in
13875 /* port-A for surround (rear panel) */
13876 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13877 /* port-B for mic-in (rear panel) with vref */
13878 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13879 /* port-C for line-in (rear panel) */
13880 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13881 /* port-D for Front */
13882 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13883 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13884 /* port-E for HP out (front panel) */
13885 /* this has to be set to VREF80 */
13886 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13887 /* route front PCM to HP */
13888 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13889 /* port-F for mic-in (front panel) with vref */
13890 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13891 /* port-G for CLFE (rear panel) */
13892 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13893 /* port-H for side (rear panel) */
13894 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13896 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13897 /* route front mic to ADC1*/
13898 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13899 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13900 /* Unmute DAC0~3 & spdif out*/
13901 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13902 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13903 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13904 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13907 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13908 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13909 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13910 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13911 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13913 /* Unmute Stereo Mixer 15 */
13914 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13916 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13917 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13919 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13921 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13922 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13923 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13924 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13925 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13926 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13927 /* hp used DAC 3 (Front) */
13928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13929 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13933 static struct hda_verb alc861_asus_init_verbs[] = {
13935 * Unmute ADC0 and set the default input to mic-in
13937 /* port-A for surround (rear panel)
13938 * according to codec#0 this is the HP jack
13940 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13941 /* route front PCM to HP */
13942 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13943 /* port-B for mic-in (rear panel) with vref */
13944 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13945 /* port-C for line-in (rear panel) */
13946 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13947 /* port-D for Front */
13948 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13949 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13950 /* port-E for HP out (front panel) */
13951 /* this has to be set to VREF80 */
13952 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13953 /* route front PCM to HP */
13954 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13955 /* port-F for mic-in (front panel) with vref */
13956 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13957 /* port-G for CLFE (rear panel) */
13958 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13959 /* port-H for side (rear panel) */
13960 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13962 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13963 /* route front mic to ADC1*/
13964 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13965 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13966 /* Unmute DAC0~3 & spdif out*/
13967 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13968 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13969 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13970 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13971 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13972 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13973 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13974 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13975 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13978 /* Unmute Stereo Mixer 15 */
13979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13980 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13981 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13982 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13984 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13985 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13986 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13988 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13989 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13990 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13991 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13992 /* hp used DAC 3 (Front) */
13993 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13998 /* additional init verbs for ASUS laptops */
13999 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14000 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14001 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14006 * generic initialization of ADC, input mixers and output mixers
14008 static struct hda_verb alc861_auto_init_verbs[] = {
14010 * Unmute ADC0 and set the default input to mic-in
14012 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14013 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14015 /* Unmute DAC0~3 & spdif out*/
14016 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14017 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14018 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14019 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14022 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14023 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14024 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14025 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14026 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14028 /* Unmute Stereo Mixer 15 */
14029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14032 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14034 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14035 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14036 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14037 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14040 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14041 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14045 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14046 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14047 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14048 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14049 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14050 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14052 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14057 static struct hda_verb alc861_toshiba_init_verbs[] = {
14058 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14063 /* toggle speaker-output according to the hp-jack state */
14064 static void alc861_toshiba_automute(struct hda_codec *codec)
14066 unsigned int present;
14068 present = snd_hda_codec_read(codec, 0x0f, 0,
14069 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14070 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14071 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14072 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14073 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14076 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14079 if ((res >> 26) == ALC880_HP_EVENT)
14080 alc861_toshiba_automute(codec);
14083 /* pcm configuration: identical with ALC880 */
14084 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14085 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14086 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14087 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14090 #define ALC861_DIGOUT_NID 0x07
14092 static struct hda_channel_mode alc861_8ch_modes[1] = {
14096 static hda_nid_t alc861_dac_nids[4] = {
14097 /* front, surround, clfe, side */
14098 0x03, 0x06, 0x05, 0x04
14101 static hda_nid_t alc660_dac_nids[3] = {
14102 /* front, clfe, surround */
14106 static hda_nid_t alc861_adc_nids[1] = {
14111 static struct hda_input_mux alc861_capture_source = {
14115 { "Front Mic", 0x3 },
14122 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14124 struct alc_spec *spec = codec->spec;
14125 hda_nid_t mix, srcs[5];
14128 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14130 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14133 for (i = 0; i < num; i++) {
14135 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14136 if (type != AC_WID_AUD_OUT)
14138 for (j = 0; j < spec->multiout.num_dacs; j++)
14139 if (spec->multiout.dac_nids[j] == srcs[i])
14141 if (j >= spec->multiout.num_dacs)
14147 /* fill in the dac_nids table from the parsed pin configuration */
14148 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14149 const struct auto_pin_cfg *cfg)
14151 struct alc_spec *spec = codec->spec;
14153 hda_nid_t nid, dac;
14155 spec->multiout.dac_nids = spec->private_dac_nids;
14156 for (i = 0; i < cfg->line_outs; i++) {
14157 nid = cfg->line_out_pins[i];
14158 dac = alc861_look_for_dac(codec, nid);
14161 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14166 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14167 hda_nid_t nid, unsigned int chs)
14170 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
14171 return add_control(codec->spec, ALC_CTL_WIDGET_MUTE, name,
14172 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14175 /* add playback controls from the parsed DAC table */
14176 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14177 const struct auto_pin_cfg *cfg)
14179 struct alc_spec *spec = codec->spec;
14180 static const char *chname[4] = {
14181 "Front", "Surround", NULL /*CLFE*/, "Side"
14186 if (cfg->line_outs == 1) {
14187 const char *pfx = NULL;
14190 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14193 nid = spec->multiout.dac_nids[0];
14194 return alc861_create_out_sw(codec, pfx, nid, 3);
14198 for (i = 0; i < cfg->line_outs; i++) {
14199 nid = spec->multiout.dac_nids[i];
14204 err = alc861_create_out_sw(codec, "Center", nid, 1);
14207 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14211 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14219 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14221 struct alc_spec *spec = codec->spec;
14228 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14229 nid = alc861_look_for_dac(codec, pin);
14231 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14234 spec->multiout.hp_nid = nid;
14240 /* create playback/capture controls for input pins */
14241 static int alc861_auto_create_analog_input_ctls(struct hda_codec *codec,
14242 const struct auto_pin_cfg *cfg)
14244 struct alc_spec *spec = codec->spec;
14245 struct hda_input_mux *imux = &spec->private_imux[0];
14246 int i, err, idx, idx1;
14248 for (i = 0; i < AUTO_PIN_LAST; i++) {
14249 switch (cfg->input_pins[i]) {
14252 idx = 2; /* Line In */
14256 idx = 2; /* Line In */
14260 idx = 1; /* Mic In */
14264 idx = 1; /* Mic In */
14274 err = new_analog_input(spec, cfg->input_pins[i],
14275 auto_pin_cfg_labels[i], idx, 0x15);
14279 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14280 imux->items[imux->num_items].index = idx1;
14286 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14288 int pin_type, hda_nid_t dac)
14290 hda_nid_t mix, srcs[5];
14293 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14295 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14297 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14299 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14302 for (i = 0; i < num; i++) {
14304 if (srcs[i] == dac || srcs[i] == 0x15)
14305 mute = AMP_IN_UNMUTE(i);
14307 mute = AMP_IN_MUTE(i);
14308 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14313 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14315 struct alc_spec *spec = codec->spec;
14318 for (i = 0; i < spec->autocfg.line_outs; i++) {
14319 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14320 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14322 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14323 spec->multiout.dac_nids[i]);
14327 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14329 struct alc_spec *spec = codec->spec;
14332 pin = spec->autocfg.hp_pins[0];
14334 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14335 spec->multiout.hp_nid);
14336 pin = spec->autocfg.speaker_pins[0];
14338 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT,
14339 spec->multiout.dac_nids[0]);
14342 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14344 struct alc_spec *spec = codec->spec;
14347 for (i = 0; i < AUTO_PIN_LAST; i++) {
14348 hda_nid_t nid = spec->autocfg.input_pins[i];
14349 if (nid >= 0x0c && nid <= 0x11)
14350 alc_set_input_pin(codec, nid, i);
14354 /* parse the BIOS configuration and set up the alc_spec */
14355 /* return 1 if successful, 0 if the proper config is not found,
14356 * or a negative error code
14358 static int alc861_parse_auto_config(struct hda_codec *codec)
14360 struct alc_spec *spec = codec->spec;
14362 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14364 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14368 if (!spec->autocfg.line_outs)
14369 return 0; /* can't find valid BIOS pin config */
14371 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14374 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14377 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14380 err = alc861_auto_create_analog_input_ctls(codec, &spec->autocfg);
14384 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14386 if (spec->autocfg.dig_outs)
14387 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14389 if (spec->kctls.list)
14390 add_mixer(spec, spec->kctls.list);
14392 add_verb(spec, alc861_auto_init_verbs);
14394 spec->num_mux_defs = 1;
14395 spec->input_mux = &spec->private_imux[0];
14397 spec->adc_nids = alc861_adc_nids;
14398 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14399 set_capture_mixer(spec);
14401 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14406 /* additional initialization for auto-configuration model */
14407 static void alc861_auto_init(struct hda_codec *codec)
14409 struct alc_spec *spec = codec->spec;
14410 alc861_auto_init_multi_out(codec);
14411 alc861_auto_init_hp_out(codec);
14412 alc861_auto_init_analog_input(codec);
14413 if (spec->unsol_event)
14414 alc_inithook(codec);
14417 #ifdef CONFIG_SND_HDA_POWER_SAVE
14418 static struct hda_amp_list alc861_loopbacks[] = {
14419 { 0x15, HDA_INPUT, 0 },
14420 { 0x15, HDA_INPUT, 1 },
14421 { 0x15, HDA_INPUT, 2 },
14422 { 0x15, HDA_INPUT, 3 },
14429 * configuration and preset
14431 static const char *alc861_models[ALC861_MODEL_LAST] = {
14432 [ALC861_3ST] = "3stack",
14433 [ALC660_3ST] = "3stack-660",
14434 [ALC861_3ST_DIG] = "3stack-dig",
14435 [ALC861_6ST_DIG] = "6stack-dig",
14436 [ALC861_UNIWILL_M31] = "uniwill-m31",
14437 [ALC861_TOSHIBA] = "toshiba",
14438 [ALC861_ASUS] = "asus",
14439 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14440 [ALC861_AUTO] = "auto",
14443 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14444 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14445 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14446 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14447 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14448 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14449 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14450 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14451 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14452 * Any other models that need this preset?
14454 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14455 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14456 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14457 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14458 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14459 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14460 /* FIXME: the below seems conflict */
14461 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14462 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14463 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14467 static struct alc_config_preset alc861_presets[] = {
14469 .mixers = { alc861_3ST_mixer },
14470 .init_verbs = { alc861_threestack_init_verbs },
14471 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14472 .dac_nids = alc861_dac_nids,
14473 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14474 .channel_mode = alc861_threestack_modes,
14476 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14477 .adc_nids = alc861_adc_nids,
14478 .input_mux = &alc861_capture_source,
14480 [ALC861_3ST_DIG] = {
14481 .mixers = { alc861_base_mixer },
14482 .init_verbs = { alc861_threestack_init_verbs },
14483 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14484 .dac_nids = alc861_dac_nids,
14485 .dig_out_nid = ALC861_DIGOUT_NID,
14486 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14487 .channel_mode = alc861_threestack_modes,
14489 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14490 .adc_nids = alc861_adc_nids,
14491 .input_mux = &alc861_capture_source,
14493 [ALC861_6ST_DIG] = {
14494 .mixers = { alc861_base_mixer },
14495 .init_verbs = { alc861_base_init_verbs },
14496 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14497 .dac_nids = alc861_dac_nids,
14498 .dig_out_nid = ALC861_DIGOUT_NID,
14499 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14500 .channel_mode = alc861_8ch_modes,
14501 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14502 .adc_nids = alc861_adc_nids,
14503 .input_mux = &alc861_capture_source,
14506 .mixers = { alc861_3ST_mixer },
14507 .init_verbs = { alc861_threestack_init_verbs },
14508 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14509 .dac_nids = alc660_dac_nids,
14510 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14511 .channel_mode = alc861_threestack_modes,
14513 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14514 .adc_nids = alc861_adc_nids,
14515 .input_mux = &alc861_capture_source,
14517 [ALC861_UNIWILL_M31] = {
14518 .mixers = { alc861_uniwill_m31_mixer },
14519 .init_verbs = { alc861_uniwill_m31_init_verbs },
14520 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14521 .dac_nids = alc861_dac_nids,
14522 .dig_out_nid = ALC861_DIGOUT_NID,
14523 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14524 .channel_mode = alc861_uniwill_m31_modes,
14526 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14527 .adc_nids = alc861_adc_nids,
14528 .input_mux = &alc861_capture_source,
14530 [ALC861_TOSHIBA] = {
14531 .mixers = { alc861_toshiba_mixer },
14532 .init_verbs = { alc861_base_init_verbs,
14533 alc861_toshiba_init_verbs },
14534 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14535 .dac_nids = alc861_dac_nids,
14536 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14537 .channel_mode = alc883_3ST_2ch_modes,
14538 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14539 .adc_nids = alc861_adc_nids,
14540 .input_mux = &alc861_capture_source,
14541 .unsol_event = alc861_toshiba_unsol_event,
14542 .init_hook = alc861_toshiba_automute,
14545 .mixers = { alc861_asus_mixer },
14546 .init_verbs = { alc861_asus_init_verbs },
14547 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14548 .dac_nids = alc861_dac_nids,
14549 .dig_out_nid = ALC861_DIGOUT_NID,
14550 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14551 .channel_mode = alc861_asus_modes,
14554 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14555 .adc_nids = alc861_adc_nids,
14556 .input_mux = &alc861_capture_source,
14558 [ALC861_ASUS_LAPTOP] = {
14559 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14560 .init_verbs = { alc861_asus_init_verbs,
14561 alc861_asus_laptop_init_verbs },
14562 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14563 .dac_nids = alc861_dac_nids,
14564 .dig_out_nid = ALC861_DIGOUT_NID,
14565 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14566 .channel_mode = alc883_3ST_2ch_modes,
14568 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14569 .adc_nids = alc861_adc_nids,
14570 .input_mux = &alc861_capture_source,
14575 static int patch_alc861(struct hda_codec *codec)
14577 struct alc_spec *spec;
14581 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14585 codec->spec = spec;
14587 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14591 if (board_config < 0) {
14592 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14594 board_config = ALC861_AUTO;
14597 if (board_config == ALC861_AUTO) {
14598 /* automatic parse from the BIOS config */
14599 err = alc861_parse_auto_config(codec);
14605 "hda_codec: Cannot set up configuration "
14606 "from BIOS. Using base mode...\n");
14607 board_config = ALC861_3ST_DIG;
14611 err = snd_hda_attach_beep_device(codec, 0x23);
14617 if (board_config != ALC861_AUTO)
14618 setup_preset(spec, &alc861_presets[board_config]);
14620 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14621 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14623 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14624 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14626 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14628 spec->vmaster_nid = 0x03;
14630 codec->patch_ops = alc_patch_ops;
14631 if (board_config == ALC861_AUTO)
14632 spec->init_hook = alc861_auto_init;
14633 #ifdef CONFIG_SND_HDA_POWER_SAVE
14634 if (!spec->loopback.amplist)
14635 spec->loopback.amplist = alc861_loopbacks;
14637 codec->proc_widget_hook = print_realtek_coef;
14643 * ALC861-VD support
14647 * In addition, an independent DAC
14649 #define ALC861VD_DIGOUT_NID 0x06
14651 static hda_nid_t alc861vd_dac_nids[4] = {
14652 /* front, surr, clfe, side surr */
14653 0x02, 0x03, 0x04, 0x05
14656 /* dac_nids for ALC660vd are in a different order - according to
14657 * Realtek's driver.
14658 * This should probably result in a different mixer for 6stack models
14659 * of ALC660vd codecs, but for now there is only 3stack mixer
14660 * - and it is the same as in 861vd.
14661 * adc_nids in ALC660vd are (is) the same as in 861vd
14663 static hda_nid_t alc660vd_dac_nids[3] = {
14664 /* front, rear, clfe, rear_surr */
14668 static hda_nid_t alc861vd_adc_nids[1] = {
14673 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14676 /* FIXME: should be a matrix-type input source selection */
14677 static struct hda_input_mux alc861vd_capture_source = {
14681 { "Front Mic", 0x1 },
14687 static struct hda_input_mux alc861vd_dallas_capture_source = {
14690 { "Ext Mic", 0x0 },
14691 { "Int Mic", 0x1 },
14695 static struct hda_input_mux alc861vd_hp_capture_source = {
14698 { "Front Mic", 0x0 },
14699 { "ATAPI Mic", 0x1 },
14706 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14713 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14714 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14715 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14716 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14717 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14724 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14725 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14726 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14727 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14728 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14732 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14733 { 6, alc861vd_6stack_ch6_init },
14734 { 8, alc861vd_6stack_ch8_init },
14737 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14739 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14740 .name = "Channel Mode",
14741 .info = alc_ch_mode_info,
14742 .get = alc_ch_mode_get,
14743 .put = alc_ch_mode_put,
14748 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14749 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14751 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14752 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14753 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14755 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14756 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14758 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14760 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14762 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14763 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14765 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14766 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14768 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14770 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14771 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14772 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14774 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14778 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14779 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14781 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14782 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14787 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14788 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14789 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14791 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14797 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14798 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14801 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14802 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14810 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14811 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14812 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14813 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14815 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14821 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14822 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14825 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14826 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14831 /* Pin assignment: Speaker=0x14, HP = 0x15,
14832 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14834 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14835 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14836 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14837 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14838 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14839 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14840 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14841 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14842 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14843 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14844 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14848 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14849 * Front Mic=0x18, ATAPI Mic = 0x19,
14851 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14852 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14853 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14854 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14855 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14856 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14857 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14858 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14859 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14865 * generic initialization of ADC, input mixers and output mixers
14867 static struct hda_verb alc861vd_volume_init_verbs[] = {
14869 * Unmute ADC0 and set the default input to mic-in
14871 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14874 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14875 * the analog-loopback mixer widget
14877 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14881 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14882 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14884 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14888 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14891 * Set up output mixers (0x02 - 0x05)
14893 /* set vol=0 to output mixers */
14894 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14895 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14896 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14897 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14899 /* set up input amps for analog loopback */
14900 /* Amp Indices: DAC = 0, mixer = 1 */
14901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14903 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14904 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14905 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14906 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14907 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14908 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14914 * 3-stack pin configuration:
14915 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14917 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14919 * Set pin mode and muting
14921 /* set front pin widgets 0x14 for output */
14922 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14923 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14924 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14926 /* Mic (rear) pin: input vref at 80% */
14927 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14928 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14929 /* Front Mic pin: input vref at 80% */
14930 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14931 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14932 /* Line In pin: input */
14933 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14934 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14935 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14936 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14937 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14938 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14939 /* CD pin widget for input */
14940 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14946 * 6-stack pin configuration:
14948 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14950 * Set pin mode and muting
14952 /* set front pin widgets 0x14 for output */
14953 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14954 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14955 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14957 /* Rear Pin: output 1 (0x0d) */
14958 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14960 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14961 /* CLFE Pin: output 2 (0x0e) */
14962 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14963 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14964 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14965 /* Side Pin: output 3 (0x0f) */
14966 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14967 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14968 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14970 /* Mic (rear) pin: input vref at 80% */
14971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14973 /* Front Mic pin: input vref at 80% */
14974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14976 /* Line In pin: input */
14977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14979 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14982 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14983 /* CD pin widget for input */
14984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14989 static struct hda_verb alc861vd_eapd_verbs[] = {
14990 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14994 static struct hda_verb alc660vd_eapd_verbs[] = {
14995 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14996 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15000 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15004 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15005 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15009 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15011 unsigned int present;
15012 unsigned char bits;
15014 present = snd_hda_codec_read(codec, 0x18, 0,
15015 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15016 bits = present ? HDA_AMP_MUTE : 0;
15017 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15018 HDA_AMP_MUTE, bits);
15021 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15023 struct alc_spec *spec = codec->spec;
15025 spec->autocfg.hp_pins[0] = 0x1b;
15026 spec->autocfg.speaker_pins[0] = 0x14;
15027 alc_automute_amp(codec);
15028 alc861vd_lenovo_mic_automute(codec);
15031 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15034 switch (res >> 26) {
15035 case ALC880_MIC_EVENT:
15036 alc861vd_lenovo_mic_automute(codec);
15039 alc_automute_amp_unsol_event(codec, res);
15044 static struct hda_verb alc861vd_dallas_verbs[] = {
15045 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15046 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15047 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15048 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15056 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15057 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15060 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15062 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15063 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15065 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15066 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15072 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15073 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15074 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15075 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15082 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15083 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15084 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15089 /* toggle speaker-output according to the hp-jack state */
15090 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15092 struct alc_spec *spec = codec->spec;
15094 spec->autocfg.hp_pins[0] = 0x15;
15095 spec->autocfg.speaker_pins[0] = 0x14;
15096 alc_automute_amp(codec);
15099 #ifdef CONFIG_SND_HDA_POWER_SAVE
15100 #define alc861vd_loopbacks alc880_loopbacks
15103 /* pcm configuration: identical with ALC880 */
15104 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15105 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15106 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15107 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15110 * configuration and preset
15112 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15113 [ALC660VD_3ST] = "3stack-660",
15114 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15115 [ALC660VD_ASUS_V1S] = "asus-v1s",
15116 [ALC861VD_3ST] = "3stack",
15117 [ALC861VD_3ST_DIG] = "3stack-digout",
15118 [ALC861VD_6ST_DIG] = "6stack-digout",
15119 [ALC861VD_LENOVO] = "lenovo",
15120 [ALC861VD_DALLAS] = "dallas",
15121 [ALC861VD_HP] = "hp",
15122 [ALC861VD_AUTO] = "auto",
15125 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15126 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15127 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15128 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15129 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15130 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15131 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15132 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15133 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15134 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15135 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15136 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15137 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15138 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15139 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15140 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15144 static struct alc_config_preset alc861vd_presets[] = {
15146 .mixers = { alc861vd_3st_mixer },
15147 .init_verbs = { alc861vd_volume_init_verbs,
15148 alc861vd_3stack_init_verbs },
15149 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15150 .dac_nids = alc660vd_dac_nids,
15151 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15152 .channel_mode = alc861vd_3stack_2ch_modes,
15153 .input_mux = &alc861vd_capture_source,
15155 [ALC660VD_3ST_DIG] = {
15156 .mixers = { alc861vd_3st_mixer },
15157 .init_verbs = { alc861vd_volume_init_verbs,
15158 alc861vd_3stack_init_verbs },
15159 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15160 .dac_nids = alc660vd_dac_nids,
15161 .dig_out_nid = ALC861VD_DIGOUT_NID,
15162 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15163 .channel_mode = alc861vd_3stack_2ch_modes,
15164 .input_mux = &alc861vd_capture_source,
15167 .mixers = { alc861vd_3st_mixer },
15168 .init_verbs = { alc861vd_volume_init_verbs,
15169 alc861vd_3stack_init_verbs },
15170 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15171 .dac_nids = alc861vd_dac_nids,
15172 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15173 .channel_mode = alc861vd_3stack_2ch_modes,
15174 .input_mux = &alc861vd_capture_source,
15176 [ALC861VD_3ST_DIG] = {
15177 .mixers = { alc861vd_3st_mixer },
15178 .init_verbs = { alc861vd_volume_init_verbs,
15179 alc861vd_3stack_init_verbs },
15180 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15181 .dac_nids = alc861vd_dac_nids,
15182 .dig_out_nid = ALC861VD_DIGOUT_NID,
15183 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15184 .channel_mode = alc861vd_3stack_2ch_modes,
15185 .input_mux = &alc861vd_capture_source,
15187 [ALC861VD_6ST_DIG] = {
15188 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15189 .init_verbs = { alc861vd_volume_init_verbs,
15190 alc861vd_6stack_init_verbs },
15191 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15192 .dac_nids = alc861vd_dac_nids,
15193 .dig_out_nid = ALC861VD_DIGOUT_NID,
15194 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15195 .channel_mode = alc861vd_6stack_modes,
15196 .input_mux = &alc861vd_capture_source,
15198 [ALC861VD_LENOVO] = {
15199 .mixers = { alc861vd_lenovo_mixer },
15200 .init_verbs = { alc861vd_volume_init_verbs,
15201 alc861vd_3stack_init_verbs,
15202 alc861vd_eapd_verbs,
15203 alc861vd_lenovo_unsol_verbs },
15204 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15205 .dac_nids = alc660vd_dac_nids,
15206 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15207 .channel_mode = alc861vd_3stack_2ch_modes,
15208 .input_mux = &alc861vd_capture_source,
15209 .unsol_event = alc861vd_lenovo_unsol_event,
15210 .init_hook = alc861vd_lenovo_init_hook,
15212 [ALC861VD_DALLAS] = {
15213 .mixers = { alc861vd_dallas_mixer },
15214 .init_verbs = { alc861vd_dallas_verbs },
15215 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15216 .dac_nids = alc861vd_dac_nids,
15217 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15218 .channel_mode = alc861vd_3stack_2ch_modes,
15219 .input_mux = &alc861vd_dallas_capture_source,
15220 .unsol_event = alc_automute_amp_unsol_event,
15221 .init_hook = alc861vd_dallas_init_hook,
15224 .mixers = { alc861vd_hp_mixer },
15225 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15226 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15227 .dac_nids = alc861vd_dac_nids,
15228 .dig_out_nid = ALC861VD_DIGOUT_NID,
15229 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15230 .channel_mode = alc861vd_3stack_2ch_modes,
15231 .input_mux = &alc861vd_hp_capture_source,
15232 .unsol_event = alc_automute_amp_unsol_event,
15233 .init_hook = alc861vd_dallas_init_hook,
15235 [ALC660VD_ASUS_V1S] = {
15236 .mixers = { alc861vd_lenovo_mixer },
15237 .init_verbs = { alc861vd_volume_init_verbs,
15238 alc861vd_3stack_init_verbs,
15239 alc861vd_eapd_verbs,
15240 alc861vd_lenovo_unsol_verbs },
15241 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15242 .dac_nids = alc660vd_dac_nids,
15243 .dig_out_nid = ALC861VD_DIGOUT_NID,
15244 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15245 .channel_mode = alc861vd_3stack_2ch_modes,
15246 .input_mux = &alc861vd_capture_source,
15247 .unsol_event = alc861vd_lenovo_unsol_event,
15248 .init_hook = alc861vd_lenovo_init_hook,
15253 * BIOS auto configuration
15255 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15256 hda_nid_t nid, int pin_type, int dac_idx)
15258 alc_set_pin_output(codec, nid, pin_type);
15261 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15263 struct alc_spec *spec = codec->spec;
15266 for (i = 0; i <= HDA_SIDE; i++) {
15267 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15268 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15270 alc861vd_auto_set_output_and_unmute(codec, nid,
15276 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15278 struct alc_spec *spec = codec->spec;
15281 pin = spec->autocfg.hp_pins[0];
15282 if (pin) /* connect to front and use dac 0 */
15283 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15284 pin = spec->autocfg.speaker_pins[0];
15286 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15289 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15290 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15292 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15294 struct alc_spec *spec = codec->spec;
15297 for (i = 0; i < AUTO_PIN_LAST; i++) {
15298 hda_nid_t nid = spec->autocfg.input_pins[i];
15299 if (alc861vd_is_input_pin(nid)) {
15300 alc_set_input_pin(codec, nid, i);
15301 if (nid != ALC861VD_PIN_CD_NID &&
15302 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15303 snd_hda_codec_write(codec, nid, 0,
15304 AC_VERB_SET_AMP_GAIN_MUTE,
15310 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15312 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15313 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15315 /* add playback controls from the parsed DAC table */
15316 /* Based on ALC880 version. But ALC861VD has separate,
15317 * different NIDs for mute/unmute switch and volume control */
15318 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15319 const struct auto_pin_cfg *cfg)
15322 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15323 hda_nid_t nid_v, nid_s;
15326 for (i = 0; i < cfg->line_outs; i++) {
15327 if (!spec->multiout.dac_nids[i])
15329 nid_v = alc861vd_idx_to_mixer_vol(
15331 spec->multiout.dac_nids[i]));
15332 nid_s = alc861vd_idx_to_mixer_switch(
15334 spec->multiout.dac_nids[i]));
15338 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15339 "Center Playback Volume",
15340 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15344 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15345 "LFE Playback Volume",
15346 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15350 err = add_control(spec, ALC_CTL_BIND_MUTE,
15351 "Center Playback Switch",
15352 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15356 err = add_control(spec, ALC_CTL_BIND_MUTE,
15357 "LFE Playback Switch",
15358 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15363 sprintf(name, "%s Playback Volume", chname[i]);
15364 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15365 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15369 sprintf(name, "%s Playback Switch", chname[i]);
15370 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15371 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15380 /* add playback controls for speaker and HP outputs */
15381 /* Based on ALC880 version. But ALC861VD has separate,
15382 * different NIDs for mute/unmute switch and volume control */
15383 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15384 hda_nid_t pin, const char *pfx)
15386 hda_nid_t nid_v, nid_s;
15393 if (alc880_is_fixed_pin(pin)) {
15394 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15395 /* specify the DAC as the extra output */
15396 if (!spec->multiout.hp_nid)
15397 spec->multiout.hp_nid = nid_v;
15399 spec->multiout.extra_out_nid[0] = nid_v;
15400 /* control HP volume/switch on the output mixer amp */
15401 nid_v = alc861vd_idx_to_mixer_vol(
15402 alc880_fixed_pin_idx(pin));
15403 nid_s = alc861vd_idx_to_mixer_switch(
15404 alc880_fixed_pin_idx(pin));
15406 sprintf(name, "%s Playback Volume", pfx);
15407 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15408 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15411 sprintf(name, "%s Playback Switch", pfx);
15412 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15413 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15416 } else if (alc880_is_multi_pin(pin)) {
15417 /* set manual connection */
15418 /* we have only a switch on HP-out PIN */
15419 sprintf(name, "%s Playback Switch", pfx);
15420 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15421 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15428 /* parse the BIOS configuration and set up the alc_spec
15429 * return 1 if successful, 0 if the proper config is not found,
15430 * or a negative error code
15431 * Based on ALC880 version - had to change it to override
15432 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15433 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15435 struct alc_spec *spec = codec->spec;
15437 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15439 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15443 if (!spec->autocfg.line_outs)
15444 return 0; /* can't find valid BIOS pin config */
15446 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15449 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15452 err = alc861vd_auto_create_extra_out(spec,
15453 spec->autocfg.speaker_pins[0],
15457 err = alc861vd_auto_create_extra_out(spec,
15458 spec->autocfg.hp_pins[0],
15462 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15466 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15468 if (spec->autocfg.dig_outs)
15469 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15471 if (spec->kctls.list)
15472 add_mixer(spec, spec->kctls.list);
15474 add_verb(spec, alc861vd_volume_init_verbs);
15476 spec->num_mux_defs = 1;
15477 spec->input_mux = &spec->private_imux[0];
15479 err = alc_auto_add_mic_boost(codec);
15483 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15488 /* additional initialization for auto-configuration model */
15489 static void alc861vd_auto_init(struct hda_codec *codec)
15491 struct alc_spec *spec = codec->spec;
15492 alc861vd_auto_init_multi_out(codec);
15493 alc861vd_auto_init_hp_out(codec);
15494 alc861vd_auto_init_analog_input(codec);
15495 alc861vd_auto_init_input_src(codec);
15496 if (spec->unsol_event)
15497 alc_inithook(codec);
15500 static int patch_alc861vd(struct hda_codec *codec)
15502 struct alc_spec *spec;
15503 int err, board_config;
15505 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15509 codec->spec = spec;
15511 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15515 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15516 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15518 board_config = ALC861VD_AUTO;
15521 if (board_config == ALC861VD_AUTO) {
15522 /* automatic parse from the BIOS config */
15523 err = alc861vd_parse_auto_config(codec);
15529 "hda_codec: Cannot set up configuration "
15530 "from BIOS. Using base mode...\n");
15531 board_config = ALC861VD_3ST;
15535 err = snd_hda_attach_beep_device(codec, 0x23);
15541 if (board_config != ALC861VD_AUTO)
15542 setup_preset(spec, &alc861vd_presets[board_config]);
15544 if (codec->vendor_id == 0x10ec0660) {
15545 /* always turn on EAPD */
15546 add_verb(spec, alc660vd_eapd_verbs);
15549 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15550 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15552 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15553 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15555 spec->adc_nids = alc861vd_adc_nids;
15556 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15557 spec->capsrc_nids = alc861vd_capsrc_nids;
15559 set_capture_mixer(spec);
15560 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15562 spec->vmaster_nid = 0x02;
15564 codec->patch_ops = alc_patch_ops;
15566 if (board_config == ALC861VD_AUTO)
15567 spec->init_hook = alc861vd_auto_init;
15568 #ifdef CONFIG_SND_HDA_POWER_SAVE
15569 if (!spec->loopback.amplist)
15570 spec->loopback.amplist = alc861vd_loopbacks;
15572 codec->proc_widget_hook = print_realtek_coef;
15580 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15581 * configuration. Each pin widget can choose any input DACs and a mixer.
15582 * Each ADC is connected from a mixer of all inputs. This makes possible
15583 * 6-channel independent captures.
15585 * In addition, an independent DAC for the multi-playback (not used in this
15588 #define ALC662_DIGOUT_NID 0x06
15589 #define ALC662_DIGIN_NID 0x0a
15591 static hda_nid_t alc662_dac_nids[4] = {
15592 /* front, rear, clfe, rear_surr */
15596 static hda_nid_t alc272_dac_nids[2] = {
15600 static hda_nid_t alc662_adc_nids[1] = {
15605 static hda_nid_t alc272_adc_nids[1] = {
15610 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15611 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15615 /* FIXME: should be a matrix-type input source selection */
15616 static struct hda_input_mux alc662_capture_source = {
15620 { "Front Mic", 0x1 },
15626 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15634 static struct hda_input_mux alc662_eeepc_capture_source = {
15642 static struct hda_input_mux alc663_capture_source = {
15646 { "Front Mic", 0x1 },
15651 static struct hda_input_mux alc663_m51va_capture_source = {
15654 { "Ext-Mic", 0x0 },
15659 #if 1 /* set to 0 for testing other input sources below */
15660 static struct hda_input_mux alc272_nc10_capture_source = {
15663 { "Autoselect Mic", 0x0 },
15664 { "Internal Mic", 0x1 },
15668 static struct hda_input_mux alc272_nc10_capture_source = {
15671 { "Autoselect Mic", 0x0 },
15672 { "Internal Mic", 0x1 },
15673 { "In-0x02", 0x2 },
15674 { "In-0x03", 0x3 },
15675 { "In-0x04", 0x4 },
15676 { "In-0x05", 0x5 },
15677 { "In-0x06", 0x6 },
15678 { "In-0x07", 0x7 },
15679 { "In-0x08", 0x8 },
15680 { "In-0x09", 0x9 },
15681 { "In-0x0a", 0x0a },
15682 { "In-0x0b", 0x0b },
15683 { "In-0x0c", 0x0c },
15684 { "In-0x0d", 0x0d },
15685 { "In-0x0e", 0x0e },
15686 { "In-0x0f", 0x0f },
15694 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15701 static struct hda_verb alc662_3ST_ch2_init[] = {
15702 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15703 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15712 static struct hda_verb alc662_3ST_ch6_init[] = {
15713 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15714 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15715 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15716 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15717 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15718 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15722 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15723 { 2, alc662_3ST_ch2_init },
15724 { 6, alc662_3ST_ch6_init },
15730 static struct hda_verb alc662_sixstack_ch6_init[] = {
15731 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15732 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15733 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15740 static struct hda_verb alc662_sixstack_ch8_init[] = {
15741 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15742 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15743 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15747 static struct hda_channel_mode alc662_5stack_modes[2] = {
15748 { 2, alc662_sixstack_ch6_init },
15749 { 6, alc662_sixstack_ch8_init },
15752 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15753 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15756 static struct snd_kcontrol_new alc662_base_mixer[] = {
15757 /* output mixer control */
15758 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15759 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15761 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15763 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15764 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15765 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15768 /*Input mixer control */
15769 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15770 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15771 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15772 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15773 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15774 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15775 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15776 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15780 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15781 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15782 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15783 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15784 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15785 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15786 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15787 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15788 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15790 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15791 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15795 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15796 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15797 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15798 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15799 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15800 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15801 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15802 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15803 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15804 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15805 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15806 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15807 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15808 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15809 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15810 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15811 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15812 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15816 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15817 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15818 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15819 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15820 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15821 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15822 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15823 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15829 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15830 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15831 ALC262_HIPPO_MASTER_SWITCH,
15833 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15834 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15835 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15837 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15838 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15839 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15843 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15844 ALC262_HIPPO_MASTER_SWITCH,
15845 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15846 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15847 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15848 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15849 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15850 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15851 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15852 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15853 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15857 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15858 .ops = &snd_hda_bind_vol,
15860 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15861 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15866 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15867 .ops = &snd_hda_bind_sw,
15869 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15870 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15875 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15876 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15877 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15878 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15879 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15883 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15884 .ops = &snd_hda_bind_sw,
15886 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15887 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15888 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15893 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15894 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15895 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15898 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15899 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15904 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15905 .ops = &snd_hda_bind_sw,
15907 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15908 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15909 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15914 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15915 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15916 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15917 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15918 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15919 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15920 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15924 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15925 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15926 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15927 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15930 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15931 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15935 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15936 .ops = &snd_hda_bind_vol,
15938 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15939 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15944 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15945 .ops = &snd_hda_bind_sw,
15947 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15948 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15953 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15954 HDA_BIND_VOL("Master Playback Volume",
15955 &alc663_asus_two_bind_master_vol),
15956 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15957 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15958 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15959 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15960 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15964 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15965 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15966 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15967 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15968 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15970 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15974 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15975 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15976 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15977 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15978 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15979 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15981 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15982 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15983 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15984 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15988 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15989 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15990 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15991 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15995 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15996 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15997 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15998 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16002 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16005 .name = "Channel Mode",
16006 .info = alc_ch_mode_info,
16007 .get = alc_ch_mode_get,
16008 .put = alc_ch_mode_put,
16013 static struct hda_verb alc662_init_verbs[] = {
16014 /* ADC: mute amp left and right */
16015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16016 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16017 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16026 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16028 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16030 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16032 /* Front Pin: output 0 (0x0c) */
16033 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16034 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16036 /* Rear Pin: output 1 (0x0d) */
16037 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16038 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16040 /* CLFE Pin: output 2 (0x0e) */
16041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16042 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16044 /* Mic (rear) pin: input vref at 80% */
16045 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16046 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16047 /* Front Mic pin: input vref at 80% */
16048 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16049 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16050 /* Line In pin: input */
16051 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16053 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16054 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16055 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16056 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16057 /* CD pin widget for input */
16058 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16060 /* FIXME: use matrix-type input source selection */
16061 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16063 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16066 /* always trun on EAPD */
16067 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16068 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16073 static struct hda_verb alc662_sue_init_verbs[] = {
16074 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16075 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16079 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16080 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16081 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16085 /* Set Unsolicited Event*/
16086 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16088 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16093 * generic initialization of ADC, input mixers and output mixers
16095 static struct hda_verb alc662_auto_init_verbs[] = {
16097 * Unmute ADC and set the default input to mic-in
16099 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16100 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16102 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16104 * Note: PASD motherboards uses the Line In 2 as the input for front
16105 * panel mic (mic 2)
16107 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16115 * Set up output mixers (0x0c - 0x0f)
16117 /* set vol=0 to output mixers */
16118 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16119 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16120 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16122 /* set up input amps for analog loopback */
16123 /* Amp Indices: DAC = 0, mixer = 1 */
16124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16132 /* FIXME: use matrix-type input source selection */
16133 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16135 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16136 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16140 /* additional verbs for ALC663 */
16141 static struct hda_verb alc663_auto_init_verbs[] = {
16142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16143 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16147 static struct hda_verb alc663_m51va_init_verbs[] = {
16148 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16149 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16150 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16151 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16152 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16154 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16155 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16156 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16160 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16161 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16162 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16163 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16165 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16166 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16167 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16171 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16172 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16173 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16174 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16175 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16179 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16183 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16185 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16188 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16189 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16190 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16194 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16195 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16196 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16197 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16198 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16204 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16205 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16206 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16210 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16211 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16212 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16213 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16214 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16217 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16219 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16220 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16221 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16222 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16226 static struct hda_verb alc663_g71v_init_verbs[] = {
16227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16228 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16229 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16231 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16232 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16233 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16235 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16236 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16237 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16241 static struct hda_verb alc663_g50v_init_verbs[] = {
16242 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16243 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16244 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16246 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16247 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16251 static struct hda_verb alc662_ecs_init_verbs[] = {
16252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16254 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16255 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16259 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16260 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16261 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16263 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16264 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16265 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16266 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16268 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16270 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16274 static struct hda_verb alc272_dell_init_verbs[] = {
16275 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16276 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16277 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16278 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16279 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16280 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16281 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16284 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16285 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16289 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16290 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16291 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16295 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16296 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16297 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16301 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16303 unsigned int present;
16304 unsigned char bits;
16306 present = snd_hda_codec_read(codec, 0x14, 0,
16307 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16308 bits = present ? HDA_AMP_MUTE : 0;
16309 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16310 HDA_AMP_MUTE, bits);
16313 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16315 unsigned int present;
16316 unsigned char bits;
16318 present = snd_hda_codec_read(codec, 0x1b, 0,
16319 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16320 bits = present ? HDA_AMP_MUTE : 0;
16321 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16322 HDA_AMP_MUTE, bits);
16323 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16324 HDA_AMP_MUTE, bits);
16327 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16330 if ((res >> 26) == ALC880_HP_EVENT)
16331 alc662_lenovo_101e_all_automute(codec);
16332 if ((res >> 26) == ALC880_FRONT_EVENT)
16333 alc662_lenovo_101e_ispeaker_automute(codec);
16336 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16338 unsigned int present;
16340 present = snd_hda_codec_read(codec, 0x18, 0,
16341 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16342 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16343 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16344 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16345 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16346 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16347 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16348 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16349 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16352 /* unsolicited event for HP jack sensing */
16353 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16356 if ((res >> 26) == ALC880_MIC_EVENT)
16357 alc662_eeepc_mic_automute(codec);
16359 alc262_hippo_unsol_event(codec, res);
16362 static void alc662_eeepc_inithook(struct hda_codec *codec)
16364 alc262_hippo1_init_hook(codec);
16365 alc662_eeepc_mic_automute(codec);
16368 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16370 struct alc_spec *spec = codec->spec;
16372 spec->autocfg.hp_pins[0] = 0x14;
16373 spec->autocfg.speaker_pins[0] = 0x1b;
16374 alc262_hippo_master_update(codec);
16377 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16379 unsigned int present;
16380 unsigned char bits;
16382 present = snd_hda_codec_read(codec, 0x21, 0,
16383 AC_VERB_GET_PIN_SENSE, 0)
16384 & AC_PINSENSE_PRESENCE;
16385 bits = present ? HDA_AMP_MUTE : 0;
16386 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16387 AMP_IN_MUTE(0), bits);
16388 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16389 AMP_IN_MUTE(0), bits);
16392 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16394 unsigned int present;
16395 unsigned char bits;
16397 present = snd_hda_codec_read(codec, 0x21, 0,
16398 AC_VERB_GET_PIN_SENSE, 0)
16399 & AC_PINSENSE_PRESENCE;
16400 bits = present ? HDA_AMP_MUTE : 0;
16401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16402 AMP_IN_MUTE(0), bits);
16403 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16404 AMP_IN_MUTE(0), bits);
16405 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16406 AMP_IN_MUTE(0), bits);
16407 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16408 AMP_IN_MUTE(0), bits);
16411 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16413 unsigned int present;
16414 unsigned char bits;
16416 present = snd_hda_codec_read(codec, 0x15, 0,
16417 AC_VERB_GET_PIN_SENSE, 0)
16418 & AC_PINSENSE_PRESENCE;
16419 bits = present ? HDA_AMP_MUTE : 0;
16420 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16421 AMP_IN_MUTE(0), bits);
16422 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16423 AMP_IN_MUTE(0), bits);
16424 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16425 AMP_IN_MUTE(0), bits);
16426 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16427 AMP_IN_MUTE(0), bits);
16430 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16432 unsigned int present;
16433 unsigned char bits;
16435 present = snd_hda_codec_read(codec, 0x1b, 0,
16436 AC_VERB_GET_PIN_SENSE, 0)
16437 & AC_PINSENSE_PRESENCE;
16438 bits = present ? 0 : PIN_OUT;
16439 snd_hda_codec_write(codec, 0x14, 0,
16440 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16443 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16445 unsigned int present1, present2;
16447 present1 = snd_hda_codec_read(codec, 0x21, 0,
16448 AC_VERB_GET_PIN_SENSE, 0)
16449 & AC_PINSENSE_PRESENCE;
16450 present2 = snd_hda_codec_read(codec, 0x15, 0,
16451 AC_VERB_GET_PIN_SENSE, 0)
16452 & AC_PINSENSE_PRESENCE;
16454 if (present1 || present2) {
16455 snd_hda_codec_write_cache(codec, 0x14, 0,
16456 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16458 snd_hda_codec_write_cache(codec, 0x14, 0,
16459 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16463 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16465 unsigned int present1, present2;
16467 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16468 AC_VERB_GET_PIN_SENSE, 0)
16469 & AC_PINSENSE_PRESENCE;
16470 present2 = snd_hda_codec_read(codec, 0x15, 0,
16471 AC_VERB_GET_PIN_SENSE, 0)
16472 & AC_PINSENSE_PRESENCE;
16474 if (present1 || present2) {
16475 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16476 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16477 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16478 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16480 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16481 AMP_IN_MUTE(0), 0);
16482 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16483 AMP_IN_MUTE(0), 0);
16487 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16489 unsigned int present;
16491 present = snd_hda_codec_read(codec, 0x18, 0,
16492 AC_VERB_GET_PIN_SENSE, 0)
16493 & AC_PINSENSE_PRESENCE;
16494 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16495 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16496 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16497 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16498 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16499 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16500 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16501 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16504 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16507 switch (res >> 26) {
16508 case ALC880_HP_EVENT:
16509 alc663_m51va_speaker_automute(codec);
16511 case ALC880_MIC_EVENT:
16512 alc663_m51va_mic_automute(codec);
16517 static void alc663_m51va_inithook(struct hda_codec *codec)
16519 alc663_m51va_speaker_automute(codec);
16520 alc663_m51va_mic_automute(codec);
16523 /* ***************** Mode1 ******************************/
16524 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16527 switch (res >> 26) {
16528 case ALC880_HP_EVENT:
16529 alc663_m51va_speaker_automute(codec);
16531 case ALC880_MIC_EVENT:
16532 alc662_eeepc_mic_automute(codec);
16537 static void alc663_mode1_inithook(struct hda_codec *codec)
16539 alc663_m51va_speaker_automute(codec);
16540 alc662_eeepc_mic_automute(codec);
16542 /* ***************** Mode2 ******************************/
16543 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16546 switch (res >> 26) {
16547 case ALC880_HP_EVENT:
16548 alc662_f5z_speaker_automute(codec);
16550 case ALC880_MIC_EVENT:
16551 alc662_eeepc_mic_automute(codec);
16556 static void alc662_mode2_inithook(struct hda_codec *codec)
16558 alc662_f5z_speaker_automute(codec);
16559 alc662_eeepc_mic_automute(codec);
16561 /* ***************** Mode3 ******************************/
16562 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16565 switch (res >> 26) {
16566 case ALC880_HP_EVENT:
16567 alc663_two_hp_m1_speaker_automute(codec);
16569 case ALC880_MIC_EVENT:
16570 alc662_eeepc_mic_automute(codec);
16575 static void alc663_mode3_inithook(struct hda_codec *codec)
16577 alc663_two_hp_m1_speaker_automute(codec);
16578 alc662_eeepc_mic_automute(codec);
16580 /* ***************** Mode4 ******************************/
16581 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16584 switch (res >> 26) {
16585 case ALC880_HP_EVENT:
16586 alc663_21jd_two_speaker_automute(codec);
16588 case ALC880_MIC_EVENT:
16589 alc662_eeepc_mic_automute(codec);
16594 static void alc663_mode4_inithook(struct hda_codec *codec)
16596 alc663_21jd_two_speaker_automute(codec);
16597 alc662_eeepc_mic_automute(codec);
16599 /* ***************** Mode5 ******************************/
16600 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16603 switch (res >> 26) {
16604 case ALC880_HP_EVENT:
16605 alc663_15jd_two_speaker_automute(codec);
16607 case ALC880_MIC_EVENT:
16608 alc662_eeepc_mic_automute(codec);
16613 static void alc663_mode5_inithook(struct hda_codec *codec)
16615 alc663_15jd_two_speaker_automute(codec);
16616 alc662_eeepc_mic_automute(codec);
16618 /* ***************** Mode6 ******************************/
16619 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16622 switch (res >> 26) {
16623 case ALC880_HP_EVENT:
16624 alc663_two_hp_m2_speaker_automute(codec);
16626 case ALC880_MIC_EVENT:
16627 alc662_eeepc_mic_automute(codec);
16632 static void alc663_mode6_inithook(struct hda_codec *codec)
16634 alc663_two_hp_m2_speaker_automute(codec);
16635 alc662_eeepc_mic_automute(codec);
16638 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16640 unsigned int present;
16641 unsigned char bits;
16643 present = snd_hda_codec_read(codec, 0x21, 0,
16644 AC_VERB_GET_PIN_SENSE, 0)
16645 & AC_PINSENSE_PRESENCE;
16646 bits = present ? HDA_AMP_MUTE : 0;
16647 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16648 HDA_AMP_MUTE, bits);
16649 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16650 HDA_AMP_MUTE, bits);
16653 static void alc663_g71v_front_automute(struct hda_codec *codec)
16655 unsigned int present;
16656 unsigned char bits;
16658 present = snd_hda_codec_read(codec, 0x15, 0,
16659 AC_VERB_GET_PIN_SENSE, 0)
16660 & AC_PINSENSE_PRESENCE;
16661 bits = present ? HDA_AMP_MUTE : 0;
16662 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16663 HDA_AMP_MUTE, bits);
16666 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16669 switch (res >> 26) {
16670 case ALC880_HP_EVENT:
16671 alc663_g71v_hp_automute(codec);
16673 case ALC880_FRONT_EVENT:
16674 alc663_g71v_front_automute(codec);
16676 case ALC880_MIC_EVENT:
16677 alc662_eeepc_mic_automute(codec);
16682 static void alc663_g71v_inithook(struct hda_codec *codec)
16684 alc663_g71v_front_automute(codec);
16685 alc663_g71v_hp_automute(codec);
16686 alc662_eeepc_mic_automute(codec);
16689 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16692 switch (res >> 26) {
16693 case ALC880_HP_EVENT:
16694 alc663_m51va_speaker_automute(codec);
16696 case ALC880_MIC_EVENT:
16697 alc662_eeepc_mic_automute(codec);
16702 static void alc663_g50v_inithook(struct hda_codec *codec)
16704 alc663_m51va_speaker_automute(codec);
16705 alc662_eeepc_mic_automute(codec);
16708 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16709 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16710 ALC262_HIPPO_MASTER_SWITCH,
16712 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16713 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16714 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16716 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16717 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16718 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16722 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16723 /* Master Playback automatically created from Speaker and Headphone */
16724 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16725 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16726 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16727 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16729 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16730 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16731 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16733 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16734 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16735 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16739 #ifdef CONFIG_SND_HDA_POWER_SAVE
16740 #define alc662_loopbacks alc880_loopbacks
16744 /* pcm configuration: identical with ALC880 */
16745 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16746 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16747 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16748 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16751 * configuration and preset
16753 static const char *alc662_models[ALC662_MODEL_LAST] = {
16754 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16755 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16756 [ALC662_3ST_6ch] = "3stack-6ch",
16757 [ALC662_5ST_DIG] = "6stack-dig",
16758 [ALC662_LENOVO_101E] = "lenovo-101e",
16759 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16760 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16761 [ALC662_ECS] = "ecs",
16762 [ALC663_ASUS_M51VA] = "m51va",
16763 [ALC663_ASUS_G71V] = "g71v",
16764 [ALC663_ASUS_H13] = "h13",
16765 [ALC663_ASUS_G50V] = "g50v",
16766 [ALC663_ASUS_MODE1] = "asus-mode1",
16767 [ALC662_ASUS_MODE2] = "asus-mode2",
16768 [ALC663_ASUS_MODE3] = "asus-mode3",
16769 [ALC663_ASUS_MODE4] = "asus-mode4",
16770 [ALC663_ASUS_MODE5] = "asus-mode5",
16771 [ALC663_ASUS_MODE6] = "asus-mode6",
16772 [ALC272_DELL] = "dell",
16773 [ALC272_DELL_ZM1] = "dell-zm1",
16774 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16775 [ALC662_AUTO] = "auto",
16778 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16779 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16780 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16781 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16782 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16783 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16784 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16785 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16786 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16787 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16788 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16789 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16790 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16791 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16792 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16793 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16794 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16795 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16796 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16797 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16798 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16799 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16800 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16801 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16802 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16803 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16804 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16805 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16806 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16807 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16808 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16809 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16810 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16811 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16812 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16813 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16814 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16815 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16816 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16817 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16818 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16819 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16820 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16821 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16822 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16823 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16824 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16825 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16826 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16827 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16828 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16829 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16830 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16831 ALC662_3ST_6ch_DIG),
16832 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16833 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16834 ALC662_3ST_6ch_DIG),
16835 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16836 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16837 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16838 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16839 ALC662_3ST_6ch_DIG),
16840 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16845 static struct alc_config_preset alc662_presets[] = {
16846 [ALC662_3ST_2ch_DIG] = {
16847 .mixers = { alc662_3ST_2ch_mixer },
16848 .init_verbs = { alc662_init_verbs },
16849 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16850 .dac_nids = alc662_dac_nids,
16851 .dig_out_nid = ALC662_DIGOUT_NID,
16852 .dig_in_nid = ALC662_DIGIN_NID,
16853 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16854 .channel_mode = alc662_3ST_2ch_modes,
16855 .input_mux = &alc662_capture_source,
16857 [ALC662_3ST_6ch_DIG] = {
16858 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16859 .init_verbs = { alc662_init_verbs },
16860 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16861 .dac_nids = alc662_dac_nids,
16862 .dig_out_nid = ALC662_DIGOUT_NID,
16863 .dig_in_nid = ALC662_DIGIN_NID,
16864 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16865 .channel_mode = alc662_3ST_6ch_modes,
16867 .input_mux = &alc662_capture_source,
16869 [ALC662_3ST_6ch] = {
16870 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16871 .init_verbs = { alc662_init_verbs },
16872 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16873 .dac_nids = alc662_dac_nids,
16874 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16875 .channel_mode = alc662_3ST_6ch_modes,
16877 .input_mux = &alc662_capture_source,
16879 [ALC662_5ST_DIG] = {
16880 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16881 .init_verbs = { alc662_init_verbs },
16882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16883 .dac_nids = alc662_dac_nids,
16884 .dig_out_nid = ALC662_DIGOUT_NID,
16885 .dig_in_nid = ALC662_DIGIN_NID,
16886 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16887 .channel_mode = alc662_5stack_modes,
16888 .input_mux = &alc662_capture_source,
16890 [ALC662_LENOVO_101E] = {
16891 .mixers = { alc662_lenovo_101e_mixer },
16892 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16893 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16894 .dac_nids = alc662_dac_nids,
16895 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16896 .channel_mode = alc662_3ST_2ch_modes,
16897 .input_mux = &alc662_lenovo_101e_capture_source,
16898 .unsol_event = alc662_lenovo_101e_unsol_event,
16899 .init_hook = alc662_lenovo_101e_all_automute,
16901 [ALC662_ASUS_EEEPC_P701] = {
16902 .mixers = { alc662_eeepc_p701_mixer },
16903 .init_verbs = { alc662_init_verbs,
16904 alc662_eeepc_sue_init_verbs },
16905 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16906 .dac_nids = alc662_dac_nids,
16907 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16908 .channel_mode = alc662_3ST_2ch_modes,
16909 .input_mux = &alc662_eeepc_capture_source,
16910 .unsol_event = alc662_eeepc_unsol_event,
16911 .init_hook = alc662_eeepc_inithook,
16913 [ALC662_ASUS_EEEPC_EP20] = {
16914 .mixers = { alc662_eeepc_ep20_mixer,
16915 alc662_chmode_mixer },
16916 .init_verbs = { alc662_init_verbs,
16917 alc662_eeepc_ep20_sue_init_verbs },
16918 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16919 .dac_nids = alc662_dac_nids,
16920 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16921 .channel_mode = alc662_3ST_6ch_modes,
16922 .input_mux = &alc662_lenovo_101e_capture_source,
16923 .unsol_event = alc662_eeepc_unsol_event,
16924 .init_hook = alc662_eeepc_ep20_inithook,
16927 .mixers = { alc662_ecs_mixer },
16928 .init_verbs = { alc662_init_verbs,
16929 alc662_ecs_init_verbs },
16930 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16931 .dac_nids = alc662_dac_nids,
16932 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16933 .channel_mode = alc662_3ST_2ch_modes,
16934 .input_mux = &alc662_eeepc_capture_source,
16935 .unsol_event = alc662_eeepc_unsol_event,
16936 .init_hook = alc662_eeepc_inithook,
16938 [ALC663_ASUS_M51VA] = {
16939 .mixers = { alc663_m51va_mixer },
16940 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16941 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16942 .dac_nids = alc662_dac_nids,
16943 .dig_out_nid = ALC662_DIGOUT_NID,
16944 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16945 .channel_mode = alc662_3ST_2ch_modes,
16946 .input_mux = &alc663_m51va_capture_source,
16947 .unsol_event = alc663_m51va_unsol_event,
16948 .init_hook = alc663_m51va_inithook,
16950 [ALC663_ASUS_G71V] = {
16951 .mixers = { alc663_g71v_mixer },
16952 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16953 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16954 .dac_nids = alc662_dac_nids,
16955 .dig_out_nid = ALC662_DIGOUT_NID,
16956 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16957 .channel_mode = alc662_3ST_2ch_modes,
16958 .input_mux = &alc662_eeepc_capture_source,
16959 .unsol_event = alc663_g71v_unsol_event,
16960 .init_hook = alc663_g71v_inithook,
16962 [ALC663_ASUS_H13] = {
16963 .mixers = { alc663_m51va_mixer },
16964 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16965 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16966 .dac_nids = alc662_dac_nids,
16967 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16968 .channel_mode = alc662_3ST_2ch_modes,
16969 .input_mux = &alc663_m51va_capture_source,
16970 .unsol_event = alc663_m51va_unsol_event,
16971 .init_hook = alc663_m51va_inithook,
16973 [ALC663_ASUS_G50V] = {
16974 .mixers = { alc663_g50v_mixer },
16975 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16976 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16977 .dac_nids = alc662_dac_nids,
16978 .dig_out_nid = ALC662_DIGOUT_NID,
16979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16980 .channel_mode = alc662_3ST_6ch_modes,
16981 .input_mux = &alc663_capture_source,
16982 .unsol_event = alc663_g50v_unsol_event,
16983 .init_hook = alc663_g50v_inithook,
16985 [ALC663_ASUS_MODE1] = {
16986 .mixers = { alc663_m51va_mixer },
16987 .cap_mixer = alc662_auto_capture_mixer,
16988 .init_verbs = { alc662_init_verbs,
16989 alc663_21jd_amic_init_verbs },
16990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16992 .dac_nids = alc662_dac_nids,
16993 .dig_out_nid = ALC662_DIGOUT_NID,
16994 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16995 .channel_mode = alc662_3ST_2ch_modes,
16996 .input_mux = &alc662_eeepc_capture_source,
16997 .unsol_event = alc663_mode1_unsol_event,
16998 .init_hook = alc663_mode1_inithook,
17000 [ALC662_ASUS_MODE2] = {
17001 .mixers = { alc662_1bjd_mixer },
17002 .cap_mixer = alc662_auto_capture_mixer,
17003 .init_verbs = { alc662_init_verbs,
17004 alc662_1bjd_amic_init_verbs },
17005 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17006 .dac_nids = alc662_dac_nids,
17007 .dig_out_nid = ALC662_DIGOUT_NID,
17008 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17009 .channel_mode = alc662_3ST_2ch_modes,
17010 .input_mux = &alc662_eeepc_capture_source,
17011 .unsol_event = alc662_mode2_unsol_event,
17012 .init_hook = alc662_mode2_inithook,
17014 [ALC663_ASUS_MODE3] = {
17015 .mixers = { alc663_two_hp_m1_mixer },
17016 .cap_mixer = alc662_auto_capture_mixer,
17017 .init_verbs = { alc662_init_verbs,
17018 alc663_two_hp_amic_m1_init_verbs },
17019 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17021 .dac_nids = alc662_dac_nids,
17022 .dig_out_nid = ALC662_DIGOUT_NID,
17023 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17024 .channel_mode = alc662_3ST_2ch_modes,
17025 .input_mux = &alc662_eeepc_capture_source,
17026 .unsol_event = alc663_mode3_unsol_event,
17027 .init_hook = alc663_mode3_inithook,
17029 [ALC663_ASUS_MODE4] = {
17030 .mixers = { alc663_asus_21jd_clfe_mixer },
17031 .cap_mixer = alc662_auto_capture_mixer,
17032 .init_verbs = { alc662_init_verbs,
17033 alc663_21jd_amic_init_verbs},
17034 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17036 .dac_nids = alc662_dac_nids,
17037 .dig_out_nid = ALC662_DIGOUT_NID,
17038 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17039 .channel_mode = alc662_3ST_2ch_modes,
17040 .input_mux = &alc662_eeepc_capture_source,
17041 .unsol_event = alc663_mode4_unsol_event,
17042 .init_hook = alc663_mode4_inithook,
17044 [ALC663_ASUS_MODE5] = {
17045 .mixers = { alc663_asus_15jd_clfe_mixer },
17046 .cap_mixer = alc662_auto_capture_mixer,
17047 .init_verbs = { alc662_init_verbs,
17048 alc663_15jd_amic_init_verbs },
17049 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17051 .dac_nids = alc662_dac_nids,
17052 .dig_out_nid = ALC662_DIGOUT_NID,
17053 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17054 .channel_mode = alc662_3ST_2ch_modes,
17055 .input_mux = &alc662_eeepc_capture_source,
17056 .unsol_event = alc663_mode5_unsol_event,
17057 .init_hook = alc663_mode5_inithook,
17059 [ALC663_ASUS_MODE6] = {
17060 .mixers = { alc663_two_hp_m2_mixer },
17061 .cap_mixer = alc662_auto_capture_mixer,
17062 .init_verbs = { alc662_init_verbs,
17063 alc663_two_hp_amic_m2_init_verbs },
17064 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17066 .dac_nids = alc662_dac_nids,
17067 .dig_out_nid = ALC662_DIGOUT_NID,
17068 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17069 .channel_mode = alc662_3ST_2ch_modes,
17070 .input_mux = &alc662_eeepc_capture_source,
17071 .unsol_event = alc663_mode6_unsol_event,
17072 .init_hook = alc663_mode6_inithook,
17075 .mixers = { alc663_m51va_mixer },
17076 .cap_mixer = alc272_auto_capture_mixer,
17077 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17078 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17079 .dac_nids = alc662_dac_nids,
17080 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17081 .adc_nids = alc272_adc_nids,
17082 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17083 .capsrc_nids = alc272_capsrc_nids,
17084 .channel_mode = alc662_3ST_2ch_modes,
17085 .input_mux = &alc663_m51va_capture_source,
17086 .unsol_event = alc663_m51va_unsol_event,
17087 .init_hook = alc663_m51va_inithook,
17089 [ALC272_DELL_ZM1] = {
17090 .mixers = { alc663_m51va_mixer },
17091 .cap_mixer = alc662_auto_capture_mixer,
17092 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17093 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17094 .dac_nids = alc662_dac_nids,
17095 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17096 .adc_nids = alc662_adc_nids,
17097 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
17098 .capsrc_nids = alc662_capsrc_nids,
17099 .channel_mode = alc662_3ST_2ch_modes,
17100 .input_mux = &alc663_m51va_capture_source,
17101 .unsol_event = alc663_m51va_unsol_event,
17102 .init_hook = alc663_m51va_inithook,
17104 [ALC272_SAMSUNG_NC10] = {
17105 .mixers = { alc272_nc10_mixer },
17106 .init_verbs = { alc662_init_verbs,
17107 alc663_21jd_amic_init_verbs },
17108 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17109 .dac_nids = alc272_dac_nids,
17110 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17111 .channel_mode = alc662_3ST_2ch_modes,
17112 .input_mux = &alc272_nc10_capture_source,
17113 .unsol_event = alc663_mode4_unsol_event,
17114 .init_hook = alc663_mode4_inithook,
17120 * BIOS auto configuration
17123 /* add playback controls from the parsed DAC table */
17124 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17125 const struct auto_pin_cfg *cfg)
17128 static const char *chname[4] = {
17129 "Front", "Surround", NULL /*CLFE*/, "Side"
17134 for (i = 0; i < cfg->line_outs; i++) {
17135 if (!spec->multiout.dac_nids[i])
17137 nid = alc880_idx_to_dac(i);
17140 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17141 "Center Playback Volume",
17142 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17146 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17147 "LFE Playback Volume",
17148 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17152 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17153 "Center Playback Switch",
17154 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17158 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17159 "LFE Playback Switch",
17160 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17165 sprintf(name, "%s Playback Volume", chname[i]);
17166 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17167 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17171 sprintf(name, "%s Playback Switch", chname[i]);
17172 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17173 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17182 /* add playback controls for speaker and HP outputs */
17183 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17194 /* ALC663 has a mono output pin on 0x17 */
17195 sprintf(name, "%s Playback Switch", pfx);
17196 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17197 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17201 if (alc880_is_fixed_pin(pin)) {
17202 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17203 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17204 /* specify the DAC as the extra output */
17205 if (!spec->multiout.hp_nid)
17206 spec->multiout.hp_nid = nid;
17208 spec->multiout.extra_out_nid[0] = nid;
17209 /* control HP volume/switch on the output mixer amp */
17210 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17211 sprintf(name, "%s Playback Volume", pfx);
17212 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17213 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17216 sprintf(name, "%s Playback Switch", pfx);
17217 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17218 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17221 } else if (alc880_is_multi_pin(pin)) {
17222 /* set manual connection */
17223 /* we have only a switch on HP-out PIN */
17224 sprintf(name, "%s Playback Switch", pfx);
17225 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17226 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17233 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17235 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17236 return (pincap & AC_PINCAP_IN) != 0;
17239 /* create playback/capture controls for input pins */
17240 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17241 const struct auto_pin_cfg *cfg)
17243 struct alc_spec *spec = codec->spec;
17244 struct hda_input_mux *imux = &spec->private_imux[0];
17247 for (i = 0; i < AUTO_PIN_LAST; i++) {
17248 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17249 idx = get_connection_index(codec, 0x0b,
17250 cfg->input_pins[i]);
17252 err = new_analog_input(spec, cfg->input_pins[i],
17253 auto_pin_cfg_labels[i],
17258 idx = get_connection_index(codec, 0x22,
17259 cfg->input_pins[i]);
17261 imux->items[imux->num_items].label =
17262 auto_pin_cfg_labels[i];
17263 imux->items[imux->num_items].index = idx;
17271 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17272 hda_nid_t nid, int pin_type,
17275 alc_set_pin_output(codec, nid, pin_type);
17276 /* need the manual connection? */
17277 if (alc880_is_multi_pin(nid)) {
17278 struct alc_spec *spec = codec->spec;
17279 int idx = alc880_multi_pin_idx(nid);
17280 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17281 AC_VERB_SET_CONNECT_SEL,
17282 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17286 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17288 struct alc_spec *spec = codec->spec;
17291 for (i = 0; i <= HDA_SIDE; i++) {
17292 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17293 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17295 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17300 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17302 struct alc_spec *spec = codec->spec;
17305 pin = spec->autocfg.hp_pins[0];
17306 if (pin) /* connect to front */
17308 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17309 pin = spec->autocfg.speaker_pins[0];
17311 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17314 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17316 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17318 struct alc_spec *spec = codec->spec;
17321 for (i = 0; i < AUTO_PIN_LAST; i++) {
17322 hda_nid_t nid = spec->autocfg.input_pins[i];
17323 if (alc662_is_input_pin(codec, nid)) {
17324 alc_set_input_pin(codec, nid, i);
17325 if (nid != ALC662_PIN_CD_NID &&
17326 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17327 snd_hda_codec_write(codec, nid, 0,
17328 AC_VERB_SET_AMP_GAIN_MUTE,
17334 #define alc662_auto_init_input_src alc882_auto_init_input_src
17336 static int alc662_parse_auto_config(struct hda_codec *codec)
17338 struct alc_spec *spec = codec->spec;
17340 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17342 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17346 if (!spec->autocfg.line_outs)
17347 return 0; /* can't find valid BIOS pin config */
17349 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17352 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17355 err = alc662_auto_create_extra_out(spec,
17356 spec->autocfg.speaker_pins[0],
17360 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17364 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17368 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17370 if (spec->autocfg.dig_outs)
17371 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17373 if (spec->kctls.list)
17374 add_mixer(spec, spec->kctls.list);
17376 spec->num_mux_defs = 1;
17377 spec->input_mux = &spec->private_imux[0];
17379 add_verb(spec, alc662_auto_init_verbs);
17380 if (codec->vendor_id == 0x10ec0663)
17381 add_verb(spec, alc663_auto_init_verbs);
17383 err = alc_auto_add_mic_boost(codec);
17387 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17392 /* additional initialization for auto-configuration model */
17393 static void alc662_auto_init(struct hda_codec *codec)
17395 struct alc_spec *spec = codec->spec;
17396 alc662_auto_init_multi_out(codec);
17397 alc662_auto_init_hp_out(codec);
17398 alc662_auto_init_analog_input(codec);
17399 alc662_auto_init_input_src(codec);
17400 if (spec->unsol_event)
17401 alc_inithook(codec);
17404 static int patch_alc662(struct hda_codec *codec)
17406 struct alc_spec *spec;
17407 int err, board_config;
17409 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17413 codec->spec = spec;
17415 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17417 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17420 if (board_config < 0) {
17421 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17423 board_config = ALC662_AUTO;
17426 if (board_config == ALC662_AUTO) {
17427 /* automatic parse from the BIOS config */
17428 err = alc662_parse_auto_config(codec);
17434 "hda_codec: Cannot set up configuration "
17435 "from BIOS. Using base mode...\n");
17436 board_config = ALC662_3ST_2ch_DIG;
17440 err = snd_hda_attach_beep_device(codec, 0x1);
17446 if (board_config != ALC662_AUTO)
17447 setup_preset(spec, &alc662_presets[board_config]);
17449 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17450 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17452 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17453 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17455 spec->adc_nids = alc662_adc_nids;
17456 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17457 spec->capsrc_nids = alc662_capsrc_nids;
17459 if (!spec->cap_mixer)
17460 set_capture_mixer(spec);
17461 if (codec->vendor_id == 0x10ec0662)
17462 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17464 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17466 spec->vmaster_nid = 0x02;
17468 codec->patch_ops = alc_patch_ops;
17469 if (board_config == ALC662_AUTO)
17470 spec->init_hook = alc662_auto_init;
17471 #ifdef CONFIG_SND_HDA_POWER_SAVE
17472 if (!spec->loopback.amplist)
17473 spec->loopback.amplist = alc662_loopbacks;
17475 codec->proc_widget_hook = print_realtek_coef;
17483 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17484 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17485 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17486 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17487 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17488 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17489 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17490 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17491 .patch = patch_alc861 },
17492 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17493 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17494 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17495 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17496 .patch = patch_alc882 },
17497 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17498 .patch = patch_alc662 },
17499 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17500 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17501 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17502 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17503 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17504 .patch = patch_alc882 },
17505 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17506 .patch = patch_alc882 },
17507 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17508 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17509 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17510 .patch = patch_alc882 },
17511 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17512 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17513 {} /* terminator */
17516 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17518 MODULE_LICENSE("GPL");
17519 MODULE_DESCRIPTION("Realtek HD-audio codec");
17521 static struct hda_codec_preset_list realtek_list = {
17522 .preset = snd_hda_preset_realtek,
17523 .owner = THIS_MODULE,
17526 static int __init patch_realtek_init(void)
17528 return snd_hda_add_codec_preset(&realtek_list);
17531 static void __exit patch_realtek_exit(void)
17533 snd_hda_delete_codec_preset(&realtek_list);
17536 module_init(patch_realtek_init)
17537 module_exit(patch_realtek_exit)