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,
248 #define GPIO_MASK 0x03
250 /* extra amp-initialization sequence types */
260 /* codec parameterization */
261 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
262 unsigned int num_mixers;
263 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
264 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
266 const struct hda_verb *init_verbs[5]; /* initialization verbs
270 unsigned int num_init_verbs;
272 char stream_name_analog[16]; /* analog PCM stream */
273 struct hda_pcm_stream *stream_analog_playback;
274 struct hda_pcm_stream *stream_analog_capture;
275 struct hda_pcm_stream *stream_analog_alt_playback;
276 struct hda_pcm_stream *stream_analog_alt_capture;
278 char stream_name_digital[16]; /* digital PCM stream */
279 struct hda_pcm_stream *stream_digital_playback;
280 struct hda_pcm_stream *stream_digital_capture;
283 struct hda_multi_out multiout; /* playback set-up
284 * max_channels, dacs must be set
285 * dig_out_nid and hp_nid are optional
287 hda_nid_t alt_dac_nid;
288 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
292 unsigned int num_adc_nids;
294 hda_nid_t *capsrc_nids;
295 hda_nid_t dig_in_nid; /* digital-in NID; optional */
298 unsigned int num_mux_defs;
299 const struct hda_input_mux *input_mux;
300 unsigned int cur_mux[3];
303 const struct hda_channel_mode *channel_mode;
304 int num_channel_mode;
306 int const_channel_count;
307 int ext_channel_count;
309 /* PCM information */
310 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
312 /* dynamic controls, init_verbs and input_mux */
313 struct auto_pin_cfg autocfg;
314 struct snd_array kctls;
315 struct hda_input_mux private_imux[3];
316 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
317 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
318 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
321 void (*init_hook)(struct hda_codec *codec);
322 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
324 /* for pin sensing */
325 unsigned int sense_updated: 1;
326 unsigned int jack_present: 1;
327 unsigned int master_sw: 1;
330 unsigned int no_analog :1; /* digital I/O only */
333 /* for virtual master */
334 hda_nid_t vmaster_nid;
335 #ifdef CONFIG_SND_HDA_POWER_SAVE
336 struct hda_loopback_check loopback;
341 unsigned int pll_coef_idx, pll_coef_bit;
345 * configuration template - to be copied to the spec instance
347 struct alc_config_preset {
348 struct snd_kcontrol_new *mixers[5]; /* should be identical size
351 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
352 const struct hda_verb *init_verbs[5];
353 unsigned int num_dacs;
355 hda_nid_t dig_out_nid; /* optional */
356 hda_nid_t hp_nid; /* optional */
357 hda_nid_t *slave_dig_outs;
358 unsigned int num_adc_nids;
360 hda_nid_t *capsrc_nids;
361 hda_nid_t dig_in_nid;
362 unsigned int num_channel_mode;
363 const struct hda_channel_mode *channel_mode;
365 int const_channel_count;
366 unsigned int num_mux_defs;
367 const struct hda_input_mux *input_mux;
368 void (*unsol_event)(struct hda_codec *, unsigned int);
369 void (*init_hook)(struct hda_codec *);
370 #ifdef CONFIG_SND_HDA_POWER_SAVE
371 struct hda_amp_list *loopbacks;
379 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
380 struct snd_ctl_elem_info *uinfo)
382 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
383 struct alc_spec *spec = codec->spec;
384 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
385 if (mux_idx >= spec->num_mux_defs)
387 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
390 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
391 struct snd_ctl_elem_value *ucontrol)
393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
394 struct alc_spec *spec = codec->spec;
395 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
397 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
401 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
402 struct snd_ctl_elem_value *ucontrol)
404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
405 struct alc_spec *spec = codec->spec;
406 const struct hda_input_mux *imux;
407 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
408 unsigned int mux_idx;
409 hda_nid_t nid = spec->capsrc_nids ?
410 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
413 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
414 imux = &spec->input_mux[mux_idx];
416 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
417 if (type == AC_WID_AUD_MIX) {
418 /* Matrix-mixer style (e.g. ALC882) */
419 unsigned int *cur_val = &spec->cur_mux[adc_idx];
422 idx = ucontrol->value.enumerated.item[0];
423 if (idx >= imux->num_items)
424 idx = imux->num_items - 1;
427 for (i = 0; i < imux->num_items; i++) {
428 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
429 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
430 imux->items[i].index,
436 /* MUX style (e.g. ALC880) */
437 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
438 &spec->cur_mux[adc_idx]);
443 * channel mode setting
445 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
446 struct snd_ctl_elem_info *uinfo)
448 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
449 struct alc_spec *spec = codec->spec;
450 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
451 spec->num_channel_mode);
454 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
455 struct snd_ctl_elem_value *ucontrol)
457 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
458 struct alc_spec *spec = codec->spec;
459 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
460 spec->num_channel_mode,
461 spec->ext_channel_count);
464 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 struct alc_spec *spec = codec->spec;
469 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
470 spec->num_channel_mode,
471 &spec->ext_channel_count);
472 if (err >= 0 && !spec->const_channel_count) {
473 spec->multiout.max_channels = spec->ext_channel_count;
474 if (spec->need_dac_fix)
475 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
481 * Control the mode of pin widget settings via the mixer. "pc" is used
482 * instead of "%" to avoid consequences of accidently treating the % as
483 * being part of a format specifier. Maximum allowed length of a value is
484 * 63 characters plus NULL terminator.
486 * Note: some retasking pin complexes seem to ignore requests for input
487 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
488 * are requested. Therefore order this list so that this behaviour will not
489 * cause problems when mixer clients move through the enum sequentially.
490 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
493 static char *alc_pin_mode_names[] = {
494 "Mic 50pc bias", "Mic 80pc bias",
495 "Line in", "Line out", "Headphone out",
497 static unsigned char alc_pin_mode_values[] = {
498 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
500 /* The control can present all 5 options, or it can limit the options based
501 * in the pin being assumed to be exclusively an input or an output pin. In
502 * addition, "input" pins may or may not process the mic bias option
503 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
504 * accept requests for bias as of chip versions up to March 2006) and/or
505 * wiring in the computer.
507 #define ALC_PIN_DIR_IN 0x00
508 #define ALC_PIN_DIR_OUT 0x01
509 #define ALC_PIN_DIR_INOUT 0x02
510 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
511 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
513 /* Info about the pin modes supported by the different pin direction modes.
514 * For each direction the minimum and maximum values are given.
516 static signed char alc_pin_mode_dir_info[5][2] = {
517 { 0, 2 }, /* ALC_PIN_DIR_IN */
518 { 3, 4 }, /* ALC_PIN_DIR_OUT */
519 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
520 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
521 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
523 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
524 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
525 #define alc_pin_mode_n_items(_dir) \
526 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
528 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
529 struct snd_ctl_elem_info *uinfo)
531 unsigned int item_num = uinfo->value.enumerated.item;
532 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
534 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
536 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
538 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
539 item_num = alc_pin_mode_min(dir);
540 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
544 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
545 struct snd_ctl_elem_value *ucontrol)
548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
549 hda_nid_t nid = kcontrol->private_value & 0xffff;
550 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
551 long *valp = ucontrol->value.integer.value;
552 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
553 AC_VERB_GET_PIN_WIDGET_CONTROL,
556 /* Find enumerated value for current pinctl setting */
557 i = alc_pin_mode_min(dir);
558 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
560 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
564 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
565 struct snd_ctl_elem_value *ucontrol)
568 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
569 hda_nid_t nid = kcontrol->private_value & 0xffff;
570 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
571 long val = *ucontrol->value.integer.value;
572 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
573 AC_VERB_GET_PIN_WIDGET_CONTROL,
576 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
577 val = alc_pin_mode_min(dir);
579 change = pinctl != alc_pin_mode_values[val];
581 /* Set pin mode to that requested */
582 snd_hda_codec_write_cache(codec, nid, 0,
583 AC_VERB_SET_PIN_WIDGET_CONTROL,
584 alc_pin_mode_values[val]);
586 /* Also enable the retasking pin's input/output as required
587 * for the requested pin mode. Enum values of 2 or less are
590 * Dynamically switching the input/output buffers probably
591 * reduces noise slightly (particularly on input) so we'll
592 * do it. However, having both input and output buffers
593 * enabled simultaneously doesn't seem to be problematic if
594 * this turns out to be necessary in the future.
597 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
598 HDA_AMP_MUTE, HDA_AMP_MUTE);
599 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
602 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
603 HDA_AMP_MUTE, HDA_AMP_MUTE);
604 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
611 #define ALC_PIN_MODE(xname, nid, dir) \
612 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
613 .info = alc_pin_mode_info, \
614 .get = alc_pin_mode_get, \
615 .put = alc_pin_mode_put, \
616 .private_value = nid | (dir<<16) }
618 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
619 * together using a mask with more than one bit set. This control is
620 * currently used only by the ALC260 test model. At this stage they are not
621 * needed for any "production" models.
623 #ifdef CONFIG_SND_DEBUG
624 #define alc_gpio_data_info snd_ctl_boolean_mono_info
626 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
627 struct snd_ctl_elem_value *ucontrol)
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
630 hda_nid_t nid = kcontrol->private_value & 0xffff;
631 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
632 long *valp = ucontrol->value.integer.value;
633 unsigned int val = snd_hda_codec_read(codec, nid, 0,
634 AC_VERB_GET_GPIO_DATA, 0x00);
636 *valp = (val & mask) != 0;
639 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
640 struct snd_ctl_elem_value *ucontrol)
643 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
644 hda_nid_t nid = kcontrol->private_value & 0xffff;
645 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
646 long val = *ucontrol->value.integer.value;
647 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
648 AC_VERB_GET_GPIO_DATA,
651 /* Set/unset the masked GPIO bit(s) as needed */
652 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
657 snd_hda_codec_write_cache(codec, nid, 0,
658 AC_VERB_SET_GPIO_DATA, gpio_data);
662 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
663 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
664 .info = alc_gpio_data_info, \
665 .get = alc_gpio_data_get, \
666 .put = alc_gpio_data_put, \
667 .private_value = nid | (mask<<16) }
668 #endif /* CONFIG_SND_DEBUG */
670 /* A switch control to allow the enabling of the digital IO pins on the
671 * ALC260. This is incredibly simplistic; the intention of this control is
672 * to provide something in the test model allowing digital outputs to be
673 * identified if present. If models are found which can utilise these
674 * outputs a more complete mixer control can be devised for those models if
677 #ifdef CONFIG_SND_DEBUG
678 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
680 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
681 struct snd_ctl_elem_value *ucontrol)
683 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
684 hda_nid_t nid = kcontrol->private_value & 0xffff;
685 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
686 long *valp = ucontrol->value.integer.value;
687 unsigned int val = snd_hda_codec_read(codec, nid, 0,
688 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
690 *valp = (val & mask) != 0;
693 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
694 struct snd_ctl_elem_value *ucontrol)
697 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
698 hda_nid_t nid = kcontrol->private_value & 0xffff;
699 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
700 long val = *ucontrol->value.integer.value;
701 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
702 AC_VERB_GET_DIGI_CONVERT_1,
705 /* Set/unset the masked control bit(s) as needed */
706 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
711 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
716 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
717 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
718 .info = alc_spdif_ctrl_info, \
719 .get = alc_spdif_ctrl_get, \
720 .put = alc_spdif_ctrl_put, \
721 .private_value = nid | (mask<<16) }
722 #endif /* CONFIG_SND_DEBUG */
724 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
725 * Again, this is only used in the ALC26x test models to help identify when
726 * the EAPD line must be asserted for features to work.
728 #ifdef CONFIG_SND_DEBUG
729 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
731 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
732 struct snd_ctl_elem_value *ucontrol)
734 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
735 hda_nid_t nid = kcontrol->private_value & 0xffff;
736 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
737 long *valp = ucontrol->value.integer.value;
738 unsigned int val = snd_hda_codec_read(codec, nid, 0,
739 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
741 *valp = (val & mask) != 0;
745 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
746 struct snd_ctl_elem_value *ucontrol)
749 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
750 hda_nid_t nid = kcontrol->private_value & 0xffff;
751 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
752 long val = *ucontrol->value.integer.value;
753 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
754 AC_VERB_GET_EAPD_BTLENABLE,
757 /* Set/unset the masked control bit(s) as needed */
758 change = (!val ? 0 : mask) != (ctrl_data & mask);
763 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
769 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
770 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
771 .info = alc_eapd_ctrl_info, \
772 .get = alc_eapd_ctrl_get, \
773 .put = alc_eapd_ctrl_put, \
774 .private_value = nid | (mask<<16) }
775 #endif /* CONFIG_SND_DEBUG */
778 * set up the input pin config (depending on the given auto-pin type)
780 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
783 unsigned int val = PIN_IN;
785 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
787 pincap = snd_hda_query_pin_caps(codec, nid);
788 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
789 if (pincap & AC_PINCAP_VREF_80)
791 else if (pincap & AC_PINCAP_VREF_50)
793 else if (pincap & AC_PINCAP_VREF_100)
795 else if (pincap & AC_PINCAP_VREF_GRD)
798 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
803 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
805 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
807 spec->mixers[spec->num_mixers++] = mix;
810 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
812 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
814 spec->init_verbs[spec->num_init_verbs++] = verb;
817 #ifdef CONFIG_PROC_FS
821 static void print_realtek_coef(struct snd_info_buffer *buffer,
822 struct hda_codec *codec, hda_nid_t nid)
828 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
829 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
830 coeff = snd_hda_codec_read(codec, nid, 0,
831 AC_VERB_GET_COEF_INDEX, 0);
832 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
835 #define print_realtek_coef NULL
839 * set up from the preset table
841 static void setup_preset(struct alc_spec *spec,
842 const struct alc_config_preset *preset)
846 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
847 add_mixer(spec, preset->mixers[i]);
848 spec->cap_mixer = preset->cap_mixer;
849 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
851 add_verb(spec, preset->init_verbs[i]);
853 spec->channel_mode = preset->channel_mode;
854 spec->num_channel_mode = preset->num_channel_mode;
855 spec->need_dac_fix = preset->need_dac_fix;
856 spec->const_channel_count = preset->const_channel_count;
858 if (preset->const_channel_count)
859 spec->multiout.max_channels = preset->const_channel_count;
861 spec->multiout.max_channels = spec->channel_mode[0].channels;
862 spec->ext_channel_count = spec->channel_mode[0].channels;
864 spec->multiout.num_dacs = preset->num_dacs;
865 spec->multiout.dac_nids = preset->dac_nids;
866 spec->multiout.dig_out_nid = preset->dig_out_nid;
867 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
868 spec->multiout.hp_nid = preset->hp_nid;
870 spec->num_mux_defs = preset->num_mux_defs;
871 if (!spec->num_mux_defs)
872 spec->num_mux_defs = 1;
873 spec->input_mux = preset->input_mux;
875 spec->num_adc_nids = preset->num_adc_nids;
876 spec->adc_nids = preset->adc_nids;
877 spec->capsrc_nids = preset->capsrc_nids;
878 spec->dig_in_nid = preset->dig_in_nid;
880 spec->unsol_event = preset->unsol_event;
881 spec->init_hook = preset->init_hook;
882 #ifdef CONFIG_SND_HDA_POWER_SAVE
883 spec->loopback.amplist = preset->loopbacks;
887 /* Enable GPIO mask and set output */
888 static struct hda_verb alc_gpio1_init_verbs[] = {
889 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
890 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
891 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
895 static struct hda_verb alc_gpio2_init_verbs[] = {
896 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
897 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
898 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
902 static struct hda_verb alc_gpio3_init_verbs[] = {
903 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
904 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
905 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
910 * Fix hardware PLL issue
911 * On some codecs, the analog PLL gating control must be off while
912 * the default value is 1.
914 static void alc_fix_pll(struct hda_codec *codec)
916 struct alc_spec *spec = codec->spec;
921 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
923 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
924 AC_VERB_GET_PROC_COEF, 0);
925 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
927 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
928 val & ~(1 << spec->pll_coef_bit));
931 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
932 unsigned int coef_idx, unsigned int coef_bit)
934 struct alc_spec *spec = codec->spec;
936 spec->pll_coef_idx = coef_idx;
937 spec->pll_coef_bit = coef_bit;
941 static void alc_automute_pin(struct hda_codec *codec)
943 struct alc_spec *spec = codec->spec;
944 unsigned int present, pincap;
945 unsigned int nid = spec->autocfg.hp_pins[0];
948 pincap = snd_hda_query_pin_caps(codec, nid);
949 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
950 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
951 present = snd_hda_codec_read(codec, nid, 0,
952 AC_VERB_GET_PIN_SENSE, 0);
953 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
954 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
955 nid = spec->autocfg.speaker_pins[i];
958 snd_hda_codec_write(codec, nid, 0,
959 AC_VERB_SET_PIN_WIDGET_CONTROL,
960 spec->jack_present ? 0 : PIN_OUT);
964 #if 0 /* it's broken in some cases -- temporarily disabled */
965 static void alc_mic_automute(struct hda_codec *codec)
967 struct alc_spec *spec = codec->spec;
968 unsigned int present;
969 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
970 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
971 unsigned int mix_nid = spec->capsrc_nids[0];
972 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
974 capsrc_idx_mic = mic_nid - 0x18;
975 capsrc_idx_fmic = fmic_nid - 0x18;
976 present = snd_hda_codec_read(codec, mic_nid, 0,
977 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
978 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
979 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
980 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
981 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
982 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
983 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
986 #define alc_mic_automute(codec) do {} while(0) /* NOP */
987 #endif /* disabled */
989 /* unsolicited event for HP jack sensing */
990 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
992 if (codec->vendor_id == 0x10ec0880)
997 case ALC880_HP_EVENT:
998 alc_automute_pin(codec);
1000 case ALC880_MIC_EVENT:
1001 alc_mic_automute(codec);
1006 static void alc_inithook(struct hda_codec *codec)
1008 alc_automute_pin(codec);
1009 alc_mic_automute(codec);
1012 /* additional initialization for ALC888 variants */
1013 static void alc888_coef_init(struct hda_codec *codec)
1017 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1018 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1019 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1020 if ((tmp & 0xf0) == 0x20)
1022 snd_hda_codec_read(codec, 0x20, 0,
1023 AC_VERB_SET_PROC_COEF, 0x830);
1026 snd_hda_codec_read(codec, 0x20, 0,
1027 AC_VERB_SET_PROC_COEF, 0x3030);
1030 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1035 case ALC_INIT_GPIO1:
1036 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1038 case ALC_INIT_GPIO2:
1039 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1041 case ALC_INIT_GPIO3:
1042 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1044 case ALC_INIT_DEFAULT:
1045 switch (codec->vendor_id) {
1047 snd_hda_codec_write(codec, 0x0f, 0,
1048 AC_VERB_SET_EAPD_BTLENABLE, 2);
1049 snd_hda_codec_write(codec, 0x10, 0,
1050 AC_VERB_SET_EAPD_BTLENABLE, 2);
1062 snd_hda_codec_write(codec, 0x14, 0,
1063 AC_VERB_SET_EAPD_BTLENABLE, 2);
1064 snd_hda_codec_write(codec, 0x15, 0,
1065 AC_VERB_SET_EAPD_BTLENABLE, 2);
1068 switch (codec->vendor_id) {
1070 snd_hda_codec_write(codec, 0x1a, 0,
1071 AC_VERB_SET_COEF_INDEX, 7);
1072 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1073 AC_VERB_GET_PROC_COEF, 0);
1074 snd_hda_codec_write(codec, 0x1a, 0,
1075 AC_VERB_SET_COEF_INDEX, 7);
1076 snd_hda_codec_write(codec, 0x1a, 0,
1077 AC_VERB_SET_PROC_COEF,
1087 snd_hda_codec_write(codec, 0x20, 0,
1088 AC_VERB_SET_COEF_INDEX, 7);
1089 tmp = snd_hda_codec_read(codec, 0x20, 0,
1090 AC_VERB_GET_PROC_COEF, 0);
1091 snd_hda_codec_write(codec, 0x20, 0,
1092 AC_VERB_SET_COEF_INDEX, 7);
1093 snd_hda_codec_write(codec, 0x20, 0,
1094 AC_VERB_SET_PROC_COEF,
1098 alc888_coef_init(codec);
1102 snd_hda_codec_write(codec, 0x20, 0,
1103 AC_VERB_SET_COEF_INDEX, 7);
1104 tmp = snd_hda_codec_read(codec, 0x20, 0,
1105 AC_VERB_GET_PROC_COEF, 0);
1106 snd_hda_codec_write(codec, 0x20, 0,
1107 AC_VERB_SET_COEF_INDEX, 7);
1108 snd_hda_codec_write(codec, 0x20, 0,
1109 AC_VERB_SET_PROC_COEF,
1117 static void alc_init_auto_hp(struct hda_codec *codec)
1119 struct alc_spec *spec = codec->spec;
1121 if (!spec->autocfg.hp_pins[0])
1124 if (!spec->autocfg.speaker_pins[0]) {
1125 if (spec->autocfg.line_out_pins[0] &&
1126 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1127 spec->autocfg.speaker_pins[0] =
1128 spec->autocfg.line_out_pins[0];
1133 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1134 spec->autocfg.hp_pins[0]);
1135 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1136 AC_VERB_SET_UNSOLICITED_ENABLE,
1137 AC_USRSP_EN | ALC880_HP_EVENT);
1138 spec->unsol_event = alc_sku_unsol_event;
1141 /* check subsystem ID and set up device-specific initialization;
1142 * return 1 if initialized, 0 if invalid SSID
1144 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1145 * 31 ~ 16 : Manufacture ID
1147 * 7 ~ 0 : Assembly ID
1148 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1150 static int alc_subsystem_id(struct hda_codec *codec,
1151 hda_nid_t porta, hda_nid_t porte,
1154 unsigned int ass, tmp, i;
1156 struct alc_spec *spec = codec->spec;
1158 ass = codec->subsystem_id & 0xffff;
1159 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1162 /* invalid SSID, check the special NID pin defcfg instead */
1164 * 31~30 : port connectivity
1167 * 19~16 : Check sum (15:1)
1172 if (codec->vendor_id == 0x10ec0260)
1174 ass = snd_hda_codec_get_pincfg(codec, nid);
1175 snd_printd("realtek: No valid SSID, "
1176 "checking pincfg 0x%08x for NID 0x%x\n",
1178 if (!(ass & 1) && !(ass & 0x100000))
1180 if ((ass >> 30) != 1) /* no physical connection */
1185 for (i = 1; i < 16; i++) {
1189 if (((ass >> 16) & 0xf) != tmp)
1192 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1193 ass & 0xffff, codec->vendor_id);
1197 * 2 : 0 --> Desktop, 1 --> Laptop
1198 * 3~5 : External Amplifier control
1201 tmp = (ass & 0x38) >> 3; /* external Amp control */
1204 spec->init_amp = ALC_INIT_GPIO1;
1207 spec->init_amp = ALC_INIT_GPIO2;
1210 spec->init_amp = ALC_INIT_GPIO3;
1213 spec->init_amp = ALC_INIT_DEFAULT;
1217 /* is laptop or Desktop and enable the function "Mute internal speaker
1218 * when the external headphone out jack is plugged"
1220 if (!(ass & 0x8000))
1223 * 10~8 : Jack location
1224 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1226 * 15 : 1 --> enable the function "Mute internal speaker
1227 * when the external headphone out jack is plugged"
1229 if (!spec->autocfg.hp_pins[0]) {
1230 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1232 spec->autocfg.hp_pins[0] = porta;
1234 spec->autocfg.hp_pins[0] = porte;
1236 spec->autocfg.hp_pins[0] = portd;
1241 alc_init_auto_hp(codec);
1245 static void alc_ssid_check(struct hda_codec *codec,
1246 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1248 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1249 struct alc_spec *spec = codec->spec;
1250 snd_printd("realtek: "
1251 "Enable default setup for auto mode as fallback\n");
1252 spec->init_amp = ALC_INIT_DEFAULT;
1253 alc_init_auto_hp(codec);
1258 * Fix-up pin default configurations
1266 static void alc_fix_pincfg(struct hda_codec *codec,
1267 const struct snd_pci_quirk *quirk,
1268 const struct alc_pincfg **pinfix)
1270 const struct alc_pincfg *cfg;
1272 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1276 cfg = pinfix[quirk->value];
1277 for (; cfg->nid; cfg++)
1278 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1288 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1289 /* Mic-in jack as mic in */
1290 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1291 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1292 /* Line-in jack as Line in */
1293 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1294 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1295 /* Line-Out as Front */
1296 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1303 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1304 /* Mic-in jack as mic in */
1305 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1306 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1307 /* Line-in jack as Surround */
1308 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1309 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1310 /* Line-Out as Front */
1311 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1318 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1319 /* Mic-in jack as CLFE */
1320 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1321 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1322 /* Line-in jack as Surround */
1323 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1324 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1325 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1326 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1333 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1334 /* Mic-in jack as CLFE */
1335 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1336 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1337 /* Line-in jack as Surround */
1338 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1339 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1340 /* Line-Out as Side */
1341 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1345 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1346 { 2, alc888_4ST_ch2_intel_init },
1347 { 4, alc888_4ST_ch4_intel_init },
1348 { 6, alc888_4ST_ch6_intel_init },
1349 { 8, alc888_4ST_ch8_intel_init },
1353 * ALC888 Fujitsu Siemens Amillo xa3530
1356 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1357 /* Front Mic: set to PIN_IN (empty by default) */
1358 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1359 /* Connect Internal HP to Front */
1360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1361 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1362 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1363 /* Connect Bass HP to Front */
1364 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1366 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1367 /* Connect Line-Out side jack (SPDIF) to Side */
1368 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1369 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1370 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1371 /* Connect Mic jack to CLFE */
1372 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1374 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1375 /* Connect Line-in jack to Surround */
1376 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1378 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1379 /* Connect HP out jack to Front */
1380 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1381 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1382 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1383 /* Enable unsolicited event for HP jack and Line-out jack */
1384 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1385 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1389 static void alc_automute_amp(struct hda_codec *codec)
1391 struct alc_spec *spec = codec->spec;
1392 unsigned int val, mute, pincap;
1396 spec->jack_present = 0;
1397 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1398 nid = spec->autocfg.hp_pins[i];
1401 pincap = snd_hda_query_pin_caps(codec, nid);
1402 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1403 snd_hda_codec_read(codec, nid, 0,
1404 AC_VERB_SET_PIN_SENSE, 0);
1405 val = snd_hda_codec_read(codec, nid, 0,
1406 AC_VERB_GET_PIN_SENSE, 0);
1407 if (val & AC_PINSENSE_PRESENCE) {
1408 spec->jack_present = 1;
1413 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1414 /* Toggle internal speakers muting */
1415 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1416 nid = spec->autocfg.speaker_pins[i];
1419 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1420 HDA_AMP_MUTE, mute);
1424 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1427 if (codec->vendor_id == 0x10ec0880)
1431 if (res == ALC880_HP_EVENT)
1432 alc_automute_amp(codec);
1435 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1437 struct alc_spec *spec = codec->spec;
1439 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1440 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1441 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1442 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1443 alc_automute_amp(codec);
1447 * ALC888 Acer Aspire 4930G model
1450 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1451 /* Front Mic: set to PIN_IN (empty by default) */
1452 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1453 /* Unselect Front Mic by default in input mixer 3 */
1454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1455 /* Enable unsolicited event for HP jack */
1456 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1457 /* Connect Internal HP to front */
1458 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1459 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1461 /* Connect HP out to front */
1462 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1463 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1464 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1469 * ALC888 Acer Aspire 6530G model
1472 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1473 /* Bias voltage on for external mic port */
1474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1475 /* Front Mic: set to PIN_IN (empty by default) */
1476 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1477 /* Unselect Front Mic by default in input mixer 3 */
1478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1479 /* Enable unsolicited event for HP jack */
1480 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1481 /* Enable speaker output */
1482 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1483 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1484 /* Enable headphone output */
1485 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1486 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1492 * ALC889 Acer Aspire 8930G model
1495 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1496 /* Front Mic: set to PIN_IN (empty by default) */
1497 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1498 /* Unselect Front Mic by default in input mixer 3 */
1499 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1500 /* Enable unsolicited event for HP jack */
1501 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1502 /* Connect Internal Front to Front */
1503 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1506 /* Connect Internal Rear to Rear */
1507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1510 /* Connect Internal CLFE to CLFE */
1511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1514 /* Connect HP out to Front */
1515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1518 /* Enable all DACs */
1519 /* DAC DISABLE/MUTE 1? */
1520 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1521 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1522 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1523 /* DAC DISABLE/MUTE 2? */
1524 /* some bit here disables the other DACs. Init=0x4900 */
1525 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1526 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1527 /* Enable amplifiers */
1528 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1529 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1531 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1532 * which makes the stereo useless. However, either the mic or the ALC889
1533 * makes the signal become a difference/sum signal instead of standard
1534 * stereo, which is annoying. So instead we flip this bit which makes the
1535 * codec replicate the sum signal to both channels, turning it into a
1538 /* DMIC_CONTROL? Init value = 0x0001 */
1539 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1540 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1544 static struct hda_input_mux alc888_2_capture_sources[2] = {
1545 /* Front mic only available on one ADC */
1552 { "Front Mic", 0xb },
1565 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1566 /* Interal mic only available on one ADC */
1573 { "Input Mix", 0xa },
1583 { "Input Mix", 0xa },
1588 static struct hda_input_mux alc889_capture_sources[3] = {
1589 /* Digital mic only available on first "ADC" */
1596 { "Front Mic", 0xb },
1597 { "Input Mix", 0xa },
1606 { "Input Mix", 0xa },
1615 { "Input Mix", 0xa },
1620 static struct snd_kcontrol_new alc888_base_mixer[] = {
1621 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1622 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1623 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1624 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1625 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1627 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1628 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1629 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1630 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1631 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1634 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1635 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1636 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1637 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1638 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1642 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1644 struct alc_spec *spec = codec->spec;
1646 spec->autocfg.hp_pins[0] = 0x15;
1647 spec->autocfg.speaker_pins[0] = 0x14;
1648 alc_automute_amp(codec);
1651 static void alc888_acer_aspire_6530g_init_hook(struct hda_codec *codec)
1653 struct alc_spec *spec = codec->spec;
1655 spec->autocfg.hp_pins[0] = 0x15;
1656 spec->autocfg.speaker_pins[0] = 0x14;
1657 spec->autocfg.speaker_pins[1] = 0x16;
1658 spec->autocfg.speaker_pins[2] = 0x17;
1659 alc_automute_amp(codec);
1662 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1664 struct alc_spec *spec = codec->spec;
1666 spec->autocfg.hp_pins[0] = 0x15;
1667 spec->autocfg.speaker_pins[0] = 0x14;
1668 spec->autocfg.speaker_pins[1] = 0x16;
1669 spec->autocfg.speaker_pins[2] = 0x1b;
1670 alc_automute_amp(codec);
1674 * ALC880 3-stack model
1676 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1677 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1678 * F-Mic = 0x1b, HP = 0x19
1681 static hda_nid_t alc880_dac_nids[4] = {
1682 /* front, rear, clfe, rear_surr */
1683 0x02, 0x05, 0x04, 0x03
1686 static hda_nid_t alc880_adc_nids[3] = {
1691 /* The datasheet says the node 0x07 is connected from inputs,
1692 * but it shows zero connection in the real implementation on some devices.
1693 * Note: this is a 915GAV bug, fixed on 915GLV
1695 static hda_nid_t alc880_adc_nids_alt[2] = {
1700 #define ALC880_DIGOUT_NID 0x06
1701 #define ALC880_DIGIN_NID 0x0a
1703 static struct hda_input_mux alc880_capture_source = {
1707 { "Front Mic", 0x3 },
1713 /* channel source setting (2/6 channel selection for 3-stack) */
1715 static struct hda_verb alc880_threestack_ch2_init[] = {
1716 /* set line-in to input, mute it */
1717 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1718 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1719 /* set mic-in to input vref 80%, mute it */
1720 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1721 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1726 static struct hda_verb alc880_threestack_ch6_init[] = {
1727 /* set line-in to output, unmute it */
1728 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1729 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1730 /* set mic-in to output, unmute it */
1731 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1732 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1736 static struct hda_channel_mode alc880_threestack_modes[2] = {
1737 { 2, alc880_threestack_ch2_init },
1738 { 6, alc880_threestack_ch6_init },
1741 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1742 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1743 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1744 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1745 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1746 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1747 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1748 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1749 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1750 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1751 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1752 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1753 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1756 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1757 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1758 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1760 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1761 .name = "Channel Mode",
1762 .info = alc_ch_mode_info,
1763 .get = alc_ch_mode_get,
1764 .put = alc_ch_mode_put,
1769 /* capture mixer elements */
1770 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1771 struct snd_ctl_elem_info *uinfo)
1773 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1774 struct alc_spec *spec = codec->spec;
1777 mutex_lock(&codec->control_mutex);
1778 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1780 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1781 mutex_unlock(&codec->control_mutex);
1785 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1786 unsigned int size, unsigned int __user *tlv)
1788 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1789 struct alc_spec *spec = codec->spec;
1792 mutex_lock(&codec->control_mutex);
1793 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1795 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1796 mutex_unlock(&codec->control_mutex);
1800 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1801 struct snd_ctl_elem_value *ucontrol);
1803 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1804 struct snd_ctl_elem_value *ucontrol,
1807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1808 struct alc_spec *spec = codec->spec;
1809 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1812 mutex_lock(&codec->control_mutex);
1813 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1815 err = func(kcontrol, ucontrol);
1816 mutex_unlock(&codec->control_mutex);
1820 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1821 struct snd_ctl_elem_value *ucontrol)
1823 return alc_cap_getput_caller(kcontrol, ucontrol,
1824 snd_hda_mixer_amp_volume_get);
1827 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1828 struct snd_ctl_elem_value *ucontrol)
1830 return alc_cap_getput_caller(kcontrol, ucontrol,
1831 snd_hda_mixer_amp_volume_put);
1834 /* capture mixer elements */
1835 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1837 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1838 struct snd_ctl_elem_value *ucontrol)
1840 return alc_cap_getput_caller(kcontrol, ucontrol,
1841 snd_hda_mixer_amp_switch_get);
1844 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1845 struct snd_ctl_elem_value *ucontrol)
1847 return alc_cap_getput_caller(kcontrol, ucontrol,
1848 snd_hda_mixer_amp_switch_put);
1851 #define _DEFINE_CAPMIX(num) \
1853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1854 .name = "Capture Switch", \
1855 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1857 .info = alc_cap_sw_info, \
1858 .get = alc_cap_sw_get, \
1859 .put = alc_cap_sw_put, \
1862 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1863 .name = "Capture Volume", \
1864 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1865 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1866 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1868 .info = alc_cap_vol_info, \
1869 .get = alc_cap_vol_get, \
1870 .put = alc_cap_vol_put, \
1871 .tlv = { .c = alc_cap_vol_tlv }, \
1874 #define _DEFINE_CAPSRC(num) \
1876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1877 /* .name = "Capture Source", */ \
1878 .name = "Input Source", \
1880 .info = alc_mux_enum_info, \
1881 .get = alc_mux_enum_get, \
1882 .put = alc_mux_enum_put, \
1885 #define DEFINE_CAPMIX(num) \
1886 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1887 _DEFINE_CAPMIX(num), \
1888 _DEFINE_CAPSRC(num), \
1892 #define DEFINE_CAPMIX_NOSRC(num) \
1893 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1894 _DEFINE_CAPMIX(num), \
1898 /* up to three ADCs */
1902 DEFINE_CAPMIX_NOSRC(1);
1903 DEFINE_CAPMIX_NOSRC(2);
1904 DEFINE_CAPMIX_NOSRC(3);
1907 * ALC880 5-stack model
1909 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1911 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1912 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1915 /* additional mixers to alc880_three_stack_mixer */
1916 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1917 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1922 /* channel source setting (6/8 channel selection for 5-stack) */
1924 static struct hda_verb alc880_fivestack_ch6_init[] = {
1925 /* set line-in to input, mute it */
1926 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1927 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1932 static struct hda_verb alc880_fivestack_ch8_init[] = {
1933 /* set line-in to output, unmute it */
1934 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1935 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1939 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1940 { 6, alc880_fivestack_ch6_init },
1941 { 8, alc880_fivestack_ch8_init },
1946 * ALC880 6-stack model
1948 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1949 * Side = 0x05 (0x0f)
1950 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1951 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1954 static hda_nid_t alc880_6st_dac_nids[4] = {
1955 /* front, rear, clfe, rear_surr */
1956 0x02, 0x03, 0x04, 0x05
1959 static struct hda_input_mux alc880_6stack_capture_source = {
1963 { "Front Mic", 0x1 },
1969 /* fixed 8-channels */
1970 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1974 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1975 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1976 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1977 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1978 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1979 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1980 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1981 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1982 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1983 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1984 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1985 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1986 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1995 .name = "Channel Mode",
1996 .info = alc_ch_mode_info,
1997 .get = alc_ch_mode_get,
1998 .put = alc_ch_mode_put,
2007 * W810 has rear IO for:
2010 * Center/LFE (DAC 04)
2013 * The system also has a pair of internal speakers, and a headphone jack.
2014 * These are both connected to Line2 on the codec, hence to DAC 02.
2016 * There is a variable resistor to control the speaker or headphone
2017 * volume. This is a hardware-only device without a software API.
2019 * Plugging headphones in will disable the internal speakers. This is
2020 * implemented in hardware, not via the driver using jack sense. In
2021 * a similar fashion, plugging into the rear socket marked "front" will
2022 * disable both the speakers and headphones.
2024 * For input, there's a microphone jack, and an "audio in" jack.
2025 * These may not do anything useful with this driver yet, because I
2026 * haven't setup any initialization verbs for these yet...
2029 static hda_nid_t alc880_w810_dac_nids[3] = {
2030 /* front, rear/surround, clfe */
2034 /* fixed 6 channels */
2035 static struct hda_channel_mode alc880_w810_modes[1] = {
2039 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2040 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2044 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2057 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2058 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2062 static hda_nid_t alc880_z71v_dac_nids[1] = {
2065 #define ALC880_Z71V_HP_DAC 0x03
2067 /* fixed 2 channels */
2068 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2072 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2073 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2074 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2075 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2076 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2077 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2078 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2086 * ALC880 F1734 model
2088 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2089 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2092 static hda_nid_t alc880_f1734_dac_nids[1] = {
2095 #define ALC880_F1734_HP_DAC 0x02
2097 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2099 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2100 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2101 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2102 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2103 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2104 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2109 static struct hda_input_mux alc880_f1734_capture_source = {
2121 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2122 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2123 * Mic = 0x18, Line = 0x1a
2126 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2127 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2129 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2145 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2146 .name = "Channel Mode",
2147 .info = alc_ch_mode_info,
2148 .get = alc_ch_mode_get,
2149 .put = alc_ch_mode_put,
2155 * ALC880 ASUS W1V model
2157 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2158 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2159 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2162 /* additional mixers to alc880_asus_mixer */
2163 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2164 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2165 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2170 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2172 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2173 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2175 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2178 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2179 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2184 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2185 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2188 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2189 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2191 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2192 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2203 .name = "Channel Mode",
2204 .info = alc_ch_mode_info,
2205 .get = alc_ch_mode_get,
2206 .put = alc_ch_mode_put,
2211 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2212 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2213 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2215 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2216 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2217 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2219 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2220 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2221 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2225 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2227 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2229 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2236 * virtual master controls
2240 * slave controls for virtual master
2242 static const char *alc_slave_vols[] = {
2243 "Front Playback Volume",
2244 "Surround Playback Volume",
2245 "Center Playback Volume",
2246 "LFE Playback Volume",
2247 "Side Playback Volume",
2248 "Headphone Playback Volume",
2249 "Speaker Playback Volume",
2250 "Mono Playback Volume",
2251 "Line-Out Playback Volume",
2252 "PCM Playback Volume",
2256 static const char *alc_slave_sws[] = {
2257 "Front Playback Switch",
2258 "Surround Playback Switch",
2259 "Center Playback Switch",
2260 "LFE Playback Switch",
2261 "Side Playback Switch",
2262 "Headphone Playback Switch",
2263 "Speaker Playback Switch",
2264 "Mono Playback Switch",
2265 "IEC958 Playback Switch",
2270 * build control elements
2273 static void alc_free_kctls(struct hda_codec *codec);
2275 /* additional beep mixers; the actual parameters are overwritten at build */
2276 static struct snd_kcontrol_new alc_beep_mixer[] = {
2277 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2278 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2282 static int alc_build_controls(struct hda_codec *codec)
2284 struct alc_spec *spec = codec->spec;
2288 for (i = 0; i < spec->num_mixers; i++) {
2289 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2293 if (spec->cap_mixer) {
2294 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2298 if (spec->multiout.dig_out_nid) {
2299 err = snd_hda_create_spdif_out_ctls(codec,
2300 spec->multiout.dig_out_nid);
2303 if (!spec->no_analog) {
2304 err = snd_hda_create_spdif_share_sw(codec,
2308 spec->multiout.share_spdif = 1;
2311 if (spec->dig_in_nid) {
2312 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2317 /* create beep controls if needed */
2318 if (spec->beep_amp) {
2319 struct snd_kcontrol_new *knew;
2320 for (knew = alc_beep_mixer; knew->name; knew++) {
2321 struct snd_kcontrol *kctl;
2322 kctl = snd_ctl_new1(knew, codec);
2325 kctl->private_value = spec->beep_amp;
2326 err = snd_hda_ctl_add(codec, kctl);
2332 /* if we have no master control, let's create it */
2333 if (!spec->no_analog &&
2334 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2335 unsigned int vmaster_tlv[4];
2336 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2337 HDA_OUTPUT, vmaster_tlv);
2338 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2339 vmaster_tlv, alc_slave_vols);
2343 if (!spec->no_analog &&
2344 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2345 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2346 NULL, alc_slave_sws);
2351 alc_free_kctls(codec); /* no longer needed */
2357 * initialize the codec volumes, etc
2361 * generic initialization of ADC, input mixers and output mixers
2363 static struct hda_verb alc880_volume_init_verbs[] = {
2365 * Unmute ADC0-2 and set the default input to mic-in
2367 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2368 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2369 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2370 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2371 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2372 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2374 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2376 * Note: PASD motherboards uses the Line In 2 as the input for front
2379 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2389 * Set up output mixers (0x0c - 0x0f)
2391 /* set vol=0 to output mixers */
2392 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2393 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2395 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2396 /* set up input amps for analog loopback */
2397 /* Amp Indices: DAC = 0, mixer = 1 */
2398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2402 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2404 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2405 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2411 * 3-stack pin configuration:
2412 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2414 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2416 * preset connection lists of input pins
2417 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2419 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2420 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2421 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2424 * Set pin mode and muting
2426 /* set front pin widgets 0x14 for output */
2427 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2428 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2429 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2432 /* Mic2 (as headphone out) for HP output */
2433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2434 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2435 /* Line In pin widget for input */
2436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2438 /* Line2 (as front mic) pin widget for input and vref at 80% */
2439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2440 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2441 /* CD pin widget for input */
2442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2448 * 5-stack pin configuration:
2449 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2450 * line-in/side = 0x1a, f-mic = 0x1b
2452 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2454 * preset connection lists of input pins
2455 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2457 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2458 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2461 * Set pin mode and muting
2463 /* set pin widgets 0x14-0x17 for output */
2464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2465 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2466 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2467 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2468 /* unmute pins for output (no gain on this amp) */
2469 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2470 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2471 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2472 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2474 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2475 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2476 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2477 /* Mic2 (as headphone out) for HP output */
2478 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2479 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2480 /* Line In pin widget for input */
2481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2483 /* Line2 (as front mic) pin widget for input and vref at 80% */
2484 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2485 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2486 /* CD pin widget for input */
2487 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2493 * W810 pin configuration:
2494 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2496 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2497 /* hphone/speaker input selector: front DAC */
2498 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2503 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2505 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2514 * Z71V pin configuration:
2515 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2517 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2518 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2520 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2521 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2523 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2532 * 6-stack pin configuration:
2533 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2534 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2536 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2537 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2539 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2540 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2541 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2544 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2545 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2546 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2548 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2549 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2551 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2552 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2553 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2554 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2555 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2556 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2562 * Uniwill pin configuration:
2563 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2566 static struct hda_verb alc880_uniwill_init_verbs[] = {
2567 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2570 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2572 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2573 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2574 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2575 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2576 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2579 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2581 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2582 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2584 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2585 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2587 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2588 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2589 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2590 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2591 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2592 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2594 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2602 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2604 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2605 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2607 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2608 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2612 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2616 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2621 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2622 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2623 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2627 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2628 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2633 static struct hda_verb alc880_beep_init_verbs[] = {
2634 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2638 /* auto-toggle front mic */
2639 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2641 unsigned int present;
2644 present = snd_hda_codec_read(codec, 0x18, 0,
2645 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2646 bits = present ? HDA_AMP_MUTE : 0;
2647 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2650 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2652 struct alc_spec *spec = codec->spec;
2654 spec->autocfg.hp_pins[0] = 0x14;
2655 spec->autocfg.speaker_pins[0] = 0x15;
2656 spec->autocfg.speaker_pins[0] = 0x16;
2657 alc_automute_amp(codec);
2658 alc880_uniwill_mic_automute(codec);
2661 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2664 /* Looks like the unsol event is incompatible with the standard
2665 * definition. 4bit tag is placed at 28 bit!
2667 switch (res >> 28) {
2668 case ALC880_MIC_EVENT:
2669 alc880_uniwill_mic_automute(codec);
2672 alc_automute_amp_unsol_event(codec, res);
2677 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2679 struct alc_spec *spec = codec->spec;
2681 spec->autocfg.hp_pins[0] = 0x14;
2682 spec->autocfg.speaker_pins[0] = 0x15;
2683 alc_automute_amp(codec);
2686 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2688 unsigned int present;
2690 present = snd_hda_codec_read(codec, 0x21, 0,
2691 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2692 present &= HDA_AMP_VOLMASK;
2693 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2694 HDA_AMP_VOLMASK, present);
2695 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2696 HDA_AMP_VOLMASK, present);
2699 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2702 /* Looks like the unsol event is incompatible with the standard
2703 * definition. 4bit tag is placed at 28 bit!
2705 if ((res >> 28) == ALC880_DCVOL_EVENT)
2706 alc880_uniwill_p53_dcvol_automute(codec);
2708 alc_automute_amp_unsol_event(codec, res);
2712 * F1734 pin configuration:
2713 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2715 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2716 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2717 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2718 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2719 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2720 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2722 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2723 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2729 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2732 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2738 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2744 * ASUS pin configuration:
2745 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2747 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2748 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2749 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2750 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2751 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2758 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2760 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2765 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2769 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2775 /* Enable GPIO mask and set output */
2776 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2777 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2778 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2780 /* Clevo m520g init */
2781 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2782 /* headphone output */
2783 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2791 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2792 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 /* Mic1 (rear panel) */
2794 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2795 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2796 /* Mic2 (front panel) */
2797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2798 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2801 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 /* change to EAPD mode */
2803 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2804 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2809 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2810 /* change to EAPD mode */
2811 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2812 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2814 /* Headphone output */
2815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2818 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2820 /* Line In pin widget for input */
2821 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 /* CD pin widget for input */
2823 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2825 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2827 /* change to EAPD mode */
2828 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2829 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2835 * LG m1 express dual
2838 * Rear Line-In/Out (blue): 0x14
2839 * Build-in Mic-In: 0x15
2841 * HP-Out (green): 0x1b
2842 * Mic-In/Out (red): 0x19
2846 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2847 static hda_nid_t alc880_lg_dac_nids[3] = {
2851 /* seems analog CD is not working */
2852 static struct hda_input_mux alc880_lg_capture_source = {
2857 { "Internal Mic", 0x6 },
2861 /* 2,4,6 channel modes */
2862 static struct hda_verb alc880_lg_ch2_init[] = {
2863 /* set line-in and mic-in to input */
2864 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2865 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2869 static struct hda_verb alc880_lg_ch4_init[] = {
2870 /* set line-in to out and mic-in to input */
2871 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2872 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2876 static struct hda_verb alc880_lg_ch6_init[] = {
2877 /* set line-in and mic-in to output */
2878 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2879 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2883 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2884 { 2, alc880_lg_ch2_init },
2885 { 4, alc880_lg_ch4_init },
2886 { 6, alc880_lg_ch6_init },
2889 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2890 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2891 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2892 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2893 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2894 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2895 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2896 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2897 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2898 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2899 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2900 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2901 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2902 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2903 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2906 .name = "Channel Mode",
2907 .info = alc_ch_mode_info,
2908 .get = alc_ch_mode_get,
2909 .put = alc_ch_mode_put,
2914 static struct hda_verb alc880_lg_init_verbs[] = {
2915 /* set capture source to mic-in */
2916 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2919 /* mute all amp mixer inputs */
2920 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2921 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2922 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2923 /* line-in to input */
2924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2925 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2930 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2931 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2932 /* mic-in to input */
2933 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2934 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2935 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2937 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2938 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2939 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2945 /* toggle speaker-output according to the hp-jack state */
2946 static void alc880_lg_init_hook(struct hda_codec *codec)
2948 struct alc_spec *spec = codec->spec;
2950 spec->autocfg.hp_pins[0] = 0x1b;
2951 spec->autocfg.speaker_pins[0] = 0x17;
2952 alc_automute_amp(codec);
2961 * Built-in Mic-In: 0x19
2967 static struct hda_input_mux alc880_lg_lw_capture_source = {
2971 { "Internal Mic", 0x1 },
2976 #define alc880_lg_lw_modes alc880_threestack_modes
2978 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2981 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2982 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2983 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2984 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2985 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2986 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2987 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2988 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2989 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2990 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2991 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2992 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2994 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2995 .name = "Channel Mode",
2996 .info = alc_ch_mode_info,
2997 .get = alc_ch_mode_get,
2998 .put = alc_ch_mode_put,
3003 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3004 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3005 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3006 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3008 /* set capture source to mic-in */
3009 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3010 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3011 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3017 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 /* mic-in to input */
3020 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3021 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3024 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3030 /* toggle speaker-output according to the hp-jack state */
3031 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3033 struct alc_spec *spec = codec->spec;
3035 spec->autocfg.hp_pins[0] = 0x1b;
3036 spec->autocfg.speaker_pins[0] = 0x14;
3037 alc_automute_amp(codec);
3040 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3041 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3042 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3045 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3046 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3050 static struct hda_input_mux alc880_medion_rim_capture_source = {
3054 { "Internal Mic", 0x1 },
3058 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3059 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3061 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3062 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3065 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3066 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3067 /* Mic2 (as headphone out) for HP output */
3068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3070 /* Internal Speaker */
3071 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3072 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3074 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3075 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3077 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3081 /* toggle speaker-output according to the hp-jack state */
3082 static void alc880_medion_rim_automute(struct hda_codec *codec)
3084 struct alc_spec *spec = codec->spec;
3085 alc_automute_amp(codec);
3087 if (spec->jack_present)
3088 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3090 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3093 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3096 /* Looks like the unsol event is incompatible with the standard
3097 * definition. 4bit tag is placed at 28 bit!
3099 if ((res >> 28) == ALC880_HP_EVENT)
3100 alc880_medion_rim_automute(codec);
3103 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3105 struct alc_spec *spec = codec->spec;
3107 spec->autocfg.hp_pins[0] = 0x14;
3108 spec->autocfg.speaker_pins[0] = 0x1b;
3109 alc880_medion_rim_automute(codec);
3112 #ifdef CONFIG_SND_HDA_POWER_SAVE
3113 static struct hda_amp_list alc880_loopbacks[] = {
3114 { 0x0b, HDA_INPUT, 0 },
3115 { 0x0b, HDA_INPUT, 1 },
3116 { 0x0b, HDA_INPUT, 2 },
3117 { 0x0b, HDA_INPUT, 3 },
3118 { 0x0b, HDA_INPUT, 4 },
3122 static struct hda_amp_list alc880_lg_loopbacks[] = {
3123 { 0x0b, HDA_INPUT, 1 },
3124 { 0x0b, HDA_INPUT, 6 },
3125 { 0x0b, HDA_INPUT, 7 },
3134 static int alc_init(struct hda_codec *codec)
3136 struct alc_spec *spec = codec->spec;
3140 alc_auto_init_amp(codec, spec->init_amp);
3142 for (i = 0; i < spec->num_init_verbs; i++)
3143 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3145 if (spec->init_hook)
3146 spec->init_hook(codec);
3151 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3153 struct alc_spec *spec = codec->spec;
3155 if (spec->unsol_event)
3156 spec->unsol_event(codec, res);
3159 #ifdef CONFIG_SND_HDA_POWER_SAVE
3160 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3162 struct alc_spec *spec = codec->spec;
3163 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3168 * Analog playback callbacks
3170 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3171 struct hda_codec *codec,
3172 struct snd_pcm_substream *substream)
3174 struct alc_spec *spec = codec->spec;
3175 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3179 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3180 struct hda_codec *codec,
3181 unsigned int stream_tag,
3182 unsigned int format,
3183 struct snd_pcm_substream *substream)
3185 struct alc_spec *spec = codec->spec;
3186 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3187 stream_tag, format, substream);
3190 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3191 struct hda_codec *codec,
3192 struct snd_pcm_substream *substream)
3194 struct alc_spec *spec = codec->spec;
3195 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3201 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3202 struct hda_codec *codec,
3203 struct snd_pcm_substream *substream)
3205 struct alc_spec *spec = codec->spec;
3206 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3209 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3210 struct hda_codec *codec,
3211 unsigned int stream_tag,
3212 unsigned int format,
3213 struct snd_pcm_substream *substream)
3215 struct alc_spec *spec = codec->spec;
3216 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3217 stream_tag, format, substream);
3220 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3221 struct hda_codec *codec,
3222 struct snd_pcm_substream *substream)
3224 struct alc_spec *spec = codec->spec;
3225 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3228 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3229 struct hda_codec *codec,
3230 struct snd_pcm_substream *substream)
3232 struct alc_spec *spec = codec->spec;
3233 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3239 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3240 struct hda_codec *codec,
3241 unsigned int stream_tag,
3242 unsigned int format,
3243 struct snd_pcm_substream *substream)
3245 struct alc_spec *spec = codec->spec;
3247 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3248 stream_tag, 0, format);
3252 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3253 struct hda_codec *codec,
3254 struct snd_pcm_substream *substream)
3256 struct alc_spec *spec = codec->spec;
3258 snd_hda_codec_cleanup_stream(codec,
3259 spec->adc_nids[substream->number + 1]);
3266 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3270 /* NID is set in alc_build_pcms */
3272 .open = alc880_playback_pcm_open,
3273 .prepare = alc880_playback_pcm_prepare,
3274 .cleanup = alc880_playback_pcm_cleanup
3278 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3282 /* NID is set in alc_build_pcms */
3285 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3289 /* NID is set in alc_build_pcms */
3292 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3293 .substreams = 2, /* can be overridden */
3296 /* NID is set in alc_build_pcms */
3298 .prepare = alc880_alt_capture_pcm_prepare,
3299 .cleanup = alc880_alt_capture_pcm_cleanup
3303 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3307 /* NID is set in alc_build_pcms */
3309 .open = alc880_dig_playback_pcm_open,
3310 .close = alc880_dig_playback_pcm_close,
3311 .prepare = alc880_dig_playback_pcm_prepare,
3312 .cleanup = alc880_dig_playback_pcm_cleanup
3316 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3320 /* NID is set in alc_build_pcms */
3323 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3324 static struct hda_pcm_stream alc_pcm_null_stream = {
3330 static int alc_build_pcms(struct hda_codec *codec)
3332 struct alc_spec *spec = codec->spec;
3333 struct hda_pcm *info = spec->pcm_rec;
3336 codec->num_pcms = 1;
3337 codec->pcm_info = info;
3339 if (spec->no_analog)
3342 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3343 "%s Analog", codec->chip_name);
3344 info->name = spec->stream_name_analog;
3346 if (spec->stream_analog_playback) {
3347 if (snd_BUG_ON(!spec->multiout.dac_nids))
3349 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3350 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3352 if (spec->stream_analog_capture) {
3353 if (snd_BUG_ON(!spec->adc_nids))
3355 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3356 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3359 if (spec->channel_mode) {
3360 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3361 for (i = 0; i < spec->num_channel_mode; i++) {
3362 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3363 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3369 /* SPDIF for stream index #1 */
3370 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3371 snprintf(spec->stream_name_digital,
3372 sizeof(spec->stream_name_digital),
3373 "%s Digital", codec->chip_name);
3374 codec->num_pcms = 2;
3375 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3376 info = spec->pcm_rec + 1;
3377 info->name = spec->stream_name_digital;
3378 if (spec->dig_out_type)
3379 info->pcm_type = spec->dig_out_type;
3381 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3382 if (spec->multiout.dig_out_nid &&
3383 spec->stream_digital_playback) {
3384 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3385 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3387 if (spec->dig_in_nid &&
3388 spec->stream_digital_capture) {
3389 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3390 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3392 /* FIXME: do we need this for all Realtek codec models? */
3393 codec->spdif_status_reset = 1;
3396 if (spec->no_analog)
3399 /* If the use of more than one ADC is requested for the current
3400 * model, configure a second analog capture-only PCM.
3402 /* Additional Analaog capture for index #2 */
3403 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3404 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3405 codec->num_pcms = 3;
3406 info = spec->pcm_rec + 2;
3407 info->name = spec->stream_name_analog;
3408 if (spec->alt_dac_nid) {
3409 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3410 *spec->stream_analog_alt_playback;
3411 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3414 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3415 alc_pcm_null_stream;
3416 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3418 if (spec->num_adc_nids > 1) {
3419 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3420 *spec->stream_analog_alt_capture;
3421 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3423 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3424 spec->num_adc_nids - 1;
3426 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3427 alc_pcm_null_stream;
3428 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3435 static void alc_free_kctls(struct hda_codec *codec)
3437 struct alc_spec *spec = codec->spec;
3439 if (spec->kctls.list) {
3440 struct snd_kcontrol_new *kctl = spec->kctls.list;
3442 for (i = 0; i < spec->kctls.used; i++)
3443 kfree(kctl[i].name);
3445 snd_array_free(&spec->kctls);
3448 static void alc_free(struct hda_codec *codec)
3450 struct alc_spec *spec = codec->spec;
3455 alc_free_kctls(codec);
3457 snd_hda_detach_beep_device(codec);
3460 #ifdef SND_HDA_NEEDS_RESUME
3461 static int alc_resume(struct hda_codec *codec)
3463 codec->patch_ops.init(codec);
3464 snd_hda_codec_resume_amp(codec);
3465 snd_hda_codec_resume_cache(codec);
3472 static struct hda_codec_ops alc_patch_ops = {
3473 .build_controls = alc_build_controls,
3474 .build_pcms = alc_build_pcms,
3477 .unsol_event = alc_unsol_event,
3478 #ifdef SND_HDA_NEEDS_RESUME
3479 .resume = alc_resume,
3481 #ifdef CONFIG_SND_HDA_POWER_SAVE
3482 .check_power_status = alc_check_power_status,
3488 * Test configuration for debugging
3490 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3493 #ifdef CONFIG_SND_DEBUG
3494 static hda_nid_t alc880_test_dac_nids[4] = {
3495 0x02, 0x03, 0x04, 0x05
3498 static struct hda_input_mux alc880_test_capture_source = {
3507 { "Surround", 0x6 },
3511 static struct hda_channel_mode alc880_test_modes[4] = {
3518 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3519 struct snd_ctl_elem_info *uinfo)
3521 static char *texts[] = {
3522 "N/A", "Line Out", "HP Out",
3523 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3525 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3527 uinfo->value.enumerated.items = 8;
3528 if (uinfo->value.enumerated.item >= 8)
3529 uinfo->value.enumerated.item = 7;
3530 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3534 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3535 struct snd_ctl_elem_value *ucontrol)
3537 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3538 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3539 unsigned int pin_ctl, item = 0;
3541 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3542 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3543 if (pin_ctl & AC_PINCTL_OUT_EN) {
3544 if (pin_ctl & AC_PINCTL_HP_EN)
3548 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3549 switch (pin_ctl & AC_PINCTL_VREFEN) {
3550 case AC_PINCTL_VREF_HIZ: item = 3; break;
3551 case AC_PINCTL_VREF_50: item = 4; break;
3552 case AC_PINCTL_VREF_GRD: item = 5; break;
3553 case AC_PINCTL_VREF_80: item = 6; break;
3554 case AC_PINCTL_VREF_100: item = 7; break;
3557 ucontrol->value.enumerated.item[0] = item;
3561 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3562 struct snd_ctl_elem_value *ucontrol)
3564 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3565 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3566 static unsigned int ctls[] = {
3567 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3568 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3569 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3570 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3571 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3572 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3574 unsigned int old_ctl, new_ctl;
3576 old_ctl = snd_hda_codec_read(codec, nid, 0,
3577 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3578 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3579 if (old_ctl != new_ctl) {
3581 snd_hda_codec_write_cache(codec, nid, 0,
3582 AC_VERB_SET_PIN_WIDGET_CONTROL,
3584 val = ucontrol->value.enumerated.item[0] >= 3 ?
3586 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3593 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3594 struct snd_ctl_elem_info *uinfo)
3596 static char *texts[] = {
3597 "Front", "Surround", "CLFE", "Side"
3599 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3601 uinfo->value.enumerated.items = 4;
3602 if (uinfo->value.enumerated.item >= 4)
3603 uinfo->value.enumerated.item = 3;
3604 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3608 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3609 struct snd_ctl_elem_value *ucontrol)
3611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3612 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3615 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3616 ucontrol->value.enumerated.item[0] = sel & 3;
3620 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3621 struct snd_ctl_elem_value *ucontrol)
3623 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3624 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3627 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3628 if (ucontrol->value.enumerated.item[0] != sel) {
3629 sel = ucontrol->value.enumerated.item[0] & 3;
3630 snd_hda_codec_write_cache(codec, nid, 0,
3631 AC_VERB_SET_CONNECT_SEL, sel);
3637 #define PIN_CTL_TEST(xname,nid) { \
3638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3640 .info = alc_test_pin_ctl_info, \
3641 .get = alc_test_pin_ctl_get, \
3642 .put = alc_test_pin_ctl_put, \
3643 .private_value = nid \
3646 #define PIN_SRC_TEST(xname,nid) { \
3647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3649 .info = alc_test_pin_src_info, \
3650 .get = alc_test_pin_src_get, \
3651 .put = alc_test_pin_src_put, \
3652 .private_value = nid \
3655 static struct snd_kcontrol_new alc880_test_mixer[] = {
3656 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3657 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3658 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3659 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3660 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3661 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3662 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3663 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3664 PIN_CTL_TEST("Front Pin Mode", 0x14),
3665 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3666 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3667 PIN_CTL_TEST("Side Pin Mode", 0x17),
3668 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3669 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3670 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3671 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3672 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3673 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3674 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3675 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3676 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3677 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3678 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3679 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3680 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3681 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3682 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3683 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3684 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3685 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3687 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3688 .name = "Channel Mode",
3689 .info = alc_ch_mode_info,
3690 .get = alc_ch_mode_get,
3691 .put = alc_ch_mode_put,
3696 static struct hda_verb alc880_test_init_verbs[] = {
3697 /* Unmute inputs of 0x0c - 0x0f */
3698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3704 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3705 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3706 /* Vol output for 0x0c-0x0f */
3707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3708 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3709 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3710 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3711 /* Set output pins 0x14-0x17 */
3712 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3713 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3714 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3715 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3716 /* Unmute output pins 0x14-0x17 */
3717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3718 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3719 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3720 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3721 /* Set input pins 0x18-0x1c */
3722 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3726 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3727 /* Mute input pins 0x18-0x1b */
3728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3729 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3730 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3731 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3734 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3738 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3739 /* Analog input/passthru */
3740 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3741 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3742 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3743 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3744 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3752 static const char *alc880_models[ALC880_MODEL_LAST] = {
3753 [ALC880_3ST] = "3stack",
3754 [ALC880_TCL_S700] = "tcl",
3755 [ALC880_3ST_DIG] = "3stack-digout",
3756 [ALC880_CLEVO] = "clevo",
3757 [ALC880_5ST] = "5stack",
3758 [ALC880_5ST_DIG] = "5stack-digout",
3759 [ALC880_W810] = "w810",
3760 [ALC880_Z71V] = "z71v",
3761 [ALC880_6ST] = "6stack",
3762 [ALC880_6ST_DIG] = "6stack-digout",
3763 [ALC880_ASUS] = "asus",
3764 [ALC880_ASUS_W1V] = "asus-w1v",
3765 [ALC880_ASUS_DIG] = "asus-dig",
3766 [ALC880_ASUS_DIG2] = "asus-dig2",
3767 [ALC880_UNIWILL_DIG] = "uniwill",
3768 [ALC880_UNIWILL_P53] = "uniwill-p53",
3769 [ALC880_FUJITSU] = "fujitsu",
3770 [ALC880_F1734] = "F1734",
3772 [ALC880_LG_LW] = "lg-lw",
3773 [ALC880_MEDION_RIM] = "medion",
3774 #ifdef CONFIG_SND_DEBUG
3775 [ALC880_TEST] = "test",
3777 [ALC880_AUTO] = "auto",
3780 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3781 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3782 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3783 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3784 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3785 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3786 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3787 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3788 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3789 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3790 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3791 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3792 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3793 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3794 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3795 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3796 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3797 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3798 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3799 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3800 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3801 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3802 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3803 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3804 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3805 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3806 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3807 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3808 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3809 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3810 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3811 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3812 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3813 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3814 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3815 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3816 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3817 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3818 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3819 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3820 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3821 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3822 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3823 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3824 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3825 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3826 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3827 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3828 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3829 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3830 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3831 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3832 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3833 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3834 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3835 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3836 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3837 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3838 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3839 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3840 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3841 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3842 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3843 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3844 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3845 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3846 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3847 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3848 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3850 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3851 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3852 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3857 * ALC880 codec presets
3859 static struct alc_config_preset alc880_presets[] = {
3861 .mixers = { alc880_three_stack_mixer },
3862 .init_verbs = { alc880_volume_init_verbs,
3863 alc880_pin_3stack_init_verbs },
3864 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3865 .dac_nids = alc880_dac_nids,
3866 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3867 .channel_mode = alc880_threestack_modes,
3869 .input_mux = &alc880_capture_source,
3871 [ALC880_3ST_DIG] = {
3872 .mixers = { alc880_three_stack_mixer },
3873 .init_verbs = { alc880_volume_init_verbs,
3874 alc880_pin_3stack_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3876 .dac_nids = alc880_dac_nids,
3877 .dig_out_nid = ALC880_DIGOUT_NID,
3878 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3879 .channel_mode = alc880_threestack_modes,
3881 .input_mux = &alc880_capture_source,
3883 [ALC880_TCL_S700] = {
3884 .mixers = { alc880_tcl_s700_mixer },
3885 .init_verbs = { alc880_volume_init_verbs,
3886 alc880_pin_tcl_S700_init_verbs,
3887 alc880_gpio2_init_verbs },
3888 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3889 .dac_nids = alc880_dac_nids,
3890 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3891 .num_adc_nids = 1, /* single ADC */
3893 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3894 .channel_mode = alc880_2_jack_modes,
3895 .input_mux = &alc880_capture_source,
3898 .mixers = { alc880_three_stack_mixer,
3899 alc880_five_stack_mixer},
3900 .init_verbs = { alc880_volume_init_verbs,
3901 alc880_pin_5stack_init_verbs },
3902 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3903 .dac_nids = alc880_dac_nids,
3904 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3905 .channel_mode = alc880_fivestack_modes,
3906 .input_mux = &alc880_capture_source,
3908 [ALC880_5ST_DIG] = {
3909 .mixers = { alc880_three_stack_mixer,
3910 alc880_five_stack_mixer },
3911 .init_verbs = { alc880_volume_init_verbs,
3912 alc880_pin_5stack_init_verbs },
3913 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3914 .dac_nids = alc880_dac_nids,
3915 .dig_out_nid = ALC880_DIGOUT_NID,
3916 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3917 .channel_mode = alc880_fivestack_modes,
3918 .input_mux = &alc880_capture_source,
3921 .mixers = { alc880_six_stack_mixer },
3922 .init_verbs = { alc880_volume_init_verbs,
3923 alc880_pin_6stack_init_verbs },
3924 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3925 .dac_nids = alc880_6st_dac_nids,
3926 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3927 .channel_mode = alc880_sixstack_modes,
3928 .input_mux = &alc880_6stack_capture_source,
3930 [ALC880_6ST_DIG] = {
3931 .mixers = { alc880_six_stack_mixer },
3932 .init_verbs = { alc880_volume_init_verbs,
3933 alc880_pin_6stack_init_verbs },
3934 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3935 .dac_nids = alc880_6st_dac_nids,
3936 .dig_out_nid = ALC880_DIGOUT_NID,
3937 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3938 .channel_mode = alc880_sixstack_modes,
3939 .input_mux = &alc880_6stack_capture_source,
3942 .mixers = { alc880_w810_base_mixer },
3943 .init_verbs = { alc880_volume_init_verbs,
3944 alc880_pin_w810_init_verbs,
3945 alc880_gpio2_init_verbs },
3946 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3947 .dac_nids = alc880_w810_dac_nids,
3948 .dig_out_nid = ALC880_DIGOUT_NID,
3949 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3950 .channel_mode = alc880_w810_modes,
3951 .input_mux = &alc880_capture_source,
3954 .mixers = { alc880_z71v_mixer },
3955 .init_verbs = { alc880_volume_init_verbs,
3956 alc880_pin_z71v_init_verbs },
3957 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3958 .dac_nids = alc880_z71v_dac_nids,
3959 .dig_out_nid = ALC880_DIGOUT_NID,
3961 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3962 .channel_mode = alc880_2_jack_modes,
3963 .input_mux = &alc880_capture_source,
3966 .mixers = { alc880_f1734_mixer },
3967 .init_verbs = { alc880_volume_init_verbs,
3968 alc880_pin_f1734_init_verbs },
3969 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3970 .dac_nids = alc880_f1734_dac_nids,
3972 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3973 .channel_mode = alc880_2_jack_modes,
3974 .input_mux = &alc880_f1734_capture_source,
3975 .unsol_event = alc880_uniwill_p53_unsol_event,
3976 .init_hook = alc880_uniwill_p53_init_hook,
3979 .mixers = { alc880_asus_mixer },
3980 .init_verbs = { alc880_volume_init_verbs,
3981 alc880_pin_asus_init_verbs,
3982 alc880_gpio1_init_verbs },
3983 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3984 .dac_nids = alc880_asus_dac_nids,
3985 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3986 .channel_mode = alc880_asus_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_ASUS_DIG] = {
3991 .mixers = { alc880_asus_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_asus_init_verbs,
3994 alc880_gpio1_init_verbs },
3995 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3996 .dac_nids = alc880_asus_dac_nids,
3997 .dig_out_nid = ALC880_DIGOUT_NID,
3998 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3999 .channel_mode = alc880_asus_modes,
4001 .input_mux = &alc880_capture_source,
4003 [ALC880_ASUS_DIG2] = {
4004 .mixers = { alc880_asus_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_pin_asus_init_verbs,
4007 alc880_gpio2_init_verbs }, /* use GPIO2 */
4008 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4009 .dac_nids = alc880_asus_dac_nids,
4010 .dig_out_nid = ALC880_DIGOUT_NID,
4011 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4012 .channel_mode = alc880_asus_modes,
4014 .input_mux = &alc880_capture_source,
4016 [ALC880_ASUS_W1V] = {
4017 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4018 .init_verbs = { alc880_volume_init_verbs,
4019 alc880_pin_asus_init_verbs,
4020 alc880_gpio1_init_verbs },
4021 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4022 .dac_nids = alc880_asus_dac_nids,
4023 .dig_out_nid = ALC880_DIGOUT_NID,
4024 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4025 .channel_mode = alc880_asus_modes,
4027 .input_mux = &alc880_capture_source,
4029 [ALC880_UNIWILL_DIG] = {
4030 .mixers = { alc880_asus_mixer },
4031 .init_verbs = { alc880_volume_init_verbs,
4032 alc880_pin_asus_init_verbs },
4033 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4034 .dac_nids = alc880_asus_dac_nids,
4035 .dig_out_nid = ALC880_DIGOUT_NID,
4036 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4037 .channel_mode = alc880_asus_modes,
4039 .input_mux = &alc880_capture_source,
4041 [ALC880_UNIWILL] = {
4042 .mixers = { alc880_uniwill_mixer },
4043 .init_verbs = { alc880_volume_init_verbs,
4044 alc880_uniwill_init_verbs },
4045 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4046 .dac_nids = alc880_asus_dac_nids,
4047 .dig_out_nid = ALC880_DIGOUT_NID,
4048 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4049 .channel_mode = alc880_threestack_modes,
4051 .input_mux = &alc880_capture_source,
4052 .unsol_event = alc880_uniwill_unsol_event,
4053 .init_hook = alc880_uniwill_init_hook,
4055 [ALC880_UNIWILL_P53] = {
4056 .mixers = { alc880_uniwill_p53_mixer },
4057 .init_verbs = { alc880_volume_init_verbs,
4058 alc880_uniwill_p53_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4060 .dac_nids = alc880_asus_dac_nids,
4061 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4062 .channel_mode = alc880_threestack_modes,
4063 .input_mux = &alc880_capture_source,
4064 .unsol_event = alc880_uniwill_p53_unsol_event,
4065 .init_hook = alc880_uniwill_p53_init_hook,
4067 [ALC880_FUJITSU] = {
4068 .mixers = { alc880_fujitsu_mixer },
4069 .init_verbs = { alc880_volume_init_verbs,
4070 alc880_uniwill_p53_init_verbs,
4071 alc880_beep_init_verbs },
4072 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4073 .dac_nids = alc880_dac_nids,
4074 .dig_out_nid = ALC880_DIGOUT_NID,
4075 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4076 .channel_mode = alc880_2_jack_modes,
4077 .input_mux = &alc880_capture_source,
4078 .unsol_event = alc880_uniwill_p53_unsol_event,
4079 .init_hook = alc880_uniwill_p53_init_hook,
4082 .mixers = { alc880_three_stack_mixer },
4083 .init_verbs = { alc880_volume_init_verbs,
4084 alc880_pin_clevo_init_verbs },
4085 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4086 .dac_nids = alc880_dac_nids,
4088 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4089 .channel_mode = alc880_threestack_modes,
4091 .input_mux = &alc880_capture_source,
4094 .mixers = { alc880_lg_mixer },
4095 .init_verbs = { alc880_volume_init_verbs,
4096 alc880_lg_init_verbs },
4097 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4098 .dac_nids = alc880_lg_dac_nids,
4099 .dig_out_nid = ALC880_DIGOUT_NID,
4100 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4101 .channel_mode = alc880_lg_ch_modes,
4103 .input_mux = &alc880_lg_capture_source,
4104 .unsol_event = alc_automute_amp_unsol_event,
4105 .init_hook = alc880_lg_init_hook,
4106 #ifdef CONFIG_SND_HDA_POWER_SAVE
4107 .loopbacks = alc880_lg_loopbacks,
4111 .mixers = { alc880_lg_lw_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_lg_lw_init_verbs },
4114 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4115 .dac_nids = alc880_dac_nids,
4116 .dig_out_nid = ALC880_DIGOUT_NID,
4117 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4118 .channel_mode = alc880_lg_lw_modes,
4119 .input_mux = &alc880_lg_lw_capture_source,
4120 .unsol_event = alc_automute_amp_unsol_event,
4121 .init_hook = alc880_lg_lw_init_hook,
4123 [ALC880_MEDION_RIM] = {
4124 .mixers = { alc880_medion_rim_mixer },
4125 .init_verbs = { alc880_volume_init_verbs,
4126 alc880_medion_rim_init_verbs,
4127 alc_gpio2_init_verbs },
4128 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4129 .dac_nids = alc880_dac_nids,
4130 .dig_out_nid = ALC880_DIGOUT_NID,
4131 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4132 .channel_mode = alc880_2_jack_modes,
4133 .input_mux = &alc880_medion_rim_capture_source,
4134 .unsol_event = alc880_medion_rim_unsol_event,
4135 .init_hook = alc880_medion_rim_init_hook,
4137 #ifdef CONFIG_SND_DEBUG
4139 .mixers = { alc880_test_mixer },
4140 .init_verbs = { alc880_test_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4142 .dac_nids = alc880_test_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4145 .channel_mode = alc880_test_modes,
4146 .input_mux = &alc880_test_capture_source,
4152 * Automatic parse of I/O pins from the BIOS configuration
4157 ALC_CTL_WIDGET_MUTE,
4160 static struct snd_kcontrol_new alc880_control_templates[] = {
4161 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4162 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4163 HDA_BIND_MUTE(NULL, 0, 0, 0),
4166 /* add dynamic controls */
4167 static int add_control(struct alc_spec *spec, int type, const char *name,
4170 struct snd_kcontrol_new *knew;
4172 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4173 knew = snd_array_new(&spec->kctls);
4176 *knew = alc880_control_templates[type];
4177 knew->name = kstrdup(name, GFP_KERNEL);
4180 knew->private_value = val;
4184 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4185 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4186 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4187 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4188 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4189 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4190 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4191 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4192 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4193 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4194 #define ALC880_PIN_CD_NID 0x1c
4196 /* fill in the dac_nids table from the parsed pin configuration */
4197 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4198 const struct auto_pin_cfg *cfg)
4204 memset(assigned, 0, sizeof(assigned));
4205 spec->multiout.dac_nids = spec->private_dac_nids;
4207 /* check the pins hardwired to audio widget */
4208 for (i = 0; i < cfg->line_outs; i++) {
4209 nid = cfg->line_out_pins[i];
4210 if (alc880_is_fixed_pin(nid)) {
4211 int idx = alc880_fixed_pin_idx(nid);
4212 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4216 /* left pins can be connect to any audio widget */
4217 for (i = 0; i < cfg->line_outs; i++) {
4218 nid = cfg->line_out_pins[i];
4219 if (alc880_is_fixed_pin(nid))
4221 /* search for an empty channel */
4222 for (j = 0; j < cfg->line_outs; j++) {
4224 spec->multiout.dac_nids[i] =
4225 alc880_idx_to_dac(j);
4231 spec->multiout.num_dacs = cfg->line_outs;
4235 /* add playback controls from the parsed DAC table */
4236 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4237 const struct auto_pin_cfg *cfg)
4240 static const char *chname[4] = {
4241 "Front", "Surround", NULL /*CLFE*/, "Side"
4246 for (i = 0; i < cfg->line_outs; i++) {
4247 if (!spec->multiout.dac_nids[i])
4249 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4252 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4253 "Center Playback Volume",
4254 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4258 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4259 "LFE Playback Volume",
4260 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4264 err = add_control(spec, ALC_CTL_BIND_MUTE,
4265 "Center Playback Switch",
4266 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4270 err = add_control(spec, ALC_CTL_BIND_MUTE,
4271 "LFE Playback Switch",
4272 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4277 sprintf(name, "%s Playback Volume", chname[i]);
4278 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4279 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4283 sprintf(name, "%s Playback Switch", chname[i]);
4284 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4285 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4294 /* add playback controls for speaker and HP outputs */
4295 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4305 if (alc880_is_fixed_pin(pin)) {
4306 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4307 /* specify the DAC as the extra output */
4308 if (!spec->multiout.hp_nid)
4309 spec->multiout.hp_nid = nid;
4311 spec->multiout.extra_out_nid[0] = nid;
4312 /* control HP volume/switch on the output mixer amp */
4313 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4314 sprintf(name, "%s Playback Volume", pfx);
4315 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4316 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4319 sprintf(name, "%s Playback Switch", pfx);
4320 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4321 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4324 } else if (alc880_is_multi_pin(pin)) {
4325 /* set manual connection */
4326 /* we have only a switch on HP-out PIN */
4327 sprintf(name, "%s Playback Switch", pfx);
4328 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4329 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4336 /* create input playback/capture controls for the given pin */
4337 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4338 const char *ctlname,
4339 int idx, hda_nid_t mix_nid)
4344 sprintf(name, "%s Playback Volume", ctlname);
4345 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4346 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4349 sprintf(name, "%s Playback Switch", ctlname);
4350 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4351 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4357 /* create playback/capture controls for input pins */
4358 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4359 const struct auto_pin_cfg *cfg)
4361 struct hda_input_mux *imux = &spec->private_imux[0];
4364 for (i = 0; i < AUTO_PIN_LAST; i++) {
4365 if (alc880_is_input_pin(cfg->input_pins[i])) {
4366 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4367 err = new_analog_input(spec, cfg->input_pins[i],
4368 auto_pin_cfg_labels[i],
4372 imux->items[imux->num_items].label =
4373 auto_pin_cfg_labels[i];
4374 imux->items[imux->num_items].index =
4375 alc880_input_pin_idx(cfg->input_pins[i]);
4382 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4383 unsigned int pin_type)
4385 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4388 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4392 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4393 hda_nid_t nid, int pin_type,
4396 alc_set_pin_output(codec, nid, pin_type);
4397 /* need the manual connection? */
4398 if (alc880_is_multi_pin(nid)) {
4399 struct alc_spec *spec = codec->spec;
4400 int idx = alc880_multi_pin_idx(nid);
4401 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4402 AC_VERB_SET_CONNECT_SEL,
4403 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4407 static int get_pin_type(int line_out_type)
4409 if (line_out_type == AUTO_PIN_HP_OUT)
4415 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4417 struct alc_spec *spec = codec->spec;
4420 for (i = 0; i < spec->autocfg.line_outs; i++) {
4421 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4422 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4423 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4427 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4429 struct alc_spec *spec = codec->spec;
4432 pin = spec->autocfg.speaker_pins[0];
4433 if (pin) /* connect to front */
4434 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4435 pin = spec->autocfg.hp_pins[0];
4436 if (pin) /* connect to front */
4437 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4440 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4442 struct alc_spec *spec = codec->spec;
4445 for (i = 0; i < AUTO_PIN_LAST; i++) {
4446 hda_nid_t nid = spec->autocfg.input_pins[i];
4447 if (alc880_is_input_pin(nid)) {
4448 alc_set_input_pin(codec, nid, i);
4449 if (nid != ALC880_PIN_CD_NID &&
4450 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4451 snd_hda_codec_write(codec, nid, 0,
4452 AC_VERB_SET_AMP_GAIN_MUTE,
4458 /* parse the BIOS configuration and set up the alc_spec */
4459 /* return 1 if successful, 0 if the proper config is not found,
4460 * or a negative error code
4462 static int alc880_parse_auto_config(struct hda_codec *codec)
4464 struct alc_spec *spec = codec->spec;
4466 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4468 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4472 if (!spec->autocfg.line_outs)
4473 return 0; /* can't find valid BIOS pin config */
4475 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4478 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4481 err = alc880_auto_create_extra_out(spec,
4482 spec->autocfg.speaker_pins[0],
4486 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4490 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4494 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4496 /* check multiple SPDIF-out (for recent codecs) */
4497 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4499 err = snd_hda_get_connections(codec,
4500 spec->autocfg.dig_out_pins[i],
4505 spec->multiout.dig_out_nid = dig_nid;
4507 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4508 spec->slave_dig_outs[i - 1] = dig_nid;
4509 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4513 if (spec->autocfg.dig_in_pin)
4514 spec->dig_in_nid = ALC880_DIGIN_NID;
4516 if (spec->kctls.list)
4517 add_mixer(spec, spec->kctls.list);
4519 add_verb(spec, alc880_volume_init_verbs);
4521 spec->num_mux_defs = 1;
4522 spec->input_mux = &spec->private_imux[0];
4524 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4529 /* additional initialization for auto-configuration model */
4530 static void alc880_auto_init(struct hda_codec *codec)
4532 struct alc_spec *spec = codec->spec;
4533 alc880_auto_init_multi_out(codec);
4534 alc880_auto_init_extra_out(codec);
4535 alc880_auto_init_analog_input(codec);
4536 if (spec->unsol_event)
4537 alc_inithook(codec);
4540 static void set_capture_mixer(struct alc_spec *spec)
4542 static struct snd_kcontrol_new *caps[2][3] = {
4543 { alc_capture_mixer_nosrc1,
4544 alc_capture_mixer_nosrc2,
4545 alc_capture_mixer_nosrc3 },
4546 { alc_capture_mixer1,
4548 alc_capture_mixer3 },
4550 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4552 if (spec->input_mux && spec->input_mux->num_items > 1)
4556 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4560 #define set_beep_amp(spec, nid, idx, dir) \
4561 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4564 * OK, here we have finally the patch for ALC880
4567 static int patch_alc880(struct hda_codec *codec)
4569 struct alc_spec *spec;
4573 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4579 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4582 if (board_config < 0) {
4583 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4584 "trying auto-probe from BIOS...\n", codec->chip_name);
4585 board_config = ALC880_AUTO;
4588 if (board_config == ALC880_AUTO) {
4589 /* automatic parse from the BIOS config */
4590 err = alc880_parse_auto_config(codec);
4596 "hda_codec: Cannot set up configuration "
4597 "from BIOS. Using 3-stack mode...\n");
4598 board_config = ALC880_3ST;
4602 err = snd_hda_attach_beep_device(codec, 0x1);
4608 if (board_config != ALC880_AUTO)
4609 setup_preset(spec, &alc880_presets[board_config]);
4611 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4612 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4613 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4615 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4616 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4618 if (!spec->adc_nids && spec->input_mux) {
4619 /* check whether NID 0x07 is valid */
4620 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4622 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4623 if (wcap != AC_WID_AUD_IN) {
4624 spec->adc_nids = alc880_adc_nids_alt;
4625 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4627 spec->adc_nids = alc880_adc_nids;
4628 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4631 set_capture_mixer(spec);
4632 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4634 spec->vmaster_nid = 0x0c;
4636 codec->patch_ops = alc_patch_ops;
4637 if (board_config == ALC880_AUTO)
4638 spec->init_hook = alc880_auto_init;
4639 #ifdef CONFIG_SND_HDA_POWER_SAVE
4640 if (!spec->loopback.amplist)
4641 spec->loopback.amplist = alc880_loopbacks;
4643 codec->proc_widget_hook = print_realtek_coef;
4653 static hda_nid_t alc260_dac_nids[1] = {
4658 static hda_nid_t alc260_adc_nids[1] = {
4663 static hda_nid_t alc260_adc_nids_alt[1] = {
4668 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4669 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4671 static hda_nid_t alc260_dual_adc_nids[2] = {
4676 #define ALC260_DIGOUT_NID 0x03
4677 #define ALC260_DIGIN_NID 0x06
4679 static struct hda_input_mux alc260_capture_source = {
4683 { "Front Mic", 0x1 },
4689 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4690 * headphone jack and the internal CD lines since these are the only pins at
4691 * which audio can appear. For flexibility, also allow the option of
4692 * recording the mixer output on the second ADC (ADC0 doesn't have a
4693 * connection to the mixer output).
4695 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4699 { "Mic/Line", 0x0 },
4701 { "Headphone", 0x2 },
4707 { "Mic/Line", 0x0 },
4709 { "Headphone", 0x2 },
4716 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4717 * the Fujitsu S702x, but jacks are marked differently.
4719 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4726 { "Headphone", 0x5 },
4735 { "Headphone", 0x6 },
4741 /* Maxdata Favorit 100XS */
4742 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4746 { "Line/Mic", 0x0 },
4753 { "Line/Mic", 0x0 },
4761 * This is just place-holder, so there's something for alc_build_pcms to look
4762 * at when it calculates the maximum number of channels. ALC260 has no mixer
4763 * element which allows changing the channel mode, so the verb list is
4766 static struct hda_channel_mode alc260_modes[1] = {
4771 /* Mixer combinations
4773 * basic: base_output + input + pc_beep + capture
4774 * HP: base_output + input + capture_alt
4775 * HP_3013: hp_3013 + input + capture
4776 * fujitsu: fujitsu + capture
4777 * acer: acer + capture
4780 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4781 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4782 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4784 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4785 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4786 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4790 static struct snd_kcontrol_new alc260_input_mixer[] = {
4791 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4792 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4793 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4794 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4796 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4797 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4798 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4802 /* update HP, line and mono out pins according to the master switch */
4803 static void alc260_hp_master_update(struct hda_codec *codec,
4804 hda_nid_t hp, hda_nid_t line,
4807 struct alc_spec *spec = codec->spec;
4808 unsigned int val = spec->master_sw ? PIN_HP : 0;
4809 /* change HP and line-out pins */
4810 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4812 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4814 /* mono (speaker) depending on the HP jack sense */
4815 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4816 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4820 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4821 struct snd_ctl_elem_value *ucontrol)
4823 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4824 struct alc_spec *spec = codec->spec;
4825 *ucontrol->value.integer.value = spec->master_sw;
4829 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4830 struct snd_ctl_elem_value *ucontrol)
4832 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4833 struct alc_spec *spec = codec->spec;
4834 int val = !!*ucontrol->value.integer.value;
4835 hda_nid_t hp, line, mono;
4837 if (val == spec->master_sw)
4839 spec->master_sw = val;
4840 hp = (kcontrol->private_value >> 16) & 0xff;
4841 line = (kcontrol->private_value >> 8) & 0xff;
4842 mono = kcontrol->private_value & 0xff;
4843 alc260_hp_master_update(codec, hp, line, mono);
4847 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4850 .name = "Master Playback Switch",
4851 .info = snd_ctl_boolean_mono_info,
4852 .get = alc260_hp_master_sw_get,
4853 .put = alc260_hp_master_sw_put,
4854 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4856 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4857 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4858 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4859 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4860 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4862 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4866 static struct hda_verb alc260_hp_unsol_verbs[] = {
4867 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4871 static void alc260_hp_automute(struct hda_codec *codec)
4873 struct alc_spec *spec = codec->spec;
4874 unsigned int present;
4876 present = snd_hda_codec_read(codec, 0x10, 0,
4877 AC_VERB_GET_PIN_SENSE, 0);
4878 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4879 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4882 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4884 if ((res >> 26) == ALC880_HP_EVENT)
4885 alc260_hp_automute(codec);
4888 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4891 .name = "Master Playback Switch",
4892 .info = snd_ctl_boolean_mono_info,
4893 .get = alc260_hp_master_sw_get,
4894 .put = alc260_hp_master_sw_put,
4895 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4897 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4898 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4899 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4900 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4902 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4903 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4904 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4908 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4909 .ops = &snd_hda_bind_vol,
4911 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4912 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4913 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4918 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4919 .ops = &snd_hda_bind_sw,
4921 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4922 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4927 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4928 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4929 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4930 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4931 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4935 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4936 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4940 static void alc260_hp_3013_automute(struct hda_codec *codec)
4942 struct alc_spec *spec = codec->spec;
4943 unsigned int present;
4945 present = snd_hda_codec_read(codec, 0x15, 0,
4946 AC_VERB_GET_PIN_SENSE, 0);
4947 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4948 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4951 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4954 if ((res >> 26) == ALC880_HP_EVENT)
4955 alc260_hp_3013_automute(codec);
4958 static void alc260_hp_3012_automute(struct hda_codec *codec)
4960 unsigned int present, bits;
4962 present = snd_hda_codec_read(codec, 0x10, 0,
4963 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4965 bits = present ? 0 : PIN_OUT;
4966 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4968 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4970 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4974 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4977 if ((res >> 26) == ALC880_HP_EVENT)
4978 alc260_hp_3012_automute(codec);
4981 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4982 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4984 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4985 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4986 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4987 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4988 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4989 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4990 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4991 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4992 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4993 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4994 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4998 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4999 * versions of the ALC260 don't act on requests to enable mic bias from NID
5000 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5001 * datasheet doesn't mention this restriction. At this stage it's not clear
5002 * whether this behaviour is intentional or is a hardware bug in chip
5003 * revisions available in early 2006. Therefore for now allow the
5004 * "Headphone Jack Mode" control to span all choices, but if it turns out
5005 * that the lack of mic bias for this NID is intentional we could change the
5006 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5008 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5009 * don't appear to make the mic bias available from the "line" jack, even
5010 * though the NID used for this jack (0x14) can supply it. The theory is
5011 * that perhaps Acer have included blocking capacitors between the ALC260
5012 * and the output jack. If this turns out to be the case for all such
5013 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5014 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5016 * The C20x Tablet series have a mono internal speaker which is controlled
5017 * via the chip's Mono sum widget and pin complex, so include the necessary
5018 * controls for such models. On models without a "mono speaker" the control
5019 * won't do anything.
5021 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5022 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5023 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5024 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5025 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5027 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5029 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5030 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5032 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5033 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5034 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5035 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5036 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5040 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5042 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5043 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5044 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5045 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5046 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5047 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5048 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5052 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5053 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5055 static struct snd_kcontrol_new alc260_will_mixer[] = {
5056 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5057 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5058 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5059 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5060 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5061 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5062 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5063 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5064 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5065 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5069 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5070 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5072 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5073 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5074 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5076 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5077 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5078 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5079 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5080 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5081 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5082 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5087 * initialization verbs
5089 static struct hda_verb alc260_init_verbs[] = {
5090 /* Line In pin widget for input */
5091 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5092 /* CD pin widget for input */
5093 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5094 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5095 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5096 /* Mic2 (front panel) pin widget for input and vref at 80% */
5097 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5098 /* LINE-2 is used for line-out in rear */
5099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5100 /* select line-out */
5101 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5103 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5105 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5107 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5108 /* mute capture amp left and right */
5109 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5110 /* set connection select to line in (default select for this ADC) */
5111 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5112 /* mute capture amp left and right */
5113 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5114 /* set connection select to line in (default select for this ADC) */
5115 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5116 /* set vol=0 Line-Out mixer amp left and right */
5117 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5118 /* unmute pin widget amp left and right (no gain on this amp) */
5119 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5120 /* set vol=0 HP mixer amp left and right */
5121 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5122 /* unmute pin widget amp left and right (no gain on this amp) */
5123 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5124 /* set vol=0 Mono mixer amp left and right */
5125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5126 /* unmute pin widget amp left and right (no gain on this amp) */
5127 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5128 /* unmute LINE-2 out pin */
5129 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5130 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5133 /* mute analog inputs */
5134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5137 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5138 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5139 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5140 /* mute Front out path */
5141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5143 /* mute Headphone out path */
5144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5145 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5146 /* mute Mono out path */
5147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5148 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5152 #if 0 /* should be identical with alc260_init_verbs? */
5153 static struct hda_verb alc260_hp_init_verbs[] = {
5154 /* Headphone and output */
5155 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5157 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5158 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5159 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5160 /* Mic2 (front panel) pin widget for input and vref at 80% */
5161 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5162 /* Line In pin widget for input */
5163 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5164 /* Line-2 pin widget for output */
5165 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5166 /* CD pin widget for input */
5167 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5168 /* unmute amp left and right */
5169 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5170 /* set connection select to line in (default select for this ADC) */
5171 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5172 /* unmute Line-Out mixer amp left and right (volume = 0) */
5173 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5174 /* mute pin widget amp left and right (no gain on this amp) */
5175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5176 /* unmute HP mixer amp left and right (volume = 0) */
5177 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5178 /* mute pin widget amp left and right (no gain on this amp) */
5179 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5180 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5183 /* mute analog inputs */
5184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5187 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5188 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5189 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5190 /* Unmute Front out path */
5191 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5192 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5193 /* Unmute Headphone out path */
5194 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5196 /* Unmute Mono out path */
5197 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5198 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5203 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5204 /* Line out and output */
5205 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5207 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5208 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5209 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5210 /* Mic2 (front panel) pin widget for input and vref at 80% */
5211 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5212 /* Line In pin widget for input */
5213 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5214 /* Headphone pin widget for output */
5215 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5216 /* CD pin widget for input */
5217 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5218 /* unmute amp left and right */
5219 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5220 /* set connection select to line in (default select for this ADC) */
5221 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5222 /* unmute Line-Out mixer amp left and right (volume = 0) */
5223 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5224 /* mute pin widget amp left and right (no gain on this amp) */
5225 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5226 /* unmute HP mixer amp left and right (volume = 0) */
5227 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5228 /* mute pin widget amp left and right (no gain on this amp) */
5229 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5230 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5233 /* mute analog inputs */
5234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5239 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5240 /* Unmute Front out path */
5241 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5242 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5243 /* Unmute Headphone out path */
5244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5246 /* Unmute Mono out path */
5247 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5248 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5252 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5253 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5254 * audio = 0x16, internal speaker = 0x10.
5256 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5257 /* Disable all GPIOs */
5258 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5259 /* Internal speaker is connected to headphone pin */
5260 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5261 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5262 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5263 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5264 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5265 /* Ensure all other unused pins are disabled and muted. */
5266 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5267 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5268 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5269 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5270 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5271 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5272 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5273 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5275 /* Disable digital (SPDIF) pins */
5276 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5277 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5279 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5280 * when acting as an output.
5282 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5284 /* Start with output sum widgets muted and their output gains at min */
5285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5287 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5288 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5289 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5291 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5292 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5293 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5295 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5296 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5297 /* Unmute Line1 pin widget output buffer since it starts as an output.
5298 * If the pin mode is changed by the user the pin mode control will
5299 * take care of enabling the pin's input/output buffers as needed.
5300 * Therefore there's no need to enable the input buffer at this
5303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5304 /* Unmute input buffer of pin widget used for Line-in (no equiv
5307 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5309 /* Mute capture amp left and right */
5310 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5311 /* Set ADC connection select to match default mixer setting - line
5314 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5316 /* Do the same for the second ADC: mute capture input amp and
5317 * set ADC connection to line in (on mic1 pin)
5319 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5320 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5322 /* Mute all inputs to mixer widget (even unconnected ones) */
5323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5325 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5326 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5327 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5328 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5329 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5330 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5335 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5336 * similar laptops (adapted from Fujitsu init verbs).
5338 static struct hda_verb alc260_acer_init_verbs[] = {
5339 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5340 * the headphone jack. Turn this on and rely on the standard mute
5341 * methods whenever the user wants to turn these outputs off.
5343 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5344 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5345 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5346 /* Internal speaker/Headphone jack is connected to Line-out pin */
5347 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5348 /* Internal microphone/Mic jack is connected to Mic1 pin */
5349 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5350 /* Line In jack is connected to Line1 pin */
5351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5352 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5353 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5354 /* Ensure all other unused pins are disabled and muted. */
5355 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5356 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5357 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5358 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5359 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5360 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5361 /* Disable digital (SPDIF) pins */
5362 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5363 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5365 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5366 * bus when acting as outputs.
5368 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5369 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5371 /* Start with output sum widgets muted and their output gains at min */
5372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5373 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5376 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5377 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5378 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5379 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5380 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5382 /* Unmute Line-out pin widget amp left and right
5383 * (no equiv mixer ctrl)
5385 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5386 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5387 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5388 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5389 * inputs. If the pin mode is changed by the user the pin mode control
5390 * will take care of enabling the pin's input/output buffers as needed.
5391 * Therefore there's no need to enable the input buffer at this
5394 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5395 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5397 /* Mute capture amp left and right */
5398 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5399 /* Set ADC connection select to match default mixer setting - mic
5402 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5404 /* Do similar with the second ADC: mute capture input amp and
5405 * set ADC connection to mic to match ALSA's default state.
5407 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5408 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5410 /* Mute all inputs to mixer widget (even unconnected ones) */
5411 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5412 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5413 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5414 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5417 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5418 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5423 /* Initialisation sequence for Maxdata Favorit 100XS
5424 * (adapted from Acer init verbs).
5426 static struct hda_verb alc260_favorit100_init_verbs[] = {
5427 /* GPIO 0 enables the output jack.
5428 * Turn this on and rely on the standard mute
5429 * methods whenever the user wants to turn these outputs off.
5431 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5432 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5433 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5434 /* Line/Mic input jack is connected to Mic1 pin */
5435 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5436 /* Ensure all other unused pins are disabled and muted. */
5437 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5438 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5440 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5441 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5442 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5443 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5444 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5447 /* Disable digital (SPDIF) pins */
5448 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5449 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5451 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5452 * bus when acting as outputs.
5454 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5455 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5457 /* Start with output sum widgets muted and their output gains at min */
5458 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5459 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5461 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5463 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5464 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5465 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5466 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5468 /* Unmute Line-out pin widget amp left and right
5469 * (no equiv mixer ctrl)
5471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5472 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5473 * inputs. If the pin mode is changed by the user the pin mode control
5474 * will take care of enabling the pin's input/output buffers as needed.
5475 * Therefore there's no need to enable the input buffer at this
5478 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5480 /* Mute capture amp left and right */
5481 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5482 /* Set ADC connection select to match default mixer setting - mic
5485 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5487 /* Do similar with the second ADC: mute capture input amp and
5488 * set ADC connection to mic to match ALSA's default state.
5490 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5491 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5493 /* Mute all inputs to mixer widget (even unconnected ones) */
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5501 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5506 static struct hda_verb alc260_will_verbs[] = {
5507 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5508 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5509 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5510 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5511 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5512 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5516 static struct hda_verb alc260_replacer_672v_verbs[] = {
5517 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5518 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5519 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5521 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5522 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5523 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5525 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5529 /* toggle speaker-output according to the hp-jack state */
5530 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5532 unsigned int present;
5534 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5535 present = snd_hda_codec_read(codec, 0x0f, 0,
5536 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5538 snd_hda_codec_write_cache(codec, 0x01, 0,
5539 AC_VERB_SET_GPIO_DATA, 1);
5540 snd_hda_codec_write_cache(codec, 0x0f, 0,
5541 AC_VERB_SET_PIN_WIDGET_CONTROL,
5544 snd_hda_codec_write_cache(codec, 0x01, 0,
5545 AC_VERB_SET_GPIO_DATA, 0);
5546 snd_hda_codec_write_cache(codec, 0x0f, 0,
5547 AC_VERB_SET_PIN_WIDGET_CONTROL,
5552 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5555 if ((res >> 26) == ALC880_HP_EVENT)
5556 alc260_replacer_672v_automute(codec);
5559 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5560 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5561 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5562 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5563 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5564 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5566 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5567 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5568 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5569 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5573 /* Test configuration for debugging, modelled after the ALC880 test
5576 #ifdef CONFIG_SND_DEBUG
5577 static hda_nid_t alc260_test_dac_nids[1] = {
5580 static hda_nid_t alc260_test_adc_nids[2] = {
5583 /* For testing the ALC260, each input MUX needs its own definition since
5584 * the signal assignments are different. This assumes that the first ADC
5587 static struct hda_input_mux alc260_test_capture_sources[2] = {
5591 { "MIC1 pin", 0x0 },
5592 { "MIC2 pin", 0x1 },
5593 { "LINE1 pin", 0x2 },
5594 { "LINE2 pin", 0x3 },
5596 { "LINE-OUT pin", 0x5 },
5597 { "HP-OUT pin", 0x6 },
5603 { "MIC1 pin", 0x0 },
5604 { "MIC2 pin", 0x1 },
5605 { "LINE1 pin", 0x2 },
5606 { "LINE2 pin", 0x3 },
5609 { "LINE-OUT pin", 0x6 },
5610 { "HP-OUT pin", 0x7 },
5614 static struct snd_kcontrol_new alc260_test_mixer[] = {
5615 /* Output driver widgets */
5616 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5617 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5618 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5619 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5620 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5621 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5623 /* Modes for retasking pin widgets
5624 * Note: the ALC260 doesn't seem to act on requests to enable mic
5625 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5626 * mention this restriction. At this stage it's not clear whether
5627 * this behaviour is intentional or is a hardware bug in chip
5628 * revisions available at least up until early 2006. Therefore for
5629 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5630 * choices, but if it turns out that the lack of mic bias for these
5631 * NIDs is intentional we could change their modes from
5632 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5634 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5635 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5636 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5637 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5638 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5639 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5641 /* Loopback mixer controls */
5642 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5643 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5644 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5645 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5646 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5647 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5648 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5649 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5650 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5651 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5652 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5653 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5654 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5655 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5657 /* Controls for GPIO pins, assuming they are configured as outputs */
5658 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5659 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5660 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5661 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5663 /* Switches to allow the digital IO pins to be enabled. The datasheet
5664 * is ambigious as to which NID is which; testing on laptops which
5665 * make this output available should provide clarification.
5667 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5668 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5670 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5671 * this output to turn on an external amplifier.
5673 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5674 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5678 static struct hda_verb alc260_test_init_verbs[] = {
5679 /* Enable all GPIOs as outputs with an initial value of 0 */
5680 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5681 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5682 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5684 /* Enable retasking pins as output, initially without power amp */
5685 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5686 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5689 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5690 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5692 /* Disable digital (SPDIF) pins initially, but users can enable
5693 * them via a mixer switch. In the case of SPDIF-out, this initverb
5694 * payload also sets the generation to 0, output to be in "consumer"
5695 * PCM format, copyright asserted, no pre-emphasis and no validity
5698 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5699 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5701 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5702 * OUT1 sum bus when acting as an output.
5704 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5705 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5706 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5707 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5709 /* Start with output sum widgets muted and their output gains at min */
5710 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5711 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5712 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5713 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5714 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5715 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5716 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5717 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5718 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5720 /* Unmute retasking pin widget output buffers since the default
5721 * state appears to be output. As the pin mode is changed by the
5722 * user the pin mode control will take care of enabling the pin's
5723 * input/output buffers as needed.
5725 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5726 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5729 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5730 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5731 /* Also unmute the mono-out pin widget */
5732 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5734 /* Mute capture amp left and right */
5735 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5736 /* Set ADC connection select to match default mixer setting (mic1
5739 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5741 /* Do the same for the second ADC: mute capture input amp and
5742 * set ADC connection to mic1 pin
5744 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5745 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5747 /* Mute all inputs to mixer widget (even unconnected ones) */
5748 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5749 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5750 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5752 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5761 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5762 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5764 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5765 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5768 * for BIOS auto-configuration
5771 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5772 const char *pfx, int *vol_bits)
5775 unsigned long vol_val, sw_val;
5779 if (nid >= 0x0f && nid < 0x11) {
5780 nid_vol = nid - 0x7;
5781 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5782 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5783 } else if (nid == 0x11) {
5784 nid_vol = nid - 0x7;
5785 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5786 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5787 } else if (nid >= 0x12 && nid <= 0x15) {
5789 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5790 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5794 if (!(*vol_bits & (1 << nid_vol))) {
5795 /* first control for the volume widget */
5796 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5797 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5800 *vol_bits |= (1 << nid_vol);
5802 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5803 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5809 /* add playback controls from the parsed DAC table */
5810 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5811 const struct auto_pin_cfg *cfg)
5817 spec->multiout.num_dacs = 1;
5818 spec->multiout.dac_nids = spec->private_dac_nids;
5819 spec->multiout.dac_nids[0] = 0x02;
5821 nid = cfg->line_out_pins[0];
5823 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5828 nid = cfg->speaker_pins[0];
5830 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5835 nid = cfg->hp_pins[0];
5837 err = alc260_add_playback_controls(spec, nid, "Headphone",
5845 /* create playback/capture controls for input pins */
5846 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5847 const struct auto_pin_cfg *cfg)
5849 struct hda_input_mux *imux = &spec->private_imux[0];
5852 for (i = 0; i < AUTO_PIN_LAST; i++) {
5853 if (cfg->input_pins[i] >= 0x12) {
5854 idx = cfg->input_pins[i] - 0x12;
5855 err = new_analog_input(spec, cfg->input_pins[i],
5856 auto_pin_cfg_labels[i], idx,
5860 imux->items[imux->num_items].label =
5861 auto_pin_cfg_labels[i];
5862 imux->items[imux->num_items].index = idx;
5865 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5866 idx = cfg->input_pins[i] - 0x09;
5867 err = new_analog_input(spec, cfg->input_pins[i],
5868 auto_pin_cfg_labels[i], idx,
5872 imux->items[imux->num_items].label =
5873 auto_pin_cfg_labels[i];
5874 imux->items[imux->num_items].index = idx;
5881 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5882 hda_nid_t nid, int pin_type,
5885 alc_set_pin_output(codec, nid, pin_type);
5886 /* need the manual connection? */
5888 int idx = nid - 0x12;
5889 snd_hda_codec_write(codec, idx + 0x0b, 0,
5890 AC_VERB_SET_CONNECT_SEL, sel_idx);
5894 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5896 struct alc_spec *spec = codec->spec;
5899 nid = spec->autocfg.line_out_pins[0];
5901 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5902 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5905 nid = spec->autocfg.speaker_pins[0];
5907 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5909 nid = spec->autocfg.hp_pins[0];
5911 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5914 #define ALC260_PIN_CD_NID 0x16
5915 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5917 struct alc_spec *spec = codec->spec;
5920 for (i = 0; i < AUTO_PIN_LAST; i++) {
5921 hda_nid_t nid = spec->autocfg.input_pins[i];
5923 alc_set_input_pin(codec, nid, i);
5924 if (nid != ALC260_PIN_CD_NID &&
5925 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5926 snd_hda_codec_write(codec, nid, 0,
5927 AC_VERB_SET_AMP_GAIN_MUTE,
5934 * generic initialization of ADC, input mixers and output mixers
5936 static struct hda_verb alc260_volume_init_verbs[] = {
5938 * Unmute ADC0-1 and set the default input to mic-in
5940 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5941 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5942 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5943 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5945 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5947 * Note: PASD motherboards uses the Line In 2 as the input for
5948 * front panel mic (mic 2)
5950 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5951 /* mute analog inputs */
5952 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5953 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5954 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5956 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5959 * Set up output mixers (0x08 - 0x0a)
5961 /* set vol=0 to output mixers */
5962 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5963 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5964 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5965 /* set up input amps for analog loopback */
5966 /* Amp Indices: DAC = 0, mixer = 1 */
5967 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5968 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5969 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5970 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5971 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5972 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5977 static int alc260_parse_auto_config(struct hda_codec *codec)
5979 struct alc_spec *spec = codec->spec;
5981 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5983 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5987 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5990 if (!spec->kctls.list)
5991 return 0; /* can't find valid BIOS pin config */
5992 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5996 spec->multiout.max_channels = 2;
5998 if (spec->autocfg.dig_outs)
5999 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6000 if (spec->kctls.list)
6001 add_mixer(spec, spec->kctls.list);
6003 add_verb(spec, alc260_volume_init_verbs);
6005 spec->num_mux_defs = 1;
6006 spec->input_mux = &spec->private_imux[0];
6008 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6013 /* additional initialization for auto-configuration model */
6014 static void alc260_auto_init(struct hda_codec *codec)
6016 struct alc_spec *spec = codec->spec;
6017 alc260_auto_init_multi_out(codec);
6018 alc260_auto_init_analog_input(codec);
6019 if (spec->unsol_event)
6020 alc_inithook(codec);
6023 #ifdef CONFIG_SND_HDA_POWER_SAVE
6024 static struct hda_amp_list alc260_loopbacks[] = {
6025 { 0x07, HDA_INPUT, 0 },
6026 { 0x07, HDA_INPUT, 1 },
6027 { 0x07, HDA_INPUT, 2 },
6028 { 0x07, HDA_INPUT, 3 },
6029 { 0x07, HDA_INPUT, 4 },
6035 * ALC260 configurations
6037 static const char *alc260_models[ALC260_MODEL_LAST] = {
6038 [ALC260_BASIC] = "basic",
6040 [ALC260_HP_3013] = "hp-3013",
6041 [ALC260_HP_DC7600] = "hp-dc7600",
6042 [ALC260_FUJITSU_S702X] = "fujitsu",
6043 [ALC260_ACER] = "acer",
6044 [ALC260_WILL] = "will",
6045 [ALC260_REPLACER_672V] = "replacer",
6046 [ALC260_FAVORIT100] = "favorit100",
6047 #ifdef CONFIG_SND_DEBUG
6048 [ALC260_TEST] = "test",
6050 [ALC260_AUTO] = "auto",
6053 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6054 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6055 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6056 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6057 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6058 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6059 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6060 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6061 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6062 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6063 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6064 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6065 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6066 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6067 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6068 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6069 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6070 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6071 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6072 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6076 static struct alc_config_preset alc260_presets[] = {
6078 .mixers = { alc260_base_output_mixer,
6079 alc260_input_mixer },
6080 .init_verbs = { alc260_init_verbs },
6081 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6082 .dac_nids = alc260_dac_nids,
6083 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6084 .adc_nids = alc260_adc_nids,
6085 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6086 .channel_mode = alc260_modes,
6087 .input_mux = &alc260_capture_source,
6090 .mixers = { alc260_hp_output_mixer,
6091 alc260_input_mixer },
6092 .init_verbs = { alc260_init_verbs,
6093 alc260_hp_unsol_verbs },
6094 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6095 .dac_nids = alc260_dac_nids,
6096 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6097 .adc_nids = alc260_adc_nids_alt,
6098 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6099 .channel_mode = alc260_modes,
6100 .input_mux = &alc260_capture_source,
6101 .unsol_event = alc260_hp_unsol_event,
6102 .init_hook = alc260_hp_automute,
6104 [ALC260_HP_DC7600] = {
6105 .mixers = { alc260_hp_dc7600_mixer,
6106 alc260_input_mixer },
6107 .init_verbs = { alc260_init_verbs,
6108 alc260_hp_dc7600_verbs },
6109 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6110 .dac_nids = alc260_dac_nids,
6111 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6112 .adc_nids = alc260_adc_nids_alt,
6113 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6114 .channel_mode = alc260_modes,
6115 .input_mux = &alc260_capture_source,
6116 .unsol_event = alc260_hp_3012_unsol_event,
6117 .init_hook = alc260_hp_3012_automute,
6119 [ALC260_HP_3013] = {
6120 .mixers = { alc260_hp_3013_mixer,
6121 alc260_input_mixer },
6122 .init_verbs = { alc260_hp_3013_init_verbs,
6123 alc260_hp_3013_unsol_verbs },
6124 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6125 .dac_nids = alc260_dac_nids,
6126 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6127 .adc_nids = alc260_adc_nids_alt,
6128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6129 .channel_mode = alc260_modes,
6130 .input_mux = &alc260_capture_source,
6131 .unsol_event = alc260_hp_3013_unsol_event,
6132 .init_hook = alc260_hp_3013_automute,
6134 [ALC260_FUJITSU_S702X] = {
6135 .mixers = { alc260_fujitsu_mixer },
6136 .init_verbs = { alc260_fujitsu_init_verbs },
6137 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6138 .dac_nids = alc260_dac_nids,
6139 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6140 .adc_nids = alc260_dual_adc_nids,
6141 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6142 .channel_mode = alc260_modes,
6143 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6144 .input_mux = alc260_fujitsu_capture_sources,
6147 .mixers = { alc260_acer_mixer },
6148 .init_verbs = { alc260_acer_init_verbs },
6149 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6150 .dac_nids = alc260_dac_nids,
6151 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6152 .adc_nids = alc260_dual_adc_nids,
6153 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6154 .channel_mode = alc260_modes,
6155 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6156 .input_mux = alc260_acer_capture_sources,
6158 [ALC260_FAVORIT100] = {
6159 .mixers = { alc260_favorit100_mixer },
6160 .init_verbs = { alc260_favorit100_init_verbs },
6161 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6162 .dac_nids = alc260_dac_nids,
6163 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6164 .adc_nids = alc260_dual_adc_nids,
6165 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6166 .channel_mode = alc260_modes,
6167 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6168 .input_mux = alc260_favorit100_capture_sources,
6171 .mixers = { alc260_will_mixer },
6172 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6173 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6174 .dac_nids = alc260_dac_nids,
6175 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6176 .adc_nids = alc260_adc_nids,
6177 .dig_out_nid = ALC260_DIGOUT_NID,
6178 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6179 .channel_mode = alc260_modes,
6180 .input_mux = &alc260_capture_source,
6182 [ALC260_REPLACER_672V] = {
6183 .mixers = { alc260_replacer_672v_mixer },
6184 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6185 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6186 .dac_nids = alc260_dac_nids,
6187 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6188 .adc_nids = alc260_adc_nids,
6189 .dig_out_nid = ALC260_DIGOUT_NID,
6190 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6191 .channel_mode = alc260_modes,
6192 .input_mux = &alc260_capture_source,
6193 .unsol_event = alc260_replacer_672v_unsol_event,
6194 .init_hook = alc260_replacer_672v_automute,
6196 #ifdef CONFIG_SND_DEBUG
6198 .mixers = { alc260_test_mixer },
6199 .init_verbs = { alc260_test_init_verbs },
6200 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6201 .dac_nids = alc260_test_dac_nids,
6202 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6203 .adc_nids = alc260_test_adc_nids,
6204 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6205 .channel_mode = alc260_modes,
6206 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6207 .input_mux = alc260_test_capture_sources,
6212 static int patch_alc260(struct hda_codec *codec)
6214 struct alc_spec *spec;
6215 int err, board_config;
6217 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6223 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6226 if (board_config < 0) {
6227 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6228 "trying auto-probe from BIOS...\n",
6230 board_config = ALC260_AUTO;
6233 if (board_config == ALC260_AUTO) {
6234 /* automatic parse from the BIOS config */
6235 err = alc260_parse_auto_config(codec);
6241 "hda_codec: Cannot set up configuration "
6242 "from BIOS. Using base mode...\n");
6243 board_config = ALC260_BASIC;
6247 err = snd_hda_attach_beep_device(codec, 0x1);
6253 if (board_config != ALC260_AUTO)
6254 setup_preset(spec, &alc260_presets[board_config]);
6256 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6257 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6259 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6260 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6262 if (!spec->adc_nids && spec->input_mux) {
6263 /* check whether NID 0x04 is valid */
6264 unsigned int wcap = get_wcaps(codec, 0x04);
6265 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6267 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6268 spec->adc_nids = alc260_adc_nids_alt;
6269 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6271 spec->adc_nids = alc260_adc_nids;
6272 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6275 set_capture_mixer(spec);
6276 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6278 spec->vmaster_nid = 0x08;
6280 codec->patch_ops = alc_patch_ops;
6281 if (board_config == ALC260_AUTO)
6282 spec->init_hook = alc260_auto_init;
6283 #ifdef CONFIG_SND_HDA_POWER_SAVE
6284 if (!spec->loopback.amplist)
6285 spec->loopback.amplist = alc260_loopbacks;
6287 codec->proc_widget_hook = print_realtek_coef;
6294 * ALC882/883/885/888/889 support
6296 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6297 * configuration. Each pin widget can choose any input DACs and a mixer.
6298 * Each ADC is connected from a mixer of all inputs. This makes possible
6299 * 6-channel independent captures.
6301 * In addition, an independent DAC for the multi-playback (not used in this
6304 #define ALC882_DIGOUT_NID 0x06
6305 #define ALC882_DIGIN_NID 0x0a
6306 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6307 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6308 #define ALC1200_DIGOUT_NID 0x10
6311 static struct hda_channel_mode alc882_ch_modes[1] = {
6316 static hda_nid_t alc882_dac_nids[4] = {
6317 /* front, rear, clfe, rear_surr */
6318 0x02, 0x03, 0x04, 0x05
6320 #define alc883_dac_nids alc882_dac_nids
6323 #define alc882_adc_nids alc880_adc_nids
6324 #define alc882_adc_nids_alt alc880_adc_nids_alt
6325 #define alc883_adc_nids alc882_adc_nids_alt
6326 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6327 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6328 #define alc889_adc_nids alc880_adc_nids
6330 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6331 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6332 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6333 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6334 #define alc889_capsrc_nids alc882_capsrc_nids
6337 /* FIXME: should be a matrix-type input source selection */
6339 static struct hda_input_mux alc882_capture_source = {
6343 { "Front Mic", 0x1 },
6349 #define alc883_capture_source alc882_capture_source
6351 static struct hda_input_mux mb5_capture_source = {
6360 static struct hda_input_mux alc883_3stack_6ch_intel = {
6364 { "Front Mic", 0x0 },
6370 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6378 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6388 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6396 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6400 { "Front Mic", 0x1 },
6405 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6413 static struct hda_input_mux alc889A_mb31_capture_source = {
6417 /* Front Mic (0x01) unused */
6419 /* Line 2 (0x03) unused */
6420 /* CD (0x04) unsused? */
6427 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6434 static struct hda_verb alc882_3ST_ch2_init[] = {
6435 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6436 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6438 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6445 static struct hda_verb alc882_3ST_ch4_init[] = {
6446 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6447 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6448 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6449 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6450 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6457 static struct hda_verb alc882_3ST_ch6_init[] = {
6458 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6459 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6460 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6461 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6462 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6463 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6467 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6468 { 2, alc882_3ST_ch2_init },
6469 { 4, alc882_3ST_ch4_init },
6470 { 6, alc882_3ST_ch6_init },
6473 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6478 static struct hda_verb alc882_sixstack_ch6_init[] = {
6479 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6480 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6481 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6482 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6489 static struct hda_verb alc882_sixstack_ch8_init[] = {
6490 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6491 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6492 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6493 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6497 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6498 { 6, alc882_sixstack_ch6_init },
6499 { 8, alc882_sixstack_ch8_init },
6503 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6509 static struct hda_verb alc885_mbp_ch2_init[] = {
6510 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6511 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6512 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6519 static struct hda_verb alc885_mbp_ch6_init[] = {
6520 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6521 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6522 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6523 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6524 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6528 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6529 { 2, alc885_mbp_ch2_init },
6530 { 6, alc885_mbp_ch6_init },
6535 * Speakers/Woofer/HP = Front
6538 static struct hda_verb alc885_mb5_ch2_init[] = {
6539 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6546 * Speakers/HP = Front
6550 static struct hda_verb alc885_mb5_ch6_init[] = {
6551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6553 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6557 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6558 { 2, alc885_mb5_ch2_init },
6559 { 6, alc885_mb5_ch6_init },
6566 static struct hda_verb alc883_4ST_ch2_init[] = {
6567 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6568 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6569 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6570 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6571 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6572 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6579 static struct hda_verb alc883_4ST_ch4_init[] = {
6580 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6581 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6582 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6583 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6584 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6585 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6586 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6593 static struct hda_verb alc883_4ST_ch6_init[] = {
6594 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6595 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6596 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6597 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6598 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6599 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6600 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6601 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6608 static struct hda_verb alc883_4ST_ch8_init[] = {
6609 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6610 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6611 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6614 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6615 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6616 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6617 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6621 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6622 { 2, alc883_4ST_ch2_init },
6623 { 4, alc883_4ST_ch4_init },
6624 { 6, alc883_4ST_ch6_init },
6625 { 8, alc883_4ST_ch8_init },
6632 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6633 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6634 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6635 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6636 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6643 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6644 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6645 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6648 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6655 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6656 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6657 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6658 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6659 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6660 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6661 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6665 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
6666 { 2, alc883_3ST_ch2_intel_init },
6667 { 4, alc883_3ST_ch4_intel_init },
6668 { 6, alc883_3ST_ch6_intel_init },
6674 static struct hda_verb alc883_sixstack_ch6_init[] = {
6675 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6676 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6677 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6678 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6685 static struct hda_verb alc883_sixstack_ch8_init[] = {
6686 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6687 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6688 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6689 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6693 static struct hda_channel_mode alc883_sixstack_modes[2] = {
6694 { 6, alc883_sixstack_ch6_init },
6695 { 8, alc883_sixstack_ch8_init },
6699 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6700 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6702 static struct snd_kcontrol_new alc882_base_mixer[] = {
6703 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6704 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6705 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6706 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6707 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6708 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6709 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6710 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6711 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6712 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6715 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6716 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6717 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6718 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6719 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6721 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6722 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6723 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6727 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6728 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6729 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6730 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6731 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6732 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6733 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6734 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6735 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6736 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6737 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6741 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6742 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6743 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6744 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6745 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6746 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6747 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6748 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6749 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6750 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6751 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6752 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6753 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6754 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6755 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6759 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6760 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6761 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6762 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6763 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6764 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6765 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6767 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6768 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6772 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6773 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6774 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6775 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6776 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6777 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6778 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6779 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6780 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6783 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6784 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6785 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6789 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6790 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6792 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6793 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6794 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6796 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6797 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6798 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6801 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6802 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6803 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6804 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6805 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6809 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6810 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6811 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6812 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6813 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6814 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6815 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6816 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6817 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6818 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6819 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6823 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6825 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6826 .name = "Channel Mode",
6827 .info = alc_ch_mode_info,
6828 .get = alc_ch_mode_get,
6829 .put = alc_ch_mode_put,
6834 static struct hda_verb alc882_base_init_verbs[] = {
6835 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6836 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6846 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6848 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6849 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6850 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6852 /* mute analog input loopbacks */
6853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6859 /* Front Pin: output 0 (0x0c) */
6860 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6861 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6862 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6863 /* Rear Pin: output 1 (0x0d) */
6864 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6865 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6866 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6867 /* CLFE Pin: output 2 (0x0e) */
6868 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6869 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6870 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6871 /* Side Pin: output 3 (0x0f) */
6872 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6873 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6874 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6875 /* Mic (rear) pin: input vref at 80% */
6876 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6877 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6878 /* Front Mic pin: input vref at 80% */
6879 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6880 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6881 /* Line In pin: input */
6882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6884 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6885 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6886 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6887 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6888 /* CD pin widget for input */
6889 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6891 /* FIXME: use matrix-type input source selection */
6892 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6894 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6895 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6896 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6900 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6903 /* ADC2: mute amp left and right */
6904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6905 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6906 /* ADC3: mute amp left and right */
6907 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6908 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6913 static struct hda_verb alc882_adc1_init_verbs[] = {
6914 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6915 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6916 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6917 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6918 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6919 /* ADC1: mute amp left and right */
6920 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6921 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6925 static struct hda_verb alc882_eapd_verbs[] = {
6926 /* change to EAPD mode */
6927 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6928 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6932 #define alc883_init_verbs alc882_base_init_verbs
6935 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6936 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6937 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6938 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6941 /* FIXME: this looks suspicious...
6942 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6943 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6948 static struct hda_verb alc882_macpro_init_verbs[] = {
6949 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6953 /* Front Pin: output 0 (0x0c) */
6954 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6955 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6956 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6957 /* Front Mic pin: input vref at 80% */
6958 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6959 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6960 /* Speaker: output */
6961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6962 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6963 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6964 /* Headphone output (output 0 - 0x0c) */
6965 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6966 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6967 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6969 /* FIXME: use matrix-type input source selection */
6970 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6971 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6972 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6973 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6974 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6975 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6977 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6978 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6979 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6980 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6983 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6985 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6986 /* ADC1: mute amp left and right */
6987 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6988 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6989 /* ADC2: mute amp left and right */
6990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6991 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6992 /* ADC3: mute amp left and right */
6993 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6994 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7000 static struct hda_verb alc885_mb5_init_verbs[] = {
7002 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7003 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7005 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7009 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7010 /* Surround mixer */
7011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7012 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7013 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7016 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7017 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7019 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7022 /* Front Pin (0x0c) */
7023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7024 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7025 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7026 /* LFE Pin (0x0e) */
7027 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7028 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7029 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7031 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7033 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7034 /* Front Mic pin: input vref at 80% */
7035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7036 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7039 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7048 /* Macbook Pro rev3 */
7049 static struct hda_verb alc885_mbp3_init_verbs[] = {
7050 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7058 /* Front Pin: output 0 (0x0c) */
7059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7060 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7061 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7062 /* HP Pin: output 0 (0x0d) */
7063 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7065 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7067 /* Mic (rear) pin: input vref at 80% */
7068 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7069 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7070 /* Front Mic pin: input vref at 80% */
7071 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7072 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7073 /* Line In pin: use output 1 when in LineOut mode */
7074 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7075 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7076 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7078 /* FIXME: use matrix-type input source selection */
7079 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7080 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7086 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7087 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7088 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7092 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7093 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7094 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7095 /* ADC1: mute amp left and right */
7096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7097 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7098 /* ADC2: mute amp left and right */
7099 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7100 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7101 /* ADC3: mute amp left and right */
7102 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7103 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7108 /* iMac 24 mixer. */
7109 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7110 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7111 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7115 /* iMac 24 init verbs. */
7116 static struct hda_verb alc885_imac24_init_verbs[] = {
7117 /* Internal speakers: output 0 (0x0c) */
7118 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7119 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7120 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7121 /* Internal speakers: output 0 (0x0c) */
7122 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7123 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7124 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7125 /* Headphone: output 0 (0x0c) */
7126 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7127 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7128 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7129 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7130 /* Front Mic: input vref at 80% */
7131 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7132 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7136 /* Toggle speaker-output according to the hp-jack state */
7137 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7139 struct alc_spec *spec = codec->spec;
7141 spec->autocfg.hp_pins[0] = 0x14;
7142 spec->autocfg.speaker_pins[0] = 0x18;
7143 spec->autocfg.speaker_pins[1] = 0x1a;
7144 alc_automute_amp(codec);
7147 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7149 struct alc_spec *spec = codec->spec;
7151 spec->autocfg.hp_pins[0] = 0x15;
7152 spec->autocfg.speaker_pins[0] = 0x14;
7153 alc_automute_amp(codec);
7157 static struct hda_verb alc882_targa_verbs[] = {
7158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7159 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7162 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7164 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7165 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7166 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7168 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7169 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7170 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7171 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7175 /* toggle speaker-output according to the hp-jack state */
7176 static void alc882_targa_automute(struct hda_codec *codec)
7178 struct alc_spec *spec = codec->spec;
7179 alc_automute_amp(codec);
7180 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7181 spec->jack_present ? 1 : 3);
7184 static void alc882_targa_init_hook(struct hda_codec *codec)
7186 struct alc_spec *spec = codec->spec;
7188 spec->autocfg.hp_pins[0] = 0x14;
7189 spec->autocfg.speaker_pins[0] = 0x1b;
7190 alc882_targa_automute(codec);
7193 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7195 if ((res >> 26) == ALC880_HP_EVENT)
7196 alc882_targa_automute(codec);
7199 static struct hda_verb alc882_asus_a7j_verbs[] = {
7200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7201 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7203 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7204 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7205 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7207 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7208 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7209 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7211 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7212 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7213 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7217 static struct hda_verb alc882_asus_a7m_verbs[] = {
7218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7222 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7225 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7226 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7227 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7229 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7230 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7231 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7235 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7237 unsigned int gpiostate, gpiomask, gpiodir;
7239 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7240 AC_VERB_GET_GPIO_DATA, 0);
7243 gpiostate |= (1 << pin);
7245 gpiostate &= ~(1 << pin);
7247 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7248 AC_VERB_GET_GPIO_MASK, 0);
7249 gpiomask |= (1 << pin);
7251 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7252 AC_VERB_GET_GPIO_DIRECTION, 0);
7253 gpiodir |= (1 << pin);
7256 snd_hda_codec_write(codec, codec->afg, 0,
7257 AC_VERB_SET_GPIO_MASK, gpiomask);
7258 snd_hda_codec_write(codec, codec->afg, 0,
7259 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7263 snd_hda_codec_write(codec, codec->afg, 0,
7264 AC_VERB_SET_GPIO_DATA, gpiostate);
7267 /* set up GPIO at initialization */
7268 static void alc885_macpro_init_hook(struct hda_codec *codec)
7270 alc882_gpio_mute(codec, 0, 0);
7271 alc882_gpio_mute(codec, 1, 0);
7274 /* set up GPIO and update auto-muting at initialization */
7275 static void alc885_imac24_init_hook(struct hda_codec *codec)
7277 alc885_macpro_init_hook(codec);
7278 alc885_imac24_automute_init_hook(codec);
7282 * generic initialization of ADC, input mixers and output mixers
7284 static struct hda_verb alc883_auto_init_verbs[] = {
7286 * Unmute ADC0-2 and set the default input to mic-in
7288 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7289 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7290 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7291 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7293 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7295 * Note: PASD motherboards uses the Line In 2 as the input for
7296 * front panel mic (mic 2)
7298 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7306 * Set up output mixers (0x0c - 0x0f)
7308 /* set vol=0 to output mixers */
7309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7312 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7313 /* set up input amps for analog loopback */
7314 /* Amp Indices: DAC = 0, mixer = 1 */
7315 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7317 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7318 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7319 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7320 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7321 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7322 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7323 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7324 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7326 /* FIXME: use matrix-type input source selection */
7327 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7329 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7331 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7332 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7342 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7343 static struct hda_verb alc889A_mb31_ch2_init[] = {
7344 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7345 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7347 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7351 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7352 static struct hda_verb alc889A_mb31_ch4_init[] = {
7353 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7354 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7360 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7361 static struct hda_verb alc889A_mb31_ch5_init[] = {
7362 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7363 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7365 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7369 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7370 static struct hda_verb alc889A_mb31_ch6_init[] = {
7371 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7372 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7373 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7374 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7378 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7379 { 2, alc889A_mb31_ch2_init },
7380 { 4, alc889A_mb31_ch4_init },
7381 { 5, alc889A_mb31_ch5_init },
7382 { 6, alc889A_mb31_ch6_init },
7385 static struct hda_verb alc883_medion_eapd_verbs[] = {
7386 /* eanable EAPD on medion laptop */
7387 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7388 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7392 #define alc883_base_mixer alc882_base_mixer
7394 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7395 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7396 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7397 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7398 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7399 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7400 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7401 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7404 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7405 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7406 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7407 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7411 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7412 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7413 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7414 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7415 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7417 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7418 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7419 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7420 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7421 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7425 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7426 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7427 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7428 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7429 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7433 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7434 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7435 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7439 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7440 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7441 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7442 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7443 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7444 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7451 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7452 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7456 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7457 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7458 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7459 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7460 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7461 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7462 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7463 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7464 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7466 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7467 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7468 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7469 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7471 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7473 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7479 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7480 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7481 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7482 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7483 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7484 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7486 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7487 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7488 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7490 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7491 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7493 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7495 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7496 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7497 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7498 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7499 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7503 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7504 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7505 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7506 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7507 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7508 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7509 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7510 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7511 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7512 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7513 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7514 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7518 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7519 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7520 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7521 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7522 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7526 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7527 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7528 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7529 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7530 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7531 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7532 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7533 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7534 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7535 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7536 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7537 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7538 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7539 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7541 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7542 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7546 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7547 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7548 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7549 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7550 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7551 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7553 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7554 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7555 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7556 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7557 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7561 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7562 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7563 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7565 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7566 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7567 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7568 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7569 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7573 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7574 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7575 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7576 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7577 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7578 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7581 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7582 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7586 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7587 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7589 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7590 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7591 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7594 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7595 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7599 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7600 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7601 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7602 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7603 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7604 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7606 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7611 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7612 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7613 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7614 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7615 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7617 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7618 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7619 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7620 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7621 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7622 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7626 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7627 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7628 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7630 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7631 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7632 0x0d, 1, 0x0, HDA_OUTPUT),
7633 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7634 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7635 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7636 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7637 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7638 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7639 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7640 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7641 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7643 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7644 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7645 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7646 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7647 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7651 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7654 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7655 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7656 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7657 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7659 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7660 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7661 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7662 /* Output switches */
7663 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7664 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7665 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
7667 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7672 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7673 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7677 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
7678 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7679 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7680 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7681 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7682 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7687 static struct hda_bind_ctls alc883_bind_cap_vol = {
7688 .ops = &snd_hda_bind_vol,
7690 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7691 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7696 static struct hda_bind_ctls alc883_bind_cap_switch = {
7697 .ops = &snd_hda_bind_sw,
7699 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7700 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7705 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7706 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7707 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7708 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7709 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7710 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7711 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7712 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7713 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7717 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7718 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7719 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7721 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7722 /* .name = "Capture Source", */
7723 .name = "Input Source",
7725 .info = alc_mux_enum_info,
7726 .get = alc_mux_enum_get,
7727 .put = alc_mux_enum_put,
7732 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7734 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7735 .name = "Channel Mode",
7736 .info = alc_ch_mode_info,
7737 .get = alc_ch_mode_get,
7738 .put = alc_ch_mode_put,
7743 /* toggle speaker-output according to the hp-jack state */
7744 static void alc883_mitac_init_hook(struct hda_codec *codec)
7746 struct alc_spec *spec = codec->spec;
7748 spec->autocfg.hp_pins[0] = 0x15;
7749 spec->autocfg.speaker_pins[0] = 0x14;
7750 spec->autocfg.speaker_pins[1] = 0x17;
7751 alc_automute_amp(codec);
7754 /* auto-toggle front mic */
7756 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7758 unsigned int present;
7761 present = snd_hda_codec_read(codec, 0x18, 0,
7762 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7763 bits = present ? HDA_AMP_MUTE : 0;
7764 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7768 static struct hda_verb alc883_mitac_verbs[] = {
7770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7771 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7773 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7774 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7776 /* enable unsolicited event */
7777 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7778 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7783 static struct hda_verb alc883_clevo_m720_verbs[] = {
7785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7788 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7791 /* enable unsolicited event */
7792 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7793 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7798 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7800 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7806 /* enable unsolicited event */
7807 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7812 static struct hda_verb alc883_targa_verbs[] = {
7813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7814 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7816 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7819 /* Connect Line-Out side jack (SPDIF) to Side */
7820 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7821 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7822 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7823 /* Connect Mic jack to CLFE */
7824 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7825 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7826 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
7827 /* Connect Line-in jack to Surround */
7828 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7829 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7830 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7831 /* Connect HP out jack to Front */
7832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7833 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7834 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7836 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7841 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7842 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7843 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7844 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7848 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7849 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7851 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7852 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7856 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7859 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7860 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7861 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7865 static struct hda_verb alc883_haier_w66_verbs[] = {
7866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7867 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7871 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7872 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7873 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7874 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7878 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7879 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7881 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7882 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7883 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7885 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7886 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7890 static struct hda_verb alc888_6st_dell_verbs[] = {
7891 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7895 static struct hda_verb alc883_vaiott_verbs[] = {
7897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7898 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7900 /* enable unsolicited event */
7901 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7906 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
7908 struct alc_spec *spec = codec->spec;
7910 spec->autocfg.hp_pins[0] = 0x1b;
7911 spec->autocfg.speaker_pins[0] = 0x14;
7912 spec->autocfg.speaker_pins[1] = 0x16;
7913 spec->autocfg.speaker_pins[2] = 0x18;
7914 alc_automute_amp(codec);
7917 static struct hda_verb alc888_3st_hp_verbs[] = {
7918 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7919 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7920 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7921 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7928 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7929 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7930 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7931 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7932 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7939 static struct hda_verb alc888_3st_hp_4ch_init[] = {
7940 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7941 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7942 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7943 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7944 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
7951 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7952 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7953 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7954 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7955 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7956 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7957 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
7961 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
7962 { 2, alc888_3st_hp_2ch_init },
7963 { 4, alc888_3st_hp_4ch_init },
7964 { 6, alc888_3st_hp_6ch_init },
7967 /* toggle front-jack and RCA according to the hp-jack state */
7968 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7970 unsigned int present;
7972 present = snd_hda_codec_read(codec, 0x1b, 0,
7973 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7975 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7976 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7977 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7980 /* toggle RCA according to the front-jack state */
7981 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7983 unsigned int present;
7985 present = snd_hda_codec_read(codec, 0x14, 0,
7986 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7987 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7988 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7991 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7994 if ((res >> 26) == ALC880_HP_EVENT)
7995 alc888_lenovo_ms7195_front_automute(codec);
7996 if ((res >> 26) == ALC880_FRONT_EVENT)
7997 alc888_lenovo_ms7195_rca_automute(codec);
8000 static struct hda_verb alc883_medion_md2_verbs[] = {
8001 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8004 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8006 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8010 /* toggle speaker-output according to the hp-jack state */
8011 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8013 struct alc_spec *spec = codec->spec;
8015 spec->autocfg.hp_pins[0] = 0x14;
8016 spec->autocfg.speaker_pins[0] = 0x15;
8017 alc_automute_amp(codec);
8020 /* toggle speaker-output according to the hp-jack state */
8021 #define alc883_targa_init_hook alc882_targa_init_hook
8022 #define alc883_targa_unsol_event alc882_targa_unsol_event
8024 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8026 unsigned int present;
8028 present = snd_hda_codec_read(codec, 0x18, 0,
8029 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8030 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8031 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8034 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8036 struct alc_spec *spec = codec->spec;
8038 spec->autocfg.hp_pins[0] = 0x15;
8039 spec->autocfg.speaker_pins[0] = 0x14;
8040 alc_automute_amp(codec);
8041 alc883_clevo_m720_mic_automute(codec);
8044 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8047 switch (res >> 26) {
8048 case ALC880_MIC_EVENT:
8049 alc883_clevo_m720_mic_automute(codec);
8052 alc_automute_amp_unsol_event(codec, res);
8057 /* toggle speaker-output according to the hp-jack state */
8058 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8060 struct alc_spec *spec = codec->spec;
8062 spec->autocfg.hp_pins[0] = 0x14;
8063 spec->autocfg.speaker_pins[0] = 0x15;
8064 alc_automute_amp(codec);
8067 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8069 struct alc_spec *spec = codec->spec;
8071 spec->autocfg.hp_pins[0] = 0x1b;
8072 spec->autocfg.speaker_pins[0] = 0x14;
8073 alc_automute_amp(codec);
8076 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8078 unsigned int present;
8081 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8082 & AC_PINSENSE_PRESENCE;
8083 bits = present ? HDA_AMP_MUTE : 0;
8084 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8085 HDA_AMP_MUTE, bits);
8088 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8090 unsigned int present;
8093 present = snd_hda_codec_read(codec, 0x1b, 0,
8094 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8095 bits = present ? HDA_AMP_MUTE : 0;
8096 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8097 HDA_AMP_MUTE, bits);
8098 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8099 HDA_AMP_MUTE, bits);
8102 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8105 if ((res >> 26) == ALC880_HP_EVENT)
8106 alc883_lenovo_101e_all_automute(codec);
8107 if ((res >> 26) == ALC880_FRONT_EVENT)
8108 alc883_lenovo_101e_ispeaker_automute(codec);
8111 /* toggle speaker-output according to the hp-jack state */
8112 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8114 struct alc_spec *spec = codec->spec;
8116 spec->autocfg.hp_pins[0] = 0x14;
8117 spec->autocfg.speaker_pins[0] = 0x15;
8118 spec->autocfg.speaker_pins[1] = 0x16;
8119 alc_automute_amp(codec);
8122 static struct hda_verb alc883_acer_eapd_verbs[] = {
8123 /* HP Pin: output 0 (0x0c) */
8124 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8125 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8126 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8127 /* Front Pin: output 0 (0x0c) */
8128 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8129 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8130 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8131 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8132 /* eanable EAPD on medion laptop */
8133 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8134 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8135 /* enable unsolicited event */
8136 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8140 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8142 struct alc_spec *spec = codec->spec;
8144 spec->autocfg.hp_pins[0] = 0x1b;
8145 spec->autocfg.speaker_pins[0] = 0x14;
8146 spec->autocfg.speaker_pins[1] = 0x15;
8147 spec->autocfg.speaker_pins[2] = 0x16;
8148 spec->autocfg.speaker_pins[3] = 0x17;
8149 alc_automute_amp(codec);
8152 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8154 struct alc_spec *spec = codec->spec;
8156 spec->autocfg.hp_pins[0] = 0x1b;
8157 spec->autocfg.speaker_pins[0] = 0x14;
8158 spec->autocfg.speaker_pins[1] = 0x15;
8159 spec->autocfg.speaker_pins[2] = 0x16;
8160 spec->autocfg.speaker_pins[3] = 0x17;
8161 spec->autocfg.speaker_pins[4] = 0x1a;
8162 alc_automute_amp(codec);
8165 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8167 struct alc_spec *spec = codec->spec;
8169 spec->autocfg.hp_pins[0] = 0x15;
8170 spec->autocfg.speaker_pins[0] = 0x14;
8171 spec->autocfg.speaker_pins[1] = 0x17;
8172 alc_automute_amp(codec);
8175 static struct hda_verb alc888_asus_m90v_verbs[] = {
8176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8177 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8178 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8179 /* enable unsolicited event */
8180 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8181 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8185 static void alc883_nb_mic_automute(struct hda_codec *codec)
8187 unsigned int present;
8189 present = snd_hda_codec_read(codec, 0x18, 0,
8190 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8191 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8192 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8193 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8194 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8197 static void alc883_M90V_init_hook(struct hda_codec *codec)
8199 struct alc_spec *spec = codec->spec;
8201 spec->autocfg.hp_pins[0] = 0x1b;
8202 spec->autocfg.speaker_pins[0] = 0x14;
8203 spec->autocfg.speaker_pins[1] = 0x15;
8204 spec->autocfg.speaker_pins[2] = 0x16;
8205 alc_automute_pin(codec);
8208 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8211 switch (res >> 26) {
8212 case ALC880_MIC_EVENT:
8213 alc883_nb_mic_automute(codec);
8216 alc_sku_unsol_event(codec, res);
8221 static void alc883_mode2_inithook(struct hda_codec *codec)
8223 alc883_M90V_init_hook(codec);
8224 alc883_nb_mic_automute(codec);
8227 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8228 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8229 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8231 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8232 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8233 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8234 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8235 /* enable unsolicited event */
8236 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8240 static void alc883_eee1601_inithook(struct hda_codec *codec)
8242 struct alc_spec *spec = codec->spec;
8244 spec->autocfg.hp_pins[0] = 0x14;
8245 spec->autocfg.speaker_pins[0] = 0x1b;
8246 alc_automute_pin(codec);
8249 static struct hda_verb alc889A_mb31_verbs[] = {
8250 /* Init rear pin (used as headphone output) */
8251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8252 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8253 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8254 /* Init line pin (used as output in 4ch and 6ch mode) */
8255 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8256 /* Init line 2 pin (used as headphone out by default) */
8257 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8258 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8262 /* Mute speakers according to the headphone jack state */
8263 static void alc889A_mb31_automute(struct hda_codec *codec)
8265 unsigned int present;
8267 /* Mute only in 2ch or 4ch mode */
8268 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8270 present = snd_hda_codec_read(codec, 0x15, 0,
8271 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8272 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8273 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8274 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8275 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8279 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8281 if ((res >> 26) == ALC880_HP_EVENT)
8282 alc889A_mb31_automute(codec);
8286 #ifdef CONFIG_SND_HDA_POWER_SAVE
8287 #define alc882_loopbacks alc880_loopbacks
8290 /* pcm configuration: identical with ALC880 */
8291 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8292 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8293 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8294 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8296 static hda_nid_t alc883_slave_dig_outs[] = {
8297 ALC1200_DIGOUT_NID, 0,
8300 static hda_nid_t alc1200_slave_dig_outs[] = {
8301 ALC883_DIGOUT_NID, 0,
8305 * configuration and preset
8307 static const char *alc882_models[ALC882_MODEL_LAST] = {
8308 [ALC882_3ST_DIG] = "3stack-dig",
8309 [ALC882_6ST_DIG] = "6stack-dig",
8310 [ALC882_ARIMA] = "arima",
8311 [ALC882_W2JC] = "w2jc",
8312 [ALC882_TARGA] = "targa",
8313 [ALC882_ASUS_A7J] = "asus-a7j",
8314 [ALC882_ASUS_A7M] = "asus-a7m",
8315 [ALC885_MACPRO] = "macpro",
8316 [ALC885_MB5] = "mb5",
8317 [ALC885_MBP3] = "mbp3",
8318 [ALC885_IMAC24] = "imac24",
8319 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8320 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8321 [ALC883_3ST_6ch] = "3stack-6ch",
8322 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8323 [ALC883_TARGA_DIG] = "targa-dig",
8324 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8325 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8326 [ALC883_ACER] = "acer",
8327 [ALC883_ACER_ASPIRE] = "acer-aspire",
8328 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8329 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8330 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8331 [ALC883_MEDION] = "medion",
8332 [ALC883_MEDION_MD2] = "medion-md2",
8333 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8334 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8335 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8336 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8337 [ALC888_LENOVO_SKY] = "lenovo-sky",
8338 [ALC883_HAIER_W66] = "haier-w66",
8339 [ALC888_3ST_HP] = "3stack-hp",
8340 [ALC888_6ST_DELL] = "6stack-dell",
8341 [ALC883_MITAC] = "mitac",
8342 [ALC883_CLEVO_M720] = "clevo-m720",
8343 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8344 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8345 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8346 [ALC1200_ASUS_P5Q] = "asus-p5q",
8347 [ALC889A_MB31] = "mb31",
8348 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8349 [ALC882_AUTO] = "auto",
8352 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8353 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8355 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8356 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8357 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8358 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8359 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8360 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8361 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8362 ALC888_ACER_ASPIRE_4930G),
8363 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8364 ALC888_ACER_ASPIRE_4930G),
8365 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8366 ALC888_ACER_ASPIRE_8930G),
8367 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8368 ALC888_ACER_ASPIRE_8930G),
8369 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8370 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8371 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8372 ALC888_ACER_ASPIRE_6530G),
8373 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8374 ALC888_ACER_ASPIRE_6530G),
8375 /* default Acer -- disabled as it causes more problems.
8376 * model=auto should work fine now
8378 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8380 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8382 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8383 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8384 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8385 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8386 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8387 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8389 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8390 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8391 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8392 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8393 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8394 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8395 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8396 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8397 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8398 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8399 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8401 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8402 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8403 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8404 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8405 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8406 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8407 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8408 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8409 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8411 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8412 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8413 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8414 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8415 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8416 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8417 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8418 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8419 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8420 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8421 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8422 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8423 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8424 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8425 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8426 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8427 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8428 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8429 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8430 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8431 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8432 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8433 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8434 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8435 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8436 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8437 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8439 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8440 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8441 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8442 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8443 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8444 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8445 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8446 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8447 ALC883_FUJITSU_PI2515),
8448 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8449 ALC888_FUJITSU_XA3530),
8450 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8451 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8452 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8453 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8454 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8455 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8456 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8457 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8458 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8460 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8461 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8462 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8463 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8464 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8469 /* codec SSID table for Intel Mac */
8470 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8471 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8472 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8473 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8474 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8475 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8476 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8477 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8478 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8479 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8480 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8481 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8482 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8483 * no perfect solution yet
8485 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8489 static struct alc_config_preset alc882_presets[] = {
8490 [ALC882_3ST_DIG] = {
8491 .mixers = { alc882_base_mixer },
8492 .init_verbs = { alc882_base_init_verbs,
8493 alc882_adc1_init_verbs },
8494 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8495 .dac_nids = alc882_dac_nids,
8496 .dig_out_nid = ALC882_DIGOUT_NID,
8497 .dig_in_nid = ALC882_DIGIN_NID,
8498 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8499 .channel_mode = alc882_ch_modes,
8501 .input_mux = &alc882_capture_source,
8503 [ALC882_6ST_DIG] = {
8504 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8505 .init_verbs = { alc882_base_init_verbs,
8506 alc882_adc1_init_verbs },
8507 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8508 .dac_nids = alc882_dac_nids,
8509 .dig_out_nid = ALC882_DIGOUT_NID,
8510 .dig_in_nid = ALC882_DIGIN_NID,
8511 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8512 .channel_mode = alc882_sixstack_modes,
8513 .input_mux = &alc882_capture_source,
8516 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8517 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8518 alc882_eapd_verbs },
8519 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8520 .dac_nids = alc882_dac_nids,
8521 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8522 .channel_mode = alc882_sixstack_modes,
8523 .input_mux = &alc882_capture_source,
8526 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8527 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8528 alc882_eapd_verbs, alc880_gpio1_init_verbs },
8529 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8530 .dac_nids = alc882_dac_nids,
8531 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8532 .channel_mode = alc880_threestack_modes,
8534 .input_mux = &alc882_capture_source,
8535 .dig_out_nid = ALC882_DIGOUT_NID,
8538 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8539 .init_verbs = { alc885_mbp3_init_verbs,
8540 alc880_gpio1_init_verbs },
8541 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8542 .dac_nids = alc882_dac_nids,
8543 .channel_mode = alc885_mbp_6ch_modes,
8544 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8545 .input_mux = &alc882_capture_source,
8546 .dig_out_nid = ALC882_DIGOUT_NID,
8547 .dig_in_nid = ALC882_DIGIN_NID,
8548 .unsol_event = alc_automute_amp_unsol_event,
8549 .init_hook = alc885_mbp3_init_hook,
8552 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8553 .init_verbs = { alc885_mb5_init_verbs,
8554 alc880_gpio1_init_verbs },
8555 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8556 .dac_nids = alc882_dac_nids,
8557 .channel_mode = alc885_mb5_6ch_modes,
8558 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8559 .input_mux = &mb5_capture_source,
8560 .dig_out_nid = ALC882_DIGOUT_NID,
8561 .dig_in_nid = ALC882_DIGIN_NID,
8564 .mixers = { alc882_macpro_mixer },
8565 .init_verbs = { alc882_macpro_init_verbs },
8566 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8567 .dac_nids = alc882_dac_nids,
8568 .dig_out_nid = ALC882_DIGOUT_NID,
8569 .dig_in_nid = ALC882_DIGIN_NID,
8570 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8571 .channel_mode = alc882_ch_modes,
8572 .input_mux = &alc882_capture_source,
8573 .init_hook = alc885_macpro_init_hook,
8576 .mixers = { alc885_imac24_mixer },
8577 .init_verbs = { alc885_imac24_init_verbs },
8578 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8579 .dac_nids = alc882_dac_nids,
8580 .dig_out_nid = ALC882_DIGOUT_NID,
8581 .dig_in_nid = ALC882_DIGIN_NID,
8582 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8583 .channel_mode = alc882_ch_modes,
8584 .input_mux = &alc882_capture_source,
8585 .unsol_event = alc_automute_amp_unsol_event,
8586 .init_hook = alc885_imac24_init_hook,
8589 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8590 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8591 alc882_targa_verbs},
8592 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8593 .dac_nids = alc882_dac_nids,
8594 .dig_out_nid = ALC882_DIGOUT_NID,
8595 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8596 .adc_nids = alc882_adc_nids,
8597 .capsrc_nids = alc882_capsrc_nids,
8598 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8599 .channel_mode = alc882_3ST_6ch_modes,
8601 .input_mux = &alc882_capture_source,
8602 .unsol_event = alc882_targa_unsol_event,
8603 .init_hook = alc882_targa_init_hook,
8605 [ALC882_ASUS_A7J] = {
8606 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8607 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8608 alc882_asus_a7j_verbs},
8609 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8610 .dac_nids = alc882_dac_nids,
8611 .dig_out_nid = ALC882_DIGOUT_NID,
8612 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8613 .adc_nids = alc882_adc_nids,
8614 .capsrc_nids = alc882_capsrc_nids,
8615 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8616 .channel_mode = alc882_3ST_6ch_modes,
8618 .input_mux = &alc882_capture_source,
8620 [ALC882_ASUS_A7M] = {
8621 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8622 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
8623 alc882_eapd_verbs, alc880_gpio1_init_verbs,
8624 alc882_asus_a7m_verbs },
8625 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8626 .dac_nids = alc882_dac_nids,
8627 .dig_out_nid = ALC882_DIGOUT_NID,
8628 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8629 .channel_mode = alc880_threestack_modes,
8631 .input_mux = &alc882_capture_source,
8633 [ALC883_3ST_2ch_DIG] = {
8634 .mixers = { alc883_3ST_2ch_mixer },
8635 .init_verbs = { alc883_init_verbs },
8636 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8637 .dac_nids = alc883_dac_nids,
8638 .dig_out_nid = ALC883_DIGOUT_NID,
8639 .dig_in_nid = ALC883_DIGIN_NID,
8640 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8641 .channel_mode = alc883_3ST_2ch_modes,
8642 .input_mux = &alc883_capture_source,
8644 [ALC883_3ST_6ch_DIG] = {
8645 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8646 .init_verbs = { alc883_init_verbs },
8647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8648 .dac_nids = alc883_dac_nids,
8649 .dig_out_nid = ALC883_DIGOUT_NID,
8650 .dig_in_nid = ALC883_DIGIN_NID,
8651 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8652 .channel_mode = alc883_3ST_6ch_modes,
8654 .input_mux = &alc883_capture_source,
8656 [ALC883_3ST_6ch] = {
8657 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8658 .init_verbs = { alc883_init_verbs },
8659 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8660 .dac_nids = alc883_dac_nids,
8661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8662 .channel_mode = alc883_3ST_6ch_modes,
8664 .input_mux = &alc883_capture_source,
8666 [ALC883_3ST_6ch_INTEL] = {
8667 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8668 .init_verbs = { alc883_init_verbs },
8669 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8670 .dac_nids = alc883_dac_nids,
8671 .dig_out_nid = ALC883_DIGOUT_NID,
8672 .dig_in_nid = ALC883_DIGIN_NID,
8673 .slave_dig_outs = alc883_slave_dig_outs,
8674 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8675 .channel_mode = alc883_3ST_6ch_intel_modes,
8677 .input_mux = &alc883_3stack_6ch_intel,
8679 [ALC883_6ST_DIG] = {
8680 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8681 .init_verbs = { alc883_init_verbs },
8682 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8683 .dac_nids = alc883_dac_nids,
8684 .dig_out_nid = ALC883_DIGOUT_NID,
8685 .dig_in_nid = ALC883_DIGIN_NID,
8686 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8687 .channel_mode = alc883_sixstack_modes,
8688 .input_mux = &alc883_capture_source,
8690 [ALC883_TARGA_DIG] = {
8691 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
8692 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8693 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8694 .dac_nids = alc883_dac_nids,
8695 .dig_out_nid = ALC883_DIGOUT_NID,
8696 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8697 .channel_mode = alc883_3ST_6ch_modes,
8699 .input_mux = &alc883_capture_source,
8700 .unsol_event = alc883_targa_unsol_event,
8701 .init_hook = alc883_targa_init_hook,
8703 [ALC883_TARGA_2ch_DIG] = {
8704 .mixers = { alc883_targa_2ch_mixer},
8705 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8706 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8707 .dac_nids = alc883_dac_nids,
8708 .adc_nids = alc883_adc_nids_alt,
8709 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8710 .dig_out_nid = ALC883_DIGOUT_NID,
8711 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8712 .channel_mode = alc883_3ST_2ch_modes,
8713 .input_mux = &alc883_capture_source,
8714 .unsol_event = alc883_targa_unsol_event,
8715 .init_hook = alc883_targa_init_hook,
8717 [ALC883_TARGA_8ch_DIG] = {
8718 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8719 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8720 alc883_targa_verbs },
8721 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8722 .dac_nids = alc883_dac_nids,
8723 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8724 .adc_nids = alc883_adc_nids_rev,
8725 .capsrc_nids = alc883_capsrc_nids_rev,
8726 .dig_out_nid = ALC883_DIGOUT_NID,
8727 .dig_in_nid = ALC883_DIGIN_NID,
8728 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
8729 .channel_mode = alc883_4ST_8ch_modes,
8731 .input_mux = &alc883_capture_source,
8732 .unsol_event = alc883_targa_unsol_event,
8733 .init_hook = alc883_targa_init_hook,
8736 .mixers = { alc883_base_mixer },
8737 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8738 * and the headphone jack. Turn this on and rely on the
8739 * standard mute methods whenever the user wants to turn
8740 * these outputs off.
8742 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8743 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8744 .dac_nids = alc883_dac_nids,
8745 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8746 .channel_mode = alc883_3ST_2ch_modes,
8747 .input_mux = &alc883_capture_source,
8749 [ALC883_ACER_ASPIRE] = {
8750 .mixers = { alc883_acer_aspire_mixer },
8751 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8752 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8753 .dac_nids = alc883_dac_nids,
8754 .dig_out_nid = ALC883_DIGOUT_NID,
8755 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8756 .channel_mode = alc883_3ST_2ch_modes,
8757 .input_mux = &alc883_capture_source,
8758 .unsol_event = alc_automute_amp_unsol_event,
8759 .init_hook = alc883_acer_aspire_init_hook,
8761 [ALC888_ACER_ASPIRE_4930G] = {
8762 .mixers = { alc888_base_mixer,
8763 alc883_chmode_mixer },
8764 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8765 alc888_acer_aspire_4930g_verbs },
8766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8767 .dac_nids = alc883_dac_nids,
8768 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8769 .adc_nids = alc883_adc_nids_rev,
8770 .capsrc_nids = alc883_capsrc_nids_rev,
8771 .dig_out_nid = ALC883_DIGOUT_NID,
8772 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8773 .channel_mode = alc883_3ST_6ch_modes,
8776 ARRAY_SIZE(alc888_2_capture_sources),
8777 .input_mux = alc888_2_capture_sources,
8778 .unsol_event = alc_automute_amp_unsol_event,
8779 .init_hook = alc888_acer_aspire_4930g_init_hook,
8781 [ALC888_ACER_ASPIRE_6530G] = {
8782 .mixers = { alc888_acer_aspire_6530_mixer },
8783 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8784 alc888_acer_aspire_6530g_verbs },
8785 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8786 .dac_nids = alc883_dac_nids,
8787 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8788 .adc_nids = alc883_adc_nids_rev,
8789 .capsrc_nids = alc883_capsrc_nids_rev,
8790 .dig_out_nid = ALC883_DIGOUT_NID,
8791 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8792 .channel_mode = alc883_3ST_2ch_modes,
8794 ARRAY_SIZE(alc888_2_capture_sources),
8795 .input_mux = alc888_acer_aspire_6530_sources,
8796 .unsol_event = alc_automute_amp_unsol_event,
8797 .init_hook = alc888_acer_aspire_6530g_init_hook,
8799 [ALC888_ACER_ASPIRE_8930G] = {
8800 .mixers = { alc888_base_mixer,
8801 alc883_chmode_mixer },
8802 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8803 alc889_acer_aspire_8930g_verbs },
8804 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8805 .dac_nids = alc883_dac_nids,
8806 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8807 .adc_nids = alc889_adc_nids,
8808 .capsrc_nids = alc889_capsrc_nids,
8809 .dig_out_nid = ALC883_DIGOUT_NID,
8810 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8811 .channel_mode = alc883_3ST_6ch_modes,
8813 .const_channel_count = 6,
8815 ARRAY_SIZE(alc889_capture_sources),
8816 .input_mux = alc889_capture_sources,
8817 .unsol_event = alc_automute_amp_unsol_event,
8818 .init_hook = alc889_acer_aspire_8930g_init_hook,
8821 .mixers = { alc883_fivestack_mixer,
8822 alc883_chmode_mixer },
8823 .init_verbs = { alc883_init_verbs,
8824 alc883_medion_eapd_verbs },
8825 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8826 .dac_nids = alc883_dac_nids,
8827 .adc_nids = alc883_adc_nids_alt,
8828 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8829 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8830 .channel_mode = alc883_sixstack_modes,
8831 .input_mux = &alc883_capture_source,
8833 [ALC883_MEDION_MD2] = {
8834 .mixers = { alc883_medion_md2_mixer},
8835 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8836 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8837 .dac_nids = alc883_dac_nids,
8838 .dig_out_nid = ALC883_DIGOUT_NID,
8839 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8840 .channel_mode = alc883_3ST_2ch_modes,
8841 .input_mux = &alc883_capture_source,
8842 .unsol_event = alc_automute_amp_unsol_event,
8843 .init_hook = alc883_medion_md2_init_hook,
8845 [ALC883_LAPTOP_EAPD] = {
8846 .mixers = { alc883_base_mixer },
8847 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8849 .dac_nids = alc883_dac_nids,
8850 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8851 .channel_mode = alc883_3ST_2ch_modes,
8852 .input_mux = &alc883_capture_source,
8854 [ALC883_CLEVO_M720] = {
8855 .mixers = { alc883_clevo_m720_mixer },
8856 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8857 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8858 .dac_nids = alc883_dac_nids,
8859 .dig_out_nid = ALC883_DIGOUT_NID,
8860 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8861 .channel_mode = alc883_3ST_2ch_modes,
8862 .input_mux = &alc883_capture_source,
8863 .unsol_event = alc883_clevo_m720_unsol_event,
8864 .init_hook = alc883_clevo_m720_init_hook,
8866 [ALC883_LENOVO_101E_2ch] = {
8867 .mixers = { alc883_lenovo_101e_2ch_mixer},
8868 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8869 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8870 .dac_nids = alc883_dac_nids,
8871 .adc_nids = alc883_adc_nids_alt,
8872 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8873 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8874 .channel_mode = alc883_3ST_2ch_modes,
8875 .input_mux = &alc883_lenovo_101e_capture_source,
8876 .unsol_event = alc883_lenovo_101e_unsol_event,
8877 .init_hook = alc883_lenovo_101e_all_automute,
8879 [ALC883_LENOVO_NB0763] = {
8880 .mixers = { alc883_lenovo_nb0763_mixer },
8881 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8882 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8883 .dac_nids = alc883_dac_nids,
8884 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8885 .channel_mode = alc883_3ST_2ch_modes,
8887 .input_mux = &alc883_lenovo_nb0763_capture_source,
8888 .unsol_event = alc_automute_amp_unsol_event,
8889 .init_hook = alc883_medion_md2_init_hook,
8891 [ALC888_LENOVO_MS7195_DIG] = {
8892 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8893 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8894 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8895 .dac_nids = alc883_dac_nids,
8896 .dig_out_nid = ALC883_DIGOUT_NID,
8897 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8898 .channel_mode = alc883_3ST_6ch_modes,
8900 .input_mux = &alc883_capture_source,
8901 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8902 .init_hook = alc888_lenovo_ms7195_front_automute,
8904 [ALC883_HAIER_W66] = {
8905 .mixers = { alc883_targa_2ch_mixer},
8906 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8907 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8908 .dac_nids = alc883_dac_nids,
8909 .dig_out_nid = ALC883_DIGOUT_NID,
8910 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8911 .channel_mode = alc883_3ST_2ch_modes,
8912 .input_mux = &alc883_capture_source,
8913 .unsol_event = alc_automute_amp_unsol_event,
8914 .init_hook = alc883_haier_w66_init_hook,
8917 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8918 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8919 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8920 .dac_nids = alc883_dac_nids,
8921 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8922 .channel_mode = alc888_3st_hp_modes,
8924 .input_mux = &alc883_capture_source,
8925 .unsol_event = alc_automute_amp_unsol_event,
8926 .init_hook = alc888_3st_hp_init_hook,
8928 [ALC888_6ST_DELL] = {
8929 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8930 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8931 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8932 .dac_nids = alc883_dac_nids,
8933 .dig_out_nid = ALC883_DIGOUT_NID,
8934 .dig_in_nid = ALC883_DIGIN_NID,
8935 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8936 .channel_mode = alc883_sixstack_modes,
8937 .input_mux = &alc883_capture_source,
8938 .unsol_event = alc_automute_amp_unsol_event,
8939 .init_hook = alc888_6st_dell_init_hook,
8942 .mixers = { alc883_mitac_mixer },
8943 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8944 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8945 .dac_nids = alc883_dac_nids,
8946 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8947 .channel_mode = alc883_3ST_2ch_modes,
8948 .input_mux = &alc883_capture_source,
8949 .unsol_event = alc_automute_amp_unsol_event,
8950 .init_hook = alc883_mitac_init_hook,
8952 [ALC883_FUJITSU_PI2515] = {
8953 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8954 .init_verbs = { alc883_init_verbs,
8955 alc883_2ch_fujitsu_pi2515_verbs},
8956 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8957 .dac_nids = alc883_dac_nids,
8958 .dig_out_nid = ALC883_DIGOUT_NID,
8959 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8960 .channel_mode = alc883_3ST_2ch_modes,
8961 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8962 .unsol_event = alc_automute_amp_unsol_event,
8963 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
8965 [ALC888_FUJITSU_XA3530] = {
8966 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8967 .init_verbs = { alc883_init_verbs,
8968 alc888_fujitsu_xa3530_verbs },
8969 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8970 .dac_nids = alc883_dac_nids,
8971 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8972 .adc_nids = alc883_adc_nids_rev,
8973 .capsrc_nids = alc883_capsrc_nids_rev,
8974 .dig_out_nid = ALC883_DIGOUT_NID,
8975 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8976 .channel_mode = alc888_4ST_8ch_intel_modes,
8978 ARRAY_SIZE(alc888_2_capture_sources),
8979 .input_mux = alc888_2_capture_sources,
8980 .unsol_event = alc_automute_amp_unsol_event,
8981 .init_hook = alc888_fujitsu_xa3530_init_hook,
8983 [ALC888_LENOVO_SKY] = {
8984 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8985 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8986 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8987 .dac_nids = alc883_dac_nids,
8988 .dig_out_nid = ALC883_DIGOUT_NID,
8989 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8990 .channel_mode = alc883_sixstack_modes,
8992 .input_mux = &alc883_lenovo_sky_capture_source,
8993 .unsol_event = alc_automute_amp_unsol_event,
8994 .init_hook = alc888_lenovo_sky_init_hook,
8996 [ALC888_ASUS_M90V] = {
8997 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8998 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8999 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9000 .dac_nids = alc883_dac_nids,
9001 .dig_out_nid = ALC883_DIGOUT_NID,
9002 .dig_in_nid = ALC883_DIGIN_NID,
9003 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9004 .channel_mode = alc883_3ST_6ch_modes,
9006 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9007 .unsol_event = alc883_mode2_unsol_event,
9008 .init_hook = alc883_mode2_inithook,
9010 [ALC888_ASUS_EEE1601] = {
9011 .mixers = { alc883_asus_eee1601_mixer },
9012 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9013 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9014 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9015 .dac_nids = alc883_dac_nids,
9016 .dig_out_nid = ALC883_DIGOUT_NID,
9017 .dig_in_nid = ALC883_DIGIN_NID,
9018 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9019 .channel_mode = alc883_3ST_2ch_modes,
9021 .input_mux = &alc883_asus_eee1601_capture_source,
9022 .unsol_event = alc_sku_unsol_event,
9023 .init_hook = alc883_eee1601_inithook,
9025 [ALC1200_ASUS_P5Q] = {
9026 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9027 .init_verbs = { alc883_init_verbs },
9028 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9029 .dac_nids = alc883_dac_nids,
9030 .dig_out_nid = ALC1200_DIGOUT_NID,
9031 .dig_in_nid = ALC883_DIGIN_NID,
9032 .slave_dig_outs = alc1200_slave_dig_outs,
9033 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9034 .channel_mode = alc883_sixstack_modes,
9035 .input_mux = &alc883_capture_source,
9038 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9039 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9040 alc880_gpio1_init_verbs },
9041 .adc_nids = alc883_adc_nids,
9042 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9043 .dac_nids = alc883_dac_nids,
9044 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9045 .channel_mode = alc889A_mb31_6ch_modes,
9046 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9047 .input_mux = &alc889A_mb31_capture_source,
9048 .dig_out_nid = ALC883_DIGOUT_NID,
9049 .unsol_event = alc889A_mb31_unsol_event,
9050 .init_hook = alc889A_mb31_automute,
9052 [ALC883_SONY_VAIO_TT] = {
9053 .mixers = { alc883_vaiott_mixer },
9054 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9055 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9056 .dac_nids = alc883_dac_nids,
9057 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9058 .channel_mode = alc883_3ST_2ch_modes,
9059 .input_mux = &alc883_capture_source,
9060 .unsol_event = alc_automute_amp_unsol_event,
9061 .init_hook = alc883_vaiott_init_hook,
9070 PINFIX_ABIT_AW9D_MAX
9073 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9074 { 0x15, 0x01080104 }, /* side */
9075 { 0x16, 0x01011012 }, /* rear */
9076 { 0x17, 0x01016011 }, /* clfe */
9080 static const struct alc_pincfg *alc882_pin_fixes[] = {
9081 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9084 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9085 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9090 * BIOS auto configuration
9092 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9093 hda_nid_t nid, int pin_type,
9097 struct alc_spec *spec = codec->spec;
9100 alc_set_pin_output(codec, nid, pin_type);
9101 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9104 idx = spec->multiout.dac_nids[dac_idx] - 2;
9105 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9109 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9111 struct alc_spec *spec = codec->spec;
9114 for (i = 0; i <= HDA_SIDE; i++) {
9115 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9116 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9118 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9123 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9125 struct alc_spec *spec = codec->spec;
9128 pin = spec->autocfg.hp_pins[0];
9129 if (pin) /* connect to front */
9131 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9132 pin = spec->autocfg.speaker_pins[0];
9134 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9137 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9139 struct alc_spec *spec = codec->spec;
9142 for (i = 0; i < AUTO_PIN_LAST; i++) {
9143 hda_nid_t nid = spec->autocfg.input_pins[i];
9146 alc_set_input_pin(codec, nid, i);
9147 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9148 snd_hda_codec_write(codec, nid, 0,
9149 AC_VERB_SET_AMP_GAIN_MUTE,
9154 static void alc882_auto_init_input_src(struct hda_codec *codec)
9156 struct alc_spec *spec = codec->spec;
9159 for (c = 0; c < spec->num_adc_nids; c++) {
9160 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9161 hda_nid_t nid = spec->capsrc_nids[c];
9162 unsigned int mux_idx;
9163 const struct hda_input_mux *imux;
9164 int conns, mute, idx, item;
9166 conns = snd_hda_get_connections(codec, nid, conn_list,
9167 ARRAY_SIZE(conn_list));
9170 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9171 imux = &spec->input_mux[mux_idx];
9172 for (idx = 0; idx < conns; idx++) {
9173 /* if the current connection is the selected one,
9174 * unmute it as default - otherwise mute it
9176 mute = AMP_IN_MUTE(idx);
9177 for (item = 0; item < imux->num_items; item++) {
9178 if (imux->items[item].index == idx) {
9179 if (spec->cur_mux[c] == item)
9180 mute = AMP_IN_UNMUTE(idx);
9184 /* check if we have a selector or mixer
9185 * we could check for the widget type instead, but
9186 * just check for Amp-In presence (in case of mixer
9187 * without amp-in there is something wrong, this
9188 * function shouldn't be used or capsrc nid is wrong)
9190 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9191 snd_hda_codec_write(codec, nid, 0,
9192 AC_VERB_SET_AMP_GAIN_MUTE,
9194 else if (mute != AMP_IN_MUTE(idx))
9195 snd_hda_codec_write(codec, nid, 0,
9196 AC_VERB_SET_CONNECT_SEL,
9202 /* add mic boosts if needed */
9203 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9205 struct alc_spec *spec = codec->spec;
9209 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9210 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9211 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9213 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9217 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9218 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9219 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9221 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9228 /* almost identical with ALC880 parser... */
9229 static int alc882_parse_auto_config(struct hda_codec *codec)
9231 struct alc_spec *spec = codec->spec;
9232 struct auto_pin_cfg *autocfg = &spec->autocfg;
9235 int err = alc880_parse_auto_config(codec);
9240 return 0; /* no config found */
9242 err = alc_auto_add_mic_boost(codec);
9246 /* hack - override the init verbs */
9247 spec->init_verbs[0] = alc883_auto_init_verbs;
9248 /* if ADC 0x07 is available, initialize it, too */
9249 wcap = get_wcaps(codec, 0x07);
9250 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9251 if (wcap == AC_WID_AUD_IN)
9252 add_verb(spec, alc882_adc1_init_verbs);
9254 /* digital-mic input pin is excluded in alc880_auto_create..()
9255 * because it's under 0x18
9257 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9258 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9259 struct hda_input_mux *imux = &spec->private_imux[0];
9260 for (i = 1; i < 3; i++)
9261 memcpy(&spec->private_imux[i],
9262 &spec->private_imux[0],
9263 sizeof(spec->private_imux[0]));
9264 imux->items[imux->num_items].label = "Int DMic";
9265 imux->items[imux->num_items].index = 0x0b;
9267 spec->num_mux_defs = 3;
9268 spec->input_mux = spec->private_imux;
9271 return 1; /* config found */
9274 /* additional initialization for auto-configuration model */
9275 static void alc882_auto_init(struct hda_codec *codec)
9277 struct alc_spec *spec = codec->spec;
9278 alc882_auto_init_multi_out(codec);
9279 alc882_auto_init_hp_out(codec);
9280 alc882_auto_init_analog_input(codec);
9281 alc882_auto_init_input_src(codec);
9282 if (spec->unsol_event)
9283 alc_inithook(codec);
9286 static int patch_alc882(struct hda_codec *codec)
9288 struct alc_spec *spec;
9289 int err, board_config;
9291 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9297 switch (codec->vendor_id) {
9302 /* ALC883 and variants */
9303 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9307 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9311 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9312 board_config = snd_hda_check_board_codec_sid_config(codec,
9313 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9315 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9316 printk(KERN_INFO "hda_codec: Unknown model for %s, "
9317 "trying auto-probe from BIOS...\n",
9319 board_config = ALC882_AUTO;
9322 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9324 if (board_config == ALC882_AUTO) {
9325 /* automatic parse from the BIOS config */
9326 err = alc882_parse_auto_config(codec);
9332 "hda_codec: Cannot set up configuration "
9333 "from BIOS. Using base mode...\n");
9334 board_config = ALC882_3ST_DIG;
9338 err = snd_hda_attach_beep_device(codec, 0x1);
9344 if (board_config != ALC882_AUTO)
9345 setup_preset(spec, &alc882_presets[board_config]);
9347 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9348 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9349 /* FIXME: setup DAC5 */
9350 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9351 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9353 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9354 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9356 if (codec->vendor_id == 0x10ec0888)
9357 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9359 if (!spec->adc_nids && spec->input_mux) {
9361 spec->num_adc_nids = 0;
9362 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9364 hda_nid_t nid = alc882_adc_nids[i];
9365 unsigned int wcap = get_wcaps(codec, nid);
9367 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9368 if (wcap != AC_WID_AUD_IN)
9370 spec->private_adc_nids[spec->num_adc_nids] = nid;
9371 err = snd_hda_get_connections(codec, nid, &cap, 1);
9374 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9375 spec->num_adc_nids++;
9377 spec->adc_nids = spec->private_adc_nids;
9378 spec->capsrc_nids = spec->private_capsrc_nids;
9381 set_capture_mixer(spec);
9382 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9384 spec->vmaster_nid = 0x0c;
9386 codec->patch_ops = alc_patch_ops;
9387 if (board_config == ALC882_AUTO)
9388 spec->init_hook = alc882_auto_init;
9389 #ifdef CONFIG_SND_HDA_POWER_SAVE
9390 if (!spec->loopback.amplist)
9391 spec->loopback.amplist = alc882_loopbacks;
9393 codec->proc_widget_hook = print_realtek_coef;
9403 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9404 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9406 #define alc262_dac_nids alc260_dac_nids
9407 #define alc262_adc_nids alc882_adc_nids
9408 #define alc262_adc_nids_alt alc882_adc_nids_alt
9409 #define alc262_capsrc_nids alc882_capsrc_nids
9410 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9412 #define alc262_modes alc260_modes
9413 #define alc262_capture_source alc882_capture_source
9415 static hda_nid_t alc262_dmic_adc_nids[1] = {
9420 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9422 static struct snd_kcontrol_new alc262_base_mixer[] = {
9423 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9424 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9425 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9426 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9427 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9428 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9431 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9434 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9435 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9436 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9437 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9438 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9442 /* update HP, line and mono-out pins according to the master switch */
9443 static void alc262_hp_master_update(struct hda_codec *codec)
9445 struct alc_spec *spec = codec->spec;
9446 int val = spec->master_sw;
9449 snd_hda_codec_write_cache(codec, 0x1b, 0,
9450 AC_VERB_SET_PIN_WIDGET_CONTROL,
9452 snd_hda_codec_write_cache(codec, 0x15, 0,
9453 AC_VERB_SET_PIN_WIDGET_CONTROL,
9455 /* mono (speaker) depending on the HP jack sense */
9456 val = val && !spec->jack_present;
9457 snd_hda_codec_write_cache(codec, 0x16, 0,
9458 AC_VERB_SET_PIN_WIDGET_CONTROL,
9462 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9464 struct alc_spec *spec = codec->spec;
9465 unsigned int presence;
9466 presence = snd_hda_codec_read(codec, 0x1b, 0,
9467 AC_VERB_GET_PIN_SENSE, 0);
9468 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9469 alc262_hp_master_update(codec);
9472 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9474 if ((res >> 26) != ALC880_HP_EVENT)
9476 alc262_hp_bpc_automute(codec);
9479 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9481 struct alc_spec *spec = codec->spec;
9482 unsigned int presence;
9483 presence = snd_hda_codec_read(codec, 0x15, 0,
9484 AC_VERB_GET_PIN_SENSE, 0);
9485 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9486 alc262_hp_master_update(codec);
9489 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9492 if ((res >> 26) != ALC880_HP_EVENT)
9494 alc262_hp_wildwest_automute(codec);
9497 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9499 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9500 struct snd_ctl_elem_value *ucontrol)
9502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9503 struct alc_spec *spec = codec->spec;
9504 int val = !!*ucontrol->value.integer.value;
9506 if (val == spec->master_sw)
9508 spec->master_sw = val;
9509 alc262_hp_master_update(codec);
9513 #define ALC262_HP_MASTER_SWITCH \
9515 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9516 .name = "Master Playback Switch", \
9517 .info = snd_ctl_boolean_mono_info, \
9518 .get = alc262_hp_master_sw_get, \
9519 .put = alc262_hp_master_sw_put, \
9522 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9523 ALC262_HP_MASTER_SWITCH,
9524 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9525 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9526 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9527 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9529 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9533 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9534 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9535 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9536 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9537 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9538 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9539 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9540 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9541 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9542 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9546 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9547 ALC262_HP_MASTER_SWITCH,
9548 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9549 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9550 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9551 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9552 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9554 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9556 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9557 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9558 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9559 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9560 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9561 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9562 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9566 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9567 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9568 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9569 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9573 /* mute/unmute internal speaker according to the hp jack and mute state */
9574 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9576 struct alc_spec *spec = codec->spec;
9578 spec->autocfg.hp_pins[0] = 0x15;
9579 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9580 alc_automute_amp(codec);
9583 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9584 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9585 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9586 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9587 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9594 static struct hda_verb alc262_hp_t5735_verbs[] = {
9595 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9598 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9602 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9603 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9605 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9606 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9607 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9608 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9612 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9613 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9614 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9615 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9616 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9617 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9618 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9619 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9620 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9621 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9622 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9626 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9633 /* bind hp and internal speaker mute (with plug check) as master switch */
9634 static void alc262_hippo_master_update(struct hda_codec *codec)
9636 struct alc_spec *spec = codec->spec;
9637 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9638 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9639 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9643 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9644 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9645 HDA_AMP_MUTE, mute);
9646 /* mute internal speaker per jack sense */
9647 if (spec->jack_present)
9648 mute = HDA_AMP_MUTE;
9650 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9651 HDA_AMP_MUTE, mute);
9652 if (speaker_nid && speaker_nid != line_nid)
9653 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9654 HDA_AMP_MUTE, mute);
9657 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9659 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9660 struct snd_ctl_elem_value *ucontrol)
9662 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9663 struct alc_spec *spec = codec->spec;
9664 int val = !!*ucontrol->value.integer.value;
9666 if (val == spec->master_sw)
9668 spec->master_sw = val;
9669 alc262_hippo_master_update(codec);
9673 #define ALC262_HIPPO_MASTER_SWITCH \
9675 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9676 .name = "Master Playback Switch", \
9677 .info = snd_ctl_boolean_mono_info, \
9678 .get = alc262_hippo_master_sw_get, \
9679 .put = alc262_hippo_master_sw_put, \
9682 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9683 ALC262_HIPPO_MASTER_SWITCH,
9684 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9685 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9686 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9687 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9688 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9691 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9692 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9693 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9694 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9695 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9699 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9700 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9701 ALC262_HIPPO_MASTER_SWITCH,
9702 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9703 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9704 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9705 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9706 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9707 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9708 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9709 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9710 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9711 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9715 /* mute/unmute internal speaker according to the hp jack and mute state */
9716 static void alc262_hippo_automute(struct hda_codec *codec)
9718 struct alc_spec *spec = codec->spec;
9719 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9720 unsigned int present;
9722 /* need to execute and sync at first */
9723 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9724 present = snd_hda_codec_read(codec, hp_nid, 0,
9725 AC_VERB_GET_PIN_SENSE, 0);
9726 spec->jack_present = (present & 0x80000000) != 0;
9727 alc262_hippo_master_update(codec);
9730 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9732 if ((res >> 26) != ALC880_HP_EVENT)
9734 alc262_hippo_automute(codec);
9737 static void alc262_hippo_init_hook(struct hda_codec *codec)
9739 struct alc_spec *spec = codec->spec;
9741 spec->autocfg.hp_pins[0] = 0x15;
9742 spec->autocfg.speaker_pins[0] = 0x14;
9743 alc262_hippo_automute(codec);
9746 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9748 struct alc_spec *spec = codec->spec;
9750 spec->autocfg.hp_pins[0] = 0x1b;
9751 spec->autocfg.speaker_pins[0] = 0x14;
9752 alc262_hippo_automute(codec);
9756 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9757 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9758 ALC262_HIPPO_MASTER_SWITCH,
9759 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9760 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9761 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9762 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9766 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9767 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9768 ALC262_HIPPO_MASTER_SWITCH,
9769 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9772 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9773 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9777 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9778 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9779 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9780 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9781 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9782 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9783 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9784 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9786 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9787 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9788 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9789 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9793 static struct hda_verb alc262_tyan_verbs[] = {
9794 /* Headphone automute */
9795 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9797 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9799 /* P11 AUX_IN, white 4-pin connector */
9800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9801 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9802 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9803 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9808 /* unsolicited event for HP jack sensing */
9809 static void alc262_tyan_init_hook(struct hda_codec *codec)
9811 struct alc_spec *spec = codec->spec;
9813 spec->autocfg.hp_pins[0] = 0x1b;
9814 spec->autocfg.speaker_pins[0] = 0x15;
9815 alc_automute_amp(codec);
9819 #define alc262_capture_mixer alc882_capture_mixer
9820 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9823 * generic initialization of ADC, input mixers and output mixers
9825 static struct hda_verb alc262_init_verbs[] = {
9827 * Unmute ADC0-2 and set the default input to mic-in
9829 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9830 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9831 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9832 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9833 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9834 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9836 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9838 * Note: PASD motherboards uses the Line In 2 as the input for
9839 * front panel mic (mic 2)
9841 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9842 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9843 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9844 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9845 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9846 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9849 * Set up output mixers (0x0c - 0x0e)
9851 /* set vol=0 to output mixers */
9852 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9853 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9854 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9855 /* set up input amps for analog loopback */
9856 /* Amp Indices: DAC = 0, mixer = 1 */
9857 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9858 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9859 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9860 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9861 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9862 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9864 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9865 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9866 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9867 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9868 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9869 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9874 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9875 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9877 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9878 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9880 /* FIXME: use matrix-type input source selection */
9881 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9882 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9883 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9884 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9885 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9886 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9888 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9901 static struct hda_verb alc262_eapd_verbs[] = {
9902 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9903 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9907 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9908 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9909 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9913 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9914 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9915 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9916 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9918 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9919 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9923 static struct hda_verb alc262_sony_unsol_verbs[] = {
9924 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9925 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9926 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9928 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9933 static struct hda_input_mux alc262_dmic_capture_source = {
9936 { "Int DMic", 0x9 },
9941 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9942 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9943 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 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),
9950 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9951 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9952 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9954 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9955 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9956 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9957 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9958 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9962 static void alc262_dmic_automute(struct hda_codec *codec)
9964 unsigned int present;
9966 present = snd_hda_codec_read(codec, 0x18, 0,
9967 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9968 snd_hda_codec_write(codec, 0x22, 0,
9969 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9973 /* unsolicited event for HP jack sensing */
9974 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9977 if ((res >> 26) == ALC880_MIC_EVENT)
9978 alc262_dmic_automute(codec);
9980 alc_sku_unsol_event(codec, res);
9983 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9985 struct alc_spec *spec = codec->spec;
9987 spec->autocfg.hp_pins[0] = 0x15;
9988 spec->autocfg.speaker_pins[0] = 0x14;
9989 alc_automute_pin(codec);
9990 alc262_dmic_automute(codec);
9996 * 0x16 = internal speaker
9997 * 0x18 = external mic
10000 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10001 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10002 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10005 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10006 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10008 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10013 static struct hda_verb alc262_nec_verbs[] = {
10014 /* Unmute Speaker */
10015 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10018 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10021 /* External mic to headphone */
10022 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10023 /* External mic to speaker */
10024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10030 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10031 * 0x1b = port replicator headphone out
10034 #define ALC_HP_EVENT 0x37
10036 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10037 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10038 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10039 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10040 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10044 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10045 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10050 static struct hda_input_mux alc262_fujitsu_capture_source = {
10054 { "Int Mic", 0x1 },
10059 static struct hda_input_mux alc262_HP_capture_source = {
10063 { "Front Mic", 0x1 },
10070 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10074 { "Front Mic", 0x2 },
10080 /* mute/unmute internal speaker according to the hp jacks and mute state */
10081 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10083 struct alc_spec *spec = codec->spec;
10086 if (force || !spec->sense_updated) {
10087 unsigned int present;
10088 /* need to execute and sync at first */
10089 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10090 /* check laptop HP jack */
10091 present = snd_hda_codec_read(codec, 0x14, 0,
10092 AC_VERB_GET_PIN_SENSE, 0);
10093 /* need to execute and sync at first */
10094 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10095 /* check docking HP jack */
10096 present |= snd_hda_codec_read(codec, 0x1b, 0,
10097 AC_VERB_GET_PIN_SENSE, 0);
10098 if (present & AC_PINSENSE_PRESENCE)
10099 spec->jack_present = 1;
10101 spec->jack_present = 0;
10102 spec->sense_updated = 1;
10104 /* unmute internal speaker only if both HPs are unplugged and
10105 * master switch is on
10107 if (spec->jack_present)
10108 mute = HDA_AMP_MUTE;
10110 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10111 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10112 HDA_AMP_MUTE, mute);
10115 /* unsolicited event for HP jack sensing */
10116 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10119 if ((res >> 26) != ALC_HP_EVENT)
10121 alc262_fujitsu_automute(codec, 1);
10124 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10126 alc262_fujitsu_automute(codec, 1);
10129 /* bind volumes of both NID 0x0c and 0x0d */
10130 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10131 .ops = &snd_hda_bind_vol,
10133 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10134 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10139 /* mute/unmute internal speaker according to the hp jack and mute state */
10140 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10142 struct alc_spec *spec = codec->spec;
10145 if (force || !spec->sense_updated) {
10146 unsigned int present_int_hp;
10147 /* need to execute and sync at first */
10148 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10149 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10150 AC_VERB_GET_PIN_SENSE, 0);
10151 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10152 spec->sense_updated = 1;
10154 if (spec->jack_present) {
10155 /* mute internal speaker */
10156 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10157 HDA_AMP_MUTE, HDA_AMP_MUTE);
10158 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10159 HDA_AMP_MUTE, HDA_AMP_MUTE);
10161 /* unmute internal speaker if necessary */
10162 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10163 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10164 HDA_AMP_MUTE, mute);
10165 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10166 HDA_AMP_MUTE, mute);
10170 /* unsolicited event for HP jack sensing */
10171 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10174 if ((res >> 26) != ALC_HP_EVENT)
10176 alc262_lenovo_3000_automute(codec, 1);
10179 /* bind hp and internal speaker mute (with plug check) */
10180 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10181 struct snd_ctl_elem_value *ucontrol)
10183 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10184 long *valp = ucontrol->value.integer.value;
10187 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10189 valp ? 0 : HDA_AMP_MUTE);
10190 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10192 valp ? 0 : HDA_AMP_MUTE);
10195 alc262_fujitsu_automute(codec, 0);
10199 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10200 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10203 .name = "Master Playback Switch",
10204 .info = snd_hda_mixer_amp_switch_info,
10205 .get = snd_hda_mixer_amp_switch_get,
10206 .put = alc262_fujitsu_master_sw_put,
10207 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10209 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10210 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10212 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10215 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10216 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10220 /* bind hp and internal speaker mute (with plug check) */
10221 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10222 struct snd_ctl_elem_value *ucontrol)
10224 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10225 long *valp = ucontrol->value.integer.value;
10228 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10230 valp ? 0 : HDA_AMP_MUTE);
10233 alc262_lenovo_3000_automute(codec, 0);
10237 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10238 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10240 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10241 .name = "Master Playback Switch",
10242 .info = snd_hda_mixer_amp_switch_info,
10243 .get = snd_hda_mixer_amp_switch_get,
10244 .put = alc262_lenovo_3000_master_sw_put,
10245 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10252 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10253 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10254 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10258 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10259 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10260 ALC262_HIPPO_MASTER_SWITCH,
10261 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10262 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10263 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10264 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10265 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10266 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10270 /* additional init verbs for Benq laptops */
10271 static struct hda_verb alc262_EAPD_verbs[] = {
10272 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10273 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10277 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10278 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10281 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10282 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10286 /* Samsung Q1 Ultra Vista model setup */
10287 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10288 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10289 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10291 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10292 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10293 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10297 static struct hda_verb alc262_ultra_verbs[] = {
10299 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10304 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10306 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10311 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10312 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10314 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10316 /* ADC, choose mic */
10317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10321 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10322 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10323 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10324 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10325 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10326 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10330 /* mute/unmute internal speaker according to the hp jack and mute state */
10331 static void alc262_ultra_automute(struct hda_codec *codec)
10333 struct alc_spec *spec = codec->spec;
10337 /* auto-mute only when HP is used as HP */
10338 if (!spec->cur_mux[0]) {
10339 unsigned int present;
10340 /* need to execute and sync at first */
10341 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10342 present = snd_hda_codec_read(codec, 0x15, 0,
10343 AC_VERB_GET_PIN_SENSE, 0);
10344 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10345 if (spec->jack_present)
10346 mute = HDA_AMP_MUTE;
10348 /* mute/unmute internal speaker */
10349 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10350 HDA_AMP_MUTE, mute);
10351 /* mute/unmute HP */
10352 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10353 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10356 /* unsolicited event for HP jack sensing */
10357 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10360 if ((res >> 26) != ALC880_HP_EVENT)
10362 alc262_ultra_automute(codec);
10365 static struct hda_input_mux alc262_ultra_capture_source = {
10369 { "Headphone", 0x7 },
10373 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10374 struct snd_ctl_elem_value *ucontrol)
10376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10377 struct alc_spec *spec = codec->spec;
10380 ret = alc_mux_enum_put(kcontrol, ucontrol);
10383 /* reprogram the HP pin as mic or HP according to the input source */
10384 snd_hda_codec_write_cache(codec, 0x15, 0,
10385 AC_VERB_SET_PIN_WIDGET_CONTROL,
10386 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10387 alc262_ultra_automute(codec); /* mute/unmute HP */
10391 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10392 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10393 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10396 .name = "Capture Source",
10397 .info = alc_mux_enum_info,
10398 .get = alc_mux_enum_get,
10399 .put = alc262_ultra_mux_enum_put,
10404 /* add playback controls from the parsed DAC table */
10405 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10406 const struct auto_pin_cfg *cfg)
10411 spec->multiout.num_dacs = 1; /* only use one dac */
10412 spec->multiout.dac_nids = spec->private_dac_nids;
10413 spec->multiout.dac_nids[0] = 2;
10415 nid = cfg->line_out_pins[0];
10417 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10418 "Front Playback Volume",
10419 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10422 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10423 "Front Playback Switch",
10424 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10429 nid = cfg->speaker_pins[0];
10432 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10433 "Speaker Playback Volume",
10434 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10438 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10439 "Speaker Playback Switch",
10440 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10445 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10446 "Speaker Playback Switch",
10447 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10453 nid = cfg->hp_pins[0];
10455 /* spec->multiout.hp_nid = 2; */
10457 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10458 "Headphone Playback Volume",
10459 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10463 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10464 "Headphone Playback Switch",
10465 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10470 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10471 "Headphone Playback Switch",
10472 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10481 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10482 const struct auto_pin_cfg *cfg)
10486 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10489 /* digital-mic input pin is excluded in alc880_auto_create..()
10490 * because it's under 0x18
10492 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10493 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10494 struct hda_input_mux *imux = &spec->private_imux[0];
10495 imux->items[imux->num_items].label = "Int Mic";
10496 imux->items[imux->num_items].index = 0x09;
10504 * generic initialization of ADC, input mixers and output mixers
10506 static struct hda_verb alc262_volume_init_verbs[] = {
10508 * Unmute ADC0-2 and set the default input to mic-in
10510 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10512 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10513 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10514 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10515 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10517 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10519 * Note: PASD motherboards uses the Line In 2 as the input for
10520 * front panel mic (mic 2)
10522 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10530 * Set up output mixers (0x0c - 0x0f)
10532 /* set vol=0 to output mixers */
10533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10534 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10535 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10537 /* set up input amps for analog loopback */
10538 /* Amp Indices: DAC = 0, mixer = 1 */
10539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10542 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10543 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10544 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10546 /* FIXME: use matrix-type input source selection */
10547 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10548 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10567 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10569 * Unmute ADC0-2 and set the default input to mic-in
10571 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10572 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10573 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10574 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10575 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10576 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10578 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10580 * Note: PASD motherboards uses the Line In 2 as the input for
10581 * front panel mic (mic 2)
10583 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10586 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10587 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10588 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10589 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10593 * Set up output mixers (0x0c - 0x0e)
10595 /* set vol=0 to output mixers */
10596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10597 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10600 /* set up input amps for analog loopback */
10601 /* Amp Indices: DAC = 0, mixer = 1 */
10602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10605 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10607 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10613 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10616 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10620 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10622 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10623 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10625 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10626 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10629 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10630 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10633 /* FIXME: use matrix-type input source selection */
10634 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10635 /* Input mixer1: only unmute Mic */
10636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10647 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10653 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10654 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10660 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10661 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10663 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10666 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10671 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10673 * Unmute ADC0-2 and set the default input to mic-in
10675 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10676 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10677 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10678 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10680 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10684 * Note: PASD motherboards uses the Line In 2 as the input for front
10685 * panel mic (mic 2)
10687 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10692 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10693 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10695 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10697 * Set up output mixers (0x0c - 0x0e)
10699 /* set vol=0 to output mixers */
10700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10704 /* set up input amps for analog loopback */
10705 /* Amp Indices: DAC = 0, mixer = 1 */
10706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10707 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10708 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10710 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10711 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10716 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10717 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10718 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10719 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10720 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10722 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10723 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10725 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10728 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10729 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10730 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10731 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10732 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10733 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10735 /* FIXME: use matrix-type input source selection */
10736 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10737 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10742 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10743 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10746 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10747 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10748 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10749 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10751 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10754 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10756 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10759 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10762 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10767 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10769 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10770 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10771 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10774 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10775 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10776 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10779 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10780 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10785 #ifdef CONFIG_SND_HDA_POWER_SAVE
10786 #define alc262_loopbacks alc880_loopbacks
10789 /* pcm configuration: identical with ALC880 */
10790 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10791 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10792 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10793 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10796 * BIOS auto configuration
10798 static int alc262_parse_auto_config(struct hda_codec *codec)
10800 struct alc_spec *spec = codec->spec;
10802 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10804 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10808 if (!spec->autocfg.line_outs) {
10809 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10810 spec->multiout.max_channels = 2;
10811 spec->no_analog = 1;
10814 return 0; /* can't find valid BIOS pin config */
10816 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10819 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10823 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10826 if (spec->autocfg.dig_outs) {
10827 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10828 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10830 if (spec->autocfg.dig_in_pin)
10831 spec->dig_in_nid = ALC262_DIGIN_NID;
10833 if (spec->kctls.list)
10834 add_mixer(spec, spec->kctls.list);
10836 add_verb(spec, alc262_volume_init_verbs);
10837 spec->num_mux_defs = 1;
10838 spec->input_mux = &spec->private_imux[0];
10840 err = alc_auto_add_mic_boost(codec);
10844 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10849 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10850 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10851 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10852 #define alc262_auto_init_input_src alc882_auto_init_input_src
10855 /* init callback for auto-configuration model -- overriding the default init */
10856 static void alc262_auto_init(struct hda_codec *codec)
10858 struct alc_spec *spec = codec->spec;
10859 alc262_auto_init_multi_out(codec);
10860 alc262_auto_init_hp_out(codec);
10861 alc262_auto_init_analog_input(codec);
10862 alc262_auto_init_input_src(codec);
10863 if (spec->unsol_event)
10864 alc_inithook(codec);
10868 * configuration and preset
10870 static const char *alc262_models[ALC262_MODEL_LAST] = {
10871 [ALC262_BASIC] = "basic",
10872 [ALC262_HIPPO] = "hippo",
10873 [ALC262_HIPPO_1] = "hippo_1",
10874 [ALC262_FUJITSU] = "fujitsu",
10875 [ALC262_HP_BPC] = "hp-bpc",
10876 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10877 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10878 [ALC262_HP_RP5700] = "hp-rp5700",
10879 [ALC262_BENQ_ED8] = "benq",
10880 [ALC262_BENQ_T31] = "benq-t31",
10881 [ALC262_SONY_ASSAMD] = "sony-assamd",
10882 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10883 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10884 [ALC262_ULTRA] = "ultra",
10885 [ALC262_LENOVO_3000] = "lenovo-3000",
10886 [ALC262_NEC] = "nec",
10887 [ALC262_TYAN] = "tyan",
10888 [ALC262_AUTO] = "auto",
10891 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10892 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10893 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10894 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10896 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10898 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10900 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10901 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10902 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10903 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10904 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10905 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10906 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10907 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10908 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10909 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10910 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10911 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10912 ALC262_HP_TC_T5735),
10913 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10914 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10915 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10916 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10917 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10918 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
10919 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10920 ALC262_SONY_ASSAMD),
10921 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10922 ALC262_TOSHIBA_RX1),
10923 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10924 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10925 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10926 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10927 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10929 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10930 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10931 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10932 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10933 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10937 static struct alc_config_preset alc262_presets[] = {
10939 .mixers = { alc262_base_mixer },
10940 .init_verbs = { alc262_init_verbs },
10941 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10942 .dac_nids = alc262_dac_nids,
10944 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10945 .channel_mode = alc262_modes,
10946 .input_mux = &alc262_capture_source,
10949 .mixers = { alc262_hippo_mixer },
10950 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10951 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10952 .dac_nids = alc262_dac_nids,
10954 .dig_out_nid = ALC262_DIGOUT_NID,
10955 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10956 .channel_mode = alc262_modes,
10957 .input_mux = &alc262_capture_source,
10958 .unsol_event = alc262_hippo_unsol_event,
10959 .init_hook = alc262_hippo_init_hook,
10961 [ALC262_HIPPO_1] = {
10962 .mixers = { alc262_hippo1_mixer },
10963 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10964 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10965 .dac_nids = alc262_dac_nids,
10967 .dig_out_nid = ALC262_DIGOUT_NID,
10968 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10969 .channel_mode = alc262_modes,
10970 .input_mux = &alc262_capture_source,
10971 .unsol_event = alc262_hippo_unsol_event,
10972 .init_hook = alc262_hippo1_init_hook,
10974 [ALC262_FUJITSU] = {
10975 .mixers = { alc262_fujitsu_mixer },
10976 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10977 alc262_fujitsu_unsol_verbs },
10978 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10979 .dac_nids = alc262_dac_nids,
10981 .dig_out_nid = ALC262_DIGOUT_NID,
10982 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10983 .channel_mode = alc262_modes,
10984 .input_mux = &alc262_fujitsu_capture_source,
10985 .unsol_event = alc262_fujitsu_unsol_event,
10986 .init_hook = alc262_fujitsu_init_hook,
10988 [ALC262_HP_BPC] = {
10989 .mixers = { alc262_HP_BPC_mixer },
10990 .init_verbs = { alc262_HP_BPC_init_verbs },
10991 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10992 .dac_nids = alc262_dac_nids,
10994 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10995 .channel_mode = alc262_modes,
10996 .input_mux = &alc262_HP_capture_source,
10997 .unsol_event = alc262_hp_bpc_unsol_event,
10998 .init_hook = alc262_hp_bpc_automute,
11000 [ALC262_HP_BPC_D7000_WF] = {
11001 .mixers = { alc262_HP_BPC_WildWest_mixer },
11002 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11003 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11004 .dac_nids = alc262_dac_nids,
11006 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11007 .channel_mode = alc262_modes,
11008 .input_mux = &alc262_HP_D7000_capture_source,
11009 .unsol_event = alc262_hp_wildwest_unsol_event,
11010 .init_hook = alc262_hp_wildwest_automute,
11012 [ALC262_HP_BPC_D7000_WL] = {
11013 .mixers = { alc262_HP_BPC_WildWest_mixer,
11014 alc262_HP_BPC_WildWest_option_mixer },
11015 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11016 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11017 .dac_nids = alc262_dac_nids,
11019 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11020 .channel_mode = alc262_modes,
11021 .input_mux = &alc262_HP_D7000_capture_source,
11022 .unsol_event = alc262_hp_wildwest_unsol_event,
11023 .init_hook = alc262_hp_wildwest_automute,
11025 [ALC262_HP_TC_T5735] = {
11026 .mixers = { alc262_hp_t5735_mixer },
11027 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11028 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11029 .dac_nids = alc262_dac_nids,
11031 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11032 .channel_mode = alc262_modes,
11033 .input_mux = &alc262_capture_source,
11034 .unsol_event = alc_automute_amp_unsol_event,
11035 .init_hook = alc262_hp_t5735_init_hook,
11037 [ALC262_HP_RP5700] = {
11038 .mixers = { alc262_hp_rp5700_mixer },
11039 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11040 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11041 .dac_nids = alc262_dac_nids,
11042 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11043 .channel_mode = alc262_modes,
11044 .input_mux = &alc262_hp_rp5700_capture_source,
11046 [ALC262_BENQ_ED8] = {
11047 .mixers = { alc262_base_mixer },
11048 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11049 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11050 .dac_nids = alc262_dac_nids,
11052 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11053 .channel_mode = alc262_modes,
11054 .input_mux = &alc262_capture_source,
11056 [ALC262_SONY_ASSAMD] = {
11057 .mixers = { alc262_sony_mixer },
11058 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11059 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11060 .dac_nids = alc262_dac_nids,
11062 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11063 .channel_mode = alc262_modes,
11064 .input_mux = &alc262_capture_source,
11065 .unsol_event = alc262_hippo_unsol_event,
11066 .init_hook = alc262_hippo_init_hook,
11068 [ALC262_BENQ_T31] = {
11069 .mixers = { alc262_benq_t31_mixer },
11070 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11071 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11072 .dac_nids = alc262_dac_nids,
11074 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11075 .channel_mode = alc262_modes,
11076 .input_mux = &alc262_capture_source,
11077 .unsol_event = alc262_hippo_unsol_event,
11078 .init_hook = alc262_hippo_init_hook,
11081 .mixers = { alc262_ultra_mixer },
11082 .cap_mixer = alc262_ultra_capture_mixer,
11083 .init_verbs = { alc262_ultra_verbs },
11084 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11085 .dac_nids = alc262_dac_nids,
11086 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11087 .channel_mode = alc262_modes,
11088 .input_mux = &alc262_ultra_capture_source,
11089 .adc_nids = alc262_adc_nids, /* ADC0 */
11090 .capsrc_nids = alc262_capsrc_nids,
11091 .num_adc_nids = 1, /* single ADC */
11092 .unsol_event = alc262_ultra_unsol_event,
11093 .init_hook = alc262_ultra_automute,
11095 [ALC262_LENOVO_3000] = {
11096 .mixers = { alc262_lenovo_3000_mixer },
11097 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11098 alc262_lenovo_3000_unsol_verbs },
11099 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11100 .dac_nids = alc262_dac_nids,
11102 .dig_out_nid = ALC262_DIGOUT_NID,
11103 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11104 .channel_mode = alc262_modes,
11105 .input_mux = &alc262_fujitsu_capture_source,
11106 .unsol_event = alc262_lenovo_3000_unsol_event,
11109 .mixers = { alc262_nec_mixer },
11110 .init_verbs = { alc262_nec_verbs },
11111 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11112 .dac_nids = alc262_dac_nids,
11114 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11115 .channel_mode = alc262_modes,
11116 .input_mux = &alc262_capture_source,
11118 [ALC262_TOSHIBA_S06] = {
11119 .mixers = { alc262_toshiba_s06_mixer },
11120 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11121 alc262_eapd_verbs },
11122 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11123 .capsrc_nids = alc262_dmic_capsrc_nids,
11124 .dac_nids = alc262_dac_nids,
11125 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11126 .num_adc_nids = 1, /* single ADC */
11127 .dig_out_nid = ALC262_DIGOUT_NID,
11128 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11129 .channel_mode = alc262_modes,
11130 .input_mux = &alc262_dmic_capture_source,
11131 .unsol_event = alc262_toshiba_s06_unsol_event,
11132 .init_hook = alc262_toshiba_s06_init_hook,
11134 [ALC262_TOSHIBA_RX1] = {
11135 .mixers = { alc262_toshiba_rx1_mixer },
11136 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11137 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11138 .dac_nids = alc262_dac_nids,
11140 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11141 .channel_mode = alc262_modes,
11142 .input_mux = &alc262_capture_source,
11143 .unsol_event = alc262_hippo_unsol_event,
11144 .init_hook = alc262_hippo_init_hook,
11147 .mixers = { alc262_tyan_mixer },
11148 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11149 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11150 .dac_nids = alc262_dac_nids,
11152 .dig_out_nid = ALC262_DIGOUT_NID,
11153 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11154 .channel_mode = alc262_modes,
11155 .input_mux = &alc262_capture_source,
11156 .unsol_event = alc_automute_amp_unsol_event,
11157 .init_hook = alc262_tyan_init_hook,
11161 static int patch_alc262(struct hda_codec *codec)
11163 struct alc_spec *spec;
11167 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11171 codec->spec = spec;
11173 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11178 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11179 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11180 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11181 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11185 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11187 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11191 if (board_config < 0) {
11192 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11193 "trying auto-probe from BIOS...\n", codec->chip_name);
11194 board_config = ALC262_AUTO;
11197 if (board_config == ALC262_AUTO) {
11198 /* automatic parse from the BIOS config */
11199 err = alc262_parse_auto_config(codec);
11205 "hda_codec: Cannot set up configuration "
11206 "from BIOS. Using base mode...\n");
11207 board_config = ALC262_BASIC;
11211 if (!spec->no_analog) {
11212 err = snd_hda_attach_beep_device(codec, 0x1);
11219 if (board_config != ALC262_AUTO)
11220 setup_preset(spec, &alc262_presets[board_config]);
11222 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11223 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11225 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11226 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11228 if (!spec->adc_nids && spec->input_mux) {
11230 /* check whether the digital-mic has to be supported */
11231 for (i = 0; i < spec->input_mux->num_items; i++) {
11232 if (spec->input_mux->items[i].index >= 9)
11235 if (i < spec->input_mux->num_items) {
11236 /* use only ADC0 */
11237 spec->adc_nids = alc262_dmic_adc_nids;
11238 spec->num_adc_nids = 1;
11239 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11241 /* all analog inputs */
11242 /* check whether NID 0x07 is valid */
11243 unsigned int wcap = get_wcaps(codec, 0x07);
11246 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11247 if (wcap != AC_WID_AUD_IN) {
11248 spec->adc_nids = alc262_adc_nids_alt;
11249 spec->num_adc_nids =
11250 ARRAY_SIZE(alc262_adc_nids_alt);
11251 spec->capsrc_nids = alc262_capsrc_nids_alt;
11253 spec->adc_nids = alc262_adc_nids;
11254 spec->num_adc_nids =
11255 ARRAY_SIZE(alc262_adc_nids);
11256 spec->capsrc_nids = alc262_capsrc_nids;
11260 if (!spec->cap_mixer && !spec->no_analog)
11261 set_capture_mixer(spec);
11262 if (!spec->no_analog)
11263 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11265 spec->vmaster_nid = 0x0c;
11267 codec->patch_ops = alc_patch_ops;
11268 if (board_config == ALC262_AUTO)
11269 spec->init_hook = alc262_auto_init;
11270 #ifdef CONFIG_SND_HDA_POWER_SAVE
11271 if (!spec->loopback.amplist)
11272 spec->loopback.amplist = alc262_loopbacks;
11274 codec->proc_widget_hook = print_realtek_coef;
11280 * ALC268 channel source setting (2 channel)
11282 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11283 #define alc268_modes alc260_modes
11285 static hda_nid_t alc268_dac_nids[2] = {
11290 static hda_nid_t alc268_adc_nids[2] = {
11295 static hda_nid_t alc268_adc_nids_alt[1] = {
11300 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11302 static struct snd_kcontrol_new alc268_base_mixer[] = {
11303 /* output mixer control */
11304 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11305 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11306 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11307 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11308 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11309 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11310 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11314 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11315 /* output mixer control */
11316 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11317 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11318 ALC262_HIPPO_MASTER_SWITCH,
11319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11320 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11321 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11325 /* bind Beep switches of both NID 0x0f and 0x10 */
11326 static struct hda_bind_ctls alc268_bind_beep_sw = {
11327 .ops = &snd_hda_bind_sw,
11329 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11330 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11335 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11336 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11337 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11341 static struct hda_verb alc268_eapd_verbs[] = {
11342 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11343 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11347 /* Toshiba specific */
11348 static struct hda_verb alc268_toshiba_verbs[] = {
11349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11353 static struct hda_input_mux alc268_acer_lc_capture_source = {
11361 /* Acer specific */
11362 /* bind volumes of both NID 0x02 and 0x03 */
11363 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11364 .ops = &snd_hda_bind_vol,
11366 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11367 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11372 /* mute/unmute internal speaker according to the hp jack and mute state */
11373 static void alc268_acer_automute(struct hda_codec *codec, int force)
11375 struct alc_spec *spec = codec->spec;
11378 if (force || !spec->sense_updated) {
11379 unsigned int present;
11380 present = snd_hda_codec_read(codec, 0x14, 0,
11381 AC_VERB_GET_PIN_SENSE, 0);
11382 spec->jack_present = (present & 0x80000000) != 0;
11383 spec->sense_updated = 1;
11385 if (spec->jack_present)
11386 mute = HDA_AMP_MUTE; /* mute internal speaker */
11387 else /* unmute internal speaker if necessary */
11388 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11389 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11390 HDA_AMP_MUTE, mute);
11394 /* bind hp and internal speaker mute (with plug check) */
11395 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11396 struct snd_ctl_elem_value *ucontrol)
11398 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11399 long *valp = ucontrol->value.integer.value;
11402 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11404 valp[0] ? 0 : HDA_AMP_MUTE);
11405 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11407 valp[1] ? 0 : HDA_AMP_MUTE);
11409 alc268_acer_automute(codec, 0);
11413 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11414 /* output mixer control */
11415 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11417 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11418 .name = "Master Playback Switch",
11419 .info = snd_hda_mixer_amp_switch_info,
11420 .get = snd_hda_mixer_amp_switch_get,
11421 .put = alc268_acer_master_sw_put,
11422 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11424 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11428 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11429 /* output mixer control */
11430 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11432 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11433 .name = "Master Playback Switch",
11434 .info = snd_hda_mixer_amp_switch_info,
11435 .get = snd_hda_mixer_amp_switch_get,
11436 .put = alc268_acer_master_sw_put,
11437 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11439 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11440 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11441 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11445 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11446 /* output mixer control */
11447 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11449 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11450 .name = "Master Playback Switch",
11451 .info = snd_hda_mixer_amp_switch_info,
11452 .get = snd_hda_mixer_amp_switch_get,
11453 .put = alc268_acer_master_sw_put,
11454 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11456 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11457 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11461 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11464 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11465 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11466 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11471 static struct hda_verb alc268_acer_verbs[] = {
11472 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11473 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11474 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11475 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11477 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11478 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11482 /* unsolicited event for HP jack sensing */
11483 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11484 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11486 static void alc268_acer_unsol_event(struct hda_codec *codec,
11489 if ((res >> 26) != ALC880_HP_EVENT)
11491 alc268_acer_automute(codec, 1);
11494 static void alc268_acer_init_hook(struct hda_codec *codec)
11496 alc268_acer_automute(codec, 1);
11499 /* toggle speaker-output according to the hp-jack state */
11500 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11502 unsigned int present;
11503 unsigned char bits;
11505 present = snd_hda_codec_read(codec, 0x15, 0,
11506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11507 bits = present ? AMP_IN_MUTE(0) : 0;
11508 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11509 AMP_IN_MUTE(0), bits);
11510 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11511 AMP_IN_MUTE(0), bits);
11515 static void alc268_acer_mic_automute(struct hda_codec *codec)
11517 unsigned int present;
11519 present = snd_hda_codec_read(codec, 0x18, 0,
11520 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11521 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11522 present ? 0x0 : 0x6);
11525 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11528 if ((res >> 26) == ALC880_HP_EVENT)
11529 alc268_aspire_one_speaker_automute(codec);
11530 if ((res >> 26) == ALC880_MIC_EVENT)
11531 alc268_acer_mic_automute(codec);
11534 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11536 alc268_aspire_one_speaker_automute(codec);
11537 alc268_acer_mic_automute(codec);
11540 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11541 /* output mixer control */
11542 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11543 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11545 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11546 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11547 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11551 static struct hda_verb alc268_dell_verbs[] = {
11552 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11554 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11558 /* mute/unmute internal speaker according to the hp jack and mute state */
11559 static void alc268_dell_init_hook(struct hda_codec *codec)
11561 struct alc_spec *spec = codec->spec;
11563 spec->autocfg.hp_pins[0] = 0x15;
11564 spec->autocfg.speaker_pins[0] = 0x14;
11565 alc_automute_pin(codec);
11568 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11569 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11570 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11571 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11573 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11574 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11575 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11576 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11580 static struct hda_verb alc267_quanta_il1_verbs[] = {
11581 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11586 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11588 unsigned int present;
11590 present = snd_hda_codec_read(codec, 0x18, 0,
11591 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11592 snd_hda_codec_write(codec, 0x23, 0,
11593 AC_VERB_SET_CONNECT_SEL,
11594 present ? 0x00 : 0x01);
11597 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11599 struct alc_spec *spec = codec->spec;
11601 spec->autocfg.hp_pins[0] = 0x15;
11602 spec->autocfg.speaker_pins[0] = 0x14;
11603 alc_automute_pin(codec);
11604 alc267_quanta_il1_mic_automute(codec);
11607 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11610 switch (res >> 26) {
11611 case ALC880_MIC_EVENT:
11612 alc267_quanta_il1_mic_automute(codec);
11615 alc_sku_unsol_event(codec, res);
11621 * generic initialization of ADC, input mixers and output mixers
11623 static struct hda_verb alc268_base_init_verbs[] = {
11624 /* Unmute DAC0-1 and set vol = 0 */
11625 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11626 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11629 * Set up output mixers (0x0c - 0x0e)
11631 /* set vol=0 to output mixers */
11632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11633 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11636 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11638 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11640 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11641 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11642 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11644 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11645 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11649 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11650 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11653 /* set PCBEEP vol = 0, mute connections */
11654 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11656 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11658 /* Unmute Selector 23h,24h and set the default input to mic-in */
11660 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11662 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11663 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11669 * generic initialization of ADC, input mixers and output mixers
11671 static struct hda_verb alc268_volume_init_verbs[] = {
11672 /* set output DAC */
11673 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11674 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11676 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11679 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11680 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11683 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11684 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11689 /* set PCBEEP vol = 0, mute connections */
11690 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11692 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11697 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11698 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11699 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11701 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11702 /* The multiple "Capture Source" controls confuse alsamixer
11703 * So call somewhat different..
11705 /* .name = "Capture Source", */
11706 .name = "Input Source",
11708 .info = alc_mux_enum_info,
11709 .get = alc_mux_enum_get,
11710 .put = alc_mux_enum_put,
11715 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11716 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11717 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11718 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11719 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11721 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11722 /* The multiple "Capture Source" controls confuse alsamixer
11723 * So call somewhat different..
11725 /* .name = "Capture Source", */
11726 .name = "Input Source",
11728 .info = alc_mux_enum_info,
11729 .get = alc_mux_enum_get,
11730 .put = alc_mux_enum_put,
11735 static struct hda_input_mux alc268_capture_source = {
11739 { "Front Mic", 0x1 },
11745 static struct hda_input_mux alc268_acer_capture_source = {
11749 { "Internal Mic", 0x1 },
11754 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11758 { "Internal Mic", 0x6 },
11763 #ifdef CONFIG_SND_DEBUG
11764 static struct snd_kcontrol_new alc268_test_mixer[] = {
11765 /* Volume widgets */
11766 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11767 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11768 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11769 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11770 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11771 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11772 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11773 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11774 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11775 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11776 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11777 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11778 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11779 /* The below appears problematic on some hardwares */
11780 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11781 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11782 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11783 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11784 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11786 /* Modes for retasking pin widgets */
11787 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11788 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11789 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11790 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11792 /* Controls for GPIO pins, assuming they are configured as outputs */
11793 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11794 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11795 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11796 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11798 /* Switches to allow the digital SPDIF output pin to be enabled.
11799 * The ALC268 does not have an SPDIF input.
11801 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11803 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11804 * this output to turn on an external amplifier.
11806 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11807 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11813 /* create input playback/capture controls for the given pin */
11814 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11815 const char *ctlname, int idx)
11820 sprintf(name, "%s Playback Volume", ctlname);
11822 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11823 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11827 } else if (nid == 0x15) {
11828 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11829 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11835 sprintf(name, "%s Playback Switch", ctlname);
11836 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11837 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11843 /* add playback controls from the parsed DAC table */
11844 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11845 const struct auto_pin_cfg *cfg)
11850 spec->multiout.num_dacs = 2; /* only use one dac */
11851 spec->multiout.dac_nids = spec->private_dac_nids;
11852 spec->multiout.dac_nids[0] = 2;
11853 spec->multiout.dac_nids[1] = 3;
11855 nid = cfg->line_out_pins[0];
11857 alc268_new_analog_output(spec, nid, "Front", 0);
11859 nid = cfg->speaker_pins[0];
11861 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11862 "Speaker Playback Volume",
11863 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11867 nid = cfg->hp_pins[0];
11869 alc268_new_analog_output(spec, nid, "Headphone", 0);
11871 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11873 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11874 "Mono Playback Switch",
11875 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11882 /* create playback/capture controls for input pins */
11883 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11884 const struct auto_pin_cfg *cfg)
11886 struct hda_input_mux *imux = &spec->private_imux[0];
11889 for (i = 0; i < AUTO_PIN_LAST; i++) {
11890 switch(cfg->input_pins[i]) {
11892 idx1 = 0; /* Mic 1 */
11895 idx1 = 1; /* Mic 2 */
11898 idx1 = 2; /* Line In */
11905 idx1 = 6; /* digital mics */
11910 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11911 imux->items[imux->num_items].index = idx1;
11917 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11919 struct alc_spec *spec = codec->spec;
11920 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11921 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11922 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11923 unsigned int dac_vol1, dac_vol2;
11926 snd_hda_codec_write(codec, speaker_nid, 0,
11927 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11928 snd_hda_codec_write(codec, 0x0f, 0,
11929 AC_VERB_SET_AMP_GAIN_MUTE,
11931 snd_hda_codec_write(codec, 0x10, 0,
11932 AC_VERB_SET_AMP_GAIN_MUTE,
11935 snd_hda_codec_write(codec, 0x0f, 0,
11936 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11937 snd_hda_codec_write(codec, 0x10, 0,
11938 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11941 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11942 if (line_nid == 0x14)
11943 dac_vol2 = AMP_OUT_ZERO;
11944 else if (line_nid == 0x15)
11945 dac_vol1 = AMP_OUT_ZERO;
11946 if (hp_nid == 0x14)
11947 dac_vol2 = AMP_OUT_ZERO;
11948 else if (hp_nid == 0x15)
11949 dac_vol1 = AMP_OUT_ZERO;
11950 if (line_nid != 0x16 || hp_nid != 0x16 ||
11951 spec->autocfg.line_out_pins[1] != 0x16 ||
11952 spec->autocfg.line_out_pins[2] != 0x16)
11953 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11955 snd_hda_codec_write(codec, 0x02, 0,
11956 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11957 snd_hda_codec_write(codec, 0x03, 0,
11958 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11961 /* pcm configuration: identical with ALC880 */
11962 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11963 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11964 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11965 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11968 * BIOS auto configuration
11970 static int alc268_parse_auto_config(struct hda_codec *codec)
11972 struct alc_spec *spec = codec->spec;
11974 static hda_nid_t alc268_ignore[] = { 0 };
11976 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11980 if (!spec->autocfg.line_outs) {
11981 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11982 spec->multiout.max_channels = 2;
11983 spec->no_analog = 1;
11986 return 0; /* can't find valid BIOS pin config */
11988 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11991 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11995 spec->multiout.max_channels = 2;
11998 /* digital only support output */
11999 if (spec->autocfg.dig_outs) {
12000 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12001 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12003 if (spec->kctls.list)
12004 add_mixer(spec, spec->kctls.list);
12006 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12007 add_mixer(spec, alc268_beep_mixer);
12009 add_verb(spec, alc268_volume_init_verbs);
12010 spec->num_mux_defs = 1;
12011 spec->input_mux = &spec->private_imux[0];
12013 err = alc_auto_add_mic_boost(codec);
12017 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12022 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12023 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12024 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12026 /* init callback for auto-configuration model -- overriding the default init */
12027 static void alc268_auto_init(struct hda_codec *codec)
12029 struct alc_spec *spec = codec->spec;
12030 alc268_auto_init_multi_out(codec);
12031 alc268_auto_init_hp_out(codec);
12032 alc268_auto_init_mono_speaker_out(codec);
12033 alc268_auto_init_analog_input(codec);
12034 if (spec->unsol_event)
12035 alc_inithook(codec);
12039 * configuration and preset
12041 static const char *alc268_models[ALC268_MODEL_LAST] = {
12042 [ALC267_QUANTA_IL1] = "quanta-il1",
12043 [ALC268_3ST] = "3stack",
12044 [ALC268_TOSHIBA] = "toshiba",
12045 [ALC268_ACER] = "acer",
12046 [ALC268_ACER_DMIC] = "acer-dmic",
12047 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12048 [ALC268_DELL] = "dell",
12049 [ALC268_ZEPTO] = "zepto",
12050 #ifdef CONFIG_SND_DEBUG
12051 [ALC268_TEST] = "test",
12053 [ALC268_AUTO] = "auto",
12056 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12057 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12058 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12059 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12060 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12061 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12062 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12063 ALC268_ACER_ASPIRE_ONE),
12064 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12065 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12066 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12068 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12069 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12070 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12072 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12073 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12074 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12075 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12079 static struct alc_config_preset alc268_presets[] = {
12080 [ALC267_QUANTA_IL1] = {
12081 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12082 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12083 alc267_quanta_il1_verbs },
12084 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12085 .dac_nids = alc268_dac_nids,
12086 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12087 .adc_nids = alc268_adc_nids_alt,
12089 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12090 .channel_mode = alc268_modes,
12091 .input_mux = &alc268_capture_source,
12092 .unsol_event = alc267_quanta_il1_unsol_event,
12093 .init_hook = alc267_quanta_il1_init_hook,
12096 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12097 alc268_beep_mixer },
12098 .init_verbs = { alc268_base_init_verbs },
12099 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12100 .dac_nids = alc268_dac_nids,
12101 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12102 .adc_nids = alc268_adc_nids_alt,
12103 .capsrc_nids = alc268_capsrc_nids,
12105 .dig_out_nid = ALC268_DIGOUT_NID,
12106 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12107 .channel_mode = alc268_modes,
12108 .input_mux = &alc268_capture_source,
12110 [ALC268_TOSHIBA] = {
12111 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12112 alc268_beep_mixer },
12113 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12114 alc268_toshiba_verbs },
12115 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12116 .dac_nids = alc268_dac_nids,
12117 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12118 .adc_nids = alc268_adc_nids_alt,
12119 .capsrc_nids = alc268_capsrc_nids,
12121 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12122 .channel_mode = alc268_modes,
12123 .input_mux = &alc268_capture_source,
12124 .unsol_event = alc268_toshiba_unsol_event,
12125 .init_hook = alc268_toshiba_init_hook,
12128 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12129 alc268_beep_mixer },
12130 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12131 alc268_acer_verbs },
12132 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12133 .dac_nids = alc268_dac_nids,
12134 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12135 .adc_nids = alc268_adc_nids_alt,
12136 .capsrc_nids = alc268_capsrc_nids,
12138 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12139 .channel_mode = alc268_modes,
12140 .input_mux = &alc268_acer_capture_source,
12141 .unsol_event = alc268_acer_unsol_event,
12142 .init_hook = alc268_acer_init_hook,
12144 [ALC268_ACER_DMIC] = {
12145 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12146 alc268_beep_mixer },
12147 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12148 alc268_acer_verbs },
12149 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12150 .dac_nids = alc268_dac_nids,
12151 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12152 .adc_nids = alc268_adc_nids_alt,
12153 .capsrc_nids = alc268_capsrc_nids,
12155 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12156 .channel_mode = alc268_modes,
12157 .input_mux = &alc268_acer_dmic_capture_source,
12158 .unsol_event = alc268_acer_unsol_event,
12159 .init_hook = alc268_acer_init_hook,
12161 [ALC268_ACER_ASPIRE_ONE] = {
12162 .mixers = { alc268_acer_aspire_one_mixer,
12164 alc268_capture_alt_mixer },
12165 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12166 alc268_acer_aspire_one_verbs },
12167 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12168 .dac_nids = alc268_dac_nids,
12169 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12170 .adc_nids = alc268_adc_nids_alt,
12171 .capsrc_nids = alc268_capsrc_nids,
12173 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12174 .channel_mode = alc268_modes,
12175 .input_mux = &alc268_acer_lc_capture_source,
12176 .unsol_event = alc268_acer_lc_unsol_event,
12177 .init_hook = alc268_acer_lc_init_hook,
12180 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12181 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12182 alc268_dell_verbs },
12183 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12184 .dac_nids = alc268_dac_nids,
12186 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12187 .channel_mode = alc268_modes,
12188 .unsol_event = alc_sku_unsol_event,
12189 .init_hook = alc268_dell_init_hook,
12190 .input_mux = &alc268_capture_source,
12193 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12194 alc268_beep_mixer },
12195 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12196 alc268_toshiba_verbs },
12197 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12198 .dac_nids = alc268_dac_nids,
12199 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12200 .adc_nids = alc268_adc_nids_alt,
12201 .capsrc_nids = alc268_capsrc_nids,
12203 .dig_out_nid = ALC268_DIGOUT_NID,
12204 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12205 .channel_mode = alc268_modes,
12206 .input_mux = &alc268_capture_source,
12207 .unsol_event = alc268_toshiba_unsol_event,
12208 .init_hook = alc268_toshiba_init_hook
12210 #ifdef CONFIG_SND_DEBUG
12212 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12213 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12214 alc268_volume_init_verbs },
12215 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12216 .dac_nids = alc268_dac_nids,
12217 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12218 .adc_nids = alc268_adc_nids_alt,
12219 .capsrc_nids = alc268_capsrc_nids,
12221 .dig_out_nid = ALC268_DIGOUT_NID,
12222 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12223 .channel_mode = alc268_modes,
12224 .input_mux = &alc268_capture_source,
12229 static int patch_alc268(struct hda_codec *codec)
12231 struct alc_spec *spec;
12233 int i, has_beep, err;
12235 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12239 codec->spec = spec;
12241 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12245 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12246 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12247 "trying auto-probe from BIOS...\n", codec->chip_name);
12248 board_config = ALC268_AUTO;
12251 if (board_config == ALC268_AUTO) {
12252 /* automatic parse from the BIOS config */
12253 err = alc268_parse_auto_config(codec);
12259 "hda_codec: Cannot set up configuration "
12260 "from BIOS. Using base mode...\n");
12261 board_config = ALC268_3ST;
12265 if (board_config != ALC268_AUTO)
12266 setup_preset(spec, &alc268_presets[board_config]);
12268 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12269 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12270 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12272 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12275 for (i = 0; i < spec->num_mixers; i++) {
12276 if (spec->mixers[i] == alc268_beep_mixer) {
12283 err = snd_hda_attach_beep_device(codec, 0x1);
12288 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12289 /* override the amp caps for beep generator */
12290 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12291 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12292 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12293 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12294 (0 << AC_AMPCAP_MUTE_SHIFT));
12297 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12298 /* check whether NID 0x07 is valid */
12299 unsigned int wcap = get_wcaps(codec, 0x07);
12303 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12304 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12305 spec->adc_nids = alc268_adc_nids_alt;
12306 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12307 add_mixer(spec, alc268_capture_alt_mixer);
12309 spec->adc_nids = alc268_adc_nids;
12310 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12311 add_mixer(spec, alc268_capture_mixer);
12313 spec->capsrc_nids = alc268_capsrc_nids;
12314 /* set default input source */
12315 for (i = 0; i < spec->num_adc_nids; i++)
12316 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12317 0, AC_VERB_SET_CONNECT_SEL,
12318 spec->input_mux->items[0].index);
12321 spec->vmaster_nid = 0x02;
12323 codec->patch_ops = alc_patch_ops;
12324 if (board_config == ALC268_AUTO)
12325 spec->init_hook = alc268_auto_init;
12327 codec->proc_widget_hook = print_realtek_coef;
12333 * ALC269 channel source setting (2 channel)
12335 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12337 #define alc269_dac_nids alc260_dac_nids
12339 static hda_nid_t alc269_adc_nids[1] = {
12344 static hda_nid_t alc269_capsrc_nids[1] = {
12348 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12352 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12360 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12368 #define alc269_modes alc260_modes
12369 #define alc269_capture_source alc880_lg_lw_capture_source
12371 static struct snd_kcontrol_new alc269_base_mixer[] = {
12372 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12373 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12383 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12387 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12388 /* output mixer control */
12389 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12391 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12392 .name = "Master Playback Switch",
12393 .info = snd_hda_mixer_amp_switch_info,
12394 .get = snd_hda_mixer_amp_switch_get,
12395 .put = alc268_acer_master_sw_put,
12396 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12401 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12402 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12403 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12407 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12408 /* output mixer control */
12409 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12411 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12412 .name = "Master Playback Switch",
12413 .info = snd_hda_mixer_amp_switch_info,
12414 .get = snd_hda_mixer_amp_switch_get,
12415 .put = alc268_acer_master_sw_put,
12416 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12420 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12421 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12422 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12423 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12424 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12425 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12426 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12430 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12431 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12432 HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12438 /* capture mixer elements */
12439 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12440 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12441 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12442 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12447 #define alc269_fujitsu_mixer alc269_eeepc_mixer
12449 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12451 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12453 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12455 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12459 static struct hda_verb alc269_lifebook_verbs[] = {
12460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12461 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12462 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12464 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12465 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12466 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12467 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12468 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12469 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12473 /* toggle speaker-output according to the hp-jack state */
12474 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12476 unsigned int present;
12477 unsigned char bits;
12479 present = snd_hda_codec_read(codec, 0x15, 0,
12480 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12481 bits = present ? AMP_IN_MUTE(0) : 0;
12482 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12483 AMP_IN_MUTE(0), bits);
12484 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12485 AMP_IN_MUTE(0), bits);
12487 snd_hda_codec_write(codec, 0x20, 0,
12488 AC_VERB_SET_COEF_INDEX, 0x0c);
12489 snd_hda_codec_write(codec, 0x20, 0,
12490 AC_VERB_SET_PROC_COEF, 0x680);
12492 snd_hda_codec_write(codec, 0x20, 0,
12493 AC_VERB_SET_COEF_INDEX, 0x0c);
12494 snd_hda_codec_write(codec, 0x20, 0,
12495 AC_VERB_SET_PROC_COEF, 0x480);
12498 /* toggle speaker-output according to the hp-jacks state */
12499 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12501 unsigned int present;
12502 unsigned char bits;
12504 /* Check laptop headphone socket */
12505 present = snd_hda_codec_read(codec, 0x15, 0,
12506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12508 /* Check port replicator headphone socket */
12509 present |= snd_hda_codec_read(codec, 0x1a, 0,
12510 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12512 bits = present ? AMP_IN_MUTE(0) : 0;
12513 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12514 AMP_IN_MUTE(0), bits);
12515 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12516 AMP_IN_MUTE(0), bits);
12518 snd_hda_codec_write(codec, 0x20, 0,
12519 AC_VERB_SET_COEF_INDEX, 0x0c);
12520 snd_hda_codec_write(codec, 0x20, 0,
12521 AC_VERB_SET_PROC_COEF, 0x680);
12523 snd_hda_codec_write(codec, 0x20, 0,
12524 AC_VERB_SET_COEF_INDEX, 0x0c);
12525 snd_hda_codec_write(codec, 0x20, 0,
12526 AC_VERB_SET_PROC_COEF, 0x480);
12529 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12531 unsigned int present;
12533 present = snd_hda_codec_read(codec, 0x18, 0,
12534 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12535 snd_hda_codec_write(codec, 0x23, 0,
12536 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12539 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12541 unsigned int present_laptop;
12542 unsigned int present_dock;
12544 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12545 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12547 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12548 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12550 /* Laptop mic port overrides dock mic port, design decision */
12552 snd_hda_codec_write(codec, 0x23, 0,
12553 AC_VERB_SET_CONNECT_SEL, 0x3);
12554 if (present_laptop)
12555 snd_hda_codec_write(codec, 0x23, 0,
12556 AC_VERB_SET_CONNECT_SEL, 0x0);
12557 if (!present_dock && !present_laptop)
12558 snd_hda_codec_write(codec, 0x23, 0,
12559 AC_VERB_SET_CONNECT_SEL, 0x1);
12562 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12565 if ((res >> 26) == ALC880_HP_EVENT)
12566 alc269_quanta_fl1_speaker_automute(codec);
12567 if ((res >> 26) == ALC880_MIC_EVENT)
12568 alc269_quanta_fl1_mic_automute(codec);
12571 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12574 if ((res >> 26) == ALC880_HP_EVENT)
12575 alc269_lifebook_speaker_automute(codec);
12576 if ((res >> 26) == ALC880_MIC_EVENT)
12577 alc269_lifebook_mic_autoswitch(codec);
12580 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12582 alc269_quanta_fl1_speaker_automute(codec);
12583 alc269_quanta_fl1_mic_automute(codec);
12586 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12588 alc269_lifebook_speaker_automute(codec);
12589 alc269_lifebook_mic_autoswitch(codec);
12592 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12594 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12595 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12596 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12597 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12598 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12603 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12605 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12606 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12607 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12608 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12609 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12613 /* toggle speaker-output according to the hp-jack state */
12614 static void alc269_speaker_automute(struct hda_codec *codec)
12616 unsigned int present;
12617 unsigned char bits;
12619 present = snd_hda_codec_read(codec, 0x15, 0,
12620 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12621 bits = present ? AMP_IN_MUTE(0) : 0;
12622 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12623 AMP_IN_MUTE(0), bits);
12624 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12625 AMP_IN_MUTE(0), bits);
12628 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12630 unsigned int present;
12632 present = snd_hda_codec_read(codec, 0x18, 0,
12633 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12634 snd_hda_codec_write(codec, 0x23, 0,
12635 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12638 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12640 unsigned int present;
12642 present = snd_hda_codec_read(codec, 0x18, 0,
12643 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12644 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12645 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12646 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12647 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12650 /* unsolicited event for HP jack sensing */
12651 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12654 if ((res >> 26) == ALC880_HP_EVENT)
12655 alc269_speaker_automute(codec);
12657 if ((res >> 26) == ALC880_MIC_EVENT)
12658 alc269_eeepc_dmic_automute(codec);
12661 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12663 alc269_speaker_automute(codec);
12664 alc269_eeepc_dmic_automute(codec);
12667 /* unsolicited event for HP jack sensing */
12668 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12671 if ((res >> 26) == ALC880_HP_EVENT)
12672 alc269_speaker_automute(codec);
12674 if ((res >> 26) == ALC880_MIC_EVENT)
12675 alc269_eeepc_amic_automute(codec);
12678 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12680 alc269_speaker_automute(codec);
12681 alc269_eeepc_amic_automute(codec);
12685 * generic initialization of ADC, input mixers and output mixers
12687 static struct hda_verb alc269_init_verbs[] = {
12689 * Unmute ADC0 and set the default input to mic-in
12691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12693 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12694 * analog-loopback mixer widget
12695 * Note: PASD motherboards uses the Line In 2 as the input for
12696 * front panel mic (mic 2)
12698 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12702 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12703 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12706 * Set up output mixers (0x0c - 0x0e)
12708 /* set vol=0 to output mixers */
12709 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12710 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12712 /* set up input amps for analog loopback */
12713 /* Amp Indices: DAC = 0, mixer = 1 */
12714 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12715 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12716 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12717 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12718 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12719 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12721 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12722 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12723 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12724 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12725 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12727 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12733 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12737 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12740 /* FIXME: use matrix-type input source selection */
12741 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12742 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12743 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12744 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12745 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12746 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12749 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12750 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12754 /* add playback controls from the parsed DAC table */
12755 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12756 const struct auto_pin_cfg *cfg)
12761 spec->multiout.num_dacs = 1; /* only use one dac */
12762 spec->multiout.dac_nids = spec->private_dac_nids;
12763 spec->multiout.dac_nids[0] = 2;
12765 nid = cfg->line_out_pins[0];
12767 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12768 "Front Playback Volume",
12769 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12772 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12773 "Front Playback Switch",
12774 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12779 nid = cfg->speaker_pins[0];
12781 if (!cfg->line_out_pins[0]) {
12782 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12783 "Speaker Playback Volume",
12784 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12790 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12791 "Speaker Playback Switch",
12792 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12797 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12798 "Speaker Playback Switch",
12799 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12805 nid = cfg->hp_pins[0];
12807 /* spec->multiout.hp_nid = 2; */
12808 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12809 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12810 "Headphone Playback Volume",
12811 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12817 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12818 "Headphone Playback Switch",
12819 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12824 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12825 "Headphone Playback Switch",
12826 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12835 #define alc269_auto_create_analog_input_ctls \
12836 alc262_auto_create_analog_input_ctls
12838 #ifdef CONFIG_SND_HDA_POWER_SAVE
12839 #define alc269_loopbacks alc880_loopbacks
12842 /* pcm configuration: identical with ALC880 */
12843 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12844 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12845 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12846 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12848 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12852 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12853 /* NID is set in alc_build_pcms */
12855 .open = alc880_playback_pcm_open,
12856 .prepare = alc880_playback_pcm_prepare,
12857 .cleanup = alc880_playback_pcm_cleanup
12861 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12865 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12866 /* NID is set in alc_build_pcms */
12870 * BIOS auto configuration
12872 static int alc269_parse_auto_config(struct hda_codec *codec)
12874 struct alc_spec *spec = codec->spec;
12876 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12878 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12883 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12886 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12890 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12892 if (spec->autocfg.dig_outs)
12893 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12895 if (spec->kctls.list)
12896 add_mixer(spec, spec->kctls.list);
12898 add_verb(spec, alc269_init_verbs);
12899 spec->num_mux_defs = 1;
12900 spec->input_mux = &spec->private_imux[0];
12901 /* set default input source */
12902 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12903 0, AC_VERB_SET_CONNECT_SEL,
12904 spec->input_mux->items[0].index);
12906 err = alc_auto_add_mic_boost(codec);
12910 if (!spec->cap_mixer && !spec->no_analog)
12911 set_capture_mixer(spec);
12913 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12918 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12919 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12920 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12923 /* init callback for auto-configuration model -- overriding the default init */
12924 static void alc269_auto_init(struct hda_codec *codec)
12926 struct alc_spec *spec = codec->spec;
12927 alc269_auto_init_multi_out(codec);
12928 alc269_auto_init_hp_out(codec);
12929 alc269_auto_init_analog_input(codec);
12930 if (spec->unsol_event)
12931 alc_inithook(codec);
12935 * configuration and preset
12937 static const char *alc269_models[ALC269_MODEL_LAST] = {
12938 [ALC269_BASIC] = "basic",
12939 [ALC269_QUANTA_FL1] = "quanta",
12940 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12941 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12942 [ALC269_FUJITSU] = "fujitsu",
12943 [ALC269_LIFEBOOK] = "lifebook"
12946 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12947 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12948 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12949 ALC269_ASUS_EEEPC_P703),
12950 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12951 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12952 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12953 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12954 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12955 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12956 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12957 ALC269_ASUS_EEEPC_P901),
12958 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12959 ALC269_ASUS_EEEPC_P901),
12960 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12961 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12962 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12966 static struct alc_config_preset alc269_presets[] = {
12968 .mixers = { alc269_base_mixer },
12969 .init_verbs = { alc269_init_verbs },
12970 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12971 .dac_nids = alc269_dac_nids,
12973 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12974 .channel_mode = alc269_modes,
12975 .input_mux = &alc269_capture_source,
12977 [ALC269_QUANTA_FL1] = {
12978 .mixers = { alc269_quanta_fl1_mixer },
12979 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12980 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12981 .dac_nids = alc269_dac_nids,
12983 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12984 .channel_mode = alc269_modes,
12985 .input_mux = &alc269_capture_source,
12986 .unsol_event = alc269_quanta_fl1_unsol_event,
12987 .init_hook = alc269_quanta_fl1_init_hook,
12989 [ALC269_ASUS_EEEPC_P703] = {
12990 .mixers = { alc269_eeepc_mixer },
12991 .cap_mixer = alc269_epc_capture_mixer,
12992 .init_verbs = { alc269_init_verbs,
12993 alc269_eeepc_amic_init_verbs },
12994 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12995 .dac_nids = alc269_dac_nids,
12997 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12998 .channel_mode = alc269_modes,
12999 .input_mux = &alc269_eeepc_amic_capture_source,
13000 .unsol_event = alc269_eeepc_amic_unsol_event,
13001 .init_hook = alc269_eeepc_amic_inithook,
13003 [ALC269_ASUS_EEEPC_P901] = {
13004 .mixers = { alc269_eeepc_mixer },
13005 .cap_mixer = alc269_epc_capture_mixer,
13006 .init_verbs = { alc269_init_verbs,
13007 alc269_eeepc_dmic_init_verbs },
13008 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13009 .dac_nids = alc269_dac_nids,
13011 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13012 .channel_mode = alc269_modes,
13013 .input_mux = &alc269_eeepc_dmic_capture_source,
13014 .unsol_event = alc269_eeepc_dmic_unsol_event,
13015 .init_hook = alc269_eeepc_dmic_inithook,
13017 [ALC269_FUJITSU] = {
13018 .mixers = { alc269_fujitsu_mixer },
13019 .cap_mixer = alc269_epc_capture_mixer,
13020 .init_verbs = { alc269_init_verbs,
13021 alc269_eeepc_dmic_init_verbs },
13022 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13023 .dac_nids = alc269_dac_nids,
13025 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13026 .channel_mode = alc269_modes,
13027 .input_mux = &alc269_eeepc_dmic_capture_source,
13028 .unsol_event = alc269_eeepc_dmic_unsol_event,
13029 .init_hook = alc269_eeepc_dmic_inithook,
13031 [ALC269_LIFEBOOK] = {
13032 .mixers = { alc269_lifebook_mixer },
13033 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13034 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13035 .dac_nids = alc269_dac_nids,
13037 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13038 .channel_mode = alc269_modes,
13039 .input_mux = &alc269_capture_source,
13040 .unsol_event = alc269_lifebook_unsol_event,
13041 .init_hook = alc269_lifebook_init_hook,
13045 static int patch_alc269(struct hda_codec *codec)
13047 struct alc_spec *spec;
13051 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13055 codec->spec = spec;
13057 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13059 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13063 if (board_config < 0) {
13064 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13065 "trying auto-probe from BIOS...\n", codec->chip_name);
13066 board_config = ALC269_AUTO;
13069 if (board_config == ALC269_AUTO) {
13070 /* automatic parse from the BIOS config */
13071 err = alc269_parse_auto_config(codec);
13077 "hda_codec: Cannot set up configuration "
13078 "from BIOS. Using base mode...\n");
13079 board_config = ALC269_BASIC;
13083 err = snd_hda_attach_beep_device(codec, 0x1);
13089 if (board_config != ALC269_AUTO)
13090 setup_preset(spec, &alc269_presets[board_config]);
13092 if (codec->subsystem_id == 0x17aa3bf8) {
13093 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13094 * fix the sample rate of analog I/O to 44.1kHz
13096 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13097 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13099 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13100 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13102 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13103 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13105 spec->adc_nids = alc269_adc_nids;
13106 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13107 spec->capsrc_nids = alc269_capsrc_nids;
13108 if (!spec->cap_mixer)
13109 set_capture_mixer(spec);
13110 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13112 codec->patch_ops = alc_patch_ops;
13113 if (board_config == ALC269_AUTO)
13114 spec->init_hook = alc269_auto_init;
13115 #ifdef CONFIG_SND_HDA_POWER_SAVE
13116 if (!spec->loopback.amplist)
13117 spec->loopback.amplist = alc269_loopbacks;
13119 codec->proc_widget_hook = print_realtek_coef;
13125 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13129 * set the path ways for 2 channel output
13130 * need to set the codec line out and mic 1 pin widgets to inputs
13132 static struct hda_verb alc861_threestack_ch2_init[] = {
13133 /* set pin widget 1Ah (line in) for input */
13134 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13135 /* set pin widget 18h (mic1/2) for input, for mic also enable
13138 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13140 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13142 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13143 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13149 * need to set the codec line out and mic 1 pin widgets to outputs
13151 static struct hda_verb alc861_threestack_ch6_init[] = {
13152 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13153 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13154 /* set pin widget 18h (mic1) for output (CLFE)*/
13155 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13157 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13158 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13160 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13162 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13163 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13168 static struct hda_channel_mode alc861_threestack_modes[2] = {
13169 { 2, alc861_threestack_ch2_init },
13170 { 6, alc861_threestack_ch6_init },
13172 /* Set mic1 as input and unmute the mixer */
13173 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13174 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13175 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13178 /* Set mic1 as output and mute mixer */
13179 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13180 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13181 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13185 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13186 { 2, alc861_uniwill_m31_ch2_init },
13187 { 4, alc861_uniwill_m31_ch4_init },
13190 /* Set mic1 and line-in as input and unmute the mixer */
13191 static struct hda_verb alc861_asus_ch2_init[] = {
13192 /* set pin widget 1Ah (line in) for input */
13193 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13194 /* set pin widget 18h (mic1/2) for input, for mic also enable
13197 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13199 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13201 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13202 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13206 /* Set mic1 nad line-in as output and mute mixer */
13207 static struct hda_verb alc861_asus_ch6_init[] = {
13208 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13209 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13210 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13211 /* set pin widget 18h (mic1) for output (CLFE)*/
13212 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13213 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13214 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13215 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13217 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13219 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13220 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13225 static struct hda_channel_mode alc861_asus_modes[2] = {
13226 { 2, alc861_asus_ch2_init },
13227 { 6, alc861_asus_ch6_init },
13232 static struct snd_kcontrol_new alc861_base_mixer[] = {
13233 /* output mixer control */
13234 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13235 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13236 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13237 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13238 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13240 /*Input mixer control */
13241 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13242 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13243 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13244 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13245 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13246 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13248 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13249 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13250 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13255 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13256 /* output mixer control */
13257 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13258 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13259 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13260 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13261 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13263 /* Input mixer control */
13264 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13265 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13266 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13267 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13268 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13269 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13271 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13277 .name = "Channel Mode",
13278 .info = alc_ch_mode_info,
13279 .get = alc_ch_mode_get,
13280 .put = alc_ch_mode_put,
13281 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13286 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13287 /* output mixer control */
13288 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13290 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13295 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13296 /* output mixer control */
13297 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13298 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13299 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13300 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13301 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13303 /* Input mixer control */
13304 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13305 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13306 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13307 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13308 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13309 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13310 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13311 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13312 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13313 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13317 .name = "Channel Mode",
13318 .info = alc_ch_mode_info,
13319 .get = alc_ch_mode_get,
13320 .put = alc_ch_mode_put,
13321 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13326 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13327 /* output mixer control */
13328 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13329 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13330 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13331 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13332 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13334 /* Input mixer control */
13335 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13336 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13337 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13338 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13339 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13340 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13342 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13343 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13348 .name = "Channel Mode",
13349 .info = alc_ch_mode_info,
13350 .get = alc_ch_mode_get,
13351 .put = alc_ch_mode_put,
13352 .private_value = ARRAY_SIZE(alc861_asus_modes),
13357 /* additional mixer */
13358 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13359 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13360 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13365 * generic initialization of ADC, input mixers and output mixers
13367 static struct hda_verb alc861_base_init_verbs[] = {
13369 * Unmute ADC0 and set the default input to mic-in
13371 /* port-A for surround (rear panel) */
13372 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13373 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13374 /* port-B for mic-in (rear panel) with vref */
13375 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13376 /* port-C for line-in (rear panel) */
13377 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13378 /* port-D for Front */
13379 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13380 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13381 /* port-E for HP out (front panel) */
13382 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13383 /* route front PCM to HP */
13384 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13385 /* port-F for mic-in (front panel) with vref */
13386 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13387 /* port-G for CLFE (rear panel) */
13388 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13389 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13390 /* port-H for side (rear panel) */
13391 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13392 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13394 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13395 /* route front mic to ADC1*/
13396 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13399 /* Unmute DAC0~3 & spdif out*/
13400 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13401 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13402 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13403 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13406 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13407 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13408 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13409 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13410 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13412 /* Unmute Stereo Mixer 15 */
13413 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13418 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13419 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13420 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13421 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13423 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13425 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13426 /* hp used DAC 3 (Front) */
13427 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13428 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13433 static struct hda_verb alc861_threestack_init_verbs[] = {
13435 * Unmute ADC0 and set the default input to mic-in
13437 /* port-A for surround (rear panel) */
13438 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13439 /* port-B for mic-in (rear panel) with vref */
13440 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13441 /* port-C for line-in (rear panel) */
13442 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13443 /* port-D for Front */
13444 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13445 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13446 /* port-E for HP out (front panel) */
13447 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13448 /* route front PCM to HP */
13449 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13450 /* port-F for mic-in (front panel) with vref */
13451 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13452 /* port-G for CLFE (rear panel) */
13453 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13454 /* port-H for side (rear panel) */
13455 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13457 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13458 /* route front mic to ADC1*/
13459 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13461 /* Unmute DAC0~3 & spdif out*/
13462 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13463 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13464 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13465 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13466 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13468 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13469 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13470 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13471 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13472 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13474 /* Unmute Stereo Mixer 15 */
13475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13476 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13481 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13482 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13483 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13487 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13488 /* hp used DAC 3 (Front) */
13489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13490 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13494 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13496 * Unmute ADC0 and set the default input to mic-in
13498 /* port-A for surround (rear panel) */
13499 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13500 /* port-B for mic-in (rear panel) with vref */
13501 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13502 /* port-C for line-in (rear panel) */
13503 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13504 /* port-D for Front */
13505 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13506 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13507 /* port-E for HP out (front panel) */
13508 /* this has to be set to VREF80 */
13509 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13510 /* route front PCM to HP */
13511 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13512 /* port-F for mic-in (front panel) with vref */
13513 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13514 /* port-G for CLFE (rear panel) */
13515 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13516 /* port-H for side (rear panel) */
13517 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13519 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13520 /* route front mic to ADC1*/
13521 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 /* Unmute DAC0~3 & spdif out*/
13524 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13525 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13526 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13527 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13528 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13530 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13531 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13532 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13533 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13534 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13536 /* Unmute Stereo Mixer 15 */
13537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13540 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13542 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13543 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13544 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13545 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13546 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13547 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13548 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13549 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13550 /* hp used DAC 3 (Front) */
13551 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13552 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13556 static struct hda_verb alc861_asus_init_verbs[] = {
13558 * Unmute ADC0 and set the default input to mic-in
13560 /* port-A for surround (rear panel)
13561 * according to codec#0 this is the HP jack
13563 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13564 /* route front PCM to HP */
13565 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13566 /* port-B for mic-in (rear panel) with vref */
13567 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13568 /* port-C for line-in (rear panel) */
13569 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13570 /* port-D for Front */
13571 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13572 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13573 /* port-E for HP out (front panel) */
13574 /* this has to be set to VREF80 */
13575 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13576 /* route front PCM to HP */
13577 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13578 /* port-F for mic-in (front panel) with vref */
13579 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13580 /* port-G for CLFE (rear panel) */
13581 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13582 /* port-H for side (rear panel) */
13583 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13585 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13586 /* route front mic to ADC1*/
13587 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13588 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13589 /* Unmute DAC0~3 & spdif out*/
13590 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13591 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13592 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13593 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13595 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13596 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13597 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13598 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13599 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13601 /* Unmute Stereo Mixer 15 */
13602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13603 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13604 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13607 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13608 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13609 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13610 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13611 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13612 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13613 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13614 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13615 /* hp used DAC 3 (Front) */
13616 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13617 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13621 /* additional init verbs for ASUS laptops */
13622 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13623 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13624 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13629 * generic initialization of ADC, input mixers and output mixers
13631 static struct hda_verb alc861_auto_init_verbs[] = {
13633 * Unmute ADC0 and set the default input to mic-in
13635 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13636 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13638 /* Unmute DAC0~3 & spdif out*/
13639 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13640 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13641 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13642 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13643 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13645 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13646 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13647 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13648 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13649 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13651 /* Unmute Stereo Mixer 15 */
13652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13654 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13657 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13658 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13659 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13660 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13662 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13663 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13664 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13666 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13667 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13668 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13670 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13671 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13672 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13673 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13675 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13680 static struct hda_verb alc861_toshiba_init_verbs[] = {
13681 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13686 /* toggle speaker-output according to the hp-jack state */
13687 static void alc861_toshiba_automute(struct hda_codec *codec)
13689 unsigned int present;
13691 present = snd_hda_codec_read(codec, 0x0f, 0,
13692 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13693 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13694 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13695 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13696 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13699 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13702 if ((res >> 26) == ALC880_HP_EVENT)
13703 alc861_toshiba_automute(codec);
13706 /* pcm configuration: identical with ALC880 */
13707 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13708 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13709 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13710 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13713 #define ALC861_DIGOUT_NID 0x07
13715 static struct hda_channel_mode alc861_8ch_modes[1] = {
13719 static hda_nid_t alc861_dac_nids[4] = {
13720 /* front, surround, clfe, side */
13721 0x03, 0x06, 0x05, 0x04
13724 static hda_nid_t alc660_dac_nids[3] = {
13725 /* front, clfe, surround */
13729 static hda_nid_t alc861_adc_nids[1] = {
13734 static struct hda_input_mux alc861_capture_source = {
13738 { "Front Mic", 0x3 },
13745 /* fill in the dac_nids table from the parsed pin configuration */
13746 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13747 const struct auto_pin_cfg *cfg)
13752 spec->multiout.dac_nids = spec->private_dac_nids;
13753 for (i = 0; i < cfg->line_outs; i++) {
13754 nid = cfg->line_out_pins[i];
13756 if (i >= ARRAY_SIZE(alc861_dac_nids))
13758 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13761 spec->multiout.num_dacs = cfg->line_outs;
13765 /* add playback controls from the parsed DAC table */
13766 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13767 const struct auto_pin_cfg *cfg)
13770 static const char *chname[4] = {
13771 "Front", "Surround", NULL /*CLFE*/, "Side"
13776 for (i = 0; i < cfg->line_outs; i++) {
13777 nid = spec->multiout.dac_nids[i];
13782 err = add_control(spec, ALC_CTL_BIND_MUTE,
13783 "Center Playback Switch",
13784 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13788 err = add_control(spec, ALC_CTL_BIND_MUTE,
13789 "LFE Playback Switch",
13790 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13795 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13797 if (nid == alc861_dac_nids[idx])
13799 sprintf(name, "%s Playback Switch", chname[idx]);
13800 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13801 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13810 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13818 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13820 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13821 "Headphone Playback Switch",
13822 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13825 spec->multiout.hp_nid = nid;
13830 /* create playback/capture controls for input pins */
13831 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13832 const struct auto_pin_cfg *cfg)
13834 struct hda_input_mux *imux = &spec->private_imux[0];
13835 int i, err, idx, idx1;
13837 for (i = 0; i < AUTO_PIN_LAST; i++) {
13838 switch (cfg->input_pins[i]) {
13841 idx = 2; /* Line In */
13845 idx = 2; /* Line In */
13849 idx = 1; /* Mic In */
13853 idx = 1; /* Mic In */
13863 err = new_analog_input(spec, cfg->input_pins[i],
13864 auto_pin_cfg_labels[i], idx, 0x15);
13868 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13869 imux->items[imux->num_items].index = idx1;
13875 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13877 int pin_type, int dac_idx)
13879 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13881 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13885 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13887 struct alc_spec *spec = codec->spec;
13890 for (i = 0; i < spec->autocfg.line_outs; i++) {
13891 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13892 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13894 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13895 spec->multiout.dac_nids[i]);
13899 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13901 struct alc_spec *spec = codec->spec;
13904 pin = spec->autocfg.hp_pins[0];
13905 if (pin) /* connect to front */
13906 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13907 spec->multiout.dac_nids[0]);
13908 pin = spec->autocfg.speaker_pins[0];
13910 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13913 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13915 struct alc_spec *spec = codec->spec;
13918 for (i = 0; i < AUTO_PIN_LAST; i++) {
13919 hda_nid_t nid = spec->autocfg.input_pins[i];
13920 if (nid >= 0x0c && nid <= 0x11)
13921 alc_set_input_pin(codec, nid, i);
13925 /* parse the BIOS configuration and set up the alc_spec */
13926 /* return 1 if successful, 0 if the proper config is not found,
13927 * or a negative error code
13929 static int alc861_parse_auto_config(struct hda_codec *codec)
13931 struct alc_spec *spec = codec->spec;
13933 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13935 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13939 if (!spec->autocfg.line_outs)
13940 return 0; /* can't find valid BIOS pin config */
13942 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13945 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13948 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13951 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13955 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13957 if (spec->autocfg.dig_outs)
13958 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13960 if (spec->kctls.list)
13961 add_mixer(spec, spec->kctls.list);
13963 add_verb(spec, alc861_auto_init_verbs);
13965 spec->num_mux_defs = 1;
13966 spec->input_mux = &spec->private_imux[0];
13968 spec->adc_nids = alc861_adc_nids;
13969 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13970 set_capture_mixer(spec);
13972 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
13977 /* additional initialization for auto-configuration model */
13978 static void alc861_auto_init(struct hda_codec *codec)
13980 struct alc_spec *spec = codec->spec;
13981 alc861_auto_init_multi_out(codec);
13982 alc861_auto_init_hp_out(codec);
13983 alc861_auto_init_analog_input(codec);
13984 if (spec->unsol_event)
13985 alc_inithook(codec);
13988 #ifdef CONFIG_SND_HDA_POWER_SAVE
13989 static struct hda_amp_list alc861_loopbacks[] = {
13990 { 0x15, HDA_INPUT, 0 },
13991 { 0x15, HDA_INPUT, 1 },
13992 { 0x15, HDA_INPUT, 2 },
13993 { 0x15, HDA_INPUT, 3 },
14000 * configuration and preset
14002 static const char *alc861_models[ALC861_MODEL_LAST] = {
14003 [ALC861_3ST] = "3stack",
14004 [ALC660_3ST] = "3stack-660",
14005 [ALC861_3ST_DIG] = "3stack-dig",
14006 [ALC861_6ST_DIG] = "6stack-dig",
14007 [ALC861_UNIWILL_M31] = "uniwill-m31",
14008 [ALC861_TOSHIBA] = "toshiba",
14009 [ALC861_ASUS] = "asus",
14010 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14011 [ALC861_AUTO] = "auto",
14014 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14015 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14016 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14017 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14018 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14019 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14020 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14021 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14022 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14023 * Any other models that need this preset?
14025 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14026 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14027 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14028 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14029 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14030 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14031 /* FIXME: the below seems conflict */
14032 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14033 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14034 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14038 static struct alc_config_preset alc861_presets[] = {
14040 .mixers = { alc861_3ST_mixer },
14041 .init_verbs = { alc861_threestack_init_verbs },
14042 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14043 .dac_nids = alc861_dac_nids,
14044 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14045 .channel_mode = alc861_threestack_modes,
14047 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14048 .adc_nids = alc861_adc_nids,
14049 .input_mux = &alc861_capture_source,
14051 [ALC861_3ST_DIG] = {
14052 .mixers = { alc861_base_mixer },
14053 .init_verbs = { alc861_threestack_init_verbs },
14054 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14055 .dac_nids = alc861_dac_nids,
14056 .dig_out_nid = ALC861_DIGOUT_NID,
14057 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14058 .channel_mode = alc861_threestack_modes,
14060 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14061 .adc_nids = alc861_adc_nids,
14062 .input_mux = &alc861_capture_source,
14064 [ALC861_6ST_DIG] = {
14065 .mixers = { alc861_base_mixer },
14066 .init_verbs = { alc861_base_init_verbs },
14067 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14068 .dac_nids = alc861_dac_nids,
14069 .dig_out_nid = ALC861_DIGOUT_NID,
14070 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14071 .channel_mode = alc861_8ch_modes,
14072 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14073 .adc_nids = alc861_adc_nids,
14074 .input_mux = &alc861_capture_source,
14077 .mixers = { alc861_3ST_mixer },
14078 .init_verbs = { alc861_threestack_init_verbs },
14079 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14080 .dac_nids = alc660_dac_nids,
14081 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14082 .channel_mode = alc861_threestack_modes,
14084 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14085 .adc_nids = alc861_adc_nids,
14086 .input_mux = &alc861_capture_source,
14088 [ALC861_UNIWILL_M31] = {
14089 .mixers = { alc861_uniwill_m31_mixer },
14090 .init_verbs = { alc861_uniwill_m31_init_verbs },
14091 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14092 .dac_nids = alc861_dac_nids,
14093 .dig_out_nid = ALC861_DIGOUT_NID,
14094 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14095 .channel_mode = alc861_uniwill_m31_modes,
14097 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14098 .adc_nids = alc861_adc_nids,
14099 .input_mux = &alc861_capture_source,
14101 [ALC861_TOSHIBA] = {
14102 .mixers = { alc861_toshiba_mixer },
14103 .init_verbs = { alc861_base_init_verbs,
14104 alc861_toshiba_init_verbs },
14105 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14106 .dac_nids = alc861_dac_nids,
14107 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14108 .channel_mode = alc883_3ST_2ch_modes,
14109 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14110 .adc_nids = alc861_adc_nids,
14111 .input_mux = &alc861_capture_source,
14112 .unsol_event = alc861_toshiba_unsol_event,
14113 .init_hook = alc861_toshiba_automute,
14116 .mixers = { alc861_asus_mixer },
14117 .init_verbs = { alc861_asus_init_verbs },
14118 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14119 .dac_nids = alc861_dac_nids,
14120 .dig_out_nid = ALC861_DIGOUT_NID,
14121 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14122 .channel_mode = alc861_asus_modes,
14125 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14126 .adc_nids = alc861_adc_nids,
14127 .input_mux = &alc861_capture_source,
14129 [ALC861_ASUS_LAPTOP] = {
14130 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14131 .init_verbs = { alc861_asus_init_verbs,
14132 alc861_asus_laptop_init_verbs },
14133 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14134 .dac_nids = alc861_dac_nids,
14135 .dig_out_nid = ALC861_DIGOUT_NID,
14136 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14137 .channel_mode = alc883_3ST_2ch_modes,
14139 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14140 .adc_nids = alc861_adc_nids,
14141 .input_mux = &alc861_capture_source,
14146 static int patch_alc861(struct hda_codec *codec)
14148 struct alc_spec *spec;
14152 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14156 codec->spec = spec;
14158 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14162 if (board_config < 0) {
14163 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14164 "trying auto-probe from BIOS...\n", codec->chip_name);
14165 board_config = ALC861_AUTO;
14168 if (board_config == ALC861_AUTO) {
14169 /* automatic parse from the BIOS config */
14170 err = alc861_parse_auto_config(codec);
14176 "hda_codec: Cannot set up configuration "
14177 "from BIOS. Using base mode...\n");
14178 board_config = ALC861_3ST_DIG;
14182 err = snd_hda_attach_beep_device(codec, 0x23);
14188 if (board_config != ALC861_AUTO)
14189 setup_preset(spec, &alc861_presets[board_config]);
14191 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14192 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14194 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14195 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14197 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14199 spec->vmaster_nid = 0x03;
14201 codec->patch_ops = alc_patch_ops;
14202 if (board_config == ALC861_AUTO)
14203 spec->init_hook = alc861_auto_init;
14204 #ifdef CONFIG_SND_HDA_POWER_SAVE
14205 if (!spec->loopback.amplist)
14206 spec->loopback.amplist = alc861_loopbacks;
14208 codec->proc_widget_hook = print_realtek_coef;
14214 * ALC861-VD support
14218 * In addition, an independent DAC
14220 #define ALC861VD_DIGOUT_NID 0x06
14222 static hda_nid_t alc861vd_dac_nids[4] = {
14223 /* front, surr, clfe, side surr */
14224 0x02, 0x03, 0x04, 0x05
14227 /* dac_nids for ALC660vd are in a different order - according to
14228 * Realtek's driver.
14229 * This should probably result in a different mixer for 6stack models
14230 * of ALC660vd codecs, but for now there is only 3stack mixer
14231 * - and it is the same as in 861vd.
14232 * adc_nids in ALC660vd are (is) the same as in 861vd
14234 static hda_nid_t alc660vd_dac_nids[3] = {
14235 /* front, rear, clfe, rear_surr */
14239 static hda_nid_t alc861vd_adc_nids[1] = {
14244 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14247 /* FIXME: should be a matrix-type input source selection */
14248 static struct hda_input_mux alc861vd_capture_source = {
14252 { "Front Mic", 0x1 },
14258 static struct hda_input_mux alc861vd_dallas_capture_source = {
14261 { "Ext Mic", 0x0 },
14262 { "Int Mic", 0x1 },
14266 static struct hda_input_mux alc861vd_hp_capture_source = {
14269 { "Front Mic", 0x0 },
14270 { "ATAPI Mic", 0x1 },
14277 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14284 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14285 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14286 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14287 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14288 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14295 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14296 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14297 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14298 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14299 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14303 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14304 { 6, alc861vd_6stack_ch6_init },
14305 { 8, alc861vd_6stack_ch8_init },
14308 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14311 .name = "Channel Mode",
14312 .info = alc_ch_mode_info,
14313 .get = alc_ch_mode_get,
14314 .put = alc_ch_mode_put,
14319 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14320 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14322 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14323 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14324 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14326 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14327 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14329 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14331 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14336 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14337 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14342 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14345 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14349 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14350 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14352 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14353 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14358 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14359 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14360 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14364 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14368 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14369 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14370 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14372 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14373 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14375 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14376 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14381 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14382 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14383 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14384 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14386 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14388 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14392 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14393 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14394 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14396 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14397 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14402 /* Pin assignment: Speaker=0x14, HP = 0x15,
14403 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14405 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14407 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14408 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14409 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14410 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14411 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14412 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14413 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14414 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14415 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14419 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14420 * Front Mic=0x18, ATAPI Mic = 0x19,
14422 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14423 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14424 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14425 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14426 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14427 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14428 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14429 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14430 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14436 * generic initialization of ADC, input mixers and output mixers
14438 static struct hda_verb alc861vd_volume_init_verbs[] = {
14440 * Unmute ADC0 and set the default input to mic-in
14442 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14443 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14445 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14446 * the analog-loopback mixer widget
14448 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14455 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14462 * Set up output mixers (0x02 - 0x05)
14464 /* set vol=0 to output mixers */
14465 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14466 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14467 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14468 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14470 /* set up input amps for analog loopback */
14471 /* Amp Indices: DAC = 0, mixer = 1 */
14472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14475 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14477 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14479 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14485 * 3-stack pin configuration:
14486 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14488 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14490 * Set pin mode and muting
14492 /* set front pin widgets 0x14 for output */
14493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14495 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14497 /* Mic (rear) pin: input vref at 80% */
14498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14500 /* Front Mic pin: input vref at 80% */
14501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14503 /* Line In pin: input */
14504 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14506 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14510 /* CD pin widget for input */
14511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14517 * 6-stack pin configuration:
14519 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14521 * Set pin mode and muting
14523 /* set front pin widgets 0x14 for output */
14524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14525 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14528 /* Rear Pin: output 1 (0x0d) */
14529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14530 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14532 /* CLFE Pin: output 2 (0x0e) */
14533 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14534 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14535 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14536 /* Side Pin: output 3 (0x0f) */
14537 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14538 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14539 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14541 /* Mic (rear) pin: input vref at 80% */
14542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14544 /* Front Mic pin: input vref at 80% */
14545 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14546 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14547 /* Line In pin: input */
14548 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14549 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14550 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14552 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14554 /* CD pin widget for input */
14555 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14560 static struct hda_verb alc861vd_eapd_verbs[] = {
14561 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14565 static struct hda_verb alc660vd_eapd_verbs[] = {
14566 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14567 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14571 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14575 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14576 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14580 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14582 unsigned int present;
14583 unsigned char bits;
14585 present = snd_hda_codec_read(codec, 0x18, 0,
14586 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14587 bits = present ? HDA_AMP_MUTE : 0;
14588 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14589 HDA_AMP_MUTE, bits);
14592 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14594 struct alc_spec *spec = codec->spec;
14596 spec->autocfg.hp_pins[0] = 0x1b;
14597 spec->autocfg.speaker_pins[0] = 0x14;
14598 alc_automute_amp(codec);
14599 alc861vd_lenovo_mic_automute(codec);
14602 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14605 switch (res >> 26) {
14606 case ALC880_MIC_EVENT:
14607 alc861vd_lenovo_mic_automute(codec);
14610 alc_automute_amp_unsol_event(codec, res);
14615 static struct hda_verb alc861vd_dallas_verbs[] = {
14616 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14617 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14619 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14623 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14624 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14625 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14626 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14627 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14631 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14635 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14636 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14637 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14639 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14640 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14641 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14642 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14643 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14644 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14645 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14646 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14653 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14654 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14655 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14660 /* toggle speaker-output according to the hp-jack state */
14661 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14663 struct alc_spec *spec = codec->spec;
14665 spec->autocfg.hp_pins[0] = 0x15;
14666 spec->autocfg.speaker_pins[0] = 0x14;
14667 alc_automute_amp(codec);
14670 #ifdef CONFIG_SND_HDA_POWER_SAVE
14671 #define alc861vd_loopbacks alc880_loopbacks
14674 /* pcm configuration: identical with ALC880 */
14675 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14676 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14677 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14678 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14681 * configuration and preset
14683 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14684 [ALC660VD_3ST] = "3stack-660",
14685 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14686 [ALC660VD_ASUS_V1S] = "asus-v1s",
14687 [ALC861VD_3ST] = "3stack",
14688 [ALC861VD_3ST_DIG] = "3stack-digout",
14689 [ALC861VD_6ST_DIG] = "6stack-digout",
14690 [ALC861VD_LENOVO] = "lenovo",
14691 [ALC861VD_DALLAS] = "dallas",
14692 [ALC861VD_HP] = "hp",
14693 [ALC861VD_AUTO] = "auto",
14696 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14697 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14698 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14699 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14700 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14701 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14702 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14703 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14704 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14705 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14706 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14707 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14708 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14709 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14710 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14711 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14715 static struct alc_config_preset alc861vd_presets[] = {
14717 .mixers = { alc861vd_3st_mixer },
14718 .init_verbs = { alc861vd_volume_init_verbs,
14719 alc861vd_3stack_init_verbs },
14720 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14721 .dac_nids = alc660vd_dac_nids,
14722 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14723 .channel_mode = alc861vd_3stack_2ch_modes,
14724 .input_mux = &alc861vd_capture_source,
14726 [ALC660VD_3ST_DIG] = {
14727 .mixers = { alc861vd_3st_mixer },
14728 .init_verbs = { alc861vd_volume_init_verbs,
14729 alc861vd_3stack_init_verbs },
14730 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14731 .dac_nids = alc660vd_dac_nids,
14732 .dig_out_nid = ALC861VD_DIGOUT_NID,
14733 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14734 .channel_mode = alc861vd_3stack_2ch_modes,
14735 .input_mux = &alc861vd_capture_source,
14738 .mixers = { alc861vd_3st_mixer },
14739 .init_verbs = { alc861vd_volume_init_verbs,
14740 alc861vd_3stack_init_verbs },
14741 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14742 .dac_nids = alc861vd_dac_nids,
14743 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14744 .channel_mode = alc861vd_3stack_2ch_modes,
14745 .input_mux = &alc861vd_capture_source,
14747 [ALC861VD_3ST_DIG] = {
14748 .mixers = { alc861vd_3st_mixer },
14749 .init_verbs = { alc861vd_volume_init_verbs,
14750 alc861vd_3stack_init_verbs },
14751 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14752 .dac_nids = alc861vd_dac_nids,
14753 .dig_out_nid = ALC861VD_DIGOUT_NID,
14754 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14755 .channel_mode = alc861vd_3stack_2ch_modes,
14756 .input_mux = &alc861vd_capture_source,
14758 [ALC861VD_6ST_DIG] = {
14759 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14760 .init_verbs = { alc861vd_volume_init_verbs,
14761 alc861vd_6stack_init_verbs },
14762 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14763 .dac_nids = alc861vd_dac_nids,
14764 .dig_out_nid = ALC861VD_DIGOUT_NID,
14765 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14766 .channel_mode = alc861vd_6stack_modes,
14767 .input_mux = &alc861vd_capture_source,
14769 [ALC861VD_LENOVO] = {
14770 .mixers = { alc861vd_lenovo_mixer },
14771 .init_verbs = { alc861vd_volume_init_verbs,
14772 alc861vd_3stack_init_verbs,
14773 alc861vd_eapd_verbs,
14774 alc861vd_lenovo_unsol_verbs },
14775 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14776 .dac_nids = alc660vd_dac_nids,
14777 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14778 .channel_mode = alc861vd_3stack_2ch_modes,
14779 .input_mux = &alc861vd_capture_source,
14780 .unsol_event = alc861vd_lenovo_unsol_event,
14781 .init_hook = alc861vd_lenovo_init_hook,
14783 [ALC861VD_DALLAS] = {
14784 .mixers = { alc861vd_dallas_mixer },
14785 .init_verbs = { alc861vd_dallas_verbs },
14786 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14787 .dac_nids = alc861vd_dac_nids,
14788 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14789 .channel_mode = alc861vd_3stack_2ch_modes,
14790 .input_mux = &alc861vd_dallas_capture_source,
14791 .unsol_event = alc_automute_amp_unsol_event,
14792 .init_hook = alc861vd_dallas_init_hook,
14795 .mixers = { alc861vd_hp_mixer },
14796 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14797 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14798 .dac_nids = alc861vd_dac_nids,
14799 .dig_out_nid = ALC861VD_DIGOUT_NID,
14800 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14801 .channel_mode = alc861vd_3stack_2ch_modes,
14802 .input_mux = &alc861vd_hp_capture_source,
14803 .unsol_event = alc_automute_amp_unsol_event,
14804 .init_hook = alc861vd_dallas_init_hook,
14806 [ALC660VD_ASUS_V1S] = {
14807 .mixers = { alc861vd_lenovo_mixer },
14808 .init_verbs = { alc861vd_volume_init_verbs,
14809 alc861vd_3stack_init_verbs,
14810 alc861vd_eapd_verbs,
14811 alc861vd_lenovo_unsol_verbs },
14812 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14813 .dac_nids = alc660vd_dac_nids,
14814 .dig_out_nid = ALC861VD_DIGOUT_NID,
14815 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14816 .channel_mode = alc861vd_3stack_2ch_modes,
14817 .input_mux = &alc861vd_capture_source,
14818 .unsol_event = alc861vd_lenovo_unsol_event,
14819 .init_hook = alc861vd_lenovo_init_hook,
14824 * BIOS auto configuration
14826 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14827 hda_nid_t nid, int pin_type, int dac_idx)
14829 alc_set_pin_output(codec, nid, pin_type);
14832 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14834 struct alc_spec *spec = codec->spec;
14837 for (i = 0; i <= HDA_SIDE; i++) {
14838 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14839 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14841 alc861vd_auto_set_output_and_unmute(codec, nid,
14847 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14849 struct alc_spec *spec = codec->spec;
14852 pin = spec->autocfg.hp_pins[0];
14853 if (pin) /* connect to front and use dac 0 */
14854 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14855 pin = spec->autocfg.speaker_pins[0];
14857 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14860 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14861 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14863 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14865 struct alc_spec *spec = codec->spec;
14868 for (i = 0; i < AUTO_PIN_LAST; i++) {
14869 hda_nid_t nid = spec->autocfg.input_pins[i];
14870 if (alc861vd_is_input_pin(nid)) {
14871 alc_set_input_pin(codec, nid, i);
14872 if (nid != ALC861VD_PIN_CD_NID &&
14873 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14874 snd_hda_codec_write(codec, nid, 0,
14875 AC_VERB_SET_AMP_GAIN_MUTE,
14881 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14883 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14884 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14886 /* add playback controls from the parsed DAC table */
14887 /* Based on ALC880 version. But ALC861VD has separate,
14888 * different NIDs for mute/unmute switch and volume control */
14889 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14890 const struct auto_pin_cfg *cfg)
14893 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14894 hda_nid_t nid_v, nid_s;
14897 for (i = 0; i < cfg->line_outs; i++) {
14898 if (!spec->multiout.dac_nids[i])
14900 nid_v = alc861vd_idx_to_mixer_vol(
14902 spec->multiout.dac_nids[i]));
14903 nid_s = alc861vd_idx_to_mixer_switch(
14905 spec->multiout.dac_nids[i]));
14909 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14910 "Center Playback Volume",
14911 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14915 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14916 "LFE Playback Volume",
14917 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14921 err = add_control(spec, ALC_CTL_BIND_MUTE,
14922 "Center Playback Switch",
14923 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14927 err = add_control(spec, ALC_CTL_BIND_MUTE,
14928 "LFE Playback Switch",
14929 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14934 sprintf(name, "%s Playback Volume", chname[i]);
14935 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14936 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14940 sprintf(name, "%s Playback Switch", chname[i]);
14941 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14942 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14951 /* add playback controls for speaker and HP outputs */
14952 /* Based on ALC880 version. But ALC861VD has separate,
14953 * different NIDs for mute/unmute switch and volume control */
14954 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14955 hda_nid_t pin, const char *pfx)
14957 hda_nid_t nid_v, nid_s;
14964 if (alc880_is_fixed_pin(pin)) {
14965 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14966 /* specify the DAC as the extra output */
14967 if (!spec->multiout.hp_nid)
14968 spec->multiout.hp_nid = nid_v;
14970 spec->multiout.extra_out_nid[0] = nid_v;
14971 /* control HP volume/switch on the output mixer amp */
14972 nid_v = alc861vd_idx_to_mixer_vol(
14973 alc880_fixed_pin_idx(pin));
14974 nid_s = alc861vd_idx_to_mixer_switch(
14975 alc880_fixed_pin_idx(pin));
14977 sprintf(name, "%s Playback Volume", pfx);
14978 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14979 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14982 sprintf(name, "%s Playback Switch", pfx);
14983 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14984 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14987 } else if (alc880_is_multi_pin(pin)) {
14988 /* set manual connection */
14989 /* we have only a switch on HP-out PIN */
14990 sprintf(name, "%s Playback Switch", pfx);
14991 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14992 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
14999 /* parse the BIOS configuration and set up the alc_spec
15000 * return 1 if successful, 0 if the proper config is not found,
15001 * or a negative error code
15002 * Based on ALC880 version - had to change it to override
15003 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15004 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15006 struct alc_spec *spec = codec->spec;
15008 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15010 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15014 if (!spec->autocfg.line_outs)
15015 return 0; /* can't find valid BIOS pin config */
15017 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15020 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15023 err = alc861vd_auto_create_extra_out(spec,
15024 spec->autocfg.speaker_pins[0],
15028 err = alc861vd_auto_create_extra_out(spec,
15029 spec->autocfg.hp_pins[0],
15033 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15037 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15039 if (spec->autocfg.dig_outs)
15040 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15042 if (spec->kctls.list)
15043 add_mixer(spec, spec->kctls.list);
15045 add_verb(spec, alc861vd_volume_init_verbs);
15047 spec->num_mux_defs = 1;
15048 spec->input_mux = &spec->private_imux[0];
15050 err = alc_auto_add_mic_boost(codec);
15054 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15059 /* additional initialization for auto-configuration model */
15060 static void alc861vd_auto_init(struct hda_codec *codec)
15062 struct alc_spec *spec = codec->spec;
15063 alc861vd_auto_init_multi_out(codec);
15064 alc861vd_auto_init_hp_out(codec);
15065 alc861vd_auto_init_analog_input(codec);
15066 alc861vd_auto_init_input_src(codec);
15067 if (spec->unsol_event)
15068 alc_inithook(codec);
15071 static int patch_alc861vd(struct hda_codec *codec)
15073 struct alc_spec *spec;
15074 int err, board_config;
15076 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15080 codec->spec = spec;
15082 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15086 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15087 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15088 "trying auto-probe from BIOS...\n", codec->chip_name);
15089 board_config = ALC861VD_AUTO;
15092 if (board_config == ALC861VD_AUTO) {
15093 /* automatic parse from the BIOS config */
15094 err = alc861vd_parse_auto_config(codec);
15100 "hda_codec: Cannot set up configuration "
15101 "from BIOS. Using base mode...\n");
15102 board_config = ALC861VD_3ST;
15106 err = snd_hda_attach_beep_device(codec, 0x23);
15112 if (board_config != ALC861VD_AUTO)
15113 setup_preset(spec, &alc861vd_presets[board_config]);
15115 if (codec->vendor_id == 0x10ec0660) {
15116 /* always turn on EAPD */
15117 add_verb(spec, alc660vd_eapd_verbs);
15120 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15121 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15123 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15124 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15126 spec->adc_nids = alc861vd_adc_nids;
15127 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15128 spec->capsrc_nids = alc861vd_capsrc_nids;
15130 set_capture_mixer(spec);
15131 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15133 spec->vmaster_nid = 0x02;
15135 codec->patch_ops = alc_patch_ops;
15137 if (board_config == ALC861VD_AUTO)
15138 spec->init_hook = alc861vd_auto_init;
15139 #ifdef CONFIG_SND_HDA_POWER_SAVE
15140 if (!spec->loopback.amplist)
15141 spec->loopback.amplist = alc861vd_loopbacks;
15143 codec->proc_widget_hook = print_realtek_coef;
15151 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15152 * configuration. Each pin widget can choose any input DACs and a mixer.
15153 * Each ADC is connected from a mixer of all inputs. This makes possible
15154 * 6-channel independent captures.
15156 * In addition, an independent DAC for the multi-playback (not used in this
15159 #define ALC662_DIGOUT_NID 0x06
15160 #define ALC662_DIGIN_NID 0x0a
15162 static hda_nid_t alc662_dac_nids[4] = {
15163 /* front, rear, clfe, rear_surr */
15167 static hda_nid_t alc272_dac_nids[2] = {
15171 static hda_nid_t alc662_adc_nids[1] = {
15176 static hda_nid_t alc272_adc_nids[1] = {
15181 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15182 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15186 /* FIXME: should be a matrix-type input source selection */
15187 static struct hda_input_mux alc662_capture_source = {
15191 { "Front Mic", 0x1 },
15197 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15205 static struct hda_input_mux alc662_eeepc_capture_source = {
15213 static struct hda_input_mux alc663_capture_source = {
15217 { "Front Mic", 0x1 },
15222 static struct hda_input_mux alc663_m51va_capture_source = {
15225 { "Ext-Mic", 0x0 },
15230 #if 1 /* set to 0 for testing other input sources below */
15231 static struct hda_input_mux alc272_nc10_capture_source = {
15234 { "Autoselect Mic", 0x0 },
15235 { "Internal Mic", 0x1 },
15239 static struct hda_input_mux alc272_nc10_capture_source = {
15242 { "Autoselect Mic", 0x0 },
15243 { "Internal Mic", 0x1 },
15244 { "In-0x02", 0x2 },
15245 { "In-0x03", 0x3 },
15246 { "In-0x04", 0x4 },
15247 { "In-0x05", 0x5 },
15248 { "In-0x06", 0x6 },
15249 { "In-0x07", 0x7 },
15250 { "In-0x08", 0x8 },
15251 { "In-0x09", 0x9 },
15252 { "In-0x0a", 0x0a },
15253 { "In-0x0b", 0x0b },
15254 { "In-0x0c", 0x0c },
15255 { "In-0x0d", 0x0d },
15256 { "In-0x0e", 0x0e },
15257 { "In-0x0f", 0x0f },
15265 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15272 static struct hda_verb alc662_3ST_ch2_init[] = {
15273 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15274 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15275 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15276 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15283 static struct hda_verb alc662_3ST_ch6_init[] = {
15284 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15285 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15286 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15287 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15288 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15289 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15293 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15294 { 2, alc662_3ST_ch2_init },
15295 { 6, alc662_3ST_ch6_init },
15301 static struct hda_verb alc662_sixstack_ch6_init[] = {
15302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15303 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15304 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15311 static struct hda_verb alc662_sixstack_ch8_init[] = {
15312 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15313 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15314 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15318 static struct hda_channel_mode alc662_5stack_modes[2] = {
15319 { 2, alc662_sixstack_ch6_init },
15320 { 6, alc662_sixstack_ch8_init },
15323 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15324 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15327 static struct snd_kcontrol_new alc662_base_mixer[] = {
15328 /* output mixer control */
15329 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15330 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15331 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15332 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15333 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15334 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15335 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15336 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15337 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15339 /*Input mixer control */
15340 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15341 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15342 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15343 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15344 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15345 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15351 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15352 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15353 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15361 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15362 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15366 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15367 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15368 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15369 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15370 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15371 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15372 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15374 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15375 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15376 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15377 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15378 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15379 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15380 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15381 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15387 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15388 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15389 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15390 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15391 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15393 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15394 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15400 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15401 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15402 ALC262_HIPPO_MASTER_SWITCH,
15404 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15405 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15406 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15408 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15409 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15410 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15414 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15415 ALC262_HIPPO_MASTER_SWITCH,
15416 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15417 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15418 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15419 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15420 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15421 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15422 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15428 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15429 .ops = &snd_hda_bind_vol,
15431 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15432 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15437 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15438 .ops = &snd_hda_bind_sw,
15440 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15441 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15446 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15447 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15448 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15454 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15455 .ops = &snd_hda_bind_sw,
15457 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15458 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15459 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15464 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15465 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15466 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15469 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15470 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15475 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15476 .ops = &snd_hda_bind_sw,
15478 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15479 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15480 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15485 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15486 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15487 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15488 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15489 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15490 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15491 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15495 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15496 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15497 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15498 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15501 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15502 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15506 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15507 .ops = &snd_hda_bind_vol,
15509 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15510 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15515 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15516 .ops = &snd_hda_bind_sw,
15518 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15519 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15524 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15525 HDA_BIND_VOL("Master Playback Volume",
15526 &alc663_asus_two_bind_master_vol),
15527 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15528 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15529 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15535 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15536 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15537 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15538 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15540 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15541 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15545 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15546 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15547 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15548 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15549 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15550 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15554 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15555 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15559 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15560 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15561 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15566 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15567 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15568 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15569 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15573 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15575 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15576 .name = "Channel Mode",
15577 .info = alc_ch_mode_info,
15578 .get = alc_ch_mode_get,
15579 .put = alc_ch_mode_put,
15584 static struct hda_verb alc662_init_verbs[] = {
15585 /* ADC: mute amp left and right */
15586 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15587 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15588 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15590 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15591 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15592 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15593 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15594 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15601 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15603 /* Front Pin: output 0 (0x0c) */
15604 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15605 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 /* Rear Pin: output 1 (0x0d) */
15608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15611 /* CLFE Pin: output 2 (0x0e) */
15612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15615 /* Mic (rear) pin: input vref at 80% */
15616 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15617 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15618 /* Front Mic pin: input vref at 80% */
15619 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15620 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15621 /* Line In pin: input */
15622 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15623 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15624 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15625 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15626 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15627 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15628 /* CD pin widget for input */
15629 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15631 /* FIXME: use matrix-type input source selection */
15632 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15634 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15637 /* always trun on EAPD */
15638 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15639 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15644 static struct hda_verb alc662_sue_init_verbs[] = {
15645 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15646 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15650 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15651 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15652 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15656 /* Set Unsolicited Event*/
15657 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15658 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15659 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15664 * generic initialization of ADC, input mixers and output mixers
15666 static struct hda_verb alc662_auto_init_verbs[] = {
15668 * Unmute ADC and set the default input to mic-in
15670 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15671 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15673 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15675 * Note: PASD motherboards uses the Line In 2 as the input for front
15676 * panel mic (mic 2)
15678 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15681 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15682 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15683 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15686 * Set up output mixers (0x0c - 0x0f)
15688 /* set vol=0 to output mixers */
15689 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15690 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15691 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15693 /* set up input amps for analog loopback */
15694 /* Amp Indices: DAC = 0, mixer = 1 */
15695 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15696 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15697 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15698 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15699 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15700 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15703 /* FIXME: use matrix-type input source selection */
15704 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15711 /* additional verbs for ALC663 */
15712 static struct hda_verb alc663_auto_init_verbs[] = {
15713 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15714 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15718 static struct hda_verb alc663_m51va_init_verbs[] = {
15719 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15720 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15721 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15722 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15723 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15724 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15725 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15726 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15727 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15731 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15732 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15733 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15734 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15737 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15738 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15742 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15743 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15746 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15749 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15750 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15754 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15757 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15760 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15761 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15765 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15767 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15768 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15769 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15770 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15771 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15772 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15775 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15776 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15777 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15781 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15782 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15783 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15784 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15785 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15786 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15791 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15792 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15793 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15797 static struct hda_verb alc663_g71v_init_verbs[] = {
15798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15799 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15800 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15802 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15803 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15804 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15806 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15807 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15808 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15812 static struct hda_verb alc663_g50v_init_verbs[] = {
15813 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15814 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15815 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15817 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15818 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15822 static struct hda_verb alc662_ecs_init_verbs[] = {
15823 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15824 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15825 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15826 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15830 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15831 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15832 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15835 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15836 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15837 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15840 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15841 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15845 static struct hda_verb alc272_dell_init_verbs[] = {
15846 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15847 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15848 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15849 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15850 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15851 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15852 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15853 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15854 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15856 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15860 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15861 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15862 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15866 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15867 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15868 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15872 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15874 unsigned int present;
15875 unsigned char bits;
15877 present = snd_hda_codec_read(codec, 0x14, 0,
15878 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15879 bits = present ? HDA_AMP_MUTE : 0;
15880 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15881 HDA_AMP_MUTE, bits);
15884 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15886 unsigned int present;
15887 unsigned char bits;
15889 present = snd_hda_codec_read(codec, 0x1b, 0,
15890 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15891 bits = present ? HDA_AMP_MUTE : 0;
15892 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15893 HDA_AMP_MUTE, bits);
15894 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15895 HDA_AMP_MUTE, bits);
15898 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15901 if ((res >> 26) == ALC880_HP_EVENT)
15902 alc662_lenovo_101e_all_automute(codec);
15903 if ((res >> 26) == ALC880_FRONT_EVENT)
15904 alc662_lenovo_101e_ispeaker_automute(codec);
15907 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15909 unsigned int present;
15911 present = snd_hda_codec_read(codec, 0x18, 0,
15912 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15913 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15914 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15915 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15916 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15917 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15918 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15919 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15920 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15923 /* unsolicited event for HP jack sensing */
15924 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15927 if ((res >> 26) == ALC880_MIC_EVENT)
15928 alc662_eeepc_mic_automute(codec);
15930 alc262_hippo_unsol_event(codec, res);
15933 static void alc662_eeepc_inithook(struct hda_codec *codec)
15935 alc262_hippo1_init_hook(codec);
15936 alc662_eeepc_mic_automute(codec);
15939 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15941 struct alc_spec *spec = codec->spec;
15943 spec->autocfg.hp_pins[0] = 0x14;
15944 spec->autocfg.speaker_pins[0] = 0x1b;
15945 alc262_hippo_master_update(codec);
15948 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15950 unsigned int present;
15951 unsigned char bits;
15953 present = snd_hda_codec_read(codec, 0x21, 0,
15954 AC_VERB_GET_PIN_SENSE, 0)
15955 & AC_PINSENSE_PRESENCE;
15956 bits = present ? HDA_AMP_MUTE : 0;
15957 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15958 AMP_IN_MUTE(0), bits);
15959 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15960 AMP_IN_MUTE(0), bits);
15963 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15965 unsigned int present;
15966 unsigned char bits;
15968 present = snd_hda_codec_read(codec, 0x21, 0,
15969 AC_VERB_GET_PIN_SENSE, 0)
15970 & AC_PINSENSE_PRESENCE;
15971 bits = present ? HDA_AMP_MUTE : 0;
15972 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15973 AMP_IN_MUTE(0), bits);
15974 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15975 AMP_IN_MUTE(0), bits);
15976 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15977 AMP_IN_MUTE(0), bits);
15978 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15979 AMP_IN_MUTE(0), bits);
15982 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15984 unsigned int present;
15985 unsigned char bits;
15987 present = snd_hda_codec_read(codec, 0x15, 0,
15988 AC_VERB_GET_PIN_SENSE, 0)
15989 & AC_PINSENSE_PRESENCE;
15990 bits = present ? HDA_AMP_MUTE : 0;
15991 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15992 AMP_IN_MUTE(0), bits);
15993 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15994 AMP_IN_MUTE(0), bits);
15995 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15996 AMP_IN_MUTE(0), bits);
15997 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15998 AMP_IN_MUTE(0), bits);
16001 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16003 unsigned int present;
16004 unsigned char bits;
16006 present = snd_hda_codec_read(codec, 0x1b, 0,
16007 AC_VERB_GET_PIN_SENSE, 0)
16008 & AC_PINSENSE_PRESENCE;
16009 bits = present ? 0 : PIN_OUT;
16010 snd_hda_codec_write(codec, 0x14, 0,
16011 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16014 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16016 unsigned int present1, present2;
16018 present1 = snd_hda_codec_read(codec, 0x21, 0,
16019 AC_VERB_GET_PIN_SENSE, 0)
16020 & AC_PINSENSE_PRESENCE;
16021 present2 = snd_hda_codec_read(codec, 0x15, 0,
16022 AC_VERB_GET_PIN_SENSE, 0)
16023 & AC_PINSENSE_PRESENCE;
16025 if (present1 || present2) {
16026 snd_hda_codec_write_cache(codec, 0x14, 0,
16027 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16029 snd_hda_codec_write_cache(codec, 0x14, 0,
16030 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16034 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16036 unsigned int present1, present2;
16038 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16039 AC_VERB_GET_PIN_SENSE, 0)
16040 & AC_PINSENSE_PRESENCE;
16041 present2 = snd_hda_codec_read(codec, 0x15, 0,
16042 AC_VERB_GET_PIN_SENSE, 0)
16043 & AC_PINSENSE_PRESENCE;
16045 if (present1 || present2) {
16046 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16047 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16048 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16049 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16051 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16052 AMP_IN_MUTE(0), 0);
16053 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16054 AMP_IN_MUTE(0), 0);
16058 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16060 unsigned int present;
16062 present = snd_hda_codec_read(codec, 0x18, 0,
16063 AC_VERB_GET_PIN_SENSE, 0)
16064 & AC_PINSENSE_PRESENCE;
16065 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16066 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16067 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16068 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16069 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16070 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16071 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16072 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16075 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16078 switch (res >> 26) {
16079 case ALC880_HP_EVENT:
16080 alc663_m51va_speaker_automute(codec);
16082 case ALC880_MIC_EVENT:
16083 alc663_m51va_mic_automute(codec);
16088 static void alc663_m51va_inithook(struct hda_codec *codec)
16090 alc663_m51va_speaker_automute(codec);
16091 alc663_m51va_mic_automute(codec);
16094 /* ***************** Mode1 ******************************/
16095 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16098 switch (res >> 26) {
16099 case ALC880_HP_EVENT:
16100 alc663_m51va_speaker_automute(codec);
16102 case ALC880_MIC_EVENT:
16103 alc662_eeepc_mic_automute(codec);
16108 static void alc663_mode1_inithook(struct hda_codec *codec)
16110 alc663_m51va_speaker_automute(codec);
16111 alc662_eeepc_mic_automute(codec);
16113 /* ***************** Mode2 ******************************/
16114 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16117 switch (res >> 26) {
16118 case ALC880_HP_EVENT:
16119 alc662_f5z_speaker_automute(codec);
16121 case ALC880_MIC_EVENT:
16122 alc662_eeepc_mic_automute(codec);
16127 static void alc662_mode2_inithook(struct hda_codec *codec)
16129 alc662_f5z_speaker_automute(codec);
16130 alc662_eeepc_mic_automute(codec);
16132 /* ***************** Mode3 ******************************/
16133 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16136 switch (res >> 26) {
16137 case ALC880_HP_EVENT:
16138 alc663_two_hp_m1_speaker_automute(codec);
16140 case ALC880_MIC_EVENT:
16141 alc662_eeepc_mic_automute(codec);
16146 static void alc663_mode3_inithook(struct hda_codec *codec)
16148 alc663_two_hp_m1_speaker_automute(codec);
16149 alc662_eeepc_mic_automute(codec);
16151 /* ***************** Mode4 ******************************/
16152 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16155 switch (res >> 26) {
16156 case ALC880_HP_EVENT:
16157 alc663_21jd_two_speaker_automute(codec);
16159 case ALC880_MIC_EVENT:
16160 alc662_eeepc_mic_automute(codec);
16165 static void alc663_mode4_inithook(struct hda_codec *codec)
16167 alc663_21jd_two_speaker_automute(codec);
16168 alc662_eeepc_mic_automute(codec);
16170 /* ***************** Mode5 ******************************/
16171 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16174 switch (res >> 26) {
16175 case ALC880_HP_EVENT:
16176 alc663_15jd_two_speaker_automute(codec);
16178 case ALC880_MIC_EVENT:
16179 alc662_eeepc_mic_automute(codec);
16184 static void alc663_mode5_inithook(struct hda_codec *codec)
16186 alc663_15jd_two_speaker_automute(codec);
16187 alc662_eeepc_mic_automute(codec);
16189 /* ***************** Mode6 ******************************/
16190 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16193 switch (res >> 26) {
16194 case ALC880_HP_EVENT:
16195 alc663_two_hp_m2_speaker_automute(codec);
16197 case ALC880_MIC_EVENT:
16198 alc662_eeepc_mic_automute(codec);
16203 static void alc663_mode6_inithook(struct hda_codec *codec)
16205 alc663_two_hp_m2_speaker_automute(codec);
16206 alc662_eeepc_mic_automute(codec);
16209 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16211 unsigned int present;
16212 unsigned char bits;
16214 present = snd_hda_codec_read(codec, 0x21, 0,
16215 AC_VERB_GET_PIN_SENSE, 0)
16216 & AC_PINSENSE_PRESENCE;
16217 bits = present ? HDA_AMP_MUTE : 0;
16218 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16219 HDA_AMP_MUTE, bits);
16220 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16221 HDA_AMP_MUTE, bits);
16224 static void alc663_g71v_front_automute(struct hda_codec *codec)
16226 unsigned int present;
16227 unsigned char bits;
16229 present = snd_hda_codec_read(codec, 0x15, 0,
16230 AC_VERB_GET_PIN_SENSE, 0)
16231 & AC_PINSENSE_PRESENCE;
16232 bits = present ? HDA_AMP_MUTE : 0;
16233 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16234 HDA_AMP_MUTE, bits);
16237 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16240 switch (res >> 26) {
16241 case ALC880_HP_EVENT:
16242 alc663_g71v_hp_automute(codec);
16244 case ALC880_FRONT_EVENT:
16245 alc663_g71v_front_automute(codec);
16247 case ALC880_MIC_EVENT:
16248 alc662_eeepc_mic_automute(codec);
16253 static void alc663_g71v_inithook(struct hda_codec *codec)
16255 alc663_g71v_front_automute(codec);
16256 alc663_g71v_hp_automute(codec);
16257 alc662_eeepc_mic_automute(codec);
16260 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16263 switch (res >> 26) {
16264 case ALC880_HP_EVENT:
16265 alc663_m51va_speaker_automute(codec);
16267 case ALC880_MIC_EVENT:
16268 alc662_eeepc_mic_automute(codec);
16273 static void alc663_g50v_inithook(struct hda_codec *codec)
16275 alc663_m51va_speaker_automute(codec);
16276 alc662_eeepc_mic_automute(codec);
16279 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16280 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16281 ALC262_HIPPO_MASTER_SWITCH,
16283 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16284 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16285 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16287 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16288 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16289 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16293 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16294 /* Master Playback automatically created from Speaker and Headphone */
16295 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16297 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16300 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16301 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16302 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16304 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16305 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16306 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16310 #ifdef CONFIG_SND_HDA_POWER_SAVE
16311 #define alc662_loopbacks alc880_loopbacks
16315 /* pcm configuration: identical with ALC880 */
16316 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16317 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16318 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16319 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16322 * configuration and preset
16324 static const char *alc662_models[ALC662_MODEL_LAST] = {
16325 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16326 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16327 [ALC662_3ST_6ch] = "3stack-6ch",
16328 [ALC662_5ST_DIG] = "6stack-dig",
16329 [ALC662_LENOVO_101E] = "lenovo-101e",
16330 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16331 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16332 [ALC662_ECS] = "ecs",
16333 [ALC663_ASUS_M51VA] = "m51va",
16334 [ALC663_ASUS_G71V] = "g71v",
16335 [ALC663_ASUS_H13] = "h13",
16336 [ALC663_ASUS_G50V] = "g50v",
16337 [ALC663_ASUS_MODE1] = "asus-mode1",
16338 [ALC662_ASUS_MODE2] = "asus-mode2",
16339 [ALC663_ASUS_MODE3] = "asus-mode3",
16340 [ALC663_ASUS_MODE4] = "asus-mode4",
16341 [ALC663_ASUS_MODE5] = "asus-mode5",
16342 [ALC663_ASUS_MODE6] = "asus-mode6",
16343 [ALC272_DELL] = "dell",
16344 [ALC272_DELL_ZM1] = "dell-zm1",
16345 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16346 [ALC662_AUTO] = "auto",
16349 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16350 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16351 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16352 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16353 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16354 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16355 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16356 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16357 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16358 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16359 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16360 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16361 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16362 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16363 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16364 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16365 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16366 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16367 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16368 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16369 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16370 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16371 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16372 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16373 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16374 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16375 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16376 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16377 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16378 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16379 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16380 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16381 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16382 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16383 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16384 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16385 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16386 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16387 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16388 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16389 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16390 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16391 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16392 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16393 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16394 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16395 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16396 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16397 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16398 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16399 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16400 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16401 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16402 ALC662_3ST_6ch_DIG),
16403 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16404 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16405 ALC662_3ST_6ch_DIG),
16406 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16407 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16408 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16409 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16410 ALC662_3ST_6ch_DIG),
16411 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16416 static struct alc_config_preset alc662_presets[] = {
16417 [ALC662_3ST_2ch_DIG] = {
16418 .mixers = { alc662_3ST_2ch_mixer },
16419 .init_verbs = { alc662_init_verbs },
16420 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16421 .dac_nids = alc662_dac_nids,
16422 .dig_out_nid = ALC662_DIGOUT_NID,
16423 .dig_in_nid = ALC662_DIGIN_NID,
16424 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16425 .channel_mode = alc662_3ST_2ch_modes,
16426 .input_mux = &alc662_capture_source,
16428 [ALC662_3ST_6ch_DIG] = {
16429 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16430 .init_verbs = { alc662_init_verbs },
16431 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16432 .dac_nids = alc662_dac_nids,
16433 .dig_out_nid = ALC662_DIGOUT_NID,
16434 .dig_in_nid = ALC662_DIGIN_NID,
16435 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16436 .channel_mode = alc662_3ST_6ch_modes,
16438 .input_mux = &alc662_capture_source,
16440 [ALC662_3ST_6ch] = {
16441 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16442 .init_verbs = { alc662_init_verbs },
16443 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16444 .dac_nids = alc662_dac_nids,
16445 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16446 .channel_mode = alc662_3ST_6ch_modes,
16448 .input_mux = &alc662_capture_source,
16450 [ALC662_5ST_DIG] = {
16451 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16452 .init_verbs = { alc662_init_verbs },
16453 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16454 .dac_nids = alc662_dac_nids,
16455 .dig_out_nid = ALC662_DIGOUT_NID,
16456 .dig_in_nid = ALC662_DIGIN_NID,
16457 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16458 .channel_mode = alc662_5stack_modes,
16459 .input_mux = &alc662_capture_source,
16461 [ALC662_LENOVO_101E] = {
16462 .mixers = { alc662_lenovo_101e_mixer },
16463 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16464 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16465 .dac_nids = alc662_dac_nids,
16466 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16467 .channel_mode = alc662_3ST_2ch_modes,
16468 .input_mux = &alc662_lenovo_101e_capture_source,
16469 .unsol_event = alc662_lenovo_101e_unsol_event,
16470 .init_hook = alc662_lenovo_101e_all_automute,
16472 [ALC662_ASUS_EEEPC_P701] = {
16473 .mixers = { alc662_eeepc_p701_mixer },
16474 .init_verbs = { alc662_init_verbs,
16475 alc662_eeepc_sue_init_verbs },
16476 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16477 .dac_nids = alc662_dac_nids,
16478 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16479 .channel_mode = alc662_3ST_2ch_modes,
16480 .input_mux = &alc662_eeepc_capture_source,
16481 .unsol_event = alc662_eeepc_unsol_event,
16482 .init_hook = alc662_eeepc_inithook,
16484 [ALC662_ASUS_EEEPC_EP20] = {
16485 .mixers = { alc662_eeepc_ep20_mixer,
16486 alc662_chmode_mixer },
16487 .init_verbs = { alc662_init_verbs,
16488 alc662_eeepc_ep20_sue_init_verbs },
16489 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16490 .dac_nids = alc662_dac_nids,
16491 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16492 .channel_mode = alc662_3ST_6ch_modes,
16493 .input_mux = &alc662_lenovo_101e_capture_source,
16494 .unsol_event = alc662_eeepc_unsol_event,
16495 .init_hook = alc662_eeepc_ep20_inithook,
16498 .mixers = { alc662_ecs_mixer },
16499 .init_verbs = { alc662_init_verbs,
16500 alc662_ecs_init_verbs },
16501 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16502 .dac_nids = alc662_dac_nids,
16503 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16504 .channel_mode = alc662_3ST_2ch_modes,
16505 .input_mux = &alc662_eeepc_capture_source,
16506 .unsol_event = alc662_eeepc_unsol_event,
16507 .init_hook = alc662_eeepc_inithook,
16509 [ALC663_ASUS_M51VA] = {
16510 .mixers = { alc663_m51va_mixer },
16511 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16512 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16513 .dac_nids = alc662_dac_nids,
16514 .dig_out_nid = ALC662_DIGOUT_NID,
16515 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16516 .channel_mode = alc662_3ST_2ch_modes,
16517 .input_mux = &alc663_m51va_capture_source,
16518 .unsol_event = alc663_m51va_unsol_event,
16519 .init_hook = alc663_m51va_inithook,
16521 [ALC663_ASUS_G71V] = {
16522 .mixers = { alc663_g71v_mixer },
16523 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16524 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16525 .dac_nids = alc662_dac_nids,
16526 .dig_out_nid = ALC662_DIGOUT_NID,
16527 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16528 .channel_mode = alc662_3ST_2ch_modes,
16529 .input_mux = &alc662_eeepc_capture_source,
16530 .unsol_event = alc663_g71v_unsol_event,
16531 .init_hook = alc663_g71v_inithook,
16533 [ALC663_ASUS_H13] = {
16534 .mixers = { alc663_m51va_mixer },
16535 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16536 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16537 .dac_nids = alc662_dac_nids,
16538 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16539 .channel_mode = alc662_3ST_2ch_modes,
16540 .input_mux = &alc663_m51va_capture_source,
16541 .unsol_event = alc663_m51va_unsol_event,
16542 .init_hook = alc663_m51va_inithook,
16544 [ALC663_ASUS_G50V] = {
16545 .mixers = { alc663_g50v_mixer },
16546 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16547 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16548 .dac_nids = alc662_dac_nids,
16549 .dig_out_nid = ALC662_DIGOUT_NID,
16550 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16551 .channel_mode = alc662_3ST_6ch_modes,
16552 .input_mux = &alc663_capture_source,
16553 .unsol_event = alc663_g50v_unsol_event,
16554 .init_hook = alc663_g50v_inithook,
16556 [ALC663_ASUS_MODE1] = {
16557 .mixers = { alc663_m51va_mixer },
16558 .cap_mixer = alc662_auto_capture_mixer,
16559 .init_verbs = { alc662_init_verbs,
16560 alc663_21jd_amic_init_verbs },
16561 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16563 .dac_nids = alc662_dac_nids,
16564 .dig_out_nid = ALC662_DIGOUT_NID,
16565 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16566 .channel_mode = alc662_3ST_2ch_modes,
16567 .input_mux = &alc662_eeepc_capture_source,
16568 .unsol_event = alc663_mode1_unsol_event,
16569 .init_hook = alc663_mode1_inithook,
16571 [ALC662_ASUS_MODE2] = {
16572 .mixers = { alc662_1bjd_mixer },
16573 .cap_mixer = alc662_auto_capture_mixer,
16574 .init_verbs = { alc662_init_verbs,
16575 alc662_1bjd_amic_init_verbs },
16576 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16577 .dac_nids = alc662_dac_nids,
16578 .dig_out_nid = ALC662_DIGOUT_NID,
16579 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16580 .channel_mode = alc662_3ST_2ch_modes,
16581 .input_mux = &alc662_eeepc_capture_source,
16582 .unsol_event = alc662_mode2_unsol_event,
16583 .init_hook = alc662_mode2_inithook,
16585 [ALC663_ASUS_MODE3] = {
16586 .mixers = { alc663_two_hp_m1_mixer },
16587 .cap_mixer = alc662_auto_capture_mixer,
16588 .init_verbs = { alc662_init_verbs,
16589 alc663_two_hp_amic_m1_init_verbs },
16590 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16592 .dac_nids = alc662_dac_nids,
16593 .dig_out_nid = ALC662_DIGOUT_NID,
16594 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16595 .channel_mode = alc662_3ST_2ch_modes,
16596 .input_mux = &alc662_eeepc_capture_source,
16597 .unsol_event = alc663_mode3_unsol_event,
16598 .init_hook = alc663_mode3_inithook,
16600 [ALC663_ASUS_MODE4] = {
16601 .mixers = { alc663_asus_21jd_clfe_mixer },
16602 .cap_mixer = alc662_auto_capture_mixer,
16603 .init_verbs = { alc662_init_verbs,
16604 alc663_21jd_amic_init_verbs},
16605 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16607 .dac_nids = alc662_dac_nids,
16608 .dig_out_nid = ALC662_DIGOUT_NID,
16609 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16610 .channel_mode = alc662_3ST_2ch_modes,
16611 .input_mux = &alc662_eeepc_capture_source,
16612 .unsol_event = alc663_mode4_unsol_event,
16613 .init_hook = alc663_mode4_inithook,
16615 [ALC663_ASUS_MODE5] = {
16616 .mixers = { alc663_asus_15jd_clfe_mixer },
16617 .cap_mixer = alc662_auto_capture_mixer,
16618 .init_verbs = { alc662_init_verbs,
16619 alc663_15jd_amic_init_verbs },
16620 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16622 .dac_nids = alc662_dac_nids,
16623 .dig_out_nid = ALC662_DIGOUT_NID,
16624 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16625 .channel_mode = alc662_3ST_2ch_modes,
16626 .input_mux = &alc662_eeepc_capture_source,
16627 .unsol_event = alc663_mode5_unsol_event,
16628 .init_hook = alc663_mode5_inithook,
16630 [ALC663_ASUS_MODE6] = {
16631 .mixers = { alc663_two_hp_m2_mixer },
16632 .cap_mixer = alc662_auto_capture_mixer,
16633 .init_verbs = { alc662_init_verbs,
16634 alc663_two_hp_amic_m2_init_verbs },
16635 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16637 .dac_nids = alc662_dac_nids,
16638 .dig_out_nid = ALC662_DIGOUT_NID,
16639 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16640 .channel_mode = alc662_3ST_2ch_modes,
16641 .input_mux = &alc662_eeepc_capture_source,
16642 .unsol_event = alc663_mode6_unsol_event,
16643 .init_hook = alc663_mode6_inithook,
16646 .mixers = { alc663_m51va_mixer },
16647 .cap_mixer = alc272_auto_capture_mixer,
16648 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16649 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16650 .dac_nids = alc662_dac_nids,
16651 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16652 .adc_nids = alc272_adc_nids,
16653 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16654 .capsrc_nids = alc272_capsrc_nids,
16655 .channel_mode = alc662_3ST_2ch_modes,
16656 .input_mux = &alc663_m51va_capture_source,
16657 .unsol_event = alc663_m51va_unsol_event,
16658 .init_hook = alc663_m51va_inithook,
16660 [ALC272_DELL_ZM1] = {
16661 .mixers = { alc663_m51va_mixer },
16662 .cap_mixer = alc662_auto_capture_mixer,
16663 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16664 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16665 .dac_nids = alc662_dac_nids,
16666 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16667 .adc_nids = alc662_adc_nids,
16668 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16669 .capsrc_nids = alc662_capsrc_nids,
16670 .channel_mode = alc662_3ST_2ch_modes,
16671 .input_mux = &alc663_m51va_capture_source,
16672 .unsol_event = alc663_m51va_unsol_event,
16673 .init_hook = alc663_m51va_inithook,
16675 [ALC272_SAMSUNG_NC10] = {
16676 .mixers = { alc272_nc10_mixer },
16677 .init_verbs = { alc662_init_verbs,
16678 alc663_21jd_amic_init_verbs },
16679 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16680 .dac_nids = alc272_dac_nids,
16681 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16682 .channel_mode = alc662_3ST_2ch_modes,
16683 .input_mux = &alc272_nc10_capture_source,
16684 .unsol_event = alc663_mode4_unsol_event,
16685 .init_hook = alc663_mode4_inithook,
16691 * BIOS auto configuration
16694 /* add playback controls from the parsed DAC table */
16695 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16696 const struct auto_pin_cfg *cfg)
16699 static const char *chname[4] = {
16700 "Front", "Surround", NULL /*CLFE*/, "Side"
16705 for (i = 0; i < cfg->line_outs; i++) {
16706 if (!spec->multiout.dac_nids[i])
16708 nid = alc880_idx_to_dac(i);
16711 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16712 "Center Playback Volume",
16713 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16717 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16718 "LFE Playback Volume",
16719 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16723 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16724 "Center Playback Switch",
16725 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16729 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16730 "LFE Playback Switch",
16731 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16736 sprintf(name, "%s Playback Volume", chname[i]);
16737 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16738 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16742 sprintf(name, "%s Playback Switch", chname[i]);
16743 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16744 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16753 /* add playback controls for speaker and HP outputs */
16754 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16765 /* ALC663 has a mono output pin on 0x17 */
16766 sprintf(name, "%s Playback Switch", pfx);
16767 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16768 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16772 if (alc880_is_fixed_pin(pin)) {
16773 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16774 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16775 /* specify the DAC as the extra output */
16776 if (!spec->multiout.hp_nid)
16777 spec->multiout.hp_nid = nid;
16779 spec->multiout.extra_out_nid[0] = nid;
16780 /* control HP volume/switch on the output mixer amp */
16781 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16782 sprintf(name, "%s Playback Volume", pfx);
16783 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16784 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16787 sprintf(name, "%s Playback Switch", pfx);
16788 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16789 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16792 } else if (alc880_is_multi_pin(pin)) {
16793 /* set manual connection */
16794 /* we have only a switch on HP-out PIN */
16795 sprintf(name, "%s Playback Switch", pfx);
16796 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16797 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16804 /* return the index of the src widget from the connection list of the nid.
16805 * return -1 if not found
16807 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16810 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16813 conns = snd_hda_get_connections(codec, nid, conn_list,
16814 ARRAY_SIZE(conn_list));
16817 for (i = 0; i < conns; i++)
16818 if (conn_list[i] == src)
16823 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16825 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16826 return (pincap & AC_PINCAP_IN) != 0;
16829 /* create playback/capture controls for input pins */
16830 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16831 const struct auto_pin_cfg *cfg)
16833 struct alc_spec *spec = codec->spec;
16834 struct hda_input_mux *imux = &spec->private_imux[0];
16837 for (i = 0; i < AUTO_PIN_LAST; i++) {
16838 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16839 idx = alc662_input_pin_idx(codec, 0x0b,
16840 cfg->input_pins[i]);
16842 err = new_analog_input(spec, cfg->input_pins[i],
16843 auto_pin_cfg_labels[i],
16848 idx = alc662_input_pin_idx(codec, 0x22,
16849 cfg->input_pins[i]);
16851 imux->items[imux->num_items].label =
16852 auto_pin_cfg_labels[i];
16853 imux->items[imux->num_items].index = idx;
16861 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16862 hda_nid_t nid, int pin_type,
16865 alc_set_pin_output(codec, nid, pin_type);
16866 /* need the manual connection? */
16867 if (alc880_is_multi_pin(nid)) {
16868 struct alc_spec *spec = codec->spec;
16869 int idx = alc880_multi_pin_idx(nid);
16870 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16871 AC_VERB_SET_CONNECT_SEL,
16872 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16876 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16878 struct alc_spec *spec = codec->spec;
16881 for (i = 0; i <= HDA_SIDE; i++) {
16882 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16883 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16885 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16890 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16892 struct alc_spec *spec = codec->spec;
16895 pin = spec->autocfg.hp_pins[0];
16896 if (pin) /* connect to front */
16898 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16899 pin = spec->autocfg.speaker_pins[0];
16901 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16904 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16906 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16908 struct alc_spec *spec = codec->spec;
16911 for (i = 0; i < AUTO_PIN_LAST; i++) {
16912 hda_nid_t nid = spec->autocfg.input_pins[i];
16913 if (alc662_is_input_pin(codec, nid)) {
16914 alc_set_input_pin(codec, nid, i);
16915 if (nid != ALC662_PIN_CD_NID &&
16916 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16917 snd_hda_codec_write(codec, nid, 0,
16918 AC_VERB_SET_AMP_GAIN_MUTE,
16924 #define alc662_auto_init_input_src alc882_auto_init_input_src
16926 static int alc662_parse_auto_config(struct hda_codec *codec)
16928 struct alc_spec *spec = codec->spec;
16930 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16932 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16936 if (!spec->autocfg.line_outs)
16937 return 0; /* can't find valid BIOS pin config */
16939 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16942 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16945 err = alc662_auto_create_extra_out(spec,
16946 spec->autocfg.speaker_pins[0],
16950 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16954 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16958 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16960 if (spec->autocfg.dig_outs)
16961 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16963 if (spec->kctls.list)
16964 add_mixer(spec, spec->kctls.list);
16966 spec->num_mux_defs = 1;
16967 spec->input_mux = &spec->private_imux[0];
16969 add_verb(spec, alc662_auto_init_verbs);
16970 if (codec->vendor_id == 0x10ec0663)
16971 add_verb(spec, alc663_auto_init_verbs);
16973 err = alc_auto_add_mic_boost(codec);
16977 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16982 /* additional initialization for auto-configuration model */
16983 static void alc662_auto_init(struct hda_codec *codec)
16985 struct alc_spec *spec = codec->spec;
16986 alc662_auto_init_multi_out(codec);
16987 alc662_auto_init_hp_out(codec);
16988 alc662_auto_init_analog_input(codec);
16989 alc662_auto_init_input_src(codec);
16990 if (spec->unsol_event)
16991 alc_inithook(codec);
16994 static int patch_alc662(struct hda_codec *codec)
16996 struct alc_spec *spec;
16997 int err, board_config;
16999 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17003 codec->spec = spec;
17005 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17007 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17010 if (board_config < 0) {
17011 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17012 "trying auto-probe from BIOS...\n", codec->chip_name);
17013 board_config = ALC662_AUTO;
17016 if (board_config == ALC662_AUTO) {
17017 /* automatic parse from the BIOS config */
17018 err = alc662_parse_auto_config(codec);
17024 "hda_codec: Cannot set up configuration "
17025 "from BIOS. Using base mode...\n");
17026 board_config = ALC662_3ST_2ch_DIG;
17030 err = snd_hda_attach_beep_device(codec, 0x1);
17036 if (board_config != ALC662_AUTO)
17037 setup_preset(spec, &alc662_presets[board_config]);
17039 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17040 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17042 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17043 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17045 spec->adc_nids = alc662_adc_nids;
17046 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17047 spec->capsrc_nids = alc662_capsrc_nids;
17049 if (!spec->cap_mixer)
17050 set_capture_mixer(spec);
17051 if (codec->vendor_id == 0x10ec0662)
17052 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17054 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17056 spec->vmaster_nid = 0x02;
17058 codec->patch_ops = alc_patch_ops;
17059 if (board_config == ALC662_AUTO)
17060 spec->init_hook = alc662_auto_init;
17061 #ifdef CONFIG_SND_HDA_POWER_SAVE
17062 if (!spec->loopback.amplist)
17063 spec->loopback.amplist = alc662_loopbacks;
17065 codec->proc_widget_hook = print_realtek_coef;
17073 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17074 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17075 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17076 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17077 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17078 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17079 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17080 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17081 .patch = patch_alc861 },
17082 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17083 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17084 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17085 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17086 .patch = patch_alc882 },
17087 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17088 .patch = patch_alc662 },
17089 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17090 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17091 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17092 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17093 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17094 .patch = patch_alc882 },
17095 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17096 .patch = patch_alc882 },
17097 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17098 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17099 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17100 .patch = patch_alc882 },
17101 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17102 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17103 {} /* terminator */
17106 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17108 MODULE_LICENSE("GPL");
17109 MODULE_DESCRIPTION("Realtek HD-audio codec");
17111 static struct hda_codec_preset_list realtek_list = {
17112 .preset = snd_hda_preset_realtek,
17113 .owner = THIS_MODULE,
17116 static int __init patch_realtek_init(void)
17118 return snd_hda_add_codec_preset(&realtek_list);
17121 static void __exit patch_realtek_exit(void)
17123 snd_hda_delete_codec_preset(&realtek_list);
17126 module_init(patch_realtek_init)
17127 module_exit(patch_realtek_exit)