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 /* Front Pin: output 0 (0x0c) */
6853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6855 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6856 /* Rear Pin: output 1 (0x0d) */
6857 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6858 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6859 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6860 /* CLFE Pin: output 2 (0x0e) */
6861 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6862 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6863 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6864 /* Side Pin: output 3 (0x0f) */
6865 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6866 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6867 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6868 /* Mic (rear) pin: input vref at 80% */
6869 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6870 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6871 /* Front Mic pin: input vref at 80% */
6872 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6873 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6874 /* Line In pin: input */
6875 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6877 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6878 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6879 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6880 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6881 /* CD pin widget for input */
6882 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6884 /* FIXME: use matrix-type input source selection */
6885 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6888 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6889 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6892 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6894 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6895 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6896 /* ADC2: mute amp left and right */
6897 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6898 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6899 /* ADC3: mute amp left and right */
6900 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6901 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6906 static struct hda_verb alc882_adc1_init_verbs[] = {
6907 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6908 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6909 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6910 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6911 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6912 /* ADC1: mute amp left and right */
6913 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6914 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6918 /* HACK - expand to two elements */
6919 #define alc882_init_verbs alc882_base_init_verbs, alc882_adc1_init_verbs
6921 static struct hda_verb alc882_eapd_verbs[] = {
6922 /* change to EAPD mode */
6923 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6924 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6928 #define alc883_init_verbs alc882_base_init_verbs
6931 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6932 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6933 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6937 /* FIXME: this looks suspicious...
6938 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6939 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6944 static struct hda_verb alc882_macpro_init_verbs[] = {
6945 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6948 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6949 /* Front Pin: output 0 (0x0c) */
6950 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6951 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6952 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6953 /* Front Mic pin: input vref at 80% */
6954 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6955 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6956 /* Speaker: output */
6957 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6959 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6960 /* Headphone output (output 0 - 0x0c) */
6961 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6962 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6963 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6965 /* FIXME: use matrix-type input source selection */
6966 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6967 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6969 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6970 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6971 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6974 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6975 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6976 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6979 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6980 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6981 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6982 /* ADC1: mute amp left and right */
6983 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6984 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6985 /* ADC2: mute amp left and right */
6986 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6987 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6988 /* ADC3: mute amp left and right */
6989 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6990 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6996 static struct hda_verb alc885_mb5_init_verbs[] = {
6998 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6999 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7000 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7001 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7006 /* Surround mixer */
7007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7009 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7011 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7013 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7015 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7017 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7018 /* Front Pin (0x0c) */
7019 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7020 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7021 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7022 /* LFE Pin (0x0e) */
7023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7025 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7027 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7028 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7029 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7030 /* Front Mic pin: input vref at 80% */
7031 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7032 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7034 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7037 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7038 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7039 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7044 /* Macbook Pro rev3 */
7045 static struct hda_verb alc885_mbp3_init_verbs[] = {
7046 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7054 /* Front Pin: output 0 (0x0c) */
7055 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7056 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7057 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7058 /* HP Pin: output 0 (0x0d) */
7059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7061 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7062 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7063 /* Mic (rear) pin: input vref at 80% */
7064 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7065 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7066 /* Front Mic pin: input vref at 80% */
7067 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7068 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7069 /* Line In pin: use output 1 when in LineOut mode */
7070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7071 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7072 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7074 /* FIXME: use matrix-type input source selection */
7075 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7076 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7077 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7078 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7079 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7080 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7082 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7083 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7084 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7085 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7087 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7088 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7089 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7091 /* ADC1: mute amp left and right */
7092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7093 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7094 /* ADC2: mute amp left and right */
7095 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7096 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7097 /* ADC3: mute amp left and right */
7098 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7099 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7104 /* iMac 24 mixer. */
7105 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7106 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7107 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7111 /* iMac 24 init verbs. */
7112 static struct hda_verb alc885_imac24_init_verbs[] = {
7113 /* Internal speakers: output 0 (0x0c) */
7114 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7115 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7116 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7117 /* Internal speakers: output 0 (0x0c) */
7118 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7119 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7120 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7121 /* Headphone: output 0 (0x0c) */
7122 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7123 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7124 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7125 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7126 /* Front Mic: input vref at 80% */
7127 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7128 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7132 /* Toggle speaker-output according to the hp-jack state */
7133 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
7135 struct alc_spec *spec = codec->spec;
7137 spec->autocfg.hp_pins[0] = 0x14;
7138 spec->autocfg.speaker_pins[0] = 0x18;
7139 spec->autocfg.speaker_pins[1] = 0x1a;
7140 alc_automute_amp(codec);
7143 static void alc885_mbp3_init_hook(struct hda_codec *codec)
7145 struct alc_spec *spec = codec->spec;
7147 spec->autocfg.hp_pins[0] = 0x15;
7148 spec->autocfg.speaker_pins[0] = 0x14;
7149 alc_automute_amp(codec);
7153 static struct hda_verb alc882_targa_verbs[] = {
7154 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7157 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7158 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7160 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7161 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7162 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7164 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7165 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7166 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
7167 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
7171 /* toggle speaker-output according to the hp-jack state */
7172 static void alc882_targa_automute(struct hda_codec *codec)
7174 struct alc_spec *spec = codec->spec;
7175 alc_automute_amp(codec);
7176 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7177 spec->jack_present ? 1 : 3);
7180 static void alc882_targa_init_hook(struct hda_codec *codec)
7182 struct alc_spec *spec = codec->spec;
7184 spec->autocfg.hp_pins[0] = 0x14;
7185 spec->autocfg.speaker_pins[0] = 0x1b;
7186 alc882_targa_automute(codec);
7189 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7191 if ((res >> 26) == ALC880_HP_EVENT)
7192 alc882_targa_automute(codec);
7195 static struct hda_verb alc882_asus_a7j_verbs[] = {
7196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7201 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7203 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7205 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7207 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7209 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7213 static struct hda_verb alc882_asus_a7m_verbs[] = {
7214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7217 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7218 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7219 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7221 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7222 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7223 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7225 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7226 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7227 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7231 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7233 unsigned int gpiostate, gpiomask, gpiodir;
7235 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7236 AC_VERB_GET_GPIO_DATA, 0);
7239 gpiostate |= (1 << pin);
7241 gpiostate &= ~(1 << pin);
7243 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7244 AC_VERB_GET_GPIO_MASK, 0);
7245 gpiomask |= (1 << pin);
7247 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7248 AC_VERB_GET_GPIO_DIRECTION, 0);
7249 gpiodir |= (1 << pin);
7252 snd_hda_codec_write(codec, codec->afg, 0,
7253 AC_VERB_SET_GPIO_MASK, gpiomask);
7254 snd_hda_codec_write(codec, codec->afg, 0,
7255 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7259 snd_hda_codec_write(codec, codec->afg, 0,
7260 AC_VERB_SET_GPIO_DATA, gpiostate);
7263 /* set up GPIO at initialization */
7264 static void alc885_macpro_init_hook(struct hda_codec *codec)
7266 alc882_gpio_mute(codec, 0, 0);
7267 alc882_gpio_mute(codec, 1, 0);
7270 /* set up GPIO and update auto-muting at initialization */
7271 static void alc885_imac24_init_hook(struct hda_codec *codec)
7273 alc885_macpro_init_hook(codec);
7274 alc885_imac24_automute_init_hook(codec);
7278 * generic initialization of ADC, input mixers and output mixers
7280 static struct hda_verb alc883_auto_init_verbs[] = {
7282 * Unmute ADC0-2 and set the default input to mic-in
7284 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7285 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7286 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7287 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7289 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7291 * Note: PASD motherboards uses the Line In 2 as the input for
7292 * front panel mic (mic 2)
7294 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7302 * Set up output mixers (0x0c - 0x0f)
7304 /* set vol=0 to output mixers */
7305 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7308 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7309 /* set up input amps for analog loopback */
7310 /* Amp Indices: DAC = 0, mixer = 1 */
7311 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7312 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7313 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7314 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7317 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7319 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7320 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7322 /* FIXME: use matrix-type input source selection */
7323 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7327 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7328 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7331 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7332 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7333 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7338 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7339 static struct hda_verb alc889A_mb31_ch2_init[] = {
7340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7341 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7342 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7343 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7347 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7348 static struct hda_verb alc889A_mb31_ch4_init[] = {
7349 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7350 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7351 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7356 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7357 static struct hda_verb alc889A_mb31_ch5_init[] = {
7358 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7359 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7360 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7365 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7366 static struct hda_verb alc889A_mb31_ch6_init[] = {
7367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7369 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7370 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7374 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7375 { 2, alc889A_mb31_ch2_init },
7376 { 4, alc889A_mb31_ch4_init },
7377 { 5, alc889A_mb31_ch5_init },
7378 { 6, alc889A_mb31_ch6_init },
7381 static struct hda_verb alc883_medion_eapd_verbs[] = {
7382 /* eanable EAPD on medion laptop */
7383 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7384 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7388 #define alc883_base_mixer alc882_base_mixer
7390 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7392 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7393 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7394 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7395 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7396 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7402 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7403 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7407 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7408 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7409 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7410 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7411 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7413 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7415 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7416 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7417 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7421 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7422 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7423 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7424 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7425 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7426 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7427 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7429 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7430 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7431 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7435 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7436 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7437 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7444 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7447 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7448 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7452 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7453 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7454 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7455 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7456 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7457 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7458 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7459 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7460 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7462 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7463 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7464 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7465 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7466 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7467 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7468 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7469 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7471 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7475 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7476 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7478 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7479 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7480 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
7482 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7483 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7484 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7486 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7487 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7491 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7492 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7493 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7494 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
7495 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7499 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7500 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7501 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7502 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7503 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7504 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7505 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7507 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7508 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7509 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7510 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7514 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7516 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7517 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7522 static struct snd_kcontrol_new alc883_targa_mixer[] = {
7523 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7525 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7526 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7527 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7528 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7529 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7530 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7531 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7533 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7537 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7542 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
7543 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7545 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7548 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7549 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7550 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7551 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7552 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7553 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7557 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7559 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7560 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7561 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7562 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7563 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7564 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7569 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7570 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7571 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
7572 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7573 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7574 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7577 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7578 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7582 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7583 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7584 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7585 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7588 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7589 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7590 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7591 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7595 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7596 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7597 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7598 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7599 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7600 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7602 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7607 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
7608 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7609 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7610 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7611 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
7612 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7613 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7614 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7615 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7617 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7618 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7622 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7624 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7625 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
7626 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
7627 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
7628 0x0d, 1, 0x0, HDA_OUTPUT),
7629 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
7630 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
7631 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
7632 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7633 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7634 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7635 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7638 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7639 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7640 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7641 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7642 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7647 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
7649 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7650 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7651 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7652 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7653 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
7655 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
7656 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
7657 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
7658 /* Output switches */
7659 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
7660 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
7661 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
7663 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7664 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7666 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7667 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7673 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
7674 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7675 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7676 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7677 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7678 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
7679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7683 static struct hda_bind_ctls alc883_bind_cap_vol = {
7684 .ops = &snd_hda_bind_vol,
7686 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7687 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7692 static struct hda_bind_ctls alc883_bind_cap_switch = {
7693 .ops = &snd_hda_bind_sw,
7695 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
7696 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
7701 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7702 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7703 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7704 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7705 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7706 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7708 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7709 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7713 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
7714 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
7715 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
7717 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7718 /* .name = "Capture Source", */
7719 .name = "Input Source",
7721 .info = alc_mux_enum_info,
7722 .get = alc_mux_enum_get,
7723 .put = alc_mux_enum_put,
7728 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
7730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7731 .name = "Channel Mode",
7732 .info = alc_ch_mode_info,
7733 .get = alc_ch_mode_get,
7734 .put = alc_ch_mode_put,
7739 /* toggle speaker-output according to the hp-jack state */
7740 static void alc883_mitac_init_hook(struct hda_codec *codec)
7742 struct alc_spec *spec = codec->spec;
7744 spec->autocfg.hp_pins[0] = 0x15;
7745 spec->autocfg.speaker_pins[0] = 0x14;
7746 spec->autocfg.speaker_pins[1] = 0x17;
7747 alc_automute_amp(codec);
7750 /* auto-toggle front mic */
7752 static void alc883_mitac_mic_automute(struct hda_codec *codec)
7754 unsigned int present;
7757 present = snd_hda_codec_read(codec, 0x18, 0,
7758 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7759 bits = present ? HDA_AMP_MUTE : 0;
7760 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
7764 static struct hda_verb alc883_mitac_verbs[] = {
7766 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7767 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7769 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
7770 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7772 /* enable unsolicited event */
7773 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7774 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
7779 static struct hda_verb alc883_clevo_m720_verbs[] = {
7781 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7784 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
7785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7787 /* enable unsolicited event */
7788 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7789 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
7794 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
7796 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7799 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7800 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7802 /* enable unsolicited event */
7803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7808 static struct hda_verb alc883_targa_verbs[] = {
7809 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7810 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7812 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7813 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7815 /* Connect Line-Out side jack (SPDIF) to Side */
7816 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7817 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7818 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7819 /* Connect Mic jack to CLFE */
7820 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7821 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7822 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
7823 /* Connect Line-in jack to Surround */
7824 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7825 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7826 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7827 /* Connect HP out jack to Front */
7828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7829 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7830 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7832 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7837 static struct hda_verb alc883_lenovo_101e_verbs[] = {
7838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7839 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
7840 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
7844 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
7845 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7846 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7852 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
7853 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
7857 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7861 static struct hda_verb alc883_haier_w66_verbs[] = {
7862 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7865 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7868 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7869 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7870 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7874 static struct hda_verb alc888_lenovo_sky_verbs[] = {
7875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7879 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7880 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7881 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7882 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7886 static struct hda_verb alc888_6st_dell_verbs[] = {
7887 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7891 static struct hda_verb alc883_vaiott_verbs[] = {
7893 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7894 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7896 /* enable unsolicited event */
7897 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7902 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
7904 struct alc_spec *spec = codec->spec;
7906 spec->autocfg.hp_pins[0] = 0x1b;
7907 spec->autocfg.speaker_pins[0] = 0x14;
7908 spec->autocfg.speaker_pins[1] = 0x16;
7909 spec->autocfg.speaker_pins[2] = 0x18;
7910 alc_automute_amp(codec);
7913 static struct hda_verb alc888_3st_hp_verbs[] = {
7914 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
7915 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
7916 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
7917 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7924 static struct hda_verb alc888_3st_hp_2ch_init[] = {
7925 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7926 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7927 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7928 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7935 static struct hda_verb alc888_3st_hp_4ch_init[] = {
7936 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7937 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7938 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7939 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7940 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
7947 static struct hda_verb alc888_3st_hp_6ch_init[] = {
7948 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7949 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7950 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7951 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7952 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7953 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
7957 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
7958 { 2, alc888_3st_hp_2ch_init },
7959 { 4, alc888_3st_hp_4ch_init },
7960 { 6, alc888_3st_hp_6ch_init },
7963 /* toggle front-jack and RCA according to the hp-jack state */
7964 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
7966 unsigned int present;
7968 present = snd_hda_codec_read(codec, 0x1b, 0,
7969 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7970 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7971 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7972 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7973 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7976 /* toggle RCA according to the front-jack state */
7977 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
7979 unsigned int present;
7981 present = snd_hda_codec_read(codec, 0x14, 0,
7982 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7983 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7984 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7987 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
7990 if ((res >> 26) == ALC880_HP_EVENT)
7991 alc888_lenovo_ms7195_front_automute(codec);
7992 if ((res >> 26) == ALC880_FRONT_EVENT)
7993 alc888_lenovo_ms7195_rca_automute(codec);
7996 static struct hda_verb alc883_medion_md2_verbs[] = {
7997 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8000 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8002 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8006 /* toggle speaker-output according to the hp-jack state */
8007 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8009 struct alc_spec *spec = codec->spec;
8011 spec->autocfg.hp_pins[0] = 0x14;
8012 spec->autocfg.speaker_pins[0] = 0x15;
8013 alc_automute_amp(codec);
8016 /* toggle speaker-output according to the hp-jack state */
8017 #define alc883_targa_init_hook alc882_targa_init_hook
8018 #define alc883_targa_unsol_event alc882_targa_unsol_event
8020 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8022 unsigned int present;
8024 present = snd_hda_codec_read(codec, 0x18, 0,
8025 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8026 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8027 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8030 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8032 struct alc_spec *spec = codec->spec;
8034 spec->autocfg.hp_pins[0] = 0x15;
8035 spec->autocfg.speaker_pins[0] = 0x14;
8036 alc_automute_amp(codec);
8037 alc883_clevo_m720_mic_automute(codec);
8040 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8043 switch (res >> 26) {
8044 case ALC880_MIC_EVENT:
8045 alc883_clevo_m720_mic_automute(codec);
8048 alc_automute_amp_unsol_event(codec, res);
8053 /* toggle speaker-output according to the hp-jack state */
8054 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8056 struct alc_spec *spec = codec->spec;
8058 spec->autocfg.hp_pins[0] = 0x14;
8059 spec->autocfg.speaker_pins[0] = 0x15;
8060 alc_automute_amp(codec);
8063 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8065 struct alc_spec *spec = codec->spec;
8067 spec->autocfg.hp_pins[0] = 0x1b;
8068 spec->autocfg.speaker_pins[0] = 0x14;
8069 alc_automute_amp(codec);
8072 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8074 unsigned int present;
8077 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8078 & AC_PINSENSE_PRESENCE;
8079 bits = present ? HDA_AMP_MUTE : 0;
8080 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8081 HDA_AMP_MUTE, bits);
8084 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8086 unsigned int present;
8089 present = snd_hda_codec_read(codec, 0x1b, 0,
8090 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8091 bits = present ? HDA_AMP_MUTE : 0;
8092 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8093 HDA_AMP_MUTE, bits);
8094 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8095 HDA_AMP_MUTE, bits);
8098 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8101 if ((res >> 26) == ALC880_HP_EVENT)
8102 alc883_lenovo_101e_all_automute(codec);
8103 if ((res >> 26) == ALC880_FRONT_EVENT)
8104 alc883_lenovo_101e_ispeaker_automute(codec);
8107 /* toggle speaker-output according to the hp-jack state */
8108 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8110 struct alc_spec *spec = codec->spec;
8112 spec->autocfg.hp_pins[0] = 0x14;
8113 spec->autocfg.speaker_pins[0] = 0x15;
8114 spec->autocfg.speaker_pins[1] = 0x16;
8115 alc_automute_amp(codec);
8118 static struct hda_verb alc883_acer_eapd_verbs[] = {
8119 /* HP Pin: output 0 (0x0c) */
8120 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8121 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8122 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8123 /* Front Pin: output 0 (0x0c) */
8124 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8125 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8126 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8127 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8128 /* eanable EAPD on medion laptop */
8129 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8130 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8131 /* enable unsolicited event */
8132 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8136 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8138 struct alc_spec *spec = codec->spec;
8140 spec->autocfg.hp_pins[0] = 0x1b;
8141 spec->autocfg.speaker_pins[0] = 0x14;
8142 spec->autocfg.speaker_pins[1] = 0x15;
8143 spec->autocfg.speaker_pins[2] = 0x16;
8144 spec->autocfg.speaker_pins[3] = 0x17;
8145 alc_automute_amp(codec);
8148 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8150 struct alc_spec *spec = codec->spec;
8152 spec->autocfg.hp_pins[0] = 0x1b;
8153 spec->autocfg.speaker_pins[0] = 0x14;
8154 spec->autocfg.speaker_pins[1] = 0x15;
8155 spec->autocfg.speaker_pins[2] = 0x16;
8156 spec->autocfg.speaker_pins[3] = 0x17;
8157 spec->autocfg.speaker_pins[4] = 0x1a;
8158 alc_automute_amp(codec);
8161 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8163 struct alc_spec *spec = codec->spec;
8165 spec->autocfg.hp_pins[0] = 0x15;
8166 spec->autocfg.speaker_pins[0] = 0x14;
8167 spec->autocfg.speaker_pins[1] = 0x17;
8168 alc_automute_amp(codec);
8171 static struct hda_verb alc888_asus_m90v_verbs[] = {
8172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8175 /* enable unsolicited event */
8176 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8177 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8181 static void alc883_nb_mic_automute(struct hda_codec *codec)
8183 unsigned int present;
8185 present = snd_hda_codec_read(codec, 0x18, 0,
8186 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8187 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8188 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8189 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8190 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8193 static void alc883_M90V_init_hook(struct hda_codec *codec)
8195 struct alc_spec *spec = codec->spec;
8197 spec->autocfg.hp_pins[0] = 0x1b;
8198 spec->autocfg.speaker_pins[0] = 0x14;
8199 spec->autocfg.speaker_pins[1] = 0x15;
8200 spec->autocfg.speaker_pins[2] = 0x16;
8201 alc_automute_pin(codec);
8204 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8207 switch (res >> 26) {
8208 case ALC880_MIC_EVENT:
8209 alc883_nb_mic_automute(codec);
8212 alc_sku_unsol_event(codec, res);
8217 static void alc883_mode2_inithook(struct hda_codec *codec)
8219 alc883_M90V_init_hook(codec);
8220 alc883_nb_mic_automute(codec);
8223 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8225 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8226 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8227 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8229 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8230 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8231 /* enable unsolicited event */
8232 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8236 static void alc883_eee1601_inithook(struct hda_codec *codec)
8238 struct alc_spec *spec = codec->spec;
8240 spec->autocfg.hp_pins[0] = 0x14;
8241 spec->autocfg.speaker_pins[0] = 0x1b;
8242 alc_automute_pin(codec);
8245 static struct hda_verb alc889A_mb31_verbs[] = {
8246 /* Init rear pin (used as headphone output) */
8247 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8248 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8249 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8250 /* Init line pin (used as output in 4ch and 6ch mode) */
8251 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8252 /* Init line 2 pin (used as headphone out by default) */
8253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8258 /* Mute speakers according to the headphone jack state */
8259 static void alc889A_mb31_automute(struct hda_codec *codec)
8261 unsigned int present;
8263 /* Mute only in 2ch or 4ch mode */
8264 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8266 present = snd_hda_codec_read(codec, 0x15, 0,
8267 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8268 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8269 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8270 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8271 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8275 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8277 if ((res >> 26) == ALC880_HP_EVENT)
8278 alc889A_mb31_automute(codec);
8282 #ifdef CONFIG_SND_HDA_POWER_SAVE
8283 #define alc882_loopbacks alc880_loopbacks
8286 /* pcm configuration: identical with ALC880 */
8287 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8288 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8289 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8290 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8292 static hda_nid_t alc883_slave_dig_outs[] = {
8293 ALC1200_DIGOUT_NID, 0,
8296 static hda_nid_t alc1200_slave_dig_outs[] = {
8297 ALC883_DIGOUT_NID, 0,
8301 * configuration and preset
8303 static const char *alc882_models[ALC882_MODEL_LAST] = {
8304 [ALC882_3ST_DIG] = "3stack-dig",
8305 [ALC882_6ST_DIG] = "6stack-dig",
8306 [ALC882_ARIMA] = "arima",
8307 [ALC882_W2JC] = "w2jc",
8308 [ALC882_TARGA] = "targa",
8309 [ALC882_ASUS_A7J] = "asus-a7j",
8310 [ALC882_ASUS_A7M] = "asus-a7m",
8311 [ALC885_MACPRO] = "macpro",
8312 [ALC885_MB5] = "mb5",
8313 [ALC885_MBP3] = "mbp3",
8314 [ALC885_IMAC24] = "imac24",
8315 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8316 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8317 [ALC883_3ST_6ch] = "3stack-6ch",
8318 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8319 [ALC883_TARGA_DIG] = "targa-dig",
8320 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8321 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8322 [ALC883_ACER] = "acer",
8323 [ALC883_ACER_ASPIRE] = "acer-aspire",
8324 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8325 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8326 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8327 [ALC883_MEDION] = "medion",
8328 [ALC883_MEDION_MD2] = "medion-md2",
8329 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8330 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8331 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8332 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8333 [ALC888_LENOVO_SKY] = "lenovo-sky",
8334 [ALC883_HAIER_W66] = "haier-w66",
8335 [ALC888_3ST_HP] = "3stack-hp",
8336 [ALC888_6ST_DELL] = "6stack-dell",
8337 [ALC883_MITAC] = "mitac",
8338 [ALC883_CLEVO_M720] = "clevo-m720",
8339 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8340 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8341 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8342 [ALC1200_ASUS_P5Q] = "asus-p5q",
8343 [ALC889A_MB31] = "mb31",
8344 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8345 [ALC882_AUTO] = "auto",
8348 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8349 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8351 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8352 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8353 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8354 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8355 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8356 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8357 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8358 ALC888_ACER_ASPIRE_4930G),
8359 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8360 ALC888_ACER_ASPIRE_4930G),
8361 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8362 ALC888_ACER_ASPIRE_8930G),
8363 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8364 ALC888_ACER_ASPIRE_8930G),
8365 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8366 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8367 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8368 ALC888_ACER_ASPIRE_6530G),
8369 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8370 ALC888_ACER_ASPIRE_6530G),
8371 /* default Acer -- disabled as it causes more problems.
8372 * model=auto should work fine now
8374 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8376 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8378 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8379 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8380 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8381 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8382 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8383 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8385 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8386 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8387 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8388 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8389 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8390 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8391 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8392 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8393 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8394 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8395 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8397 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8398 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8399 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8400 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8401 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8402 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8403 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
8404 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
8405 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
8407 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
8408 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
8409 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
8410 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
8411 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
8412 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
8413 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
8414 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
8415 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
8416 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
8417 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
8418 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
8419 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
8420 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
8421 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
8422 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
8423 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
8424 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
8425 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
8426 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
8427 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
8428 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
8429 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
8430 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
8431 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
8432 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
8433 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
8435 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
8436 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
8437 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
8438 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
8439 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
8440 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
8441 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
8442 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
8443 ALC883_FUJITSU_PI2515),
8444 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
8445 ALC888_FUJITSU_XA3530),
8446 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
8447 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8448 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8449 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
8450 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
8451 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
8452 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
8453 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
8454 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
8456 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
8457 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
8458 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
8459 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
8460 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
8465 /* codec SSID table for Intel Mac */
8466 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
8467 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
8468 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
8469 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
8470 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
8471 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
8472 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
8473 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
8474 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
8475 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
8476 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
8477 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
8478 /* FIXME: HP jack sense seems not working for MBP 5,1, so apparently
8479 * no perfect solution yet
8481 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
8485 static struct alc_config_preset alc882_presets[] = {
8486 [ALC882_3ST_DIG] = {
8487 .mixers = { alc882_base_mixer },
8488 .init_verbs = { alc882_init_verbs },
8489 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8490 .dac_nids = alc882_dac_nids,
8491 .dig_out_nid = ALC882_DIGOUT_NID,
8492 .dig_in_nid = ALC882_DIGIN_NID,
8493 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8494 .channel_mode = alc882_ch_modes,
8496 .input_mux = &alc882_capture_source,
8498 [ALC882_6ST_DIG] = {
8499 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8500 .init_verbs = { alc882_init_verbs },
8501 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8502 .dac_nids = alc882_dac_nids,
8503 .dig_out_nid = ALC882_DIGOUT_NID,
8504 .dig_in_nid = ALC882_DIGIN_NID,
8505 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8506 .channel_mode = alc882_sixstack_modes,
8507 .input_mux = &alc882_capture_source,
8510 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
8511 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
8512 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8513 .dac_nids = alc882_dac_nids,
8514 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
8515 .channel_mode = alc882_sixstack_modes,
8516 .input_mux = &alc882_capture_source,
8519 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
8520 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
8521 alc880_gpio1_init_verbs },
8522 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8523 .dac_nids = alc882_dac_nids,
8524 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8525 .channel_mode = alc880_threestack_modes,
8527 .input_mux = &alc882_capture_source,
8528 .dig_out_nid = ALC882_DIGOUT_NID,
8531 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
8532 .init_verbs = { alc885_mbp3_init_verbs,
8533 alc880_gpio1_init_verbs },
8534 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8535 .dac_nids = alc882_dac_nids,
8536 .channel_mode = alc885_mbp_6ch_modes,
8537 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
8538 .input_mux = &alc882_capture_source,
8539 .dig_out_nid = ALC882_DIGOUT_NID,
8540 .dig_in_nid = ALC882_DIGIN_NID,
8541 .unsol_event = alc_automute_amp_unsol_event,
8542 .init_hook = alc885_mbp3_init_hook,
8545 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
8546 .init_verbs = { alc885_mb5_init_verbs,
8547 alc880_gpio1_init_verbs },
8548 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8549 .dac_nids = alc882_dac_nids,
8550 .channel_mode = alc885_mb5_6ch_modes,
8551 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
8552 .input_mux = &mb5_capture_source,
8553 .dig_out_nid = ALC882_DIGOUT_NID,
8554 .dig_in_nid = ALC882_DIGIN_NID,
8557 .mixers = { alc882_macpro_mixer },
8558 .init_verbs = { alc882_macpro_init_verbs },
8559 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8560 .dac_nids = alc882_dac_nids,
8561 .dig_out_nid = ALC882_DIGOUT_NID,
8562 .dig_in_nid = ALC882_DIGIN_NID,
8563 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8564 .channel_mode = alc882_ch_modes,
8565 .input_mux = &alc882_capture_source,
8566 .init_hook = alc885_macpro_init_hook,
8569 .mixers = { alc885_imac24_mixer },
8570 .init_verbs = { alc885_imac24_init_verbs },
8571 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8572 .dac_nids = alc882_dac_nids,
8573 .dig_out_nid = ALC882_DIGOUT_NID,
8574 .dig_in_nid = ALC882_DIGIN_NID,
8575 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
8576 .channel_mode = alc882_ch_modes,
8577 .input_mux = &alc882_capture_source,
8578 .unsol_event = alc_automute_amp_unsol_event,
8579 .init_hook = alc885_imac24_init_hook,
8582 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
8583 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
8584 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8585 .dac_nids = alc882_dac_nids,
8586 .dig_out_nid = ALC882_DIGOUT_NID,
8587 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8588 .adc_nids = alc882_adc_nids,
8589 .capsrc_nids = alc882_capsrc_nids,
8590 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8591 .channel_mode = alc882_3ST_6ch_modes,
8593 .input_mux = &alc882_capture_source,
8594 .unsol_event = alc882_targa_unsol_event,
8595 .init_hook = alc882_targa_init_hook,
8597 [ALC882_ASUS_A7J] = {
8598 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
8599 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
8600 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8601 .dac_nids = alc882_dac_nids,
8602 .dig_out_nid = ALC882_DIGOUT_NID,
8603 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
8604 .adc_nids = alc882_adc_nids,
8605 .capsrc_nids = alc882_capsrc_nids,
8606 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
8607 .channel_mode = alc882_3ST_6ch_modes,
8609 .input_mux = &alc882_capture_source,
8611 [ALC882_ASUS_A7M] = {
8612 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
8613 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
8614 alc880_gpio1_init_verbs,
8615 alc882_asus_a7m_verbs },
8616 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
8617 .dac_nids = alc882_dac_nids,
8618 .dig_out_nid = ALC882_DIGOUT_NID,
8619 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
8620 .channel_mode = alc880_threestack_modes,
8622 .input_mux = &alc882_capture_source,
8624 [ALC883_3ST_2ch_DIG] = {
8625 .mixers = { alc883_3ST_2ch_mixer },
8626 .init_verbs = { alc883_init_verbs },
8627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8628 .dac_nids = alc883_dac_nids,
8629 .dig_out_nid = ALC883_DIGOUT_NID,
8630 .dig_in_nid = ALC883_DIGIN_NID,
8631 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8632 .channel_mode = alc883_3ST_2ch_modes,
8633 .input_mux = &alc883_capture_source,
8635 [ALC883_3ST_6ch_DIG] = {
8636 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8637 .init_verbs = { alc883_init_verbs },
8638 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8639 .dac_nids = alc883_dac_nids,
8640 .dig_out_nid = ALC883_DIGOUT_NID,
8641 .dig_in_nid = ALC883_DIGIN_NID,
8642 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8643 .channel_mode = alc883_3ST_6ch_modes,
8645 .input_mux = &alc883_capture_source,
8647 [ALC883_3ST_6ch] = {
8648 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8649 .init_verbs = { alc883_init_verbs },
8650 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8651 .dac_nids = alc883_dac_nids,
8652 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8653 .channel_mode = alc883_3ST_6ch_modes,
8655 .input_mux = &alc883_capture_source,
8657 [ALC883_3ST_6ch_INTEL] = {
8658 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
8659 .init_verbs = { alc883_init_verbs },
8660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8661 .dac_nids = alc883_dac_nids,
8662 .dig_out_nid = ALC883_DIGOUT_NID,
8663 .dig_in_nid = ALC883_DIGIN_NID,
8664 .slave_dig_outs = alc883_slave_dig_outs,
8665 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
8666 .channel_mode = alc883_3ST_6ch_intel_modes,
8668 .input_mux = &alc883_3stack_6ch_intel,
8670 [ALC883_6ST_DIG] = {
8671 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8672 .init_verbs = { alc883_init_verbs },
8673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8674 .dac_nids = alc883_dac_nids,
8675 .dig_out_nid = ALC883_DIGOUT_NID,
8676 .dig_in_nid = ALC883_DIGIN_NID,
8677 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8678 .channel_mode = alc883_sixstack_modes,
8679 .input_mux = &alc883_capture_source,
8681 [ALC883_TARGA_DIG] = {
8682 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
8683 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8685 .dac_nids = alc883_dac_nids,
8686 .dig_out_nid = ALC883_DIGOUT_NID,
8687 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8688 .channel_mode = alc883_3ST_6ch_modes,
8690 .input_mux = &alc883_capture_source,
8691 .unsol_event = alc883_targa_unsol_event,
8692 .init_hook = alc883_targa_init_hook,
8694 [ALC883_TARGA_2ch_DIG] = {
8695 .mixers = { alc883_targa_2ch_mixer},
8696 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
8697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8698 .dac_nids = alc883_dac_nids,
8699 .adc_nids = alc883_adc_nids_alt,
8700 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8701 .dig_out_nid = ALC883_DIGOUT_NID,
8702 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8703 .channel_mode = alc883_3ST_2ch_modes,
8704 .input_mux = &alc883_capture_source,
8705 .unsol_event = alc883_targa_unsol_event,
8706 .init_hook = alc883_targa_init_hook,
8708 [ALC883_TARGA_8ch_DIG] = {
8709 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8710 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
8711 alc883_targa_verbs },
8712 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8713 .dac_nids = alc883_dac_nids,
8714 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8715 .adc_nids = alc883_adc_nids_rev,
8716 .capsrc_nids = alc883_capsrc_nids_rev,
8717 .dig_out_nid = ALC883_DIGOUT_NID,
8718 .dig_in_nid = ALC883_DIGIN_NID,
8719 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
8720 .channel_mode = alc883_4ST_8ch_modes,
8722 .input_mux = &alc883_capture_source,
8723 .unsol_event = alc883_targa_unsol_event,
8724 .init_hook = alc883_targa_init_hook,
8727 .mixers = { alc883_base_mixer },
8728 /* On TravelMate laptops, GPIO 0 enables the internal speaker
8729 * and the headphone jack. Turn this on and rely on the
8730 * standard mute methods whenever the user wants to turn
8731 * these outputs off.
8733 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
8734 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8735 .dac_nids = alc883_dac_nids,
8736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8737 .channel_mode = alc883_3ST_2ch_modes,
8738 .input_mux = &alc883_capture_source,
8740 [ALC883_ACER_ASPIRE] = {
8741 .mixers = { alc883_acer_aspire_mixer },
8742 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
8743 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8744 .dac_nids = alc883_dac_nids,
8745 .dig_out_nid = ALC883_DIGOUT_NID,
8746 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8747 .channel_mode = alc883_3ST_2ch_modes,
8748 .input_mux = &alc883_capture_source,
8749 .unsol_event = alc_automute_amp_unsol_event,
8750 .init_hook = alc883_acer_aspire_init_hook,
8752 [ALC888_ACER_ASPIRE_4930G] = {
8753 .mixers = { alc888_base_mixer,
8754 alc883_chmode_mixer },
8755 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8756 alc888_acer_aspire_4930g_verbs },
8757 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8758 .dac_nids = alc883_dac_nids,
8759 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8760 .adc_nids = alc883_adc_nids_rev,
8761 .capsrc_nids = alc883_capsrc_nids_rev,
8762 .dig_out_nid = ALC883_DIGOUT_NID,
8763 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8764 .channel_mode = alc883_3ST_6ch_modes,
8767 ARRAY_SIZE(alc888_2_capture_sources),
8768 .input_mux = alc888_2_capture_sources,
8769 .unsol_event = alc_automute_amp_unsol_event,
8770 .init_hook = alc888_acer_aspire_4930g_init_hook,
8772 [ALC888_ACER_ASPIRE_6530G] = {
8773 .mixers = { alc888_acer_aspire_6530_mixer },
8774 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8775 alc888_acer_aspire_6530g_verbs },
8776 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8777 .dac_nids = alc883_dac_nids,
8778 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8779 .adc_nids = alc883_adc_nids_rev,
8780 .capsrc_nids = alc883_capsrc_nids_rev,
8781 .dig_out_nid = ALC883_DIGOUT_NID,
8782 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8783 .channel_mode = alc883_3ST_2ch_modes,
8785 ARRAY_SIZE(alc888_2_capture_sources),
8786 .input_mux = alc888_acer_aspire_6530_sources,
8787 .unsol_event = alc_automute_amp_unsol_event,
8788 .init_hook = alc888_acer_aspire_6530g_init_hook,
8790 [ALC888_ACER_ASPIRE_8930G] = {
8791 .mixers = { alc888_base_mixer,
8792 alc883_chmode_mixer },
8793 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
8794 alc889_acer_aspire_8930g_verbs },
8795 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8796 .dac_nids = alc883_dac_nids,
8797 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
8798 .adc_nids = alc889_adc_nids,
8799 .capsrc_nids = alc889_capsrc_nids,
8800 .dig_out_nid = ALC883_DIGOUT_NID,
8801 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8802 .channel_mode = alc883_3ST_6ch_modes,
8804 .const_channel_count = 6,
8806 ARRAY_SIZE(alc889_capture_sources),
8807 .input_mux = alc889_capture_sources,
8808 .unsol_event = alc_automute_amp_unsol_event,
8809 .init_hook = alc889_acer_aspire_8930g_init_hook,
8812 .mixers = { alc883_fivestack_mixer,
8813 alc883_chmode_mixer },
8814 .init_verbs = { alc883_init_verbs,
8815 alc883_medion_eapd_verbs },
8816 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8817 .dac_nids = alc883_dac_nids,
8818 .adc_nids = alc883_adc_nids_alt,
8819 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8820 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8821 .channel_mode = alc883_sixstack_modes,
8822 .input_mux = &alc883_capture_source,
8824 [ALC883_MEDION_MD2] = {
8825 .mixers = { alc883_medion_md2_mixer},
8826 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
8827 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8828 .dac_nids = alc883_dac_nids,
8829 .dig_out_nid = ALC883_DIGOUT_NID,
8830 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8831 .channel_mode = alc883_3ST_2ch_modes,
8832 .input_mux = &alc883_capture_source,
8833 .unsol_event = alc_automute_amp_unsol_event,
8834 .init_hook = alc883_medion_md2_init_hook,
8836 [ALC883_LAPTOP_EAPD] = {
8837 .mixers = { alc883_base_mixer },
8838 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
8839 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8840 .dac_nids = alc883_dac_nids,
8841 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8842 .channel_mode = alc883_3ST_2ch_modes,
8843 .input_mux = &alc883_capture_source,
8845 [ALC883_CLEVO_M720] = {
8846 .mixers = { alc883_clevo_m720_mixer },
8847 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
8848 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8849 .dac_nids = alc883_dac_nids,
8850 .dig_out_nid = ALC883_DIGOUT_NID,
8851 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8852 .channel_mode = alc883_3ST_2ch_modes,
8853 .input_mux = &alc883_capture_source,
8854 .unsol_event = alc883_clevo_m720_unsol_event,
8855 .init_hook = alc883_clevo_m720_init_hook,
8857 [ALC883_LENOVO_101E_2ch] = {
8858 .mixers = { alc883_lenovo_101e_2ch_mixer},
8859 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
8860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8861 .dac_nids = alc883_dac_nids,
8862 .adc_nids = alc883_adc_nids_alt,
8863 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
8864 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8865 .channel_mode = alc883_3ST_2ch_modes,
8866 .input_mux = &alc883_lenovo_101e_capture_source,
8867 .unsol_event = alc883_lenovo_101e_unsol_event,
8868 .init_hook = alc883_lenovo_101e_all_automute,
8870 [ALC883_LENOVO_NB0763] = {
8871 .mixers = { alc883_lenovo_nb0763_mixer },
8872 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
8873 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8874 .dac_nids = alc883_dac_nids,
8875 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8876 .channel_mode = alc883_3ST_2ch_modes,
8878 .input_mux = &alc883_lenovo_nb0763_capture_source,
8879 .unsol_event = alc_automute_amp_unsol_event,
8880 .init_hook = alc883_medion_md2_init_hook,
8882 [ALC888_LENOVO_MS7195_DIG] = {
8883 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8884 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
8885 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8886 .dac_nids = alc883_dac_nids,
8887 .dig_out_nid = ALC883_DIGOUT_NID,
8888 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8889 .channel_mode = alc883_3ST_6ch_modes,
8891 .input_mux = &alc883_capture_source,
8892 .unsol_event = alc883_lenovo_ms7195_unsol_event,
8893 .init_hook = alc888_lenovo_ms7195_front_automute,
8895 [ALC883_HAIER_W66] = {
8896 .mixers = { alc883_targa_2ch_mixer},
8897 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
8898 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8899 .dac_nids = alc883_dac_nids,
8900 .dig_out_nid = ALC883_DIGOUT_NID,
8901 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8902 .channel_mode = alc883_3ST_2ch_modes,
8903 .input_mux = &alc883_capture_source,
8904 .unsol_event = alc_automute_amp_unsol_event,
8905 .init_hook = alc883_haier_w66_init_hook,
8908 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8909 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
8910 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8911 .dac_nids = alc883_dac_nids,
8912 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
8913 .channel_mode = alc888_3st_hp_modes,
8915 .input_mux = &alc883_capture_source,
8916 .unsol_event = alc_automute_amp_unsol_event,
8917 .init_hook = alc888_3st_hp_init_hook,
8919 [ALC888_6ST_DELL] = {
8920 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
8921 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
8922 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8923 .dac_nids = alc883_dac_nids,
8924 .dig_out_nid = ALC883_DIGOUT_NID,
8925 .dig_in_nid = ALC883_DIGIN_NID,
8926 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8927 .channel_mode = alc883_sixstack_modes,
8928 .input_mux = &alc883_capture_source,
8929 .unsol_event = alc_automute_amp_unsol_event,
8930 .init_hook = alc888_6st_dell_init_hook,
8933 .mixers = { alc883_mitac_mixer },
8934 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
8935 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8936 .dac_nids = alc883_dac_nids,
8937 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8938 .channel_mode = alc883_3ST_2ch_modes,
8939 .input_mux = &alc883_capture_source,
8940 .unsol_event = alc_automute_amp_unsol_event,
8941 .init_hook = alc883_mitac_init_hook,
8943 [ALC883_FUJITSU_PI2515] = {
8944 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
8945 .init_verbs = { alc883_init_verbs,
8946 alc883_2ch_fujitsu_pi2515_verbs},
8947 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8948 .dac_nids = alc883_dac_nids,
8949 .dig_out_nid = ALC883_DIGOUT_NID,
8950 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
8951 .channel_mode = alc883_3ST_2ch_modes,
8952 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8953 .unsol_event = alc_automute_amp_unsol_event,
8954 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
8956 [ALC888_FUJITSU_XA3530] = {
8957 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
8958 .init_verbs = { alc883_init_verbs,
8959 alc888_fujitsu_xa3530_verbs },
8960 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8961 .dac_nids = alc883_dac_nids,
8962 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
8963 .adc_nids = alc883_adc_nids_rev,
8964 .capsrc_nids = alc883_capsrc_nids_rev,
8965 .dig_out_nid = ALC883_DIGOUT_NID,
8966 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
8967 .channel_mode = alc888_4ST_8ch_intel_modes,
8969 ARRAY_SIZE(alc888_2_capture_sources),
8970 .input_mux = alc888_2_capture_sources,
8971 .unsol_event = alc_automute_amp_unsol_event,
8972 .init_hook = alc888_fujitsu_xa3530_init_hook,
8974 [ALC888_LENOVO_SKY] = {
8975 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
8976 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
8977 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8978 .dac_nids = alc883_dac_nids,
8979 .dig_out_nid = ALC883_DIGOUT_NID,
8980 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
8981 .channel_mode = alc883_sixstack_modes,
8983 .input_mux = &alc883_lenovo_sky_capture_source,
8984 .unsol_event = alc_automute_amp_unsol_event,
8985 .init_hook = alc888_lenovo_sky_init_hook,
8987 [ALC888_ASUS_M90V] = {
8988 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
8989 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
8990 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
8991 .dac_nids = alc883_dac_nids,
8992 .dig_out_nid = ALC883_DIGOUT_NID,
8993 .dig_in_nid = ALC883_DIGIN_NID,
8994 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
8995 .channel_mode = alc883_3ST_6ch_modes,
8997 .input_mux = &alc883_fujitsu_pi2515_capture_source,
8998 .unsol_event = alc883_mode2_unsol_event,
8999 .init_hook = alc883_mode2_inithook,
9001 [ALC888_ASUS_EEE1601] = {
9002 .mixers = { alc883_asus_eee1601_mixer },
9003 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9004 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9005 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9006 .dac_nids = alc883_dac_nids,
9007 .dig_out_nid = ALC883_DIGOUT_NID,
9008 .dig_in_nid = ALC883_DIGIN_NID,
9009 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9010 .channel_mode = alc883_3ST_2ch_modes,
9012 .input_mux = &alc883_asus_eee1601_capture_source,
9013 .unsol_event = alc_sku_unsol_event,
9014 .init_hook = alc883_eee1601_inithook,
9016 [ALC1200_ASUS_P5Q] = {
9017 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9018 .init_verbs = { alc883_init_verbs },
9019 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9020 .dac_nids = alc883_dac_nids,
9021 .dig_out_nid = ALC1200_DIGOUT_NID,
9022 .dig_in_nid = ALC883_DIGIN_NID,
9023 .slave_dig_outs = alc1200_slave_dig_outs,
9024 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9025 .channel_mode = alc883_sixstack_modes,
9026 .input_mux = &alc883_capture_source,
9029 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9030 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9031 alc880_gpio1_init_verbs },
9032 .adc_nids = alc883_adc_nids,
9033 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9034 .dac_nids = alc883_dac_nids,
9035 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9036 .channel_mode = alc889A_mb31_6ch_modes,
9037 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9038 .input_mux = &alc889A_mb31_capture_source,
9039 .dig_out_nid = ALC883_DIGOUT_NID,
9040 .unsol_event = alc889A_mb31_unsol_event,
9041 .init_hook = alc889A_mb31_automute,
9043 [ALC883_SONY_VAIO_TT] = {
9044 .mixers = { alc883_vaiott_mixer },
9045 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9046 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9047 .dac_nids = alc883_dac_nids,
9048 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9049 .channel_mode = alc883_3ST_2ch_modes,
9050 .input_mux = &alc883_capture_source,
9051 .unsol_event = alc_automute_amp_unsol_event,
9052 .init_hook = alc883_vaiott_init_hook,
9061 PINFIX_ABIT_AW9D_MAX
9064 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9065 { 0x15, 0x01080104 }, /* side */
9066 { 0x16, 0x01011012 }, /* rear */
9067 { 0x17, 0x01016011 }, /* clfe */
9071 static const struct alc_pincfg *alc882_pin_fixes[] = {
9072 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
9075 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
9076 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9081 * BIOS auto configuration
9083 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9084 hda_nid_t nid, int pin_type,
9088 struct alc_spec *spec = codec->spec;
9091 alc_set_pin_output(codec, nid, pin_type);
9092 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9095 idx = spec->multiout.dac_nids[dac_idx] - 2;
9096 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9100 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9102 struct alc_spec *spec = codec->spec;
9105 for (i = 0; i <= HDA_SIDE; i++) {
9106 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9107 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9109 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9114 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9116 struct alc_spec *spec = codec->spec;
9119 pin = spec->autocfg.hp_pins[0];
9120 if (pin) /* connect to front */
9122 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9123 pin = spec->autocfg.speaker_pins[0];
9125 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9128 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9130 struct alc_spec *spec = codec->spec;
9133 for (i = 0; i < AUTO_PIN_LAST; i++) {
9134 hda_nid_t nid = spec->autocfg.input_pins[i];
9137 alc_set_input_pin(codec, nid, i);
9138 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9139 snd_hda_codec_write(codec, nid, 0,
9140 AC_VERB_SET_AMP_GAIN_MUTE,
9145 static void alc882_auto_init_input_src(struct hda_codec *codec)
9147 struct alc_spec *spec = codec->spec;
9150 for (c = 0; c < spec->num_adc_nids; c++) {
9151 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9152 hda_nid_t nid = spec->capsrc_nids[c];
9153 unsigned int mux_idx;
9154 const struct hda_input_mux *imux;
9155 int conns, mute, idx, item;
9157 conns = snd_hda_get_connections(codec, nid, conn_list,
9158 ARRAY_SIZE(conn_list));
9161 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9162 imux = &spec->input_mux[mux_idx];
9163 for (idx = 0; idx < conns; idx++) {
9164 /* if the current connection is the selected one,
9165 * unmute it as default - otherwise mute it
9167 mute = AMP_IN_MUTE(idx);
9168 for (item = 0; item < imux->num_items; item++) {
9169 if (imux->items[item].index == idx) {
9170 if (spec->cur_mux[c] == item)
9171 mute = AMP_IN_UNMUTE(idx);
9175 /* check if we have a selector or mixer
9176 * we could check for the widget type instead, but
9177 * just check for Amp-In presence (in case of mixer
9178 * without amp-in there is something wrong, this
9179 * function shouldn't be used or capsrc nid is wrong)
9181 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9182 snd_hda_codec_write(codec, nid, 0,
9183 AC_VERB_SET_AMP_GAIN_MUTE,
9185 else if (mute != AMP_IN_MUTE(idx))
9186 snd_hda_codec_write(codec, nid, 0,
9187 AC_VERB_SET_CONNECT_SEL,
9193 /* add mic boosts if needed */
9194 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9196 struct alc_spec *spec = codec->spec;
9200 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9201 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9202 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9204 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9208 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9209 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9210 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9212 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9219 /* almost identical with ALC880 parser... */
9220 static int alc882_parse_auto_config(struct hda_codec *codec)
9222 struct alc_spec *spec = codec->spec;
9223 struct auto_pin_cfg *autocfg = &spec->autocfg;
9226 int err = alc880_parse_auto_config(codec);
9231 return 0; /* no config found */
9233 err = alc_auto_add_mic_boost(codec);
9237 /* hack - override the init verbs */
9238 spec->init_verbs[0] = alc883_auto_init_verbs;
9239 /* if ADC 0x07 is available, initialize it, too */
9240 wcap = get_wcaps(codec, 0x07);
9241 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9242 if (wcap == AC_WID_AUD_IN)
9243 add_verb(spec, alc882_adc1_init_verbs);
9245 /* digital-mic input pin is excluded in alc880_auto_create..()
9246 * because it's under 0x18
9248 if (autocfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9249 autocfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9250 struct hda_input_mux *imux = &spec->private_imux[0];
9251 for (i = 1; i < 3; i++)
9252 memcpy(&spec->private_imux[i],
9253 &spec->private_imux[0],
9254 sizeof(spec->private_imux[0]));
9255 imux->items[imux->num_items].label = "Int DMic";
9256 imux->items[imux->num_items].index = 0x0b;
9258 spec->num_mux_defs = 3;
9259 spec->input_mux = spec->private_imux;
9262 return 1; /* config found */
9265 /* additional initialization for auto-configuration model */
9266 static void alc882_auto_init(struct hda_codec *codec)
9268 struct alc_spec *spec = codec->spec;
9269 alc882_auto_init_multi_out(codec);
9270 alc882_auto_init_hp_out(codec);
9271 alc882_auto_init_analog_input(codec);
9272 alc882_auto_init_input_src(codec);
9273 if (spec->unsol_event)
9274 alc_inithook(codec);
9277 static int patch_alc882(struct hda_codec *codec)
9279 struct alc_spec *spec;
9280 int err, board_config;
9282 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9288 switch (codec->vendor_id) {
9293 /* ALC883 and variants */
9294 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9298 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
9302 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
9303 board_config = snd_hda_check_board_codec_sid_config(codec,
9304 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
9306 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
9307 printk(KERN_INFO "hda_codec: Unknown model for %s, "
9308 "trying auto-probe from BIOS...\n",
9310 board_config = ALC882_AUTO;
9313 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
9315 if (board_config == ALC882_AUTO) {
9316 /* automatic parse from the BIOS config */
9317 err = alc882_parse_auto_config(codec);
9323 "hda_codec: Cannot set up configuration "
9324 "from BIOS. Using base mode...\n");
9325 board_config = ALC882_3ST_DIG;
9329 err = snd_hda_attach_beep_device(codec, 0x1);
9335 if (board_config != ALC882_AUTO)
9336 setup_preset(spec, &alc882_presets[board_config]);
9338 spec->stream_analog_playback = &alc882_pcm_analog_playback;
9339 spec->stream_analog_capture = &alc882_pcm_analog_capture;
9340 /* FIXME: setup DAC5 */
9341 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
9342 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
9344 spec->stream_digital_playback = &alc882_pcm_digital_playback;
9345 spec->stream_digital_capture = &alc882_pcm_digital_capture;
9347 if (codec->vendor_id == 0x10ec0888)
9348 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9350 if (!spec->adc_nids && spec->input_mux) {
9352 spec->num_adc_nids = 0;
9353 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
9355 hda_nid_t nid = alc882_adc_nids[i];
9356 unsigned int wcap = get_wcaps(codec, nid);
9358 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
9359 if (wcap != AC_WID_AUD_IN)
9361 spec->private_adc_nids[spec->num_adc_nids] = nid;
9362 err = snd_hda_get_connections(codec, nid, &cap, 1);
9365 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
9366 spec->num_adc_nids++;
9368 spec->adc_nids = spec->private_adc_nids;
9369 spec->capsrc_nids = spec->private_capsrc_nids;
9372 set_capture_mixer(spec);
9373 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9375 spec->vmaster_nid = 0x0c;
9377 codec->patch_ops = alc_patch_ops;
9378 if (board_config == ALC882_AUTO)
9379 spec->init_hook = alc882_auto_init;
9380 #ifdef CONFIG_SND_HDA_POWER_SAVE
9381 if (!spec->loopback.amplist)
9382 spec->loopback.amplist = alc882_loopbacks;
9384 codec->proc_widget_hook = print_realtek_coef;
9394 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9395 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9397 #define alc262_dac_nids alc260_dac_nids
9398 #define alc262_adc_nids alc882_adc_nids
9399 #define alc262_adc_nids_alt alc882_adc_nids_alt
9400 #define alc262_capsrc_nids alc882_capsrc_nids
9401 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9403 #define alc262_modes alc260_modes
9404 #define alc262_capture_source alc882_capture_source
9406 static hda_nid_t alc262_dmic_adc_nids[1] = {
9411 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9413 static struct snd_kcontrol_new alc262_base_mixer[] = {
9414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9415 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9416 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9417 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9418 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9419 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9421 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9422 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9423 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9424 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9425 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9426 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9427 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9428 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9429 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9433 /* update HP, line and mono-out pins according to the master switch */
9434 static void alc262_hp_master_update(struct hda_codec *codec)
9436 struct alc_spec *spec = codec->spec;
9437 int val = spec->master_sw;
9440 snd_hda_codec_write_cache(codec, 0x1b, 0,
9441 AC_VERB_SET_PIN_WIDGET_CONTROL,
9443 snd_hda_codec_write_cache(codec, 0x15, 0,
9444 AC_VERB_SET_PIN_WIDGET_CONTROL,
9446 /* mono (speaker) depending on the HP jack sense */
9447 val = val && !spec->jack_present;
9448 snd_hda_codec_write_cache(codec, 0x16, 0,
9449 AC_VERB_SET_PIN_WIDGET_CONTROL,
9453 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9455 struct alc_spec *spec = codec->spec;
9456 unsigned int presence;
9457 presence = snd_hda_codec_read(codec, 0x1b, 0,
9458 AC_VERB_GET_PIN_SENSE, 0);
9459 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9460 alc262_hp_master_update(codec);
9463 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9465 if ((res >> 26) != ALC880_HP_EVENT)
9467 alc262_hp_bpc_automute(codec);
9470 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9472 struct alc_spec *spec = codec->spec;
9473 unsigned int presence;
9474 presence = snd_hda_codec_read(codec, 0x15, 0,
9475 AC_VERB_GET_PIN_SENSE, 0);
9476 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9477 alc262_hp_master_update(codec);
9480 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9483 if ((res >> 26) != ALC880_HP_EVENT)
9485 alc262_hp_wildwest_automute(codec);
9488 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9490 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9491 struct snd_ctl_elem_value *ucontrol)
9493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9494 struct alc_spec *spec = codec->spec;
9495 int val = !!*ucontrol->value.integer.value;
9497 if (val == spec->master_sw)
9499 spec->master_sw = val;
9500 alc262_hp_master_update(codec);
9504 #define ALC262_HP_MASTER_SWITCH \
9506 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9507 .name = "Master Playback Switch", \
9508 .info = snd_ctl_boolean_mono_info, \
9509 .get = alc262_hp_master_sw_get, \
9510 .put = alc262_hp_master_sw_put, \
9513 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9514 ALC262_HP_MASTER_SWITCH,
9515 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9516 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9518 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9520 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9522 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9523 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9524 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9525 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9527 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9528 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9529 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9530 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9531 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9532 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9533 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9537 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9538 ALC262_HP_MASTER_SWITCH,
9539 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9540 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9541 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9542 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9543 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9545 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9549 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9550 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9551 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9552 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9553 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9557 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9558 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9559 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9560 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9564 /* mute/unmute internal speaker according to the hp jack and mute state */
9565 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9567 struct alc_spec *spec = codec->spec;
9569 spec->autocfg.hp_pins[0] = 0x15;
9570 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9571 alc_automute_amp(codec);
9574 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9575 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9576 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9577 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9578 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9581 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9585 static struct hda_verb alc262_hp_t5735_verbs[] = {
9586 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9589 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9593 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9594 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9595 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9596 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9597 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9598 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9599 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9603 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9605 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9606 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9607 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9608 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9609 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9617 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9624 /* bind hp and internal speaker mute (with plug check) as master switch */
9625 static void alc262_hippo_master_update(struct hda_codec *codec)
9627 struct alc_spec *spec = codec->spec;
9628 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9629 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
9630 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
9634 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
9635 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
9636 HDA_AMP_MUTE, mute);
9637 /* mute internal speaker per jack sense */
9638 if (spec->jack_present)
9639 mute = HDA_AMP_MUTE;
9641 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
9642 HDA_AMP_MUTE, mute);
9643 if (speaker_nid && speaker_nid != line_nid)
9644 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
9645 HDA_AMP_MUTE, mute);
9648 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
9650 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
9651 struct snd_ctl_elem_value *ucontrol)
9653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9654 struct alc_spec *spec = codec->spec;
9655 int val = !!*ucontrol->value.integer.value;
9657 if (val == spec->master_sw)
9659 spec->master_sw = val;
9660 alc262_hippo_master_update(codec);
9664 #define ALC262_HIPPO_MASTER_SWITCH \
9666 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9667 .name = "Master Playback Switch", \
9668 .info = snd_ctl_boolean_mono_info, \
9669 .get = alc262_hippo_master_sw_get, \
9670 .put = alc262_hippo_master_sw_put, \
9673 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
9674 ALC262_HIPPO_MASTER_SWITCH,
9675 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9676 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9677 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9678 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9679 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9680 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9681 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9682 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9683 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9684 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9685 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9686 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9690 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
9691 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9692 ALC262_HIPPO_MASTER_SWITCH,
9693 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9694 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9695 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9696 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9698 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9699 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9700 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9702 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9706 /* mute/unmute internal speaker according to the hp jack and mute state */
9707 static void alc262_hippo_automute(struct hda_codec *codec)
9709 struct alc_spec *spec = codec->spec;
9710 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9711 unsigned int present;
9713 /* need to execute and sync at first */
9714 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
9715 present = snd_hda_codec_read(codec, hp_nid, 0,
9716 AC_VERB_GET_PIN_SENSE, 0);
9717 spec->jack_present = (present & 0x80000000) != 0;
9718 alc262_hippo_master_update(codec);
9721 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
9723 if ((res >> 26) != ALC880_HP_EVENT)
9725 alc262_hippo_automute(codec);
9728 static void alc262_hippo_init_hook(struct hda_codec *codec)
9730 struct alc_spec *spec = codec->spec;
9732 spec->autocfg.hp_pins[0] = 0x15;
9733 spec->autocfg.speaker_pins[0] = 0x14;
9734 alc262_hippo_automute(codec);
9737 static void alc262_hippo1_init_hook(struct hda_codec *codec)
9739 struct alc_spec *spec = codec->spec;
9741 spec->autocfg.hp_pins[0] = 0x1b;
9742 spec->autocfg.speaker_pins[0] = 0x14;
9743 alc262_hippo_automute(codec);
9747 static struct snd_kcontrol_new alc262_sony_mixer[] = {
9748 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9749 ALC262_HIPPO_MASTER_SWITCH,
9750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9752 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9753 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9757 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
9758 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9759 ALC262_HIPPO_MASTER_SWITCH,
9760 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9761 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9762 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9763 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9764 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9768 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
9769 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9770 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
9771 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
9772 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
9773 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9774 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9775 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9776 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9777 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9778 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9779 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9780 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9784 static struct hda_verb alc262_tyan_verbs[] = {
9785 /* Headphone automute */
9786 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9790 /* P11 AUX_IN, white 4-pin connector */
9791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9792 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
9793 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
9794 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
9799 /* unsolicited event for HP jack sensing */
9800 static void alc262_tyan_init_hook(struct hda_codec *codec)
9802 struct alc_spec *spec = codec->spec;
9804 spec->autocfg.hp_pins[0] = 0x1b;
9805 spec->autocfg.speaker_pins[0] = 0x15;
9806 alc_automute_amp(codec);
9810 #define alc262_capture_mixer alc882_capture_mixer
9811 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
9814 * generic initialization of ADC, input mixers and output mixers
9816 static struct hda_verb alc262_init_verbs[] = {
9818 * Unmute ADC0-2 and set the default input to mic-in
9820 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
9821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9822 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
9823 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9824 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
9825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9827 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
9829 * Note: PASD motherboards uses the Line In 2 as the input for
9830 * front panel mic (mic 2)
9832 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
9833 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9834 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9835 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
9836 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
9837 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
9840 * Set up output mixers (0x0c - 0x0e)
9842 /* set vol=0 to output mixers */
9843 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9844 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
9846 /* set up input amps for analog loopback */
9847 /* Amp Indices: DAC = 0, mixer = 1 */
9848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9850 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9851 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9852 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9853 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9855 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9856 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9857 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
9858 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9859 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9860 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
9862 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9863 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9864 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9865 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9866 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9868 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9869 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9871 /* FIXME: use matrix-type input source selection */
9872 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
9873 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
9874 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9875 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9876 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9877 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9879 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9880 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
9885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
9886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
9887 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
9892 static struct hda_verb alc262_eapd_verbs[] = {
9893 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9894 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
9898 static struct hda_verb alc262_hippo_unsol_verbs[] = {
9899 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9904 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
9905 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9906 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9907 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
9909 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9910 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9914 static struct hda_verb alc262_sony_unsol_verbs[] = {
9915 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
9916 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9917 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
9919 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9920 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9924 static struct hda_input_mux alc262_dmic_capture_source = {
9927 { "Int DMic", 0x9 },
9932 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
9933 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9934 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9935 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9937 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9941 static struct hda_verb alc262_toshiba_s06_verbs[] = {
9942 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9943 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9944 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9945 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9946 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
9947 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9948 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
9949 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
9953 static void alc262_dmic_automute(struct hda_codec *codec)
9955 unsigned int present;
9957 present = snd_hda_codec_read(codec, 0x18, 0,
9958 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9959 snd_hda_codec_write(codec, 0x22, 0,
9960 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
9964 /* unsolicited event for HP jack sensing */
9965 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
9968 if ((res >> 26) == ALC880_MIC_EVENT)
9969 alc262_dmic_automute(codec);
9971 alc_sku_unsol_event(codec, res);
9974 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
9976 struct alc_spec *spec = codec->spec;
9978 spec->autocfg.hp_pins[0] = 0x15;
9979 spec->autocfg.speaker_pins[0] = 0x14;
9980 alc_automute_pin(codec);
9981 alc262_dmic_automute(codec);
9987 * 0x16 = internal speaker
9988 * 0x18 = external mic
9991 static struct snd_kcontrol_new alc262_nec_mixer[] = {
9992 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
9993 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
9995 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9996 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9997 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9999 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10000 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10004 static struct hda_verb alc262_nec_verbs[] = {
10005 /* Unmute Speaker */
10006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10012 /* External mic to headphone */
10013 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10014 /* External mic to speaker */
10015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10021 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10022 * 0x1b = port replicator headphone out
10025 #define ALC_HP_EVENT 0x37
10027 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10028 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10030 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10035 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10036 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10037 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10041 static struct hda_input_mux alc262_fujitsu_capture_source = {
10045 { "Int Mic", 0x1 },
10050 static struct hda_input_mux alc262_HP_capture_source = {
10054 { "Front Mic", 0x1 },
10061 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10065 { "Front Mic", 0x2 },
10071 /* mute/unmute internal speaker according to the hp jacks and mute state */
10072 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10074 struct alc_spec *spec = codec->spec;
10077 if (force || !spec->sense_updated) {
10078 unsigned int present;
10079 /* need to execute and sync at first */
10080 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10081 /* check laptop HP jack */
10082 present = snd_hda_codec_read(codec, 0x14, 0,
10083 AC_VERB_GET_PIN_SENSE, 0);
10084 /* need to execute and sync at first */
10085 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10086 /* check docking HP jack */
10087 present |= snd_hda_codec_read(codec, 0x1b, 0,
10088 AC_VERB_GET_PIN_SENSE, 0);
10089 if (present & AC_PINSENSE_PRESENCE)
10090 spec->jack_present = 1;
10092 spec->jack_present = 0;
10093 spec->sense_updated = 1;
10095 /* unmute internal speaker only if both HPs are unplugged and
10096 * master switch is on
10098 if (spec->jack_present)
10099 mute = HDA_AMP_MUTE;
10101 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10102 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10103 HDA_AMP_MUTE, mute);
10106 /* unsolicited event for HP jack sensing */
10107 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10110 if ((res >> 26) != ALC_HP_EVENT)
10112 alc262_fujitsu_automute(codec, 1);
10115 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10117 alc262_fujitsu_automute(codec, 1);
10120 /* bind volumes of both NID 0x0c and 0x0d */
10121 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10122 .ops = &snd_hda_bind_vol,
10124 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10125 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10130 /* mute/unmute internal speaker according to the hp jack and mute state */
10131 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10133 struct alc_spec *spec = codec->spec;
10136 if (force || !spec->sense_updated) {
10137 unsigned int present_int_hp;
10138 /* need to execute and sync at first */
10139 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10140 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10141 AC_VERB_GET_PIN_SENSE, 0);
10142 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10143 spec->sense_updated = 1;
10145 if (spec->jack_present) {
10146 /* mute internal speaker */
10147 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10148 HDA_AMP_MUTE, HDA_AMP_MUTE);
10149 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10150 HDA_AMP_MUTE, HDA_AMP_MUTE);
10152 /* unmute internal speaker if necessary */
10153 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10154 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10155 HDA_AMP_MUTE, mute);
10156 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10157 HDA_AMP_MUTE, mute);
10161 /* unsolicited event for HP jack sensing */
10162 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10165 if ((res >> 26) != ALC_HP_EVENT)
10167 alc262_lenovo_3000_automute(codec, 1);
10170 /* bind hp and internal speaker mute (with plug check) */
10171 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10172 struct snd_ctl_elem_value *ucontrol)
10174 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10175 long *valp = ucontrol->value.integer.value;
10178 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10180 valp ? 0 : HDA_AMP_MUTE);
10181 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10183 valp ? 0 : HDA_AMP_MUTE);
10186 alc262_fujitsu_automute(codec, 0);
10190 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10191 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10194 .name = "Master Playback Switch",
10195 .info = snd_hda_mixer_amp_switch_info,
10196 .get = snd_hda_mixer_amp_switch_get,
10197 .put = alc262_fujitsu_master_sw_put,
10198 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10205 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10206 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10207 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10211 /* bind hp and internal speaker mute (with plug check) */
10212 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10213 struct snd_ctl_elem_value *ucontrol)
10215 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10216 long *valp = ucontrol->value.integer.value;
10219 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10221 valp ? 0 : HDA_AMP_MUTE);
10224 alc262_lenovo_3000_automute(codec, 0);
10228 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10229 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10231 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10232 .name = "Master Playback Switch",
10233 .info = snd_hda_mixer_amp_switch_info,
10234 .get = snd_hda_mixer_amp_switch_get,
10235 .put = alc262_lenovo_3000_master_sw_put,
10236 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10240 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10243 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10244 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10245 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10249 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10250 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10251 ALC262_HIPPO_MASTER_SWITCH,
10252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10256 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10257 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10261 /* additional init verbs for Benq laptops */
10262 static struct hda_verb alc262_EAPD_verbs[] = {
10263 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10264 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10268 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10269 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10270 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10272 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10273 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10277 /* Samsung Q1 Ultra Vista model setup */
10278 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10279 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10280 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10281 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10282 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10283 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10284 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10288 static struct hda_verb alc262_ultra_verbs[] = {
10290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10295 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10296 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10297 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10302 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10305 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10307 /* ADC, choose mic */
10308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10309 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10310 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10311 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10316 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10321 /* mute/unmute internal speaker according to the hp jack and mute state */
10322 static void alc262_ultra_automute(struct hda_codec *codec)
10324 struct alc_spec *spec = codec->spec;
10328 /* auto-mute only when HP is used as HP */
10329 if (!spec->cur_mux[0]) {
10330 unsigned int present;
10331 /* need to execute and sync at first */
10332 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10333 present = snd_hda_codec_read(codec, 0x15, 0,
10334 AC_VERB_GET_PIN_SENSE, 0);
10335 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10336 if (spec->jack_present)
10337 mute = HDA_AMP_MUTE;
10339 /* mute/unmute internal speaker */
10340 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10341 HDA_AMP_MUTE, mute);
10342 /* mute/unmute HP */
10343 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10344 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10347 /* unsolicited event for HP jack sensing */
10348 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10351 if ((res >> 26) != ALC880_HP_EVENT)
10353 alc262_ultra_automute(codec);
10356 static struct hda_input_mux alc262_ultra_capture_source = {
10360 { "Headphone", 0x7 },
10364 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10365 struct snd_ctl_elem_value *ucontrol)
10367 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10368 struct alc_spec *spec = codec->spec;
10371 ret = alc_mux_enum_put(kcontrol, ucontrol);
10374 /* reprogram the HP pin as mic or HP according to the input source */
10375 snd_hda_codec_write_cache(codec, 0x15, 0,
10376 AC_VERB_SET_PIN_WIDGET_CONTROL,
10377 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10378 alc262_ultra_automute(codec); /* mute/unmute HP */
10382 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10383 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10384 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10387 .name = "Capture Source",
10388 .info = alc_mux_enum_info,
10389 .get = alc_mux_enum_get,
10390 .put = alc262_ultra_mux_enum_put,
10395 /* add playback controls from the parsed DAC table */
10396 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10397 const struct auto_pin_cfg *cfg)
10402 spec->multiout.num_dacs = 1; /* only use one dac */
10403 spec->multiout.dac_nids = spec->private_dac_nids;
10404 spec->multiout.dac_nids[0] = 2;
10406 nid = cfg->line_out_pins[0];
10408 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10409 "Front Playback Volume",
10410 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10413 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10414 "Front Playback Switch",
10415 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10420 nid = cfg->speaker_pins[0];
10423 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10424 "Speaker Playback Volume",
10425 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10429 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10430 "Speaker Playback Switch",
10431 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10436 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10437 "Speaker Playback Switch",
10438 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10444 nid = cfg->hp_pins[0];
10446 /* spec->multiout.hp_nid = 2; */
10448 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10449 "Headphone Playback Volume",
10450 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10454 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10455 "Headphone Playback Switch",
10456 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10461 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10462 "Headphone Playback Switch",
10463 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10472 static int alc262_auto_create_analog_input_ctls(struct alc_spec *spec,
10473 const struct auto_pin_cfg *cfg)
10477 err = alc880_auto_create_analog_input_ctls(spec, cfg);
10480 /* digital-mic input pin is excluded in alc880_auto_create..()
10481 * because it's under 0x18
10483 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
10484 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
10485 struct hda_input_mux *imux = &spec->private_imux[0];
10486 imux->items[imux->num_items].label = "Int Mic";
10487 imux->items[imux->num_items].index = 0x09;
10495 * generic initialization of ADC, input mixers and output mixers
10497 static struct hda_verb alc262_volume_init_verbs[] = {
10499 * Unmute ADC0-2 and set the default input to mic-in
10501 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10502 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10503 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10505 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10508 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10510 * Note: PASD motherboards uses the Line In 2 as the input for
10511 * front panel mic (mic 2)
10513 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10518 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10521 * Set up output mixers (0x0c - 0x0f)
10523 /* set vol=0 to output mixers */
10524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10525 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10528 /* set up input amps for analog loopback */
10529 /* Amp Indices: DAC = 0, mixer = 1 */
10530 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10531 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10532 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10533 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10534 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10535 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10537 /* FIXME: use matrix-type input source selection */
10538 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10539 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10558 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10560 * Unmute ADC0-2 and set the default input to mic-in
10562 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10563 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10564 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10565 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10566 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10567 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10569 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10571 * Note: PASD motherboards uses the Line In 2 as the input for
10572 * front panel mic (mic 2)
10574 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10584 * Set up output mixers (0x0c - 0x0e)
10586 /* set vol=0 to output mixers */
10587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10588 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10591 /* set up input amps for analog loopback */
10592 /* Amp Indices: DAC = 0, mixer = 1 */
10593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10594 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10596 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10598 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10600 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10602 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10604 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10607 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10608 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10610 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10611 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10612 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10613 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10614 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10616 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10617 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10618 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10619 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10620 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10621 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10624 /* FIXME: use matrix-type input source selection */
10625 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10626 /* Input mixer1: only unmute Mic */
10627 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10629 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10630 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10631 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10632 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10633 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10634 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10635 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10637 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10657 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10662 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
10664 * Unmute ADC0-2 and set the default input to mic-in
10666 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10668 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10669 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10670 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10671 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10673 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10675 * Note: PASD motherboards uses the Line In 2 as the input for front
10676 * panel mic (mic 2)
10678 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10679 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10680 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10681 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10682 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10683 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10688 * Set up output mixers (0x0c - 0x0e)
10690 /* set vol=0 to output mixers */
10691 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10692 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10693 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10695 /* set up input amps for analog loopback */
10696 /* Amp Indices: DAC = 0, mixer = 1 */
10697 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10699 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10701 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10705 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
10706 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
10707 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
10708 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
10709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
10711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
10713 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10716 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10719 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
10720 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10722 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
10723 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10724 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10726 /* FIXME: use matrix-type input source selection */
10727 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10728 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10729 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
10730 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
10731 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
10732 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
10733 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
10734 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10735 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
10737 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10738 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10739 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10740 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10742 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10743 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10745 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10747 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
10748 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
10749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
10750 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
10751 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
10753 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10758 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
10760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
10761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10762 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
10764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
10765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
10766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10767 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
10769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
10770 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10771 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10776 #ifdef CONFIG_SND_HDA_POWER_SAVE
10777 #define alc262_loopbacks alc880_loopbacks
10780 /* pcm configuration: identical with ALC880 */
10781 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
10782 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
10783 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
10784 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
10787 * BIOS auto configuration
10789 static int alc262_parse_auto_config(struct hda_codec *codec)
10791 struct alc_spec *spec = codec->spec;
10793 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
10795 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10799 if (!spec->autocfg.line_outs) {
10800 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
10801 spec->multiout.max_channels = 2;
10802 spec->no_analog = 1;
10805 return 0; /* can't find valid BIOS pin config */
10807 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
10810 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
10814 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10817 if (spec->autocfg.dig_outs) {
10818 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
10819 spec->dig_out_type = spec->autocfg.dig_out_type[0];
10821 if (spec->autocfg.dig_in_pin)
10822 spec->dig_in_nid = ALC262_DIGIN_NID;
10824 if (spec->kctls.list)
10825 add_mixer(spec, spec->kctls.list);
10827 add_verb(spec, alc262_volume_init_verbs);
10828 spec->num_mux_defs = 1;
10829 spec->input_mux = &spec->private_imux[0];
10831 err = alc_auto_add_mic_boost(codec);
10835 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
10840 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
10841 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
10842 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
10843 #define alc262_auto_init_input_src alc882_auto_init_input_src
10846 /* init callback for auto-configuration model -- overriding the default init */
10847 static void alc262_auto_init(struct hda_codec *codec)
10849 struct alc_spec *spec = codec->spec;
10850 alc262_auto_init_multi_out(codec);
10851 alc262_auto_init_hp_out(codec);
10852 alc262_auto_init_analog_input(codec);
10853 alc262_auto_init_input_src(codec);
10854 if (spec->unsol_event)
10855 alc_inithook(codec);
10859 * configuration and preset
10861 static const char *alc262_models[ALC262_MODEL_LAST] = {
10862 [ALC262_BASIC] = "basic",
10863 [ALC262_HIPPO] = "hippo",
10864 [ALC262_HIPPO_1] = "hippo_1",
10865 [ALC262_FUJITSU] = "fujitsu",
10866 [ALC262_HP_BPC] = "hp-bpc",
10867 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
10868 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
10869 [ALC262_HP_RP5700] = "hp-rp5700",
10870 [ALC262_BENQ_ED8] = "benq",
10871 [ALC262_BENQ_T31] = "benq-t31",
10872 [ALC262_SONY_ASSAMD] = "sony-assamd",
10873 [ALC262_TOSHIBA_S06] = "toshiba-s06",
10874 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
10875 [ALC262_ULTRA] = "ultra",
10876 [ALC262_LENOVO_3000] = "lenovo-3000",
10877 [ALC262_NEC] = "nec",
10878 [ALC262_TYAN] = "tyan",
10879 [ALC262_AUTO] = "auto",
10882 static struct snd_pci_quirk alc262_cfg_tbl[] = {
10883 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
10884 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
10885 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
10887 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
10889 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
10891 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
10892 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
10893 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
10894 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
10895 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
10896 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
10897 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
10898 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
10899 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
10900 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
10901 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
10902 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
10903 ALC262_HP_TC_T5735),
10904 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
10905 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10906 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
10907 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
10908 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
10909 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
10910 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
10911 ALC262_SONY_ASSAMD),
10912 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
10913 ALC262_TOSHIBA_RX1),
10914 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
10915 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
10916 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
10917 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
10918 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
10920 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
10921 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
10922 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
10923 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
10924 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
10928 static struct alc_config_preset alc262_presets[] = {
10930 .mixers = { alc262_base_mixer },
10931 .init_verbs = { alc262_init_verbs },
10932 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10933 .dac_nids = alc262_dac_nids,
10935 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10936 .channel_mode = alc262_modes,
10937 .input_mux = &alc262_capture_source,
10940 .mixers = { alc262_hippo_mixer },
10941 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
10942 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10943 .dac_nids = alc262_dac_nids,
10945 .dig_out_nid = ALC262_DIGOUT_NID,
10946 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10947 .channel_mode = alc262_modes,
10948 .input_mux = &alc262_capture_source,
10949 .unsol_event = alc262_hippo_unsol_event,
10950 .init_hook = alc262_hippo_init_hook,
10952 [ALC262_HIPPO_1] = {
10953 .mixers = { alc262_hippo1_mixer },
10954 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
10955 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10956 .dac_nids = alc262_dac_nids,
10958 .dig_out_nid = ALC262_DIGOUT_NID,
10959 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10960 .channel_mode = alc262_modes,
10961 .input_mux = &alc262_capture_source,
10962 .unsol_event = alc262_hippo_unsol_event,
10963 .init_hook = alc262_hippo1_init_hook,
10965 [ALC262_FUJITSU] = {
10966 .mixers = { alc262_fujitsu_mixer },
10967 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
10968 alc262_fujitsu_unsol_verbs },
10969 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10970 .dac_nids = alc262_dac_nids,
10972 .dig_out_nid = ALC262_DIGOUT_NID,
10973 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10974 .channel_mode = alc262_modes,
10975 .input_mux = &alc262_fujitsu_capture_source,
10976 .unsol_event = alc262_fujitsu_unsol_event,
10977 .init_hook = alc262_fujitsu_init_hook,
10979 [ALC262_HP_BPC] = {
10980 .mixers = { alc262_HP_BPC_mixer },
10981 .init_verbs = { alc262_HP_BPC_init_verbs },
10982 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10983 .dac_nids = alc262_dac_nids,
10985 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10986 .channel_mode = alc262_modes,
10987 .input_mux = &alc262_HP_capture_source,
10988 .unsol_event = alc262_hp_bpc_unsol_event,
10989 .init_hook = alc262_hp_bpc_automute,
10991 [ALC262_HP_BPC_D7000_WF] = {
10992 .mixers = { alc262_HP_BPC_WildWest_mixer },
10993 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
10994 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
10995 .dac_nids = alc262_dac_nids,
10997 .num_channel_mode = ARRAY_SIZE(alc262_modes),
10998 .channel_mode = alc262_modes,
10999 .input_mux = &alc262_HP_D7000_capture_source,
11000 .unsol_event = alc262_hp_wildwest_unsol_event,
11001 .init_hook = alc262_hp_wildwest_automute,
11003 [ALC262_HP_BPC_D7000_WL] = {
11004 .mixers = { alc262_HP_BPC_WildWest_mixer,
11005 alc262_HP_BPC_WildWest_option_mixer },
11006 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11007 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11008 .dac_nids = alc262_dac_nids,
11010 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11011 .channel_mode = alc262_modes,
11012 .input_mux = &alc262_HP_D7000_capture_source,
11013 .unsol_event = alc262_hp_wildwest_unsol_event,
11014 .init_hook = alc262_hp_wildwest_automute,
11016 [ALC262_HP_TC_T5735] = {
11017 .mixers = { alc262_hp_t5735_mixer },
11018 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11019 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11020 .dac_nids = alc262_dac_nids,
11022 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11023 .channel_mode = alc262_modes,
11024 .input_mux = &alc262_capture_source,
11025 .unsol_event = alc_automute_amp_unsol_event,
11026 .init_hook = alc262_hp_t5735_init_hook,
11028 [ALC262_HP_RP5700] = {
11029 .mixers = { alc262_hp_rp5700_mixer },
11030 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11031 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11032 .dac_nids = alc262_dac_nids,
11033 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11034 .channel_mode = alc262_modes,
11035 .input_mux = &alc262_hp_rp5700_capture_source,
11037 [ALC262_BENQ_ED8] = {
11038 .mixers = { alc262_base_mixer },
11039 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11040 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11041 .dac_nids = alc262_dac_nids,
11043 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11044 .channel_mode = alc262_modes,
11045 .input_mux = &alc262_capture_source,
11047 [ALC262_SONY_ASSAMD] = {
11048 .mixers = { alc262_sony_mixer },
11049 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11050 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11051 .dac_nids = alc262_dac_nids,
11053 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11054 .channel_mode = alc262_modes,
11055 .input_mux = &alc262_capture_source,
11056 .unsol_event = alc262_hippo_unsol_event,
11057 .init_hook = alc262_hippo_init_hook,
11059 [ALC262_BENQ_T31] = {
11060 .mixers = { alc262_benq_t31_mixer },
11061 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11062 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11063 .dac_nids = alc262_dac_nids,
11065 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11066 .channel_mode = alc262_modes,
11067 .input_mux = &alc262_capture_source,
11068 .unsol_event = alc262_hippo_unsol_event,
11069 .init_hook = alc262_hippo_init_hook,
11072 .mixers = { alc262_ultra_mixer },
11073 .cap_mixer = alc262_ultra_capture_mixer,
11074 .init_verbs = { alc262_ultra_verbs },
11075 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11076 .dac_nids = alc262_dac_nids,
11077 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11078 .channel_mode = alc262_modes,
11079 .input_mux = &alc262_ultra_capture_source,
11080 .adc_nids = alc262_adc_nids, /* ADC0 */
11081 .capsrc_nids = alc262_capsrc_nids,
11082 .num_adc_nids = 1, /* single ADC */
11083 .unsol_event = alc262_ultra_unsol_event,
11084 .init_hook = alc262_ultra_automute,
11086 [ALC262_LENOVO_3000] = {
11087 .mixers = { alc262_lenovo_3000_mixer },
11088 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11089 alc262_lenovo_3000_unsol_verbs },
11090 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11091 .dac_nids = alc262_dac_nids,
11093 .dig_out_nid = ALC262_DIGOUT_NID,
11094 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11095 .channel_mode = alc262_modes,
11096 .input_mux = &alc262_fujitsu_capture_source,
11097 .unsol_event = alc262_lenovo_3000_unsol_event,
11100 .mixers = { alc262_nec_mixer },
11101 .init_verbs = { alc262_nec_verbs },
11102 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11103 .dac_nids = alc262_dac_nids,
11105 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11106 .channel_mode = alc262_modes,
11107 .input_mux = &alc262_capture_source,
11109 [ALC262_TOSHIBA_S06] = {
11110 .mixers = { alc262_toshiba_s06_mixer },
11111 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11112 alc262_eapd_verbs },
11113 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11114 .capsrc_nids = alc262_dmic_capsrc_nids,
11115 .dac_nids = alc262_dac_nids,
11116 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11117 .num_adc_nids = 1, /* single ADC */
11118 .dig_out_nid = ALC262_DIGOUT_NID,
11119 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11120 .channel_mode = alc262_modes,
11121 .input_mux = &alc262_dmic_capture_source,
11122 .unsol_event = alc262_toshiba_s06_unsol_event,
11123 .init_hook = alc262_toshiba_s06_init_hook,
11125 [ALC262_TOSHIBA_RX1] = {
11126 .mixers = { alc262_toshiba_rx1_mixer },
11127 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11128 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11129 .dac_nids = alc262_dac_nids,
11131 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11132 .channel_mode = alc262_modes,
11133 .input_mux = &alc262_capture_source,
11134 .unsol_event = alc262_hippo_unsol_event,
11135 .init_hook = alc262_hippo_init_hook,
11138 .mixers = { alc262_tyan_mixer },
11139 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11140 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11141 .dac_nids = alc262_dac_nids,
11143 .dig_out_nid = ALC262_DIGOUT_NID,
11144 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11145 .channel_mode = alc262_modes,
11146 .input_mux = &alc262_capture_source,
11147 .unsol_event = alc_automute_amp_unsol_event,
11148 .init_hook = alc262_tyan_init_hook,
11152 static int patch_alc262(struct hda_codec *codec)
11154 struct alc_spec *spec;
11158 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11162 codec->spec = spec;
11164 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11169 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11170 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11171 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11172 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11176 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11178 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11182 if (board_config < 0) {
11183 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11184 "trying auto-probe from BIOS...\n", codec->chip_name);
11185 board_config = ALC262_AUTO;
11188 if (board_config == ALC262_AUTO) {
11189 /* automatic parse from the BIOS config */
11190 err = alc262_parse_auto_config(codec);
11196 "hda_codec: Cannot set up configuration "
11197 "from BIOS. Using base mode...\n");
11198 board_config = ALC262_BASIC;
11202 if (!spec->no_analog) {
11203 err = snd_hda_attach_beep_device(codec, 0x1);
11210 if (board_config != ALC262_AUTO)
11211 setup_preset(spec, &alc262_presets[board_config]);
11213 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11214 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11216 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11217 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11219 if (!spec->adc_nids && spec->input_mux) {
11221 /* check whether the digital-mic has to be supported */
11222 for (i = 0; i < spec->input_mux->num_items; i++) {
11223 if (spec->input_mux->items[i].index >= 9)
11226 if (i < spec->input_mux->num_items) {
11227 /* use only ADC0 */
11228 spec->adc_nids = alc262_dmic_adc_nids;
11229 spec->num_adc_nids = 1;
11230 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11232 /* all analog inputs */
11233 /* check whether NID 0x07 is valid */
11234 unsigned int wcap = get_wcaps(codec, 0x07);
11237 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11238 if (wcap != AC_WID_AUD_IN) {
11239 spec->adc_nids = alc262_adc_nids_alt;
11240 spec->num_adc_nids =
11241 ARRAY_SIZE(alc262_adc_nids_alt);
11242 spec->capsrc_nids = alc262_capsrc_nids_alt;
11244 spec->adc_nids = alc262_adc_nids;
11245 spec->num_adc_nids =
11246 ARRAY_SIZE(alc262_adc_nids);
11247 spec->capsrc_nids = alc262_capsrc_nids;
11251 if (!spec->cap_mixer && !spec->no_analog)
11252 set_capture_mixer(spec);
11253 if (!spec->no_analog)
11254 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11256 spec->vmaster_nid = 0x0c;
11258 codec->patch_ops = alc_patch_ops;
11259 if (board_config == ALC262_AUTO)
11260 spec->init_hook = alc262_auto_init;
11261 #ifdef CONFIG_SND_HDA_POWER_SAVE
11262 if (!spec->loopback.amplist)
11263 spec->loopback.amplist = alc262_loopbacks;
11265 codec->proc_widget_hook = print_realtek_coef;
11271 * ALC268 channel source setting (2 channel)
11273 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11274 #define alc268_modes alc260_modes
11276 static hda_nid_t alc268_dac_nids[2] = {
11281 static hda_nid_t alc268_adc_nids[2] = {
11286 static hda_nid_t alc268_adc_nids_alt[1] = {
11291 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11293 static struct snd_kcontrol_new alc268_base_mixer[] = {
11294 /* output mixer control */
11295 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11296 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11297 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11299 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11300 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11301 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11305 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11306 /* output mixer control */
11307 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11309 ALC262_HIPPO_MASTER_SWITCH,
11310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11311 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11312 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11316 /* bind Beep switches of both NID 0x0f and 0x10 */
11317 static struct hda_bind_ctls alc268_bind_beep_sw = {
11318 .ops = &snd_hda_bind_sw,
11320 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11321 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11326 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11327 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11328 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11332 static struct hda_verb alc268_eapd_verbs[] = {
11333 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11334 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11338 /* Toshiba specific */
11339 static struct hda_verb alc268_toshiba_verbs[] = {
11340 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11344 static struct hda_input_mux alc268_acer_lc_capture_source = {
11352 /* Acer specific */
11353 /* bind volumes of both NID 0x02 and 0x03 */
11354 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11355 .ops = &snd_hda_bind_vol,
11357 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11358 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11363 /* mute/unmute internal speaker according to the hp jack and mute state */
11364 static void alc268_acer_automute(struct hda_codec *codec, int force)
11366 struct alc_spec *spec = codec->spec;
11369 if (force || !spec->sense_updated) {
11370 unsigned int present;
11371 present = snd_hda_codec_read(codec, 0x14, 0,
11372 AC_VERB_GET_PIN_SENSE, 0);
11373 spec->jack_present = (present & 0x80000000) != 0;
11374 spec->sense_updated = 1;
11376 if (spec->jack_present)
11377 mute = HDA_AMP_MUTE; /* mute internal speaker */
11378 else /* unmute internal speaker if necessary */
11379 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11380 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11381 HDA_AMP_MUTE, mute);
11385 /* bind hp and internal speaker mute (with plug check) */
11386 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11387 struct snd_ctl_elem_value *ucontrol)
11389 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11390 long *valp = ucontrol->value.integer.value;
11393 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11395 valp[0] ? 0 : HDA_AMP_MUTE);
11396 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11398 valp[1] ? 0 : HDA_AMP_MUTE);
11400 alc268_acer_automute(codec, 0);
11404 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11405 /* output mixer control */
11406 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11408 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11409 .name = "Master Playback Switch",
11410 .info = snd_hda_mixer_amp_switch_info,
11411 .get = snd_hda_mixer_amp_switch_get,
11412 .put = alc268_acer_master_sw_put,
11413 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11415 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11419 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11420 /* output mixer control */
11421 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11423 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11424 .name = "Master Playback Switch",
11425 .info = snd_hda_mixer_amp_switch_info,
11426 .get = snd_hda_mixer_amp_switch_get,
11427 .put = alc268_acer_master_sw_put,
11428 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11430 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11431 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11432 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11436 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11437 /* output mixer control */
11438 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11440 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11441 .name = "Master Playback Switch",
11442 .info = snd_hda_mixer_amp_switch_info,
11443 .get = snd_hda_mixer_amp_switch_get,
11444 .put = alc268_acer_master_sw_put,
11445 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11447 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11448 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11452 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11453 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11455 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11456 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11457 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11462 static struct hda_verb alc268_acer_verbs[] = {
11463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11464 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11465 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11467 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11468 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11469 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11473 /* unsolicited event for HP jack sensing */
11474 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11475 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11477 static void alc268_acer_unsol_event(struct hda_codec *codec,
11480 if ((res >> 26) != ALC880_HP_EVENT)
11482 alc268_acer_automute(codec, 1);
11485 static void alc268_acer_init_hook(struct hda_codec *codec)
11487 alc268_acer_automute(codec, 1);
11490 /* toggle speaker-output according to the hp-jack state */
11491 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11493 unsigned int present;
11494 unsigned char bits;
11496 present = snd_hda_codec_read(codec, 0x15, 0,
11497 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11498 bits = present ? AMP_IN_MUTE(0) : 0;
11499 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11500 AMP_IN_MUTE(0), bits);
11501 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11502 AMP_IN_MUTE(0), bits);
11506 static void alc268_acer_mic_automute(struct hda_codec *codec)
11508 unsigned int present;
11510 present = snd_hda_codec_read(codec, 0x18, 0,
11511 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11512 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11513 present ? 0x0 : 0x6);
11516 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11519 if ((res >> 26) == ALC880_HP_EVENT)
11520 alc268_aspire_one_speaker_automute(codec);
11521 if ((res >> 26) == ALC880_MIC_EVENT)
11522 alc268_acer_mic_automute(codec);
11525 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11527 alc268_aspire_one_speaker_automute(codec);
11528 alc268_acer_mic_automute(codec);
11531 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11532 /* output mixer control */
11533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11534 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11535 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11536 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11537 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11538 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11542 static struct hda_verb alc268_dell_verbs[] = {
11543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11544 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11545 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11549 /* mute/unmute internal speaker according to the hp jack and mute state */
11550 static void alc268_dell_init_hook(struct hda_codec *codec)
11552 struct alc_spec *spec = codec->spec;
11554 spec->autocfg.hp_pins[0] = 0x15;
11555 spec->autocfg.speaker_pins[0] = 0x14;
11556 alc_automute_pin(codec);
11559 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11560 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11561 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11562 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11563 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11564 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11565 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11566 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11567 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11571 static struct hda_verb alc267_quanta_il1_verbs[] = {
11572 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11573 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11577 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11579 unsigned int present;
11581 present = snd_hda_codec_read(codec, 0x18, 0,
11582 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11583 snd_hda_codec_write(codec, 0x23, 0,
11584 AC_VERB_SET_CONNECT_SEL,
11585 present ? 0x00 : 0x01);
11588 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11590 struct alc_spec *spec = codec->spec;
11592 spec->autocfg.hp_pins[0] = 0x15;
11593 spec->autocfg.speaker_pins[0] = 0x14;
11594 alc_automute_pin(codec);
11595 alc267_quanta_il1_mic_automute(codec);
11598 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11601 switch (res >> 26) {
11602 case ALC880_MIC_EVENT:
11603 alc267_quanta_il1_mic_automute(codec);
11606 alc_sku_unsol_event(codec, res);
11612 * generic initialization of ADC, input mixers and output mixers
11614 static struct hda_verb alc268_base_init_verbs[] = {
11615 /* Unmute DAC0-1 and set vol = 0 */
11616 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11617 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11620 * Set up output mixers (0x0c - 0x0e)
11622 /* set vol=0 to output mixers */
11623 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11624 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11627 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11629 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11630 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11631 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11632 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11633 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11634 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11635 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11636 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11638 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11640 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11641 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11642 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11644 /* set PCBEEP vol = 0, mute connections */
11645 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11647 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11649 /* Unmute Selector 23h,24h and set the default input to mic-in */
11651 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11653 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11654 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11660 * generic initialization of ADC, input mixers and output mixers
11662 static struct hda_verb alc268_volume_init_verbs[] = {
11663 /* set output DAC */
11664 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11665 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11667 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11668 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11669 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11670 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11671 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11673 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11675 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11677 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11680 /* set PCBEEP vol = 0, mute connections */
11681 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11682 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11683 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11688 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11689 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11690 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11692 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11693 /* The multiple "Capture Source" controls confuse alsamixer
11694 * So call somewhat different..
11696 /* .name = "Capture Source", */
11697 .name = "Input Source",
11699 .info = alc_mux_enum_info,
11700 .get = alc_mux_enum_get,
11701 .put = alc_mux_enum_put,
11706 static struct snd_kcontrol_new alc268_capture_mixer[] = {
11707 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11708 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
11709 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
11710 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
11712 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11713 /* The multiple "Capture Source" controls confuse alsamixer
11714 * So call somewhat different..
11716 /* .name = "Capture Source", */
11717 .name = "Input Source",
11719 .info = alc_mux_enum_info,
11720 .get = alc_mux_enum_get,
11721 .put = alc_mux_enum_put,
11726 static struct hda_input_mux alc268_capture_source = {
11730 { "Front Mic", 0x1 },
11736 static struct hda_input_mux alc268_acer_capture_source = {
11740 { "Internal Mic", 0x1 },
11745 static struct hda_input_mux alc268_acer_dmic_capture_source = {
11749 { "Internal Mic", 0x6 },
11754 #ifdef CONFIG_SND_DEBUG
11755 static struct snd_kcontrol_new alc268_test_mixer[] = {
11756 /* Volume widgets */
11757 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11758 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11759 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
11760 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
11761 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
11762 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
11763 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
11764 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
11765 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
11766 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
11767 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
11768 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
11769 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
11770 /* The below appears problematic on some hardwares */
11771 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
11772 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11773 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
11774 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
11775 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
11777 /* Modes for retasking pin widgets */
11778 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
11779 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
11780 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
11781 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
11783 /* Controls for GPIO pins, assuming they are configured as outputs */
11784 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
11785 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
11786 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
11787 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
11789 /* Switches to allow the digital SPDIF output pin to be enabled.
11790 * The ALC268 does not have an SPDIF input.
11792 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
11794 /* A switch allowing EAPD to be enabled. Some laptops seem to use
11795 * this output to turn on an external amplifier.
11797 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
11798 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
11804 /* create input playback/capture controls for the given pin */
11805 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
11806 const char *ctlname, int idx)
11811 sprintf(name, "%s Playback Volume", ctlname);
11813 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11814 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
11818 } else if (nid == 0x15) {
11819 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
11820 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
11826 sprintf(name, "%s Playback Switch", ctlname);
11827 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
11828 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
11834 /* add playback controls from the parsed DAC table */
11835 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11836 const struct auto_pin_cfg *cfg)
11841 spec->multiout.num_dacs = 2; /* only use one dac */
11842 spec->multiout.dac_nids = spec->private_dac_nids;
11843 spec->multiout.dac_nids[0] = 2;
11844 spec->multiout.dac_nids[1] = 3;
11846 nid = cfg->line_out_pins[0];
11848 alc268_new_analog_output(spec, nid, "Front", 0);
11850 nid = cfg->speaker_pins[0];
11852 err = add_control(spec, ALC_CTL_WIDGET_VOL,
11853 "Speaker Playback Volume",
11854 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
11858 nid = cfg->hp_pins[0];
11860 alc268_new_analog_output(spec, nid, "Headphone", 0);
11862 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
11864 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
11865 "Mono Playback Switch",
11866 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
11873 /* create playback/capture controls for input pins */
11874 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11875 const struct auto_pin_cfg *cfg)
11877 struct hda_input_mux *imux = &spec->private_imux[0];
11880 for (i = 0; i < AUTO_PIN_LAST; i++) {
11881 switch(cfg->input_pins[i]) {
11883 idx1 = 0; /* Mic 1 */
11886 idx1 = 1; /* Mic 2 */
11889 idx1 = 2; /* Line In */
11896 idx1 = 6; /* digital mics */
11901 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
11902 imux->items[imux->num_items].index = idx1;
11908 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
11910 struct alc_spec *spec = codec->spec;
11911 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11912 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11913 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11914 unsigned int dac_vol1, dac_vol2;
11917 snd_hda_codec_write(codec, speaker_nid, 0,
11918 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
11919 snd_hda_codec_write(codec, 0x0f, 0,
11920 AC_VERB_SET_AMP_GAIN_MUTE,
11922 snd_hda_codec_write(codec, 0x10, 0,
11923 AC_VERB_SET_AMP_GAIN_MUTE,
11926 snd_hda_codec_write(codec, 0x0f, 0,
11927 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11928 snd_hda_codec_write(codec, 0x10, 0,
11929 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
11932 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
11933 if (line_nid == 0x14)
11934 dac_vol2 = AMP_OUT_ZERO;
11935 else if (line_nid == 0x15)
11936 dac_vol1 = AMP_OUT_ZERO;
11937 if (hp_nid == 0x14)
11938 dac_vol2 = AMP_OUT_ZERO;
11939 else if (hp_nid == 0x15)
11940 dac_vol1 = AMP_OUT_ZERO;
11941 if (line_nid != 0x16 || hp_nid != 0x16 ||
11942 spec->autocfg.line_out_pins[1] != 0x16 ||
11943 spec->autocfg.line_out_pins[2] != 0x16)
11944 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
11946 snd_hda_codec_write(codec, 0x02, 0,
11947 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
11948 snd_hda_codec_write(codec, 0x03, 0,
11949 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
11952 /* pcm configuration: identical with ALC880 */
11953 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
11954 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
11955 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
11956 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
11959 * BIOS auto configuration
11961 static int alc268_parse_auto_config(struct hda_codec *codec)
11963 struct alc_spec *spec = codec->spec;
11965 static hda_nid_t alc268_ignore[] = { 0 };
11967 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11971 if (!spec->autocfg.line_outs) {
11972 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11973 spec->multiout.max_channels = 2;
11974 spec->no_analog = 1;
11977 return 0; /* can't find valid BIOS pin config */
11979 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
11982 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
11986 spec->multiout.max_channels = 2;
11989 /* digital only support output */
11990 if (spec->autocfg.dig_outs) {
11991 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
11992 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11994 if (spec->kctls.list)
11995 add_mixer(spec, spec->kctls.list);
11997 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
11998 add_mixer(spec, alc268_beep_mixer);
12000 add_verb(spec, alc268_volume_init_verbs);
12001 spec->num_mux_defs = 1;
12002 spec->input_mux = &spec->private_imux[0];
12004 err = alc_auto_add_mic_boost(codec);
12008 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12013 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12014 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12015 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12017 /* init callback for auto-configuration model -- overriding the default init */
12018 static void alc268_auto_init(struct hda_codec *codec)
12020 struct alc_spec *spec = codec->spec;
12021 alc268_auto_init_multi_out(codec);
12022 alc268_auto_init_hp_out(codec);
12023 alc268_auto_init_mono_speaker_out(codec);
12024 alc268_auto_init_analog_input(codec);
12025 if (spec->unsol_event)
12026 alc_inithook(codec);
12030 * configuration and preset
12032 static const char *alc268_models[ALC268_MODEL_LAST] = {
12033 [ALC267_QUANTA_IL1] = "quanta-il1",
12034 [ALC268_3ST] = "3stack",
12035 [ALC268_TOSHIBA] = "toshiba",
12036 [ALC268_ACER] = "acer",
12037 [ALC268_ACER_DMIC] = "acer-dmic",
12038 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12039 [ALC268_DELL] = "dell",
12040 [ALC268_ZEPTO] = "zepto",
12041 #ifdef CONFIG_SND_DEBUG
12042 [ALC268_TEST] = "test",
12044 [ALC268_AUTO] = "auto",
12047 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12048 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12049 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12050 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12051 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12052 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12053 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12054 ALC268_ACER_ASPIRE_ONE),
12055 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12056 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12057 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12059 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12060 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12061 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12063 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12064 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12065 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12066 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12070 static struct alc_config_preset alc268_presets[] = {
12071 [ALC267_QUANTA_IL1] = {
12072 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12073 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12074 alc267_quanta_il1_verbs },
12075 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12076 .dac_nids = alc268_dac_nids,
12077 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12078 .adc_nids = alc268_adc_nids_alt,
12080 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12081 .channel_mode = alc268_modes,
12082 .input_mux = &alc268_capture_source,
12083 .unsol_event = alc267_quanta_il1_unsol_event,
12084 .init_hook = alc267_quanta_il1_init_hook,
12087 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12088 alc268_beep_mixer },
12089 .init_verbs = { alc268_base_init_verbs },
12090 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12091 .dac_nids = alc268_dac_nids,
12092 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12093 .adc_nids = alc268_adc_nids_alt,
12094 .capsrc_nids = alc268_capsrc_nids,
12096 .dig_out_nid = ALC268_DIGOUT_NID,
12097 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12098 .channel_mode = alc268_modes,
12099 .input_mux = &alc268_capture_source,
12101 [ALC268_TOSHIBA] = {
12102 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12103 alc268_beep_mixer },
12104 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12105 alc268_toshiba_verbs },
12106 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12107 .dac_nids = alc268_dac_nids,
12108 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12109 .adc_nids = alc268_adc_nids_alt,
12110 .capsrc_nids = alc268_capsrc_nids,
12112 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12113 .channel_mode = alc268_modes,
12114 .input_mux = &alc268_capture_source,
12115 .unsol_event = alc268_toshiba_unsol_event,
12116 .init_hook = alc268_toshiba_init_hook,
12119 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12120 alc268_beep_mixer },
12121 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12122 alc268_acer_verbs },
12123 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12124 .dac_nids = alc268_dac_nids,
12125 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12126 .adc_nids = alc268_adc_nids_alt,
12127 .capsrc_nids = alc268_capsrc_nids,
12129 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12130 .channel_mode = alc268_modes,
12131 .input_mux = &alc268_acer_capture_source,
12132 .unsol_event = alc268_acer_unsol_event,
12133 .init_hook = alc268_acer_init_hook,
12135 [ALC268_ACER_DMIC] = {
12136 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12137 alc268_beep_mixer },
12138 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12139 alc268_acer_verbs },
12140 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12141 .dac_nids = alc268_dac_nids,
12142 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12143 .adc_nids = alc268_adc_nids_alt,
12144 .capsrc_nids = alc268_capsrc_nids,
12146 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12147 .channel_mode = alc268_modes,
12148 .input_mux = &alc268_acer_dmic_capture_source,
12149 .unsol_event = alc268_acer_unsol_event,
12150 .init_hook = alc268_acer_init_hook,
12152 [ALC268_ACER_ASPIRE_ONE] = {
12153 .mixers = { alc268_acer_aspire_one_mixer,
12155 alc268_capture_alt_mixer },
12156 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12157 alc268_acer_aspire_one_verbs },
12158 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12159 .dac_nids = alc268_dac_nids,
12160 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12161 .adc_nids = alc268_adc_nids_alt,
12162 .capsrc_nids = alc268_capsrc_nids,
12164 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12165 .channel_mode = alc268_modes,
12166 .input_mux = &alc268_acer_lc_capture_source,
12167 .unsol_event = alc268_acer_lc_unsol_event,
12168 .init_hook = alc268_acer_lc_init_hook,
12171 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12172 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12173 alc268_dell_verbs },
12174 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12175 .dac_nids = alc268_dac_nids,
12177 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12178 .channel_mode = alc268_modes,
12179 .unsol_event = alc_sku_unsol_event,
12180 .init_hook = alc268_dell_init_hook,
12181 .input_mux = &alc268_capture_source,
12184 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12185 alc268_beep_mixer },
12186 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12187 alc268_toshiba_verbs },
12188 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12189 .dac_nids = alc268_dac_nids,
12190 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12191 .adc_nids = alc268_adc_nids_alt,
12192 .capsrc_nids = alc268_capsrc_nids,
12194 .dig_out_nid = ALC268_DIGOUT_NID,
12195 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12196 .channel_mode = alc268_modes,
12197 .input_mux = &alc268_capture_source,
12198 .unsol_event = alc268_toshiba_unsol_event,
12199 .init_hook = alc268_toshiba_init_hook
12201 #ifdef CONFIG_SND_DEBUG
12203 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12204 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12205 alc268_volume_init_verbs },
12206 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12207 .dac_nids = alc268_dac_nids,
12208 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12209 .adc_nids = alc268_adc_nids_alt,
12210 .capsrc_nids = alc268_capsrc_nids,
12212 .dig_out_nid = ALC268_DIGOUT_NID,
12213 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12214 .channel_mode = alc268_modes,
12215 .input_mux = &alc268_capture_source,
12220 static int patch_alc268(struct hda_codec *codec)
12222 struct alc_spec *spec;
12224 int i, has_beep, err;
12226 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12230 codec->spec = spec;
12232 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12236 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12237 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12238 "trying auto-probe from BIOS...\n", codec->chip_name);
12239 board_config = ALC268_AUTO;
12242 if (board_config == ALC268_AUTO) {
12243 /* automatic parse from the BIOS config */
12244 err = alc268_parse_auto_config(codec);
12250 "hda_codec: Cannot set up configuration "
12251 "from BIOS. Using base mode...\n");
12252 board_config = ALC268_3ST;
12256 if (board_config != ALC268_AUTO)
12257 setup_preset(spec, &alc268_presets[board_config]);
12259 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12260 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12261 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12263 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12266 for (i = 0; i < spec->num_mixers; i++) {
12267 if (spec->mixers[i] == alc268_beep_mixer) {
12274 err = snd_hda_attach_beep_device(codec, 0x1);
12279 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12280 /* override the amp caps for beep generator */
12281 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12282 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12283 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12284 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12285 (0 << AC_AMPCAP_MUTE_SHIFT));
12288 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12289 /* check whether NID 0x07 is valid */
12290 unsigned int wcap = get_wcaps(codec, 0x07);
12294 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12295 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12296 spec->adc_nids = alc268_adc_nids_alt;
12297 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12298 add_mixer(spec, alc268_capture_alt_mixer);
12300 spec->adc_nids = alc268_adc_nids;
12301 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12302 add_mixer(spec, alc268_capture_mixer);
12304 spec->capsrc_nids = alc268_capsrc_nids;
12305 /* set default input source */
12306 for (i = 0; i < spec->num_adc_nids; i++)
12307 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12308 0, AC_VERB_SET_CONNECT_SEL,
12309 spec->input_mux->items[0].index);
12312 spec->vmaster_nid = 0x02;
12314 codec->patch_ops = alc_patch_ops;
12315 if (board_config == ALC268_AUTO)
12316 spec->init_hook = alc268_auto_init;
12318 codec->proc_widget_hook = print_realtek_coef;
12324 * ALC269 channel source setting (2 channel)
12326 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12328 #define alc269_dac_nids alc260_dac_nids
12330 static hda_nid_t alc269_adc_nids[1] = {
12335 static hda_nid_t alc269_capsrc_nids[1] = {
12339 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12343 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12351 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12359 #define alc269_modes alc260_modes
12360 #define alc269_capture_source alc880_lg_lw_capture_source
12362 static struct snd_kcontrol_new alc269_base_mixer[] = {
12363 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12364 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12365 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12366 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12367 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12370 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12371 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12372 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12378 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12379 /* output mixer control */
12380 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12382 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12383 .name = "Master Playback Switch",
12384 .info = snd_hda_mixer_amp_switch_info,
12385 .get = snd_hda_mixer_amp_switch_get,
12386 .put = alc268_acer_master_sw_put,
12387 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12390 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12391 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12392 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12393 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12394 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12398 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12399 /* output mixer control */
12400 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12403 .name = "Master Playback Switch",
12404 .info = snd_hda_mixer_amp_switch_info,
12405 .get = snd_hda_mixer_amp_switch_get,
12406 .put = alc268_acer_master_sw_put,
12407 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12409 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12410 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12411 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12412 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12413 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12414 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12415 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12416 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12417 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12421 /* bind volumes of both NID 0x0c and 0x0d */
12422 static struct hda_bind_ctls alc269_epc_bind_vol = {
12423 .ops = &snd_hda_bind_vol,
12425 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12426 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12431 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12432 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12433 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12434 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 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 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12448 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12450 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12454 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12456 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12458 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12459 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12460 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12464 static struct hda_verb alc269_lifebook_verbs[] = {
12465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12466 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12470 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12471 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12472 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12473 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12474 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12478 /* toggle speaker-output according to the hp-jack state */
12479 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12481 unsigned int present;
12482 unsigned char bits;
12484 present = snd_hda_codec_read(codec, 0x15, 0,
12485 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12486 bits = present ? AMP_IN_MUTE(0) : 0;
12487 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12488 AMP_IN_MUTE(0), bits);
12489 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12490 AMP_IN_MUTE(0), bits);
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, 0x680);
12497 snd_hda_codec_write(codec, 0x20, 0,
12498 AC_VERB_SET_COEF_INDEX, 0x0c);
12499 snd_hda_codec_write(codec, 0x20, 0,
12500 AC_VERB_SET_PROC_COEF, 0x480);
12503 /* toggle speaker-output according to the hp-jacks state */
12504 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12506 unsigned int present;
12507 unsigned char bits;
12509 /* Check laptop headphone socket */
12510 present = snd_hda_codec_read(codec, 0x15, 0,
12511 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12513 /* Check port replicator headphone socket */
12514 present |= snd_hda_codec_read(codec, 0x1a, 0,
12515 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12517 bits = present ? AMP_IN_MUTE(0) : 0;
12518 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12519 AMP_IN_MUTE(0), bits);
12520 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12521 AMP_IN_MUTE(0), bits);
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, 0x680);
12528 snd_hda_codec_write(codec, 0x20, 0,
12529 AC_VERB_SET_COEF_INDEX, 0x0c);
12530 snd_hda_codec_write(codec, 0x20, 0,
12531 AC_VERB_SET_PROC_COEF, 0x480);
12534 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12536 unsigned int present;
12538 present = snd_hda_codec_read(codec, 0x18, 0,
12539 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12540 snd_hda_codec_write(codec, 0x23, 0,
12541 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12544 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12546 unsigned int present_laptop;
12547 unsigned int present_dock;
12549 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12550 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12552 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12553 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12555 /* Laptop mic port overrides dock mic port, design decision */
12557 snd_hda_codec_write(codec, 0x23, 0,
12558 AC_VERB_SET_CONNECT_SEL, 0x3);
12559 if (present_laptop)
12560 snd_hda_codec_write(codec, 0x23, 0,
12561 AC_VERB_SET_CONNECT_SEL, 0x0);
12562 if (!present_dock && !present_laptop)
12563 snd_hda_codec_write(codec, 0x23, 0,
12564 AC_VERB_SET_CONNECT_SEL, 0x1);
12567 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12570 if ((res >> 26) == ALC880_HP_EVENT)
12571 alc269_quanta_fl1_speaker_automute(codec);
12572 if ((res >> 26) == ALC880_MIC_EVENT)
12573 alc269_quanta_fl1_mic_automute(codec);
12576 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12579 if ((res >> 26) == ALC880_HP_EVENT)
12580 alc269_lifebook_speaker_automute(codec);
12581 if ((res >> 26) == ALC880_MIC_EVENT)
12582 alc269_lifebook_mic_autoswitch(codec);
12585 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12587 alc269_quanta_fl1_speaker_automute(codec);
12588 alc269_quanta_fl1_mic_automute(codec);
12591 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12593 alc269_lifebook_speaker_automute(codec);
12594 alc269_lifebook_mic_autoswitch(codec);
12597 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12598 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12599 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12600 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12602 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12603 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12608 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12610 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12611 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12613 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12614 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12618 /* toggle speaker-output according to the hp-jack state */
12619 static void alc269_speaker_automute(struct hda_codec *codec)
12621 unsigned int present;
12622 unsigned char bits;
12624 present = snd_hda_codec_read(codec, 0x15, 0,
12625 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12626 bits = present ? AMP_IN_MUTE(0) : 0;
12627 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12628 AMP_IN_MUTE(0), bits);
12629 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12630 AMP_IN_MUTE(0), bits);
12633 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12635 unsigned int present;
12637 present = snd_hda_codec_read(codec, 0x18, 0,
12638 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12639 snd_hda_codec_write(codec, 0x23, 0,
12640 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12643 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12645 unsigned int present;
12647 present = snd_hda_codec_read(codec, 0x18, 0,
12648 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12649 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12650 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12651 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12652 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12655 /* unsolicited event for HP jack sensing */
12656 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12659 if ((res >> 26) == ALC880_HP_EVENT)
12660 alc269_speaker_automute(codec);
12662 if ((res >> 26) == ALC880_MIC_EVENT)
12663 alc269_eeepc_dmic_automute(codec);
12666 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
12668 alc269_speaker_automute(codec);
12669 alc269_eeepc_dmic_automute(codec);
12672 /* unsolicited event for HP jack sensing */
12673 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
12676 if ((res >> 26) == ALC880_HP_EVENT)
12677 alc269_speaker_automute(codec);
12679 if ((res >> 26) == ALC880_MIC_EVENT)
12680 alc269_eeepc_amic_automute(codec);
12683 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
12685 alc269_speaker_automute(codec);
12686 alc269_eeepc_amic_automute(codec);
12690 * generic initialization of ADC, input mixers and output mixers
12692 static struct hda_verb alc269_init_verbs[] = {
12694 * Unmute ADC0 and set the default input to mic-in
12696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12698 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
12699 * analog-loopback mixer widget
12700 * Note: PASD motherboards uses the Line In 2 as the input for
12701 * front panel mic (mic 2)
12703 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12704 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12705 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12706 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12707 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12708 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12711 * Set up output mixers (0x0c - 0x0e)
12713 /* set vol=0 to output mixers */
12714 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12715 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12717 /* set up input amps for analog loopback */
12718 /* Amp Indices: DAC = 0, mixer = 1 */
12719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12720 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12721 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12723 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12724 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12729 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12730 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12731 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12735 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12736 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12739 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12740 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12742 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
12743 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12745 /* FIXME: use matrix-type input source selection */
12746 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
12747 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12751 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12754 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12755 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12759 /* add playback controls from the parsed DAC table */
12760 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
12761 const struct auto_pin_cfg *cfg)
12766 spec->multiout.num_dacs = 1; /* only use one dac */
12767 spec->multiout.dac_nids = spec->private_dac_nids;
12768 spec->multiout.dac_nids[0] = 2;
12770 nid = cfg->line_out_pins[0];
12772 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12773 "Front Playback Volume",
12774 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
12777 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12778 "Front Playback Switch",
12779 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
12784 nid = cfg->speaker_pins[0];
12786 if (!cfg->line_out_pins[0]) {
12787 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12788 "Speaker Playback Volume",
12789 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12795 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12796 "Speaker Playback Switch",
12797 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12802 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12803 "Speaker Playback Switch",
12804 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12810 nid = cfg->hp_pins[0];
12812 /* spec->multiout.hp_nid = 2; */
12813 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
12814 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12815 "Headphone Playback Volume",
12816 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
12822 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12823 "Headphone Playback Switch",
12824 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
12829 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12830 "Headphone Playback Switch",
12831 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
12840 #define alc269_auto_create_analog_input_ctls \
12841 alc262_auto_create_analog_input_ctls
12843 #ifdef CONFIG_SND_HDA_POWER_SAVE
12844 #define alc269_loopbacks alc880_loopbacks
12847 /* pcm configuration: identical with ALC880 */
12848 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
12849 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
12850 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
12851 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
12853 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
12857 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12858 /* NID is set in alc_build_pcms */
12860 .open = alc880_playback_pcm_open,
12861 .prepare = alc880_playback_pcm_prepare,
12862 .cleanup = alc880_playback_pcm_cleanup
12866 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
12870 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
12871 /* NID is set in alc_build_pcms */
12875 * BIOS auto configuration
12877 static int alc269_parse_auto_config(struct hda_codec *codec)
12879 struct alc_spec *spec = codec->spec;
12881 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
12883 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12888 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
12891 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
12895 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12897 if (spec->autocfg.dig_outs)
12898 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
12900 if (spec->kctls.list)
12901 add_mixer(spec, spec->kctls.list);
12903 add_verb(spec, alc269_init_verbs);
12904 spec->num_mux_defs = 1;
12905 spec->input_mux = &spec->private_imux[0];
12906 /* set default input source */
12907 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12908 0, AC_VERB_SET_CONNECT_SEL,
12909 spec->input_mux->items[0].index);
12911 err = alc_auto_add_mic_boost(codec);
12915 if (!spec->cap_mixer && !spec->no_analog)
12916 set_capture_mixer(spec);
12918 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12923 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
12924 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
12925 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
12928 /* init callback for auto-configuration model -- overriding the default init */
12929 static void alc269_auto_init(struct hda_codec *codec)
12931 struct alc_spec *spec = codec->spec;
12932 alc269_auto_init_multi_out(codec);
12933 alc269_auto_init_hp_out(codec);
12934 alc269_auto_init_analog_input(codec);
12935 if (spec->unsol_event)
12936 alc_inithook(codec);
12940 * configuration and preset
12942 static const char *alc269_models[ALC269_MODEL_LAST] = {
12943 [ALC269_BASIC] = "basic",
12944 [ALC269_QUANTA_FL1] = "quanta",
12945 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
12946 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
12947 [ALC269_FUJITSU] = "fujitsu",
12948 [ALC269_LIFEBOOK] = "lifebook"
12951 static struct snd_pci_quirk alc269_cfg_tbl[] = {
12952 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
12953 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
12954 ALC269_ASUS_EEEPC_P703),
12955 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
12956 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
12957 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
12958 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
12959 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
12960 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
12961 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
12962 ALC269_ASUS_EEEPC_P901),
12963 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
12964 ALC269_ASUS_EEEPC_P901),
12965 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
12966 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
12967 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
12971 static struct alc_config_preset alc269_presets[] = {
12973 .mixers = { alc269_base_mixer },
12974 .init_verbs = { alc269_init_verbs },
12975 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12976 .dac_nids = alc269_dac_nids,
12978 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12979 .channel_mode = alc269_modes,
12980 .input_mux = &alc269_capture_source,
12982 [ALC269_QUANTA_FL1] = {
12983 .mixers = { alc269_quanta_fl1_mixer },
12984 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
12985 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
12986 .dac_nids = alc269_dac_nids,
12988 .num_channel_mode = ARRAY_SIZE(alc269_modes),
12989 .channel_mode = alc269_modes,
12990 .input_mux = &alc269_capture_source,
12991 .unsol_event = alc269_quanta_fl1_unsol_event,
12992 .init_hook = alc269_quanta_fl1_init_hook,
12994 [ALC269_ASUS_EEEPC_P703] = {
12995 .mixers = { alc269_eeepc_mixer },
12996 .cap_mixer = alc269_epc_capture_mixer,
12997 .init_verbs = { alc269_init_verbs,
12998 alc269_eeepc_amic_init_verbs },
12999 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13000 .dac_nids = alc269_dac_nids,
13002 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13003 .channel_mode = alc269_modes,
13004 .input_mux = &alc269_eeepc_amic_capture_source,
13005 .unsol_event = alc269_eeepc_amic_unsol_event,
13006 .init_hook = alc269_eeepc_amic_inithook,
13008 [ALC269_ASUS_EEEPC_P901] = {
13009 .mixers = { alc269_eeepc_mixer },
13010 .cap_mixer = alc269_epc_capture_mixer,
13011 .init_verbs = { alc269_init_verbs,
13012 alc269_eeepc_dmic_init_verbs },
13013 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13014 .dac_nids = alc269_dac_nids,
13016 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13017 .channel_mode = alc269_modes,
13018 .input_mux = &alc269_eeepc_dmic_capture_source,
13019 .unsol_event = alc269_eeepc_dmic_unsol_event,
13020 .init_hook = alc269_eeepc_dmic_inithook,
13022 [ALC269_FUJITSU] = {
13023 .mixers = { alc269_fujitsu_mixer },
13024 .cap_mixer = alc269_epc_capture_mixer,
13025 .init_verbs = { alc269_init_verbs,
13026 alc269_eeepc_dmic_init_verbs },
13027 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13028 .dac_nids = alc269_dac_nids,
13030 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13031 .channel_mode = alc269_modes,
13032 .input_mux = &alc269_eeepc_dmic_capture_source,
13033 .unsol_event = alc269_eeepc_dmic_unsol_event,
13034 .init_hook = alc269_eeepc_dmic_inithook,
13036 [ALC269_LIFEBOOK] = {
13037 .mixers = { alc269_lifebook_mixer },
13038 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13039 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13040 .dac_nids = alc269_dac_nids,
13042 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13043 .channel_mode = alc269_modes,
13044 .input_mux = &alc269_capture_source,
13045 .unsol_event = alc269_lifebook_unsol_event,
13046 .init_hook = alc269_lifebook_init_hook,
13050 static int patch_alc269(struct hda_codec *codec)
13052 struct alc_spec *spec;
13056 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13060 codec->spec = spec;
13062 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13064 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13068 if (board_config < 0) {
13069 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13070 "trying auto-probe from BIOS...\n", codec->chip_name);
13071 board_config = ALC269_AUTO;
13074 if (board_config == ALC269_AUTO) {
13075 /* automatic parse from the BIOS config */
13076 err = alc269_parse_auto_config(codec);
13082 "hda_codec: Cannot set up configuration "
13083 "from BIOS. Using base mode...\n");
13084 board_config = ALC269_BASIC;
13088 err = snd_hda_attach_beep_device(codec, 0x1);
13094 if (board_config != ALC269_AUTO)
13095 setup_preset(spec, &alc269_presets[board_config]);
13097 if (codec->subsystem_id == 0x17aa3bf8) {
13098 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13099 * fix the sample rate of analog I/O to 44.1kHz
13101 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13102 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13104 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13105 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13107 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13108 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13110 spec->adc_nids = alc269_adc_nids;
13111 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13112 spec->capsrc_nids = alc269_capsrc_nids;
13113 if (!spec->cap_mixer)
13114 set_capture_mixer(spec);
13115 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13117 codec->patch_ops = alc_patch_ops;
13118 if (board_config == ALC269_AUTO)
13119 spec->init_hook = alc269_auto_init;
13120 #ifdef CONFIG_SND_HDA_POWER_SAVE
13121 if (!spec->loopback.amplist)
13122 spec->loopback.amplist = alc269_loopbacks;
13124 codec->proc_widget_hook = print_realtek_coef;
13130 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13134 * set the path ways for 2 channel output
13135 * need to set the codec line out and mic 1 pin widgets to inputs
13137 static struct hda_verb alc861_threestack_ch2_init[] = {
13138 /* set pin widget 1Ah (line in) for input */
13139 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13140 /* set pin widget 18h (mic1/2) for input, for mic also enable
13143 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13145 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13147 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13148 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13154 * need to set the codec line out and mic 1 pin widgets to outputs
13156 static struct hda_verb alc861_threestack_ch6_init[] = {
13157 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13158 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13159 /* set pin widget 18h (mic1) for output (CLFE)*/
13160 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13162 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13163 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13165 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13167 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13168 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13173 static struct hda_channel_mode alc861_threestack_modes[2] = {
13174 { 2, alc861_threestack_ch2_init },
13175 { 6, alc861_threestack_ch6_init },
13177 /* Set mic1 as input and unmute the mixer */
13178 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13179 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13180 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13183 /* Set mic1 as output and mute mixer */
13184 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13185 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13186 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13190 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13191 { 2, alc861_uniwill_m31_ch2_init },
13192 { 4, alc861_uniwill_m31_ch4_init },
13195 /* Set mic1 and line-in as input and unmute the mixer */
13196 static struct hda_verb alc861_asus_ch2_init[] = {
13197 /* set pin widget 1Ah (line in) for input */
13198 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13199 /* set pin widget 18h (mic1/2) for input, for mic also enable
13202 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13204 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13206 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13207 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13211 /* Set mic1 nad line-in as output and mute mixer */
13212 static struct hda_verb alc861_asus_ch6_init[] = {
13213 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13214 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13215 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13216 /* set pin widget 18h (mic1) for output (CLFE)*/
13217 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13218 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13219 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13220 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13222 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13224 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13225 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13230 static struct hda_channel_mode alc861_asus_modes[2] = {
13231 { 2, alc861_asus_ch2_init },
13232 { 6, alc861_asus_ch6_init },
13237 static struct snd_kcontrol_new alc861_base_mixer[] = {
13238 /* output mixer control */
13239 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13240 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13241 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13242 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13243 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13245 /*Input mixer control */
13246 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13247 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13248 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13249 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13250 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13251 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13253 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13260 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13261 /* output mixer control */
13262 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13263 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13264 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13265 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13266 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13268 /* Input mixer control */
13269 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13270 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13271 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13272 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13273 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13274 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13275 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13276 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13277 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13281 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13282 .name = "Channel Mode",
13283 .info = alc_ch_mode_info,
13284 .get = alc_ch_mode_get,
13285 .put = alc_ch_mode_put,
13286 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13291 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13292 /* output mixer control */
13293 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13295 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13300 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13301 /* output mixer control */
13302 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13303 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13304 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13305 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13306 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13308 /* Input mixer control */
13309 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13310 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13311 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13312 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13313 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13314 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13316 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13317 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13318 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13321 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13322 .name = "Channel Mode",
13323 .info = alc_ch_mode_info,
13324 .get = alc_ch_mode_get,
13325 .put = alc_ch_mode_put,
13326 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13331 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13332 /* output mixer control */
13333 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13334 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13335 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13336 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13337 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13339 /* Input mixer control */
13340 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13341 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13342 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13343 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13344 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13345 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13346 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13347 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13348 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13352 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13353 .name = "Channel Mode",
13354 .info = alc_ch_mode_info,
13355 .get = alc_ch_mode_get,
13356 .put = alc_ch_mode_put,
13357 .private_value = ARRAY_SIZE(alc861_asus_modes),
13362 /* additional mixer */
13363 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13364 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13365 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13370 * generic initialization of ADC, input mixers and output mixers
13372 static struct hda_verb alc861_base_init_verbs[] = {
13374 * Unmute ADC0 and set the default input to mic-in
13376 /* port-A for surround (rear panel) */
13377 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13378 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13379 /* port-B for mic-in (rear panel) with vref */
13380 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13381 /* port-C for line-in (rear panel) */
13382 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13383 /* port-D for Front */
13384 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13385 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13386 /* port-E for HP out (front panel) */
13387 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13388 /* route front PCM to HP */
13389 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13390 /* port-F for mic-in (front panel) with vref */
13391 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13392 /* port-G for CLFE (rear panel) */
13393 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13394 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13395 /* port-H for side (rear panel) */
13396 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13397 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13399 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13400 /* route front mic to ADC1*/
13401 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13402 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13404 /* Unmute DAC0~3 & spdif out*/
13405 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13406 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13407 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13408 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13409 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13411 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13412 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13413 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13414 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13415 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13417 /* Unmute Stereo Mixer 15 */
13418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13423 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13424 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13425 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13426 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13428 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13429 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13430 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13431 /* hp used DAC 3 (Front) */
13432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13433 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13438 static struct hda_verb alc861_threestack_init_verbs[] = {
13440 * Unmute ADC0 and set the default input to mic-in
13442 /* port-A for surround (rear panel) */
13443 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13444 /* port-B for mic-in (rear panel) with vref */
13445 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13446 /* port-C for line-in (rear panel) */
13447 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13448 /* port-D for Front */
13449 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13450 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13451 /* port-E for HP out (front panel) */
13452 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13453 /* route front PCM to HP */
13454 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13455 /* port-F for mic-in (front panel) with vref */
13456 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13457 /* port-G for CLFE (rear panel) */
13458 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13459 /* port-H for side (rear panel) */
13460 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13462 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13463 /* route front mic to ADC1*/
13464 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13465 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13466 /* Unmute DAC0~3 & spdif out*/
13467 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13468 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13469 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13470 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13473 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13474 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13475 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13476 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13477 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13479 /* Unmute Stereo Mixer 15 */
13480 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13481 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13482 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13485 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13486 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13487 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13488 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13489 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13491 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13492 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13493 /* hp used DAC 3 (Front) */
13494 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13495 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13499 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13501 * Unmute ADC0 and set the default input to mic-in
13503 /* port-A for surround (rear panel) */
13504 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13505 /* port-B for mic-in (rear panel) with vref */
13506 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13507 /* port-C for line-in (rear panel) */
13508 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13509 /* port-D for Front */
13510 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13511 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13512 /* port-E for HP out (front panel) */
13513 /* this has to be set to VREF80 */
13514 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13515 /* route front PCM to HP */
13516 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13517 /* port-F for mic-in (front panel) with vref */
13518 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13519 /* port-G for CLFE (rear panel) */
13520 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13521 /* port-H for side (rear panel) */
13522 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13524 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13525 /* route front mic to ADC1*/
13526 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13527 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13528 /* Unmute DAC0~3 & spdif out*/
13529 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13531 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13532 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13533 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13535 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13536 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13537 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13538 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13539 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13541 /* Unmute Stereo Mixer 15 */
13542 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13543 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13544 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13545 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13547 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13548 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13549 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13550 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13551 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13553 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13554 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13555 /* hp used DAC 3 (Front) */
13556 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13557 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13561 static struct hda_verb alc861_asus_init_verbs[] = {
13563 * Unmute ADC0 and set the default input to mic-in
13565 /* port-A for surround (rear panel)
13566 * according to codec#0 this is the HP jack
13568 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13569 /* route front PCM to HP */
13570 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13571 /* port-B for mic-in (rear panel) with vref */
13572 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13573 /* port-C for line-in (rear panel) */
13574 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13575 /* port-D for Front */
13576 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13577 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13578 /* port-E for HP out (front panel) */
13579 /* this has to be set to VREF80 */
13580 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13581 /* route front PCM to HP */
13582 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13583 /* port-F for mic-in (front panel) with vref */
13584 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13585 /* port-G for CLFE (rear panel) */
13586 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13587 /* port-H for side (rear panel) */
13588 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13590 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13591 /* route front mic to ADC1*/
13592 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13594 /* Unmute DAC0~3 & spdif out*/
13595 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13596 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13597 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13598 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13600 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13601 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13602 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13603 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13604 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13606 /* Unmute Stereo Mixer 15 */
13607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13608 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13612 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13614 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13615 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13616 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13617 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13618 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13619 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13620 /* hp used DAC 3 (Front) */
13621 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13622 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13626 /* additional init verbs for ASUS laptops */
13627 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13628 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13629 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13634 * generic initialization of ADC, input mixers and output mixers
13636 static struct hda_verb alc861_auto_init_verbs[] = {
13638 * Unmute ADC0 and set the default input to mic-in
13640 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13643 /* Unmute DAC0~3 & spdif out*/
13644 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13645 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13646 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13647 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13650 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13651 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13652 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13653 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13654 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13656 /* Unmute Stereo Mixer 15 */
13657 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13658 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13660 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
13662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13663 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13664 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13665 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13666 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13667 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13668 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13669 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13671 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13672 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13673 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13674 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13675 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13676 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13677 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13678 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13680 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
13685 static struct hda_verb alc861_toshiba_init_verbs[] = {
13686 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13691 /* toggle speaker-output according to the hp-jack state */
13692 static void alc861_toshiba_automute(struct hda_codec *codec)
13694 unsigned int present;
13696 present = snd_hda_codec_read(codec, 0x0f, 0,
13697 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13698 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
13699 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
13700 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
13701 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
13704 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
13707 if ((res >> 26) == ALC880_HP_EVENT)
13708 alc861_toshiba_automute(codec);
13711 /* pcm configuration: identical with ALC880 */
13712 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
13713 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
13714 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
13715 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
13718 #define ALC861_DIGOUT_NID 0x07
13720 static struct hda_channel_mode alc861_8ch_modes[1] = {
13724 static hda_nid_t alc861_dac_nids[4] = {
13725 /* front, surround, clfe, side */
13726 0x03, 0x06, 0x05, 0x04
13729 static hda_nid_t alc660_dac_nids[3] = {
13730 /* front, clfe, surround */
13734 static hda_nid_t alc861_adc_nids[1] = {
13739 static struct hda_input_mux alc861_capture_source = {
13743 { "Front Mic", 0x3 },
13750 /* fill in the dac_nids table from the parsed pin configuration */
13751 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
13752 const struct auto_pin_cfg *cfg)
13757 spec->multiout.dac_nids = spec->private_dac_nids;
13758 for (i = 0; i < cfg->line_outs; i++) {
13759 nid = cfg->line_out_pins[i];
13761 if (i >= ARRAY_SIZE(alc861_dac_nids))
13763 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
13766 spec->multiout.num_dacs = cfg->line_outs;
13770 /* add playback controls from the parsed DAC table */
13771 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
13772 const struct auto_pin_cfg *cfg)
13775 static const char *chname[4] = {
13776 "Front", "Surround", NULL /*CLFE*/, "Side"
13781 for (i = 0; i < cfg->line_outs; i++) {
13782 nid = spec->multiout.dac_nids[i];
13787 err = add_control(spec, ALC_CTL_BIND_MUTE,
13788 "Center Playback Switch",
13789 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
13793 err = add_control(spec, ALC_CTL_BIND_MUTE,
13794 "LFE Playback Switch",
13795 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13800 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
13802 if (nid == alc861_dac_nids[idx])
13804 sprintf(name, "%s Playback Switch", chname[idx]);
13805 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
13806 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13815 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13823 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
13825 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13826 "Headphone Playback Switch",
13827 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13830 spec->multiout.hp_nid = nid;
13835 /* create playback/capture controls for input pins */
13836 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13837 const struct auto_pin_cfg *cfg)
13839 struct hda_input_mux *imux = &spec->private_imux[0];
13840 int i, err, idx, idx1;
13842 for (i = 0; i < AUTO_PIN_LAST; i++) {
13843 switch (cfg->input_pins[i]) {
13846 idx = 2; /* Line In */
13850 idx = 2; /* Line In */
13854 idx = 1; /* Mic In */
13858 idx = 1; /* Mic In */
13868 err = new_analog_input(spec, cfg->input_pins[i],
13869 auto_pin_cfg_labels[i], idx, 0x15);
13873 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
13874 imux->items[imux->num_items].index = idx1;
13880 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
13882 int pin_type, int dac_idx)
13884 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
13886 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13890 static void alc861_auto_init_multi_out(struct hda_codec *codec)
13892 struct alc_spec *spec = codec->spec;
13895 for (i = 0; i < spec->autocfg.line_outs; i++) {
13896 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13897 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13899 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
13900 spec->multiout.dac_nids[i]);
13904 static void alc861_auto_init_hp_out(struct hda_codec *codec)
13906 struct alc_spec *spec = codec->spec;
13909 pin = spec->autocfg.hp_pins[0];
13910 if (pin) /* connect to front */
13911 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
13912 spec->multiout.dac_nids[0]);
13913 pin = spec->autocfg.speaker_pins[0];
13915 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
13918 static void alc861_auto_init_analog_input(struct hda_codec *codec)
13920 struct alc_spec *spec = codec->spec;
13923 for (i = 0; i < AUTO_PIN_LAST; i++) {
13924 hda_nid_t nid = spec->autocfg.input_pins[i];
13925 if (nid >= 0x0c && nid <= 0x11)
13926 alc_set_input_pin(codec, nid, i);
13930 /* parse the BIOS configuration and set up the alc_spec */
13931 /* return 1 if successful, 0 if the proper config is not found,
13932 * or a negative error code
13934 static int alc861_parse_auto_config(struct hda_codec *codec)
13936 struct alc_spec *spec = codec->spec;
13938 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
13940 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13944 if (!spec->autocfg.line_outs)
13945 return 0; /* can't find valid BIOS pin config */
13947 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
13950 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
13953 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
13956 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
13960 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13962 if (spec->autocfg.dig_outs)
13963 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
13965 if (spec->kctls.list)
13966 add_mixer(spec, spec->kctls.list);
13968 add_verb(spec, alc861_auto_init_verbs);
13970 spec->num_mux_defs = 1;
13971 spec->input_mux = &spec->private_imux[0];
13973 spec->adc_nids = alc861_adc_nids;
13974 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
13975 set_capture_mixer(spec);
13977 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
13982 /* additional initialization for auto-configuration model */
13983 static void alc861_auto_init(struct hda_codec *codec)
13985 struct alc_spec *spec = codec->spec;
13986 alc861_auto_init_multi_out(codec);
13987 alc861_auto_init_hp_out(codec);
13988 alc861_auto_init_analog_input(codec);
13989 if (spec->unsol_event)
13990 alc_inithook(codec);
13993 #ifdef CONFIG_SND_HDA_POWER_SAVE
13994 static struct hda_amp_list alc861_loopbacks[] = {
13995 { 0x15, HDA_INPUT, 0 },
13996 { 0x15, HDA_INPUT, 1 },
13997 { 0x15, HDA_INPUT, 2 },
13998 { 0x15, HDA_INPUT, 3 },
14005 * configuration and preset
14007 static const char *alc861_models[ALC861_MODEL_LAST] = {
14008 [ALC861_3ST] = "3stack",
14009 [ALC660_3ST] = "3stack-660",
14010 [ALC861_3ST_DIG] = "3stack-dig",
14011 [ALC861_6ST_DIG] = "6stack-dig",
14012 [ALC861_UNIWILL_M31] = "uniwill-m31",
14013 [ALC861_TOSHIBA] = "toshiba",
14014 [ALC861_ASUS] = "asus",
14015 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14016 [ALC861_AUTO] = "auto",
14019 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14020 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14021 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14022 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14023 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14024 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14025 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14026 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14027 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14028 * Any other models that need this preset?
14030 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14031 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14032 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14033 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14034 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14035 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14036 /* FIXME: the below seems conflict */
14037 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14038 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14039 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14043 static struct alc_config_preset alc861_presets[] = {
14045 .mixers = { alc861_3ST_mixer },
14046 .init_verbs = { alc861_threestack_init_verbs },
14047 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14048 .dac_nids = alc861_dac_nids,
14049 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14050 .channel_mode = alc861_threestack_modes,
14052 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14053 .adc_nids = alc861_adc_nids,
14054 .input_mux = &alc861_capture_source,
14056 [ALC861_3ST_DIG] = {
14057 .mixers = { alc861_base_mixer },
14058 .init_verbs = { alc861_threestack_init_verbs },
14059 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14060 .dac_nids = alc861_dac_nids,
14061 .dig_out_nid = ALC861_DIGOUT_NID,
14062 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14063 .channel_mode = alc861_threestack_modes,
14065 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14066 .adc_nids = alc861_adc_nids,
14067 .input_mux = &alc861_capture_source,
14069 [ALC861_6ST_DIG] = {
14070 .mixers = { alc861_base_mixer },
14071 .init_verbs = { alc861_base_init_verbs },
14072 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14073 .dac_nids = alc861_dac_nids,
14074 .dig_out_nid = ALC861_DIGOUT_NID,
14075 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14076 .channel_mode = alc861_8ch_modes,
14077 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14078 .adc_nids = alc861_adc_nids,
14079 .input_mux = &alc861_capture_source,
14082 .mixers = { alc861_3ST_mixer },
14083 .init_verbs = { alc861_threestack_init_verbs },
14084 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14085 .dac_nids = alc660_dac_nids,
14086 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14087 .channel_mode = alc861_threestack_modes,
14089 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14090 .adc_nids = alc861_adc_nids,
14091 .input_mux = &alc861_capture_source,
14093 [ALC861_UNIWILL_M31] = {
14094 .mixers = { alc861_uniwill_m31_mixer },
14095 .init_verbs = { alc861_uniwill_m31_init_verbs },
14096 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14097 .dac_nids = alc861_dac_nids,
14098 .dig_out_nid = ALC861_DIGOUT_NID,
14099 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14100 .channel_mode = alc861_uniwill_m31_modes,
14102 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14103 .adc_nids = alc861_adc_nids,
14104 .input_mux = &alc861_capture_source,
14106 [ALC861_TOSHIBA] = {
14107 .mixers = { alc861_toshiba_mixer },
14108 .init_verbs = { alc861_base_init_verbs,
14109 alc861_toshiba_init_verbs },
14110 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14111 .dac_nids = alc861_dac_nids,
14112 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14113 .channel_mode = alc883_3ST_2ch_modes,
14114 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14115 .adc_nids = alc861_adc_nids,
14116 .input_mux = &alc861_capture_source,
14117 .unsol_event = alc861_toshiba_unsol_event,
14118 .init_hook = alc861_toshiba_automute,
14121 .mixers = { alc861_asus_mixer },
14122 .init_verbs = { alc861_asus_init_verbs },
14123 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14124 .dac_nids = alc861_dac_nids,
14125 .dig_out_nid = ALC861_DIGOUT_NID,
14126 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14127 .channel_mode = alc861_asus_modes,
14130 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14131 .adc_nids = alc861_adc_nids,
14132 .input_mux = &alc861_capture_source,
14134 [ALC861_ASUS_LAPTOP] = {
14135 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14136 .init_verbs = { alc861_asus_init_verbs,
14137 alc861_asus_laptop_init_verbs },
14138 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14139 .dac_nids = alc861_dac_nids,
14140 .dig_out_nid = ALC861_DIGOUT_NID,
14141 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14142 .channel_mode = alc883_3ST_2ch_modes,
14144 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14145 .adc_nids = alc861_adc_nids,
14146 .input_mux = &alc861_capture_source,
14151 static int patch_alc861(struct hda_codec *codec)
14153 struct alc_spec *spec;
14157 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14161 codec->spec = spec;
14163 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14167 if (board_config < 0) {
14168 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14169 "trying auto-probe from BIOS...\n", codec->chip_name);
14170 board_config = ALC861_AUTO;
14173 if (board_config == ALC861_AUTO) {
14174 /* automatic parse from the BIOS config */
14175 err = alc861_parse_auto_config(codec);
14181 "hda_codec: Cannot set up configuration "
14182 "from BIOS. Using base mode...\n");
14183 board_config = ALC861_3ST_DIG;
14187 err = snd_hda_attach_beep_device(codec, 0x23);
14193 if (board_config != ALC861_AUTO)
14194 setup_preset(spec, &alc861_presets[board_config]);
14196 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14197 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14199 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14200 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14202 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14204 spec->vmaster_nid = 0x03;
14206 codec->patch_ops = alc_patch_ops;
14207 if (board_config == ALC861_AUTO)
14208 spec->init_hook = alc861_auto_init;
14209 #ifdef CONFIG_SND_HDA_POWER_SAVE
14210 if (!spec->loopback.amplist)
14211 spec->loopback.amplist = alc861_loopbacks;
14213 codec->proc_widget_hook = print_realtek_coef;
14219 * ALC861-VD support
14223 * In addition, an independent DAC
14225 #define ALC861VD_DIGOUT_NID 0x06
14227 static hda_nid_t alc861vd_dac_nids[4] = {
14228 /* front, surr, clfe, side surr */
14229 0x02, 0x03, 0x04, 0x05
14232 /* dac_nids for ALC660vd are in a different order - according to
14233 * Realtek's driver.
14234 * This should probably result in a different mixer for 6stack models
14235 * of ALC660vd codecs, but for now there is only 3stack mixer
14236 * - and it is the same as in 861vd.
14237 * adc_nids in ALC660vd are (is) the same as in 861vd
14239 static hda_nid_t alc660vd_dac_nids[3] = {
14240 /* front, rear, clfe, rear_surr */
14244 static hda_nid_t alc861vd_adc_nids[1] = {
14249 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14252 /* FIXME: should be a matrix-type input source selection */
14253 static struct hda_input_mux alc861vd_capture_source = {
14257 { "Front Mic", 0x1 },
14263 static struct hda_input_mux alc861vd_dallas_capture_source = {
14266 { "Ext Mic", 0x0 },
14267 { "Int Mic", 0x1 },
14271 static struct hda_input_mux alc861vd_hp_capture_source = {
14274 { "Front Mic", 0x0 },
14275 { "ATAPI Mic", 0x1 },
14282 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14289 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14290 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14291 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14292 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14293 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14300 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14301 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14302 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14303 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14304 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14308 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14309 { 6, alc861vd_6stack_ch6_init },
14310 { 8, alc861vd_6stack_ch8_init },
14313 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14315 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14316 .name = "Channel Mode",
14317 .info = alc_ch_mode_info,
14318 .get = alc_ch_mode_get,
14319 .put = alc_ch_mode_put,
14324 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14325 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14327 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14328 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14329 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14331 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14332 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14334 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14336 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14338 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14339 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14341 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14342 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14346 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14348 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14350 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14351 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14352 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14354 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14355 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14357 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14358 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14363 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14364 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14365 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14367 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14369 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14373 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14377 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14378 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14380 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14381 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14386 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14387 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14388 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14389 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14391 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14393 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14394 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14395 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14397 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14398 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14399 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14401 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14402 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14407 /* Pin assignment: Speaker=0x14, HP = 0x15,
14408 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14410 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14411 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14412 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14413 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14414 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14415 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14416 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14417 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14418 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14419 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14420 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14424 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14425 * Front Mic=0x18, ATAPI Mic = 0x19,
14427 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14428 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14430 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14431 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14432 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14434 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14435 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14441 * generic initialization of ADC, input mixers and output mixers
14443 static struct hda_verb alc861vd_volume_init_verbs[] = {
14445 * Unmute ADC0 and set the default input to mic-in
14447 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14450 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14451 * the analog-loopback mixer widget
14453 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14460 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14464 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14467 * Set up output mixers (0x02 - 0x05)
14469 /* set vol=0 to output mixers */
14470 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14471 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14472 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14473 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14475 /* set up input amps for analog loopback */
14476 /* Amp Indices: DAC = 0, mixer = 1 */
14477 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14478 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14479 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14480 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14490 * 3-stack pin configuration:
14491 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14493 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14495 * Set pin mode and muting
14497 /* set front pin widgets 0x14 for output */
14498 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14499 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14500 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14502 /* Mic (rear) pin: input vref at 80% */
14503 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14504 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14505 /* Front Mic pin: input vref at 80% */
14506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14507 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14508 /* Line In pin: input */
14509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14510 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14511 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14513 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14514 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14515 /* CD pin widget for input */
14516 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14522 * 6-stack pin configuration:
14524 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14526 * Set pin mode and muting
14528 /* set front pin widgets 0x14 for output */
14529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14530 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14531 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14533 /* Rear Pin: output 1 (0x0d) */
14534 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14536 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14537 /* CLFE Pin: output 2 (0x0e) */
14538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14539 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14540 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14541 /* Side Pin: output 3 (0x0f) */
14542 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14543 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14544 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14546 /* Mic (rear) pin: input vref at 80% */
14547 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14548 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14549 /* Front Mic pin: input vref at 80% */
14550 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14551 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14552 /* Line In pin: input */
14553 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14554 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14555 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14556 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14557 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14558 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14559 /* CD pin widget for input */
14560 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14565 static struct hda_verb alc861vd_eapd_verbs[] = {
14566 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14570 static struct hda_verb alc660vd_eapd_verbs[] = {
14571 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14572 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14576 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14580 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14581 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14585 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14587 unsigned int present;
14588 unsigned char bits;
14590 present = snd_hda_codec_read(codec, 0x18, 0,
14591 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14592 bits = present ? HDA_AMP_MUTE : 0;
14593 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14594 HDA_AMP_MUTE, bits);
14597 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14599 struct alc_spec *spec = codec->spec;
14601 spec->autocfg.hp_pins[0] = 0x1b;
14602 spec->autocfg.speaker_pins[0] = 0x14;
14603 alc_automute_amp(codec);
14604 alc861vd_lenovo_mic_automute(codec);
14607 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14610 switch (res >> 26) {
14611 case ALC880_MIC_EVENT:
14612 alc861vd_lenovo_mic_automute(codec);
14615 alc_automute_amp_unsol_event(codec, res);
14620 static struct hda_verb alc861vd_dallas_verbs[] = {
14621 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14622 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14623 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14624 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14633 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14639 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14640 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14641 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14642 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14646 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14647 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14650 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14651 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14658 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14659 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14665 /* toggle speaker-output according to the hp-jack state */
14666 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
14668 struct alc_spec *spec = codec->spec;
14670 spec->autocfg.hp_pins[0] = 0x15;
14671 spec->autocfg.speaker_pins[0] = 0x14;
14672 alc_automute_amp(codec);
14675 #ifdef CONFIG_SND_HDA_POWER_SAVE
14676 #define alc861vd_loopbacks alc880_loopbacks
14679 /* pcm configuration: identical with ALC880 */
14680 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
14681 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
14682 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
14683 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
14686 * configuration and preset
14688 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
14689 [ALC660VD_3ST] = "3stack-660",
14690 [ALC660VD_3ST_DIG] = "3stack-660-digout",
14691 [ALC660VD_ASUS_V1S] = "asus-v1s",
14692 [ALC861VD_3ST] = "3stack",
14693 [ALC861VD_3ST_DIG] = "3stack-digout",
14694 [ALC861VD_6ST_DIG] = "6stack-digout",
14695 [ALC861VD_LENOVO] = "lenovo",
14696 [ALC861VD_DALLAS] = "dallas",
14697 [ALC861VD_HP] = "hp",
14698 [ALC861VD_AUTO] = "auto",
14701 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
14702 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
14703 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
14704 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
14705 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
14706 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
14707 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
14708 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
14709 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
14710 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
14711 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
14712 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
14713 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
14714 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
14715 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
14716 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
14720 static struct alc_config_preset alc861vd_presets[] = {
14722 .mixers = { alc861vd_3st_mixer },
14723 .init_verbs = { alc861vd_volume_init_verbs,
14724 alc861vd_3stack_init_verbs },
14725 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14726 .dac_nids = alc660vd_dac_nids,
14727 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14728 .channel_mode = alc861vd_3stack_2ch_modes,
14729 .input_mux = &alc861vd_capture_source,
14731 [ALC660VD_3ST_DIG] = {
14732 .mixers = { alc861vd_3st_mixer },
14733 .init_verbs = { alc861vd_volume_init_verbs,
14734 alc861vd_3stack_init_verbs },
14735 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14736 .dac_nids = alc660vd_dac_nids,
14737 .dig_out_nid = ALC861VD_DIGOUT_NID,
14738 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14739 .channel_mode = alc861vd_3stack_2ch_modes,
14740 .input_mux = &alc861vd_capture_source,
14743 .mixers = { alc861vd_3st_mixer },
14744 .init_verbs = { alc861vd_volume_init_verbs,
14745 alc861vd_3stack_init_verbs },
14746 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14747 .dac_nids = alc861vd_dac_nids,
14748 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14749 .channel_mode = alc861vd_3stack_2ch_modes,
14750 .input_mux = &alc861vd_capture_source,
14752 [ALC861VD_3ST_DIG] = {
14753 .mixers = { alc861vd_3st_mixer },
14754 .init_verbs = { alc861vd_volume_init_verbs,
14755 alc861vd_3stack_init_verbs },
14756 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14757 .dac_nids = alc861vd_dac_nids,
14758 .dig_out_nid = ALC861VD_DIGOUT_NID,
14759 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14760 .channel_mode = alc861vd_3stack_2ch_modes,
14761 .input_mux = &alc861vd_capture_source,
14763 [ALC861VD_6ST_DIG] = {
14764 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
14765 .init_verbs = { alc861vd_volume_init_verbs,
14766 alc861vd_6stack_init_verbs },
14767 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14768 .dac_nids = alc861vd_dac_nids,
14769 .dig_out_nid = ALC861VD_DIGOUT_NID,
14770 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
14771 .channel_mode = alc861vd_6stack_modes,
14772 .input_mux = &alc861vd_capture_source,
14774 [ALC861VD_LENOVO] = {
14775 .mixers = { alc861vd_lenovo_mixer },
14776 .init_verbs = { alc861vd_volume_init_verbs,
14777 alc861vd_3stack_init_verbs,
14778 alc861vd_eapd_verbs,
14779 alc861vd_lenovo_unsol_verbs },
14780 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14781 .dac_nids = alc660vd_dac_nids,
14782 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14783 .channel_mode = alc861vd_3stack_2ch_modes,
14784 .input_mux = &alc861vd_capture_source,
14785 .unsol_event = alc861vd_lenovo_unsol_event,
14786 .init_hook = alc861vd_lenovo_init_hook,
14788 [ALC861VD_DALLAS] = {
14789 .mixers = { alc861vd_dallas_mixer },
14790 .init_verbs = { alc861vd_dallas_verbs },
14791 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14792 .dac_nids = alc861vd_dac_nids,
14793 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14794 .channel_mode = alc861vd_3stack_2ch_modes,
14795 .input_mux = &alc861vd_dallas_capture_source,
14796 .unsol_event = alc_automute_amp_unsol_event,
14797 .init_hook = alc861vd_dallas_init_hook,
14800 .mixers = { alc861vd_hp_mixer },
14801 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
14802 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
14803 .dac_nids = alc861vd_dac_nids,
14804 .dig_out_nid = ALC861VD_DIGOUT_NID,
14805 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14806 .channel_mode = alc861vd_3stack_2ch_modes,
14807 .input_mux = &alc861vd_hp_capture_source,
14808 .unsol_event = alc_automute_amp_unsol_event,
14809 .init_hook = alc861vd_dallas_init_hook,
14811 [ALC660VD_ASUS_V1S] = {
14812 .mixers = { alc861vd_lenovo_mixer },
14813 .init_verbs = { alc861vd_volume_init_verbs,
14814 alc861vd_3stack_init_verbs,
14815 alc861vd_eapd_verbs,
14816 alc861vd_lenovo_unsol_verbs },
14817 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
14818 .dac_nids = alc660vd_dac_nids,
14819 .dig_out_nid = ALC861VD_DIGOUT_NID,
14820 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
14821 .channel_mode = alc861vd_3stack_2ch_modes,
14822 .input_mux = &alc861vd_capture_source,
14823 .unsol_event = alc861vd_lenovo_unsol_event,
14824 .init_hook = alc861vd_lenovo_init_hook,
14829 * BIOS auto configuration
14831 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
14832 hda_nid_t nid, int pin_type, int dac_idx)
14834 alc_set_pin_output(codec, nid, pin_type);
14837 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
14839 struct alc_spec *spec = codec->spec;
14842 for (i = 0; i <= HDA_SIDE; i++) {
14843 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14844 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14846 alc861vd_auto_set_output_and_unmute(codec, nid,
14852 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
14854 struct alc_spec *spec = codec->spec;
14857 pin = spec->autocfg.hp_pins[0];
14858 if (pin) /* connect to front and use dac 0 */
14859 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
14860 pin = spec->autocfg.speaker_pins[0];
14862 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14865 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
14866 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
14868 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
14870 struct alc_spec *spec = codec->spec;
14873 for (i = 0; i < AUTO_PIN_LAST; i++) {
14874 hda_nid_t nid = spec->autocfg.input_pins[i];
14875 if (alc861vd_is_input_pin(nid)) {
14876 alc_set_input_pin(codec, nid, i);
14877 if (nid != ALC861VD_PIN_CD_NID &&
14878 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
14879 snd_hda_codec_write(codec, nid, 0,
14880 AC_VERB_SET_AMP_GAIN_MUTE,
14886 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
14888 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
14889 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
14891 /* add playback controls from the parsed DAC table */
14892 /* Based on ALC880 version. But ALC861VD has separate,
14893 * different NIDs for mute/unmute switch and volume control */
14894 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
14895 const struct auto_pin_cfg *cfg)
14898 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
14899 hda_nid_t nid_v, nid_s;
14902 for (i = 0; i < cfg->line_outs; i++) {
14903 if (!spec->multiout.dac_nids[i])
14905 nid_v = alc861vd_idx_to_mixer_vol(
14907 spec->multiout.dac_nids[i]));
14908 nid_s = alc861vd_idx_to_mixer_switch(
14910 spec->multiout.dac_nids[i]));
14914 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14915 "Center Playback Volume",
14916 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
14920 err = add_control(spec, ALC_CTL_WIDGET_VOL,
14921 "LFE Playback Volume",
14922 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
14926 err = add_control(spec, ALC_CTL_BIND_MUTE,
14927 "Center Playback Switch",
14928 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
14932 err = add_control(spec, ALC_CTL_BIND_MUTE,
14933 "LFE Playback Switch",
14934 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
14939 sprintf(name, "%s Playback Volume", chname[i]);
14940 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14941 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
14945 sprintf(name, "%s Playback Switch", chname[i]);
14946 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14947 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
14956 /* add playback controls for speaker and HP outputs */
14957 /* Based on ALC880 version. But ALC861VD has separate,
14958 * different NIDs for mute/unmute switch and volume control */
14959 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
14960 hda_nid_t pin, const char *pfx)
14962 hda_nid_t nid_v, nid_s;
14969 if (alc880_is_fixed_pin(pin)) {
14970 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
14971 /* specify the DAC as the extra output */
14972 if (!spec->multiout.hp_nid)
14973 spec->multiout.hp_nid = nid_v;
14975 spec->multiout.extra_out_nid[0] = nid_v;
14976 /* control HP volume/switch on the output mixer amp */
14977 nid_v = alc861vd_idx_to_mixer_vol(
14978 alc880_fixed_pin_idx(pin));
14979 nid_s = alc861vd_idx_to_mixer_switch(
14980 alc880_fixed_pin_idx(pin));
14982 sprintf(name, "%s Playback Volume", pfx);
14983 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
14984 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
14987 sprintf(name, "%s Playback Switch", pfx);
14988 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14989 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
14992 } else if (alc880_is_multi_pin(pin)) {
14993 /* set manual connection */
14994 /* we have only a switch on HP-out PIN */
14995 sprintf(name, "%s Playback Switch", pfx);
14996 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
14997 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15004 /* parse the BIOS configuration and set up the alc_spec
15005 * return 1 if successful, 0 if the proper config is not found,
15006 * or a negative error code
15007 * Based on ALC880 version - had to change it to override
15008 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15009 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15011 struct alc_spec *spec = codec->spec;
15013 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15015 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15019 if (!spec->autocfg.line_outs)
15020 return 0; /* can't find valid BIOS pin config */
15022 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15025 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15028 err = alc861vd_auto_create_extra_out(spec,
15029 spec->autocfg.speaker_pins[0],
15033 err = alc861vd_auto_create_extra_out(spec,
15034 spec->autocfg.hp_pins[0],
15038 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15042 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15044 if (spec->autocfg.dig_outs)
15045 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15047 if (spec->kctls.list)
15048 add_mixer(spec, spec->kctls.list);
15050 add_verb(spec, alc861vd_volume_init_verbs);
15052 spec->num_mux_defs = 1;
15053 spec->input_mux = &spec->private_imux[0];
15055 err = alc_auto_add_mic_boost(codec);
15059 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15064 /* additional initialization for auto-configuration model */
15065 static void alc861vd_auto_init(struct hda_codec *codec)
15067 struct alc_spec *spec = codec->spec;
15068 alc861vd_auto_init_multi_out(codec);
15069 alc861vd_auto_init_hp_out(codec);
15070 alc861vd_auto_init_analog_input(codec);
15071 alc861vd_auto_init_input_src(codec);
15072 if (spec->unsol_event)
15073 alc_inithook(codec);
15076 static int patch_alc861vd(struct hda_codec *codec)
15078 struct alc_spec *spec;
15079 int err, board_config;
15081 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15085 codec->spec = spec;
15087 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15091 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15092 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15093 "trying auto-probe from BIOS...\n", codec->chip_name);
15094 board_config = ALC861VD_AUTO;
15097 if (board_config == ALC861VD_AUTO) {
15098 /* automatic parse from the BIOS config */
15099 err = alc861vd_parse_auto_config(codec);
15105 "hda_codec: Cannot set up configuration "
15106 "from BIOS. Using base mode...\n");
15107 board_config = ALC861VD_3ST;
15111 err = snd_hda_attach_beep_device(codec, 0x23);
15117 if (board_config != ALC861VD_AUTO)
15118 setup_preset(spec, &alc861vd_presets[board_config]);
15120 if (codec->vendor_id == 0x10ec0660) {
15121 /* always turn on EAPD */
15122 add_verb(spec, alc660vd_eapd_verbs);
15125 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15126 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15128 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15129 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15131 spec->adc_nids = alc861vd_adc_nids;
15132 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15133 spec->capsrc_nids = alc861vd_capsrc_nids;
15135 set_capture_mixer(spec);
15136 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15138 spec->vmaster_nid = 0x02;
15140 codec->patch_ops = alc_patch_ops;
15142 if (board_config == ALC861VD_AUTO)
15143 spec->init_hook = alc861vd_auto_init;
15144 #ifdef CONFIG_SND_HDA_POWER_SAVE
15145 if (!spec->loopback.amplist)
15146 spec->loopback.amplist = alc861vd_loopbacks;
15148 codec->proc_widget_hook = print_realtek_coef;
15156 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15157 * configuration. Each pin widget can choose any input DACs and a mixer.
15158 * Each ADC is connected from a mixer of all inputs. This makes possible
15159 * 6-channel independent captures.
15161 * In addition, an independent DAC for the multi-playback (not used in this
15164 #define ALC662_DIGOUT_NID 0x06
15165 #define ALC662_DIGIN_NID 0x0a
15167 static hda_nid_t alc662_dac_nids[4] = {
15168 /* front, rear, clfe, rear_surr */
15172 static hda_nid_t alc272_dac_nids[2] = {
15176 static hda_nid_t alc662_adc_nids[1] = {
15181 static hda_nid_t alc272_adc_nids[1] = {
15186 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15187 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15191 /* FIXME: should be a matrix-type input source selection */
15192 static struct hda_input_mux alc662_capture_source = {
15196 { "Front Mic", 0x1 },
15202 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15210 static struct hda_input_mux alc662_eeepc_capture_source = {
15218 static struct hda_input_mux alc663_capture_source = {
15222 { "Front Mic", 0x1 },
15227 static struct hda_input_mux alc663_m51va_capture_source = {
15230 { "Ext-Mic", 0x0 },
15235 #if 1 /* set to 0 for testing other input sources below */
15236 static struct hda_input_mux alc272_nc10_capture_source = {
15239 { "Autoselect Mic", 0x0 },
15240 { "Internal Mic", 0x1 },
15244 static struct hda_input_mux alc272_nc10_capture_source = {
15247 { "Autoselect Mic", 0x0 },
15248 { "Internal Mic", 0x1 },
15249 { "In-0x02", 0x2 },
15250 { "In-0x03", 0x3 },
15251 { "In-0x04", 0x4 },
15252 { "In-0x05", 0x5 },
15253 { "In-0x06", 0x6 },
15254 { "In-0x07", 0x7 },
15255 { "In-0x08", 0x8 },
15256 { "In-0x09", 0x9 },
15257 { "In-0x0a", 0x0a },
15258 { "In-0x0b", 0x0b },
15259 { "In-0x0c", 0x0c },
15260 { "In-0x0d", 0x0d },
15261 { "In-0x0e", 0x0e },
15262 { "In-0x0f", 0x0f },
15270 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15277 static struct hda_verb alc662_3ST_ch2_init[] = {
15278 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15279 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15280 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15281 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15288 static struct hda_verb alc662_3ST_ch6_init[] = {
15289 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15290 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15291 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15292 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15293 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15294 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15298 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15299 { 2, alc662_3ST_ch2_init },
15300 { 6, alc662_3ST_ch6_init },
15306 static struct hda_verb alc662_sixstack_ch6_init[] = {
15307 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15308 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15309 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15316 static struct hda_verb alc662_sixstack_ch8_init[] = {
15317 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15318 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15319 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15323 static struct hda_channel_mode alc662_5stack_modes[2] = {
15324 { 2, alc662_sixstack_ch6_init },
15325 { 6, alc662_sixstack_ch8_init },
15328 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15329 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15332 static struct snd_kcontrol_new alc662_base_mixer[] = {
15333 /* output mixer control */
15334 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15335 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15336 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15337 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15338 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15339 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15340 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15341 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15344 /*Input mixer control */
15345 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15346 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15347 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15348 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15349 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15350 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15351 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15352 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15356 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15357 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15358 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15360 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15361 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15362 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15363 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15366 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15367 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15371 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15372 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15373 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15374 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15375 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15376 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15378 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15379 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15380 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15383 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15384 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15387 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15388 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15392 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15393 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15394 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15395 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15396 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15398 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15399 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15400 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15405 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15406 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15407 ALC262_HIPPO_MASTER_SWITCH,
15409 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15410 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15411 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15413 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15414 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15415 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15419 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15420 ALC262_HIPPO_MASTER_SWITCH,
15421 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15422 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15423 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15424 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15425 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15429 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15433 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15434 .ops = &snd_hda_bind_vol,
15436 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15437 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15442 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15443 .ops = &snd_hda_bind_sw,
15445 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15446 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15451 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15452 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15453 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15454 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15455 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15459 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15460 .ops = &snd_hda_bind_sw,
15462 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15463 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15464 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15469 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15470 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15471 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15474 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15475 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15480 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15481 .ops = &snd_hda_bind_sw,
15483 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15484 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15485 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15490 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15491 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15492 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15493 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15494 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15495 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15496 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15500 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15501 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15502 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15503 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15504 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15505 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15506 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15507 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15511 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15512 .ops = &snd_hda_bind_vol,
15514 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15515 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15520 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15521 .ops = &snd_hda_bind_sw,
15523 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15524 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15529 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15530 HDA_BIND_VOL("Master Playback Volume",
15531 &alc663_asus_two_bind_master_vol),
15532 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15533 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15534 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15535 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15536 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15540 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15541 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15542 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15543 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15550 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15551 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15552 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15553 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15554 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15555 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15557 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15558 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15559 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15560 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15564 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15565 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15566 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15567 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15569 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15570 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15571 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15572 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15573 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15574 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15578 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15581 .name = "Channel Mode",
15582 .info = alc_ch_mode_info,
15583 .get = alc_ch_mode_get,
15584 .put = alc_ch_mode_put,
15589 static struct hda_verb alc662_init_verbs[] = {
15590 /* ADC: mute amp left and right */
15591 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15592 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15593 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15595 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15604 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15606 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15608 /* Front Pin: output 0 (0x0c) */
15609 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15610 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15612 /* Rear Pin: output 1 (0x0d) */
15613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15616 /* CLFE Pin: output 2 (0x0e) */
15617 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15618 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15620 /* Mic (rear) pin: input vref at 80% */
15621 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15622 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15623 /* Front Mic pin: input vref at 80% */
15624 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15626 /* Line In pin: input */
15627 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15629 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15630 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15631 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15632 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15633 /* CD pin widget for input */
15634 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15636 /* FIXME: use matrix-type input source selection */
15637 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15640 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15642 /* always trun on EAPD */
15643 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15644 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15649 static struct hda_verb alc662_sue_init_verbs[] = {
15650 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15651 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15655 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
15656 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15657 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15661 /* Set Unsolicited Event*/
15662 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
15663 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15664 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15669 * generic initialization of ADC, input mixers and output mixers
15671 static struct hda_verb alc662_auto_init_verbs[] = {
15673 * Unmute ADC and set the default input to mic-in
15675 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15678 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
15680 * Note: PASD motherboards uses the Line In 2 as the input for front
15681 * panel mic (mic 2)
15683 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15691 * Set up output mixers (0x0c - 0x0f)
15693 /* set vol=0 to output mixers */
15694 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15695 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15696 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15698 /* set up input amps for analog loopback */
15699 /* Amp Indices: DAC = 0, mixer = 1 */
15700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15701 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15702 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15703 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15705 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15708 /* FIXME: use matrix-type input source selection */
15709 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15716 /* additional verbs for ALC663 */
15717 static struct hda_verb alc663_auto_init_verbs[] = {
15718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15719 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15723 static struct hda_verb alc663_m51va_init_verbs[] = {
15724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15725 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15726 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15727 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15728 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15731 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15732 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15736 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
15737 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15738 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15739 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15743 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15747 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
15748 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15749 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15751 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15752 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15753 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15754 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15755 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15759 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
15760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15763 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15764 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15765 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15770 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
15771 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15772 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15773 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15774 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15775 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15776 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15777 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
15778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15780 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15781 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15782 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15786 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
15787 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15789 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15790 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15792 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15793 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15794 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15795 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15796 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15797 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15798 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15802 static struct hda_verb alc663_g71v_init_verbs[] = {
15803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15804 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
15805 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
15807 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15808 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15809 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15811 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
15812 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
15813 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
15817 static struct hda_verb alc663_g50v_init_verbs[] = {
15818 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15819 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15820 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
15822 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15823 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15827 static struct hda_verb alc662_ecs_init_verbs[] = {
15828 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
15829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15830 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15831 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15835 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
15836 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15837 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15839 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15840 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15841 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15842 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15845 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15846 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15850 static struct hda_verb alc272_dell_init_verbs[] = {
15851 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15852 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15855 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15856 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15857 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
15858 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15859 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
15860 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15861 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15865 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
15866 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
15867 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
15871 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
15872 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
15873 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
15877 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
15879 unsigned int present;
15880 unsigned char bits;
15882 present = snd_hda_codec_read(codec, 0x14, 0,
15883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15884 bits = present ? HDA_AMP_MUTE : 0;
15885 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15886 HDA_AMP_MUTE, bits);
15889 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
15891 unsigned int present;
15892 unsigned char bits;
15894 present = snd_hda_codec_read(codec, 0x1b, 0,
15895 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15896 bits = present ? HDA_AMP_MUTE : 0;
15897 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
15898 HDA_AMP_MUTE, bits);
15899 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
15900 HDA_AMP_MUTE, bits);
15903 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
15906 if ((res >> 26) == ALC880_HP_EVENT)
15907 alc662_lenovo_101e_all_automute(codec);
15908 if ((res >> 26) == ALC880_FRONT_EVENT)
15909 alc662_lenovo_101e_ispeaker_automute(codec);
15912 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
15914 unsigned int present;
15916 present = snd_hda_codec_read(codec, 0x18, 0,
15917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15918 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15919 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15920 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15921 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
15922 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15923 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15924 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15925 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
15928 /* unsolicited event for HP jack sensing */
15929 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
15932 if ((res >> 26) == ALC880_MIC_EVENT)
15933 alc662_eeepc_mic_automute(codec);
15935 alc262_hippo_unsol_event(codec, res);
15938 static void alc662_eeepc_inithook(struct hda_codec *codec)
15940 alc262_hippo1_init_hook(codec);
15941 alc662_eeepc_mic_automute(codec);
15944 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
15946 struct alc_spec *spec = codec->spec;
15948 spec->autocfg.hp_pins[0] = 0x14;
15949 spec->autocfg.speaker_pins[0] = 0x1b;
15950 alc262_hippo_master_update(codec);
15953 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
15955 unsigned int present;
15956 unsigned char bits;
15958 present = snd_hda_codec_read(codec, 0x21, 0,
15959 AC_VERB_GET_PIN_SENSE, 0)
15960 & AC_PINSENSE_PRESENCE;
15961 bits = present ? HDA_AMP_MUTE : 0;
15962 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15963 AMP_IN_MUTE(0), bits);
15964 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15965 AMP_IN_MUTE(0), bits);
15968 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
15970 unsigned int present;
15971 unsigned char bits;
15973 present = snd_hda_codec_read(codec, 0x21, 0,
15974 AC_VERB_GET_PIN_SENSE, 0)
15975 & AC_PINSENSE_PRESENCE;
15976 bits = present ? HDA_AMP_MUTE : 0;
15977 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15978 AMP_IN_MUTE(0), bits);
15979 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15980 AMP_IN_MUTE(0), bits);
15981 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
15982 AMP_IN_MUTE(0), bits);
15983 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
15984 AMP_IN_MUTE(0), bits);
15987 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
15989 unsigned int present;
15990 unsigned char bits;
15992 present = snd_hda_codec_read(codec, 0x15, 0,
15993 AC_VERB_GET_PIN_SENSE, 0)
15994 & AC_PINSENSE_PRESENCE;
15995 bits = present ? HDA_AMP_MUTE : 0;
15996 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
15997 AMP_IN_MUTE(0), bits);
15998 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
15999 AMP_IN_MUTE(0), bits);
16000 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16001 AMP_IN_MUTE(0), bits);
16002 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16003 AMP_IN_MUTE(0), bits);
16006 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16008 unsigned int present;
16009 unsigned char bits;
16011 present = snd_hda_codec_read(codec, 0x1b, 0,
16012 AC_VERB_GET_PIN_SENSE, 0)
16013 & AC_PINSENSE_PRESENCE;
16014 bits = present ? 0 : PIN_OUT;
16015 snd_hda_codec_write(codec, 0x14, 0,
16016 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16019 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16021 unsigned int present1, present2;
16023 present1 = snd_hda_codec_read(codec, 0x21, 0,
16024 AC_VERB_GET_PIN_SENSE, 0)
16025 & AC_PINSENSE_PRESENCE;
16026 present2 = snd_hda_codec_read(codec, 0x15, 0,
16027 AC_VERB_GET_PIN_SENSE, 0)
16028 & AC_PINSENSE_PRESENCE;
16030 if (present1 || present2) {
16031 snd_hda_codec_write_cache(codec, 0x14, 0,
16032 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16034 snd_hda_codec_write_cache(codec, 0x14, 0,
16035 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16039 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16041 unsigned int present1, present2;
16043 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16044 AC_VERB_GET_PIN_SENSE, 0)
16045 & AC_PINSENSE_PRESENCE;
16046 present2 = snd_hda_codec_read(codec, 0x15, 0,
16047 AC_VERB_GET_PIN_SENSE, 0)
16048 & AC_PINSENSE_PRESENCE;
16050 if (present1 || present2) {
16051 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16052 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16053 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16054 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16056 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16057 AMP_IN_MUTE(0), 0);
16058 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16059 AMP_IN_MUTE(0), 0);
16063 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16065 unsigned int present;
16067 present = snd_hda_codec_read(codec, 0x18, 0,
16068 AC_VERB_GET_PIN_SENSE, 0)
16069 & AC_PINSENSE_PRESENCE;
16070 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16071 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16072 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16073 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16074 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16075 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16076 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16077 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16080 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16083 switch (res >> 26) {
16084 case ALC880_HP_EVENT:
16085 alc663_m51va_speaker_automute(codec);
16087 case ALC880_MIC_EVENT:
16088 alc663_m51va_mic_automute(codec);
16093 static void alc663_m51va_inithook(struct hda_codec *codec)
16095 alc663_m51va_speaker_automute(codec);
16096 alc663_m51va_mic_automute(codec);
16099 /* ***************** Mode1 ******************************/
16100 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16103 switch (res >> 26) {
16104 case ALC880_HP_EVENT:
16105 alc663_m51va_speaker_automute(codec);
16107 case ALC880_MIC_EVENT:
16108 alc662_eeepc_mic_automute(codec);
16113 static void alc663_mode1_inithook(struct hda_codec *codec)
16115 alc663_m51va_speaker_automute(codec);
16116 alc662_eeepc_mic_automute(codec);
16118 /* ***************** Mode2 ******************************/
16119 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16122 switch (res >> 26) {
16123 case ALC880_HP_EVENT:
16124 alc662_f5z_speaker_automute(codec);
16126 case ALC880_MIC_EVENT:
16127 alc662_eeepc_mic_automute(codec);
16132 static void alc662_mode2_inithook(struct hda_codec *codec)
16134 alc662_f5z_speaker_automute(codec);
16135 alc662_eeepc_mic_automute(codec);
16137 /* ***************** Mode3 ******************************/
16138 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16141 switch (res >> 26) {
16142 case ALC880_HP_EVENT:
16143 alc663_two_hp_m1_speaker_automute(codec);
16145 case ALC880_MIC_EVENT:
16146 alc662_eeepc_mic_automute(codec);
16151 static void alc663_mode3_inithook(struct hda_codec *codec)
16153 alc663_two_hp_m1_speaker_automute(codec);
16154 alc662_eeepc_mic_automute(codec);
16156 /* ***************** Mode4 ******************************/
16157 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16160 switch (res >> 26) {
16161 case ALC880_HP_EVENT:
16162 alc663_21jd_two_speaker_automute(codec);
16164 case ALC880_MIC_EVENT:
16165 alc662_eeepc_mic_automute(codec);
16170 static void alc663_mode4_inithook(struct hda_codec *codec)
16172 alc663_21jd_two_speaker_automute(codec);
16173 alc662_eeepc_mic_automute(codec);
16175 /* ***************** Mode5 ******************************/
16176 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16179 switch (res >> 26) {
16180 case ALC880_HP_EVENT:
16181 alc663_15jd_two_speaker_automute(codec);
16183 case ALC880_MIC_EVENT:
16184 alc662_eeepc_mic_automute(codec);
16189 static void alc663_mode5_inithook(struct hda_codec *codec)
16191 alc663_15jd_two_speaker_automute(codec);
16192 alc662_eeepc_mic_automute(codec);
16194 /* ***************** Mode6 ******************************/
16195 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16198 switch (res >> 26) {
16199 case ALC880_HP_EVENT:
16200 alc663_two_hp_m2_speaker_automute(codec);
16202 case ALC880_MIC_EVENT:
16203 alc662_eeepc_mic_automute(codec);
16208 static void alc663_mode6_inithook(struct hda_codec *codec)
16210 alc663_two_hp_m2_speaker_automute(codec);
16211 alc662_eeepc_mic_automute(codec);
16214 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16216 unsigned int present;
16217 unsigned char bits;
16219 present = snd_hda_codec_read(codec, 0x21, 0,
16220 AC_VERB_GET_PIN_SENSE, 0)
16221 & AC_PINSENSE_PRESENCE;
16222 bits = present ? HDA_AMP_MUTE : 0;
16223 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16224 HDA_AMP_MUTE, bits);
16225 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16226 HDA_AMP_MUTE, bits);
16229 static void alc663_g71v_front_automute(struct hda_codec *codec)
16231 unsigned int present;
16232 unsigned char bits;
16234 present = snd_hda_codec_read(codec, 0x15, 0,
16235 AC_VERB_GET_PIN_SENSE, 0)
16236 & AC_PINSENSE_PRESENCE;
16237 bits = present ? HDA_AMP_MUTE : 0;
16238 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16239 HDA_AMP_MUTE, bits);
16242 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16245 switch (res >> 26) {
16246 case ALC880_HP_EVENT:
16247 alc663_g71v_hp_automute(codec);
16249 case ALC880_FRONT_EVENT:
16250 alc663_g71v_front_automute(codec);
16252 case ALC880_MIC_EVENT:
16253 alc662_eeepc_mic_automute(codec);
16258 static void alc663_g71v_inithook(struct hda_codec *codec)
16260 alc663_g71v_front_automute(codec);
16261 alc663_g71v_hp_automute(codec);
16262 alc662_eeepc_mic_automute(codec);
16265 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16268 switch (res >> 26) {
16269 case ALC880_HP_EVENT:
16270 alc663_m51va_speaker_automute(codec);
16272 case ALC880_MIC_EVENT:
16273 alc662_eeepc_mic_automute(codec);
16278 static void alc663_g50v_inithook(struct hda_codec *codec)
16280 alc663_m51va_speaker_automute(codec);
16281 alc662_eeepc_mic_automute(codec);
16284 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16285 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16286 ALC262_HIPPO_MASTER_SWITCH,
16288 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16289 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16290 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16292 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16293 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16294 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16298 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16299 /* Master Playback automatically created from Speaker and Headphone */
16300 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16301 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16302 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16303 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16305 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16306 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16307 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16309 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16310 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16311 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16315 #ifdef CONFIG_SND_HDA_POWER_SAVE
16316 #define alc662_loopbacks alc880_loopbacks
16320 /* pcm configuration: identical with ALC880 */
16321 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16322 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16323 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16324 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16327 * configuration and preset
16329 static const char *alc662_models[ALC662_MODEL_LAST] = {
16330 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16331 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16332 [ALC662_3ST_6ch] = "3stack-6ch",
16333 [ALC662_5ST_DIG] = "6stack-dig",
16334 [ALC662_LENOVO_101E] = "lenovo-101e",
16335 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16336 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16337 [ALC662_ECS] = "ecs",
16338 [ALC663_ASUS_M51VA] = "m51va",
16339 [ALC663_ASUS_G71V] = "g71v",
16340 [ALC663_ASUS_H13] = "h13",
16341 [ALC663_ASUS_G50V] = "g50v",
16342 [ALC663_ASUS_MODE1] = "asus-mode1",
16343 [ALC662_ASUS_MODE2] = "asus-mode2",
16344 [ALC663_ASUS_MODE3] = "asus-mode3",
16345 [ALC663_ASUS_MODE4] = "asus-mode4",
16346 [ALC663_ASUS_MODE5] = "asus-mode5",
16347 [ALC663_ASUS_MODE6] = "asus-mode6",
16348 [ALC272_DELL] = "dell",
16349 [ALC272_DELL_ZM1] = "dell-zm1",
16350 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16351 [ALC662_AUTO] = "auto",
16354 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16355 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16356 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16357 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16358 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16359 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16360 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16361 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16362 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16363 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16364 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16365 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16366 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16367 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16368 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16369 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16370 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16371 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16372 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16373 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16374 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16375 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16376 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16377 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16378 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16379 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16380 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16381 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16382 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16383 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16384 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16385 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16386 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16387 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16388 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16389 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16390 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16391 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16392 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16393 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16394 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16395 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16396 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16397 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16398 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16399 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16400 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16401 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16402 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16403 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16404 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16405 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16406 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16407 ALC662_3ST_6ch_DIG),
16408 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16409 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16410 ALC662_3ST_6ch_DIG),
16411 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16412 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16413 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16414 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16415 ALC662_3ST_6ch_DIG),
16416 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16421 static struct alc_config_preset alc662_presets[] = {
16422 [ALC662_3ST_2ch_DIG] = {
16423 .mixers = { alc662_3ST_2ch_mixer },
16424 .init_verbs = { alc662_init_verbs },
16425 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16426 .dac_nids = alc662_dac_nids,
16427 .dig_out_nid = ALC662_DIGOUT_NID,
16428 .dig_in_nid = ALC662_DIGIN_NID,
16429 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16430 .channel_mode = alc662_3ST_2ch_modes,
16431 .input_mux = &alc662_capture_source,
16433 [ALC662_3ST_6ch_DIG] = {
16434 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16435 .init_verbs = { alc662_init_verbs },
16436 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16437 .dac_nids = alc662_dac_nids,
16438 .dig_out_nid = ALC662_DIGOUT_NID,
16439 .dig_in_nid = ALC662_DIGIN_NID,
16440 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16441 .channel_mode = alc662_3ST_6ch_modes,
16443 .input_mux = &alc662_capture_source,
16445 [ALC662_3ST_6ch] = {
16446 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16447 .init_verbs = { alc662_init_verbs },
16448 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16449 .dac_nids = alc662_dac_nids,
16450 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16451 .channel_mode = alc662_3ST_6ch_modes,
16453 .input_mux = &alc662_capture_source,
16455 [ALC662_5ST_DIG] = {
16456 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16457 .init_verbs = { alc662_init_verbs },
16458 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16459 .dac_nids = alc662_dac_nids,
16460 .dig_out_nid = ALC662_DIGOUT_NID,
16461 .dig_in_nid = ALC662_DIGIN_NID,
16462 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16463 .channel_mode = alc662_5stack_modes,
16464 .input_mux = &alc662_capture_source,
16466 [ALC662_LENOVO_101E] = {
16467 .mixers = { alc662_lenovo_101e_mixer },
16468 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16470 .dac_nids = alc662_dac_nids,
16471 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16472 .channel_mode = alc662_3ST_2ch_modes,
16473 .input_mux = &alc662_lenovo_101e_capture_source,
16474 .unsol_event = alc662_lenovo_101e_unsol_event,
16475 .init_hook = alc662_lenovo_101e_all_automute,
16477 [ALC662_ASUS_EEEPC_P701] = {
16478 .mixers = { alc662_eeepc_p701_mixer },
16479 .init_verbs = { alc662_init_verbs,
16480 alc662_eeepc_sue_init_verbs },
16481 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16482 .dac_nids = alc662_dac_nids,
16483 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16484 .channel_mode = alc662_3ST_2ch_modes,
16485 .input_mux = &alc662_eeepc_capture_source,
16486 .unsol_event = alc662_eeepc_unsol_event,
16487 .init_hook = alc662_eeepc_inithook,
16489 [ALC662_ASUS_EEEPC_EP20] = {
16490 .mixers = { alc662_eeepc_ep20_mixer,
16491 alc662_chmode_mixer },
16492 .init_verbs = { alc662_init_verbs,
16493 alc662_eeepc_ep20_sue_init_verbs },
16494 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16495 .dac_nids = alc662_dac_nids,
16496 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16497 .channel_mode = alc662_3ST_6ch_modes,
16498 .input_mux = &alc662_lenovo_101e_capture_source,
16499 .unsol_event = alc662_eeepc_unsol_event,
16500 .init_hook = alc662_eeepc_ep20_inithook,
16503 .mixers = { alc662_ecs_mixer },
16504 .init_verbs = { alc662_init_verbs,
16505 alc662_ecs_init_verbs },
16506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16507 .dac_nids = alc662_dac_nids,
16508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16509 .channel_mode = alc662_3ST_2ch_modes,
16510 .input_mux = &alc662_eeepc_capture_source,
16511 .unsol_event = alc662_eeepc_unsol_event,
16512 .init_hook = alc662_eeepc_inithook,
16514 [ALC663_ASUS_M51VA] = {
16515 .mixers = { alc663_m51va_mixer },
16516 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16517 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16518 .dac_nids = alc662_dac_nids,
16519 .dig_out_nid = ALC662_DIGOUT_NID,
16520 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16521 .channel_mode = alc662_3ST_2ch_modes,
16522 .input_mux = &alc663_m51va_capture_source,
16523 .unsol_event = alc663_m51va_unsol_event,
16524 .init_hook = alc663_m51va_inithook,
16526 [ALC663_ASUS_G71V] = {
16527 .mixers = { alc663_g71v_mixer },
16528 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16529 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16530 .dac_nids = alc662_dac_nids,
16531 .dig_out_nid = ALC662_DIGOUT_NID,
16532 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16533 .channel_mode = alc662_3ST_2ch_modes,
16534 .input_mux = &alc662_eeepc_capture_source,
16535 .unsol_event = alc663_g71v_unsol_event,
16536 .init_hook = alc663_g71v_inithook,
16538 [ALC663_ASUS_H13] = {
16539 .mixers = { alc663_m51va_mixer },
16540 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16541 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16542 .dac_nids = alc662_dac_nids,
16543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16544 .channel_mode = alc662_3ST_2ch_modes,
16545 .input_mux = &alc663_m51va_capture_source,
16546 .unsol_event = alc663_m51va_unsol_event,
16547 .init_hook = alc663_m51va_inithook,
16549 [ALC663_ASUS_G50V] = {
16550 .mixers = { alc663_g50v_mixer },
16551 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16552 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16553 .dac_nids = alc662_dac_nids,
16554 .dig_out_nid = ALC662_DIGOUT_NID,
16555 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16556 .channel_mode = alc662_3ST_6ch_modes,
16557 .input_mux = &alc663_capture_source,
16558 .unsol_event = alc663_g50v_unsol_event,
16559 .init_hook = alc663_g50v_inithook,
16561 [ALC663_ASUS_MODE1] = {
16562 .mixers = { alc663_m51va_mixer },
16563 .cap_mixer = alc662_auto_capture_mixer,
16564 .init_verbs = { alc662_init_verbs,
16565 alc663_21jd_amic_init_verbs },
16566 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16568 .dac_nids = alc662_dac_nids,
16569 .dig_out_nid = ALC662_DIGOUT_NID,
16570 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16571 .channel_mode = alc662_3ST_2ch_modes,
16572 .input_mux = &alc662_eeepc_capture_source,
16573 .unsol_event = alc663_mode1_unsol_event,
16574 .init_hook = alc663_mode1_inithook,
16576 [ALC662_ASUS_MODE2] = {
16577 .mixers = { alc662_1bjd_mixer },
16578 .cap_mixer = alc662_auto_capture_mixer,
16579 .init_verbs = { alc662_init_verbs,
16580 alc662_1bjd_amic_init_verbs },
16581 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16582 .dac_nids = alc662_dac_nids,
16583 .dig_out_nid = ALC662_DIGOUT_NID,
16584 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16585 .channel_mode = alc662_3ST_2ch_modes,
16586 .input_mux = &alc662_eeepc_capture_source,
16587 .unsol_event = alc662_mode2_unsol_event,
16588 .init_hook = alc662_mode2_inithook,
16590 [ALC663_ASUS_MODE3] = {
16591 .mixers = { alc663_two_hp_m1_mixer },
16592 .cap_mixer = alc662_auto_capture_mixer,
16593 .init_verbs = { alc662_init_verbs,
16594 alc663_two_hp_amic_m1_init_verbs },
16595 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16597 .dac_nids = alc662_dac_nids,
16598 .dig_out_nid = ALC662_DIGOUT_NID,
16599 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16600 .channel_mode = alc662_3ST_2ch_modes,
16601 .input_mux = &alc662_eeepc_capture_source,
16602 .unsol_event = alc663_mode3_unsol_event,
16603 .init_hook = alc663_mode3_inithook,
16605 [ALC663_ASUS_MODE4] = {
16606 .mixers = { alc663_asus_21jd_clfe_mixer },
16607 .cap_mixer = alc662_auto_capture_mixer,
16608 .init_verbs = { alc662_init_verbs,
16609 alc663_21jd_amic_init_verbs},
16610 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16612 .dac_nids = alc662_dac_nids,
16613 .dig_out_nid = ALC662_DIGOUT_NID,
16614 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16615 .channel_mode = alc662_3ST_2ch_modes,
16616 .input_mux = &alc662_eeepc_capture_source,
16617 .unsol_event = alc663_mode4_unsol_event,
16618 .init_hook = alc663_mode4_inithook,
16620 [ALC663_ASUS_MODE5] = {
16621 .mixers = { alc663_asus_15jd_clfe_mixer },
16622 .cap_mixer = alc662_auto_capture_mixer,
16623 .init_verbs = { alc662_init_verbs,
16624 alc663_15jd_amic_init_verbs },
16625 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16627 .dac_nids = alc662_dac_nids,
16628 .dig_out_nid = ALC662_DIGOUT_NID,
16629 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16630 .channel_mode = alc662_3ST_2ch_modes,
16631 .input_mux = &alc662_eeepc_capture_source,
16632 .unsol_event = alc663_mode5_unsol_event,
16633 .init_hook = alc663_mode5_inithook,
16635 [ALC663_ASUS_MODE6] = {
16636 .mixers = { alc663_two_hp_m2_mixer },
16637 .cap_mixer = alc662_auto_capture_mixer,
16638 .init_verbs = { alc662_init_verbs,
16639 alc663_two_hp_amic_m2_init_verbs },
16640 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16642 .dac_nids = alc662_dac_nids,
16643 .dig_out_nid = ALC662_DIGOUT_NID,
16644 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16645 .channel_mode = alc662_3ST_2ch_modes,
16646 .input_mux = &alc662_eeepc_capture_source,
16647 .unsol_event = alc663_mode6_unsol_event,
16648 .init_hook = alc663_mode6_inithook,
16651 .mixers = { alc663_m51va_mixer },
16652 .cap_mixer = alc272_auto_capture_mixer,
16653 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
16654 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16655 .dac_nids = alc662_dac_nids,
16656 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16657 .adc_nids = alc272_adc_nids,
16658 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
16659 .capsrc_nids = alc272_capsrc_nids,
16660 .channel_mode = alc662_3ST_2ch_modes,
16661 .input_mux = &alc663_m51va_capture_source,
16662 .unsol_event = alc663_m51va_unsol_event,
16663 .init_hook = alc663_m51va_inithook,
16665 [ALC272_DELL_ZM1] = {
16666 .mixers = { alc663_m51va_mixer },
16667 .cap_mixer = alc662_auto_capture_mixer,
16668 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
16669 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16670 .dac_nids = alc662_dac_nids,
16671 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16672 .adc_nids = alc662_adc_nids,
16673 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
16674 .capsrc_nids = alc662_capsrc_nids,
16675 .channel_mode = alc662_3ST_2ch_modes,
16676 .input_mux = &alc663_m51va_capture_source,
16677 .unsol_event = alc663_m51va_unsol_event,
16678 .init_hook = alc663_m51va_inithook,
16680 [ALC272_SAMSUNG_NC10] = {
16681 .mixers = { alc272_nc10_mixer },
16682 .init_verbs = { alc662_init_verbs,
16683 alc663_21jd_amic_init_verbs },
16684 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
16685 .dac_nids = alc272_dac_nids,
16686 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16687 .channel_mode = alc662_3ST_2ch_modes,
16688 .input_mux = &alc272_nc10_capture_source,
16689 .unsol_event = alc663_mode4_unsol_event,
16690 .init_hook = alc663_mode4_inithook,
16696 * BIOS auto configuration
16699 /* add playback controls from the parsed DAC table */
16700 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
16701 const struct auto_pin_cfg *cfg)
16704 static const char *chname[4] = {
16705 "Front", "Surround", NULL /*CLFE*/, "Side"
16710 for (i = 0; i < cfg->line_outs; i++) {
16711 if (!spec->multiout.dac_nids[i])
16713 nid = alc880_idx_to_dac(i);
16716 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16717 "Center Playback Volume",
16718 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
16722 err = add_control(spec, ALC_CTL_WIDGET_VOL,
16723 "LFE Playback Volume",
16724 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
16728 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16729 "Center Playback Switch",
16730 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
16734 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
16735 "LFE Playback Switch",
16736 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
16741 sprintf(name, "%s Playback Volume", chname[i]);
16742 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16743 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
16747 sprintf(name, "%s Playback Switch", chname[i]);
16748 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16749 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
16758 /* add playback controls for speaker and HP outputs */
16759 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16770 /* ALC663 has a mono output pin on 0x17 */
16771 sprintf(name, "%s Playback Switch", pfx);
16772 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16773 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
16777 if (alc880_is_fixed_pin(pin)) {
16778 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16779 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
16780 /* specify the DAC as the extra output */
16781 if (!spec->multiout.hp_nid)
16782 spec->multiout.hp_nid = nid;
16784 spec->multiout.extra_out_nid[0] = nid;
16785 /* control HP volume/switch on the output mixer amp */
16786 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
16787 sprintf(name, "%s Playback Volume", pfx);
16788 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
16789 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
16792 sprintf(name, "%s Playback Switch", pfx);
16793 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
16794 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
16797 } else if (alc880_is_multi_pin(pin)) {
16798 /* set manual connection */
16799 /* we have only a switch on HP-out PIN */
16800 sprintf(name, "%s Playback Switch", pfx);
16801 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
16802 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
16809 /* return the index of the src widget from the connection list of the nid.
16810 * return -1 if not found
16812 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16815 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
16818 conns = snd_hda_get_connections(codec, nid, conn_list,
16819 ARRAY_SIZE(conn_list));
16822 for (i = 0; i < conns; i++)
16823 if (conn_list[i] == src)
16828 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16830 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16831 return (pincap & AC_PINCAP_IN) != 0;
16834 /* create playback/capture controls for input pins */
16835 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
16836 const struct auto_pin_cfg *cfg)
16838 struct alc_spec *spec = codec->spec;
16839 struct hda_input_mux *imux = &spec->private_imux[0];
16842 for (i = 0; i < AUTO_PIN_LAST; i++) {
16843 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
16844 idx = alc662_input_pin_idx(codec, 0x0b,
16845 cfg->input_pins[i]);
16847 err = new_analog_input(spec, cfg->input_pins[i],
16848 auto_pin_cfg_labels[i],
16853 idx = alc662_input_pin_idx(codec, 0x22,
16854 cfg->input_pins[i]);
16856 imux->items[imux->num_items].label =
16857 auto_pin_cfg_labels[i];
16858 imux->items[imux->num_items].index = idx;
16866 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
16867 hda_nid_t nid, int pin_type,
16870 alc_set_pin_output(codec, nid, pin_type);
16871 /* need the manual connection? */
16872 if (alc880_is_multi_pin(nid)) {
16873 struct alc_spec *spec = codec->spec;
16874 int idx = alc880_multi_pin_idx(nid);
16875 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
16876 AC_VERB_SET_CONNECT_SEL,
16877 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
16881 static void alc662_auto_init_multi_out(struct hda_codec *codec)
16883 struct alc_spec *spec = codec->spec;
16886 for (i = 0; i <= HDA_SIDE; i++) {
16887 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16888 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16890 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
16895 static void alc662_auto_init_hp_out(struct hda_codec *codec)
16897 struct alc_spec *spec = codec->spec;
16900 pin = spec->autocfg.hp_pins[0];
16901 if (pin) /* connect to front */
16903 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16904 pin = spec->autocfg.speaker_pins[0];
16906 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16909 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
16911 static void alc662_auto_init_analog_input(struct hda_codec *codec)
16913 struct alc_spec *spec = codec->spec;
16916 for (i = 0; i < AUTO_PIN_LAST; i++) {
16917 hda_nid_t nid = spec->autocfg.input_pins[i];
16918 if (alc662_is_input_pin(codec, nid)) {
16919 alc_set_input_pin(codec, nid, i);
16920 if (nid != ALC662_PIN_CD_NID &&
16921 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16922 snd_hda_codec_write(codec, nid, 0,
16923 AC_VERB_SET_AMP_GAIN_MUTE,
16929 #define alc662_auto_init_input_src alc882_auto_init_input_src
16931 static int alc662_parse_auto_config(struct hda_codec *codec)
16933 struct alc_spec *spec = codec->spec;
16935 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
16937 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16941 if (!spec->autocfg.line_outs)
16942 return 0; /* can't find valid BIOS pin config */
16944 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
16947 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
16950 err = alc662_auto_create_extra_out(spec,
16951 spec->autocfg.speaker_pins[0],
16955 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
16959 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
16963 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16965 if (spec->autocfg.dig_outs)
16966 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
16968 if (spec->kctls.list)
16969 add_mixer(spec, spec->kctls.list);
16971 spec->num_mux_defs = 1;
16972 spec->input_mux = &spec->private_imux[0];
16974 add_verb(spec, alc662_auto_init_verbs);
16975 if (codec->vendor_id == 0x10ec0663)
16976 add_verb(spec, alc663_auto_init_verbs);
16978 err = alc_auto_add_mic_boost(codec);
16982 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
16987 /* additional initialization for auto-configuration model */
16988 static void alc662_auto_init(struct hda_codec *codec)
16990 struct alc_spec *spec = codec->spec;
16991 alc662_auto_init_multi_out(codec);
16992 alc662_auto_init_hp_out(codec);
16993 alc662_auto_init_analog_input(codec);
16994 alc662_auto_init_input_src(codec);
16995 if (spec->unsol_event)
16996 alc_inithook(codec);
16999 static int patch_alc662(struct hda_codec *codec)
17001 struct alc_spec *spec;
17002 int err, board_config;
17004 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17008 codec->spec = spec;
17010 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17012 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17015 if (board_config < 0) {
17016 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17017 "trying auto-probe from BIOS...\n", codec->chip_name);
17018 board_config = ALC662_AUTO;
17021 if (board_config == ALC662_AUTO) {
17022 /* automatic parse from the BIOS config */
17023 err = alc662_parse_auto_config(codec);
17029 "hda_codec: Cannot set up configuration "
17030 "from BIOS. Using base mode...\n");
17031 board_config = ALC662_3ST_2ch_DIG;
17035 err = snd_hda_attach_beep_device(codec, 0x1);
17041 if (board_config != ALC662_AUTO)
17042 setup_preset(spec, &alc662_presets[board_config]);
17044 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17045 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17047 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17048 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17050 spec->adc_nids = alc662_adc_nids;
17051 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17052 spec->capsrc_nids = alc662_capsrc_nids;
17054 if (!spec->cap_mixer)
17055 set_capture_mixer(spec);
17056 if (codec->vendor_id == 0x10ec0662)
17057 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17059 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17061 spec->vmaster_nid = 0x02;
17063 codec->patch_ops = alc_patch_ops;
17064 if (board_config == ALC662_AUTO)
17065 spec->init_hook = alc662_auto_init;
17066 #ifdef CONFIG_SND_HDA_POWER_SAVE
17067 if (!spec->loopback.amplist)
17068 spec->loopback.amplist = alc662_loopbacks;
17070 codec->proc_widget_hook = print_realtek_coef;
17078 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17079 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17080 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17081 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17082 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17083 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17084 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17085 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17086 .patch = patch_alc861 },
17087 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17088 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17089 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17090 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17091 .patch = patch_alc882 },
17092 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17093 .patch = patch_alc662 },
17094 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17095 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17096 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17097 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17098 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17099 .patch = patch_alc882 },
17100 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17101 .patch = patch_alc882 },
17102 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17103 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17104 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17105 .patch = patch_alc882 },
17106 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
17107 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17108 {} /* terminator */
17111 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17113 MODULE_LICENSE("GPL");
17114 MODULE_DESCRIPTION("Realtek HD-audio codec");
17116 static struct hda_codec_preset_list realtek_list = {
17117 .preset = snd_hda_preset_realtek,
17118 .owner = THIS_MODULE,
17121 static int __init patch_realtek_init(void)
17123 return snd_hda_add_codec_preset(&realtek_list);
17126 static void __exit patch_realtek_exit(void)
17128 snd_hda_delete_codec_preset(&realtek_list);
17131 module_init(patch_realtek_init)
17132 module_exit(patch_realtek_exit)