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,
222 ALC883_TARGA_2ch_DIG,
223 ALC883_TARGA_8ch_DIG,
226 ALC888_ACER_ASPIRE_4930G,
227 ALC888_ACER_ASPIRE_6530G,
228 ALC888_ACER_ASPIRE_8930G,
232 ALC883_LENOVO_101E_2ch,
233 ALC883_LENOVO_NB0763,
234 ALC888_LENOVO_MS7195_DIG,
241 ALC883_FUJITSU_PI2515,
242 ALC888_FUJITSU_XA3530,
243 ALC883_3ST_6ch_INTEL,
253 /* styles of capture selection */
255 CAPT_MUX = 0, /* only mux based */
256 CAPT_MIX, /* only mixer based */
257 CAPT_1MUX_MIX, /* first mux and other mixers */
261 #define GPIO_MASK 0x03
263 /* extra amp-initialization sequence types */
273 /* codec parameterization */
274 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
275 unsigned int num_mixers;
276 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
277 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
279 const struct hda_verb *init_verbs[5]; /* initialization verbs
283 unsigned int num_init_verbs;
285 char stream_name_analog[16]; /* analog PCM stream */
286 struct hda_pcm_stream *stream_analog_playback;
287 struct hda_pcm_stream *stream_analog_capture;
288 struct hda_pcm_stream *stream_analog_alt_playback;
289 struct hda_pcm_stream *stream_analog_alt_capture;
291 char stream_name_digital[16]; /* digital PCM stream */
292 struct hda_pcm_stream *stream_digital_playback;
293 struct hda_pcm_stream *stream_digital_capture;
296 struct hda_multi_out multiout; /* playback set-up
297 * max_channels, dacs must be set
298 * dig_out_nid and hp_nid are optional
300 hda_nid_t alt_dac_nid;
301 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
305 unsigned int num_adc_nids;
307 hda_nid_t *capsrc_nids;
308 hda_nid_t dig_in_nid; /* digital-in NID; optional */
309 int capture_style; /* capture style (CAPT_*) */
312 unsigned int num_mux_defs;
313 const struct hda_input_mux *input_mux;
314 unsigned int cur_mux[3];
317 const struct hda_channel_mode *channel_mode;
318 int num_channel_mode;
320 int const_channel_count;
321 int ext_channel_count;
323 /* PCM information */
324 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
326 /* dynamic controls, init_verbs and input_mux */
327 struct auto_pin_cfg autocfg;
328 struct snd_array kctls;
329 struct hda_input_mux private_imux[3];
330 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
333 void (*init_hook)(struct hda_codec *codec);
334 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
336 /* for pin sensing */
337 unsigned int sense_updated: 1;
338 unsigned int jack_present: 1;
339 unsigned int master_sw: 1;
342 unsigned int no_analog :1; /* digital I/O only */
345 /* for virtual master */
346 hda_nid_t vmaster_nid;
347 #ifdef CONFIG_SND_HDA_POWER_SAVE
348 struct hda_loopback_check loopback;
353 unsigned int pll_coef_idx, pll_coef_bit;
357 * configuration template - to be copied to the spec instance
359 struct alc_config_preset {
360 struct snd_kcontrol_new *mixers[5]; /* should be identical size
363 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
364 const struct hda_verb *init_verbs[5];
365 unsigned int num_dacs;
367 hda_nid_t dig_out_nid; /* optional */
368 hda_nid_t hp_nid; /* optional */
369 hda_nid_t *slave_dig_outs;
370 unsigned int num_adc_nids;
372 hda_nid_t *capsrc_nids;
373 hda_nid_t dig_in_nid;
374 unsigned int num_channel_mode;
375 const struct hda_channel_mode *channel_mode;
377 int const_channel_count;
378 unsigned int num_mux_defs;
379 const struct hda_input_mux *input_mux;
380 void (*unsol_event)(struct hda_codec *, unsigned int);
381 void (*init_hook)(struct hda_codec *);
382 #ifdef CONFIG_SND_HDA_POWER_SAVE
383 struct hda_amp_list *loopbacks;
391 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
392 struct snd_ctl_elem_info *uinfo)
394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
395 struct alc_spec *spec = codec->spec;
396 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
397 if (mux_idx >= spec->num_mux_defs)
399 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
402 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_value *ucontrol)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
409 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
413 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 const struct hda_input_mux *imux;
419 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 unsigned int mux_idx;
421 hda_nid_t nid = spec->capsrc_nids ?
422 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
424 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
425 imux = &spec->input_mux[mux_idx];
427 if (spec->capture_style &&
428 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
429 /* Matrix-mixer style (e.g. ALC882) */
430 unsigned int *cur_val = &spec->cur_mux[adc_idx];
433 idx = ucontrol->value.enumerated.item[0];
434 if (idx >= imux->num_items)
435 idx = imux->num_items - 1;
438 for (i = 0; i < imux->num_items; i++) {
439 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
440 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
441 imux->items[i].index,
447 /* MUX style (e.g. ALC880) */
448 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
449 &spec->cur_mux[adc_idx]);
454 * channel mode setting
456 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
457 struct snd_ctl_elem_info *uinfo)
459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
460 struct alc_spec *spec = codec->spec;
461 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
462 spec->num_channel_mode);
465 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
466 struct snd_ctl_elem_value *ucontrol)
468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
469 struct alc_spec *spec = codec->spec;
470 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
471 spec->num_channel_mode,
472 spec->ext_channel_count);
475 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
476 struct snd_ctl_elem_value *ucontrol)
478 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
479 struct alc_spec *spec = codec->spec;
480 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
481 spec->num_channel_mode,
482 &spec->ext_channel_count);
483 if (err >= 0 && !spec->const_channel_count) {
484 spec->multiout.max_channels = spec->ext_channel_count;
485 if (spec->need_dac_fix)
486 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
492 * Control the mode of pin widget settings via the mixer. "pc" is used
493 * instead of "%" to avoid consequences of accidently treating the % as
494 * being part of a format specifier. Maximum allowed length of a value is
495 * 63 characters plus NULL terminator.
497 * Note: some retasking pin complexes seem to ignore requests for input
498 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
499 * are requested. Therefore order this list so that this behaviour will not
500 * cause problems when mixer clients move through the enum sequentially.
501 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
504 static char *alc_pin_mode_names[] = {
505 "Mic 50pc bias", "Mic 80pc bias",
506 "Line in", "Line out", "Headphone out",
508 static unsigned char alc_pin_mode_values[] = {
509 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
511 /* The control can present all 5 options, or it can limit the options based
512 * in the pin being assumed to be exclusively an input or an output pin. In
513 * addition, "input" pins may or may not process the mic bias option
514 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
515 * accept requests for bias as of chip versions up to March 2006) and/or
516 * wiring in the computer.
518 #define ALC_PIN_DIR_IN 0x00
519 #define ALC_PIN_DIR_OUT 0x01
520 #define ALC_PIN_DIR_INOUT 0x02
521 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
522 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
524 /* Info about the pin modes supported by the different pin direction modes.
525 * For each direction the minimum and maximum values are given.
527 static signed char alc_pin_mode_dir_info[5][2] = {
528 { 0, 2 }, /* ALC_PIN_DIR_IN */
529 { 3, 4 }, /* ALC_PIN_DIR_OUT */
530 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
531 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
532 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
534 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
535 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
536 #define alc_pin_mode_n_items(_dir) \
537 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
539 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
540 struct snd_ctl_elem_info *uinfo)
542 unsigned int item_num = uinfo->value.enumerated.item;
543 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
545 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
547 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
549 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
550 item_num = alc_pin_mode_min(dir);
551 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
555 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
556 struct snd_ctl_elem_value *ucontrol)
559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
560 hda_nid_t nid = kcontrol->private_value & 0xffff;
561 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
562 long *valp = ucontrol->value.integer.value;
563 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
564 AC_VERB_GET_PIN_WIDGET_CONTROL,
567 /* Find enumerated value for current pinctl setting */
568 i = alc_pin_mode_min(dir);
569 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
571 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
575 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
576 struct snd_ctl_elem_value *ucontrol)
579 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
580 hda_nid_t nid = kcontrol->private_value & 0xffff;
581 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
582 long val = *ucontrol->value.integer.value;
583 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
584 AC_VERB_GET_PIN_WIDGET_CONTROL,
587 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
588 val = alc_pin_mode_min(dir);
590 change = pinctl != alc_pin_mode_values[val];
592 /* Set pin mode to that requested */
593 snd_hda_codec_write_cache(codec, nid, 0,
594 AC_VERB_SET_PIN_WIDGET_CONTROL,
595 alc_pin_mode_values[val]);
597 /* Also enable the retasking pin's input/output as required
598 * for the requested pin mode. Enum values of 2 or less are
601 * Dynamically switching the input/output buffers probably
602 * reduces noise slightly (particularly on input) so we'll
603 * do it. However, having both input and output buffers
604 * enabled simultaneously doesn't seem to be problematic if
605 * this turns out to be necessary in the future.
608 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
609 HDA_AMP_MUTE, HDA_AMP_MUTE);
610 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
613 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
614 HDA_AMP_MUTE, HDA_AMP_MUTE);
615 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
622 #define ALC_PIN_MODE(xname, nid, dir) \
623 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
624 .info = alc_pin_mode_info, \
625 .get = alc_pin_mode_get, \
626 .put = alc_pin_mode_put, \
627 .private_value = nid | (dir<<16) }
629 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
630 * together using a mask with more than one bit set. This control is
631 * currently used only by the ALC260 test model. At this stage they are not
632 * needed for any "production" models.
634 #ifdef CONFIG_SND_DEBUG
635 #define alc_gpio_data_info snd_ctl_boolean_mono_info
637 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
638 struct snd_ctl_elem_value *ucontrol)
640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
641 hda_nid_t nid = kcontrol->private_value & 0xffff;
642 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
643 long *valp = ucontrol->value.integer.value;
644 unsigned int val = snd_hda_codec_read(codec, nid, 0,
645 AC_VERB_GET_GPIO_DATA, 0x00);
647 *valp = (val & mask) != 0;
650 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
654 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
655 hda_nid_t nid = kcontrol->private_value & 0xffff;
656 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
657 long val = *ucontrol->value.integer.value;
658 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
659 AC_VERB_GET_GPIO_DATA,
662 /* Set/unset the masked GPIO bit(s) as needed */
663 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
668 snd_hda_codec_write_cache(codec, nid, 0,
669 AC_VERB_SET_GPIO_DATA, gpio_data);
673 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
674 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
675 .info = alc_gpio_data_info, \
676 .get = alc_gpio_data_get, \
677 .put = alc_gpio_data_put, \
678 .private_value = nid | (mask<<16) }
679 #endif /* CONFIG_SND_DEBUG */
681 /* A switch control to allow the enabling of the digital IO pins on the
682 * ALC260. This is incredibly simplistic; the intention of this control is
683 * to provide something in the test model allowing digital outputs to be
684 * identified if present. If models are found which can utilise these
685 * outputs a more complete mixer control can be devised for those models if
688 #ifdef CONFIG_SND_DEBUG
689 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
691 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
692 struct snd_ctl_elem_value *ucontrol)
694 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
695 hda_nid_t nid = kcontrol->private_value & 0xffff;
696 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
697 long *valp = ucontrol->value.integer.value;
698 unsigned int val = snd_hda_codec_read(codec, nid, 0,
699 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
701 *valp = (val & mask) != 0;
704 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
705 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long val = *ucontrol->value.integer.value;
712 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_DIGI_CONVERT_1,
716 /* Set/unset the masked control bit(s) as needed */
717 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
722 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
727 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
728 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
729 .info = alc_spdif_ctrl_info, \
730 .get = alc_spdif_ctrl_get, \
731 .put = alc_spdif_ctrl_put, \
732 .private_value = nid | (mask<<16) }
733 #endif /* CONFIG_SND_DEBUG */
735 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
736 * Again, this is only used in the ALC26x test models to help identify when
737 * the EAPD line must be asserted for features to work.
739 #ifdef CONFIG_SND_DEBUG
740 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
742 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
743 struct snd_ctl_elem_value *ucontrol)
745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
746 hda_nid_t nid = kcontrol->private_value & 0xffff;
747 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
748 long *valp = ucontrol->value.integer.value;
749 unsigned int val = snd_hda_codec_read(codec, nid, 0,
750 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
752 *valp = (val & mask) != 0;
756 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
757 struct snd_ctl_elem_value *ucontrol)
760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
761 hda_nid_t nid = kcontrol->private_value & 0xffff;
762 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
763 long val = *ucontrol->value.integer.value;
764 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
765 AC_VERB_GET_EAPD_BTLENABLE,
768 /* Set/unset the masked control bit(s) as needed */
769 change = (!val ? 0 : mask) != (ctrl_data & mask);
774 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
780 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
781 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
782 .info = alc_eapd_ctrl_info, \
783 .get = alc_eapd_ctrl_get, \
784 .put = alc_eapd_ctrl_put, \
785 .private_value = nid | (mask<<16) }
786 #endif /* CONFIG_SND_DEBUG */
789 * set up the input pin config (depending on the given auto-pin type)
791 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
794 unsigned int val = PIN_IN;
796 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
798 pincap = snd_hda_query_pin_caps(codec, nid);
799 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
800 if (pincap & AC_PINCAP_VREF_80)
802 else if (pincap & AC_PINCAP_VREF_50)
804 else if (pincap & AC_PINCAP_VREF_100)
806 else if (pincap & AC_PINCAP_VREF_GRD)
809 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
814 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
816 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
818 spec->mixers[spec->num_mixers++] = mix;
821 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
823 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
825 spec->init_verbs[spec->num_init_verbs++] = verb;
828 #ifdef CONFIG_PROC_FS
832 static void print_realtek_coef(struct snd_info_buffer *buffer,
833 struct hda_codec *codec, hda_nid_t nid)
839 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
840 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
841 coeff = snd_hda_codec_read(codec, nid, 0,
842 AC_VERB_GET_COEF_INDEX, 0);
843 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
846 #define print_realtek_coef NULL
850 * set up from the preset table
852 static void setup_preset(struct alc_spec *spec,
853 const struct alc_config_preset *preset)
857 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
858 add_mixer(spec, preset->mixers[i]);
859 spec->cap_mixer = preset->cap_mixer;
860 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
862 add_verb(spec, preset->init_verbs[i]);
864 spec->channel_mode = preset->channel_mode;
865 spec->num_channel_mode = preset->num_channel_mode;
866 spec->need_dac_fix = preset->need_dac_fix;
867 spec->const_channel_count = preset->const_channel_count;
869 if (preset->const_channel_count)
870 spec->multiout.max_channels = preset->const_channel_count;
872 spec->multiout.max_channels = spec->channel_mode[0].channels;
873 spec->ext_channel_count = spec->channel_mode[0].channels;
875 spec->multiout.num_dacs = preset->num_dacs;
876 spec->multiout.dac_nids = preset->dac_nids;
877 spec->multiout.dig_out_nid = preset->dig_out_nid;
878 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
879 spec->multiout.hp_nid = preset->hp_nid;
881 spec->num_mux_defs = preset->num_mux_defs;
882 if (!spec->num_mux_defs)
883 spec->num_mux_defs = 1;
884 spec->input_mux = preset->input_mux;
886 spec->num_adc_nids = preset->num_adc_nids;
887 spec->adc_nids = preset->adc_nids;
888 spec->capsrc_nids = preset->capsrc_nids;
889 spec->dig_in_nid = preset->dig_in_nid;
891 spec->unsol_event = preset->unsol_event;
892 spec->init_hook = preset->init_hook;
893 #ifdef CONFIG_SND_HDA_POWER_SAVE
894 spec->loopback.amplist = preset->loopbacks;
898 /* Enable GPIO mask and set output */
899 static struct hda_verb alc_gpio1_init_verbs[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
902 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
906 static struct hda_verb alc_gpio2_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
913 static struct hda_verb alc_gpio3_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
921 * Fix hardware PLL issue
922 * On some codecs, the analog PLL gating control must be off while
923 * the default value is 1.
925 static void alc_fix_pll(struct hda_codec *codec)
927 struct alc_spec *spec = codec->spec;
932 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
934 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
935 AC_VERB_GET_PROC_COEF, 0);
936 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
939 val & ~(1 << spec->pll_coef_bit));
942 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
943 unsigned int coef_idx, unsigned int coef_bit)
945 struct alc_spec *spec = codec->spec;
947 spec->pll_coef_idx = coef_idx;
948 spec->pll_coef_bit = coef_bit;
952 static void alc_automute_pin(struct hda_codec *codec)
954 struct alc_spec *spec = codec->spec;
955 unsigned int present;
956 unsigned int nid = spec->autocfg.hp_pins[0];
959 /* need to execute and sync at first */
960 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
961 present = snd_hda_codec_read(codec, nid, 0,
962 AC_VERB_GET_PIN_SENSE, 0);
963 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
964 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
965 nid = spec->autocfg.speaker_pins[i];
968 snd_hda_codec_write(codec, nid, 0,
969 AC_VERB_SET_PIN_WIDGET_CONTROL,
970 spec->jack_present ? 0 : PIN_OUT);
974 #if 0 /* it's broken in some cases -- temporarily disabled */
975 static void alc_mic_automute(struct hda_codec *codec)
977 struct alc_spec *spec = codec->spec;
978 unsigned int present;
979 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
980 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
981 unsigned int mix_nid = spec->capsrc_nids[0];
982 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
984 capsrc_idx_mic = mic_nid - 0x18;
985 capsrc_idx_fmic = fmic_nid - 0x18;
986 present = snd_hda_codec_read(codec, mic_nid, 0,
987 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
988 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
989 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
990 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
991 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
992 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
993 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
996 #define alc_mic_automute(codec) do {} while(0) /* NOP */
997 #endif /* disabled */
999 /* unsolicited event for HP jack sensing */
1000 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1002 if (codec->vendor_id == 0x10ec0880)
1007 case ALC880_HP_EVENT:
1008 alc_automute_pin(codec);
1010 case ALC880_MIC_EVENT:
1011 alc_mic_automute(codec);
1016 static void alc_inithook(struct hda_codec *codec)
1018 alc_automute_pin(codec);
1019 alc_mic_automute(codec);
1022 /* additional initialization for ALC888 variants */
1023 static void alc888_coef_init(struct hda_codec *codec)
1027 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1028 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1029 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1030 if ((tmp & 0xf0) == 0x20)
1032 snd_hda_codec_read(codec, 0x20, 0,
1033 AC_VERB_SET_PROC_COEF, 0x830);
1036 snd_hda_codec_read(codec, 0x20, 0,
1037 AC_VERB_SET_PROC_COEF, 0x3030);
1040 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1045 case ALC_INIT_GPIO1:
1046 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1048 case ALC_INIT_GPIO2:
1049 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1051 case ALC_INIT_GPIO3:
1052 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1054 case ALC_INIT_DEFAULT:
1055 switch (codec->vendor_id) {
1057 snd_hda_codec_write(codec, 0x0f, 0,
1058 AC_VERB_SET_EAPD_BTLENABLE, 2);
1059 snd_hda_codec_write(codec, 0x10, 0,
1060 AC_VERB_SET_EAPD_BTLENABLE, 2);
1072 snd_hda_codec_write(codec, 0x14, 0,
1073 AC_VERB_SET_EAPD_BTLENABLE, 2);
1074 snd_hda_codec_write(codec, 0x15, 0,
1075 AC_VERB_SET_EAPD_BTLENABLE, 2);
1078 switch (codec->vendor_id) {
1080 snd_hda_codec_write(codec, 0x1a, 0,
1081 AC_VERB_SET_COEF_INDEX, 7);
1082 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1083 AC_VERB_GET_PROC_COEF, 0);
1084 snd_hda_codec_write(codec, 0x1a, 0,
1085 AC_VERB_SET_COEF_INDEX, 7);
1086 snd_hda_codec_write(codec, 0x1a, 0,
1087 AC_VERB_SET_PROC_COEF,
1097 snd_hda_codec_write(codec, 0x20, 0,
1098 AC_VERB_SET_COEF_INDEX, 7);
1099 tmp = snd_hda_codec_read(codec, 0x20, 0,
1100 AC_VERB_GET_PROC_COEF, 0);
1101 snd_hda_codec_write(codec, 0x20, 0,
1102 AC_VERB_SET_COEF_INDEX, 7);
1103 snd_hda_codec_write(codec, 0x20, 0,
1104 AC_VERB_SET_PROC_COEF,
1108 alc888_coef_init(codec);
1112 snd_hda_codec_write(codec, 0x20, 0,
1113 AC_VERB_SET_COEF_INDEX, 7);
1114 tmp = snd_hda_codec_read(codec, 0x20, 0,
1115 AC_VERB_GET_PROC_COEF, 0);
1116 snd_hda_codec_write(codec, 0x20, 0,
1117 AC_VERB_SET_COEF_INDEX, 7);
1118 snd_hda_codec_write(codec, 0x20, 0,
1119 AC_VERB_SET_PROC_COEF,
1127 static void alc_init_auto_hp(struct hda_codec *codec)
1129 struct alc_spec *spec = codec->spec;
1131 if (!spec->autocfg.hp_pins[0])
1134 if (!spec->autocfg.speaker_pins[0]) {
1135 if (spec->autocfg.line_out_pins[0] &&
1136 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1137 spec->autocfg.speaker_pins[0] =
1138 spec->autocfg.line_out_pins[0];
1143 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1144 spec->autocfg.hp_pins[0]);
1145 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1146 AC_VERB_SET_UNSOLICITED_ENABLE,
1147 AC_USRSP_EN | ALC880_HP_EVENT);
1148 spec->unsol_event = alc_sku_unsol_event;
1151 /* check subsystem ID and set up device-specific initialization;
1152 * return 1 if initialized, 0 if invalid SSID
1154 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1155 * 31 ~ 16 : Manufacture ID
1157 * 7 ~ 0 : Assembly ID
1158 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1160 static int alc_subsystem_id(struct hda_codec *codec,
1161 hda_nid_t porta, hda_nid_t porte,
1164 unsigned int ass, tmp, i;
1166 struct alc_spec *spec = codec->spec;
1168 ass = codec->subsystem_id & 0xffff;
1169 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1172 /* invalid SSID, check the special NID pin defcfg instead */
1174 * 31~30 : port connectivity
1177 * 19~16 : Check sum (15:1)
1182 if (codec->vendor_id == 0x10ec0260)
1184 ass = snd_hda_codec_get_pincfg(codec, nid);
1185 snd_printd("realtek: No valid SSID, "
1186 "checking pincfg 0x%08x for NID 0x%x\n",
1188 if (!(ass & 1) && !(ass & 0x100000))
1190 if ((ass >> 30) != 1) /* no physical connection */
1195 for (i = 1; i < 16; i++) {
1199 if (((ass >> 16) & 0xf) != tmp)
1202 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1203 ass & 0xffff, codec->vendor_id);
1207 * 2 : 0 --> Desktop, 1 --> Laptop
1208 * 3~5 : External Amplifier control
1211 tmp = (ass & 0x38) >> 3; /* external Amp control */
1214 spec->init_amp = ALC_INIT_GPIO1;
1217 spec->init_amp = ALC_INIT_GPIO2;
1220 spec->init_amp = ALC_INIT_GPIO3;
1223 spec->init_amp = ALC_INIT_DEFAULT;
1227 /* is laptop or Desktop and enable the function "Mute internal speaker
1228 * when the external headphone out jack is plugged"
1230 if (!(ass & 0x8000))
1233 * 10~8 : Jack location
1234 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1236 * 15 : 1 --> enable the function "Mute internal speaker
1237 * when the external headphone out jack is plugged"
1239 if (!spec->autocfg.hp_pins[0]) {
1240 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1242 spec->autocfg.hp_pins[0] = porta;
1244 spec->autocfg.hp_pins[0] = porte;
1246 spec->autocfg.hp_pins[0] = portd;
1251 alc_init_auto_hp(codec);
1255 static void alc_ssid_check(struct hda_codec *codec,
1256 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1258 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1259 struct alc_spec *spec = codec->spec;
1260 snd_printd("realtek: "
1261 "Enable default setup for auto mode as fallback\n");
1262 spec->init_amp = ALC_INIT_DEFAULT;
1263 alc_init_auto_hp(codec);
1268 * Fix-up pin default configurations
1276 static void alc_fix_pincfg(struct hda_codec *codec,
1277 const struct snd_pci_quirk *quirk,
1278 const struct alc_pincfg **pinfix)
1280 const struct alc_pincfg *cfg;
1282 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1286 cfg = pinfix[quirk->value];
1287 for (; cfg->nid; cfg++)
1288 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1298 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1299 /* Mic-in jack as mic in */
1300 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1301 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1302 /* Line-in jack as Line in */
1303 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1304 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1305 /* Line-Out as Front */
1306 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1313 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1314 /* Mic-in jack as mic in */
1315 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1316 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1317 /* Line-in jack as Surround */
1318 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1319 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1320 /* Line-Out as Front */
1321 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1328 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1329 /* Mic-in jack as CLFE */
1330 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1331 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1332 /* Line-in jack as Surround */
1333 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1334 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1335 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1336 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1343 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1344 /* Mic-in jack as CLFE */
1345 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1346 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1347 /* Line-in jack as Surround */
1348 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1349 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1350 /* Line-Out as Side */
1351 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1355 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1356 { 2, alc888_4ST_ch2_intel_init },
1357 { 4, alc888_4ST_ch4_intel_init },
1358 { 6, alc888_4ST_ch6_intel_init },
1359 { 8, alc888_4ST_ch8_intel_init },
1363 * ALC888 Fujitsu Siemens Amillo xa3530
1366 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1367 /* Front Mic: set to PIN_IN (empty by default) */
1368 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1369 /* Connect Internal HP to Front */
1370 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1371 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1372 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1373 /* Connect Bass HP to Front */
1374 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1375 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1376 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1377 /* Connect Line-Out side jack (SPDIF) to Side */
1378 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1379 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1380 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1381 /* Connect Mic jack to CLFE */
1382 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1383 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1384 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1385 /* Connect Line-in jack to Surround */
1386 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1387 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1388 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1389 /* Connect HP out jack to Front */
1390 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1391 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1392 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1393 /* Enable unsolicited event for HP jack and Line-out jack */
1394 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1395 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1399 static void alc_automute_amp(struct hda_codec *codec)
1401 struct alc_spec *spec = codec->spec;
1402 unsigned int val, mute;
1406 spec->jack_present = 0;
1407 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1408 nid = spec->autocfg.hp_pins[i];
1411 val = snd_hda_codec_read(codec, nid, 0,
1412 AC_VERB_GET_PIN_SENSE, 0);
1413 if (val & AC_PINSENSE_PRESENCE) {
1414 spec->jack_present = 1;
1419 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1420 /* Toggle internal speakers muting */
1421 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1422 nid = spec->autocfg.speaker_pins[i];
1425 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1426 HDA_AMP_MUTE, mute);
1430 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1433 if (codec->vendor_id == 0x10ec0880)
1437 if (res == ALC880_HP_EVENT)
1438 alc_automute_amp(codec);
1441 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1443 struct alc_spec *spec = codec->spec;
1445 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1446 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1447 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1448 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1449 alc_automute_amp(codec);
1453 * ALC888 Acer Aspire 4930G model
1456 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1457 /* Front Mic: set to PIN_IN (empty by default) */
1458 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1459 /* Unselect Front Mic by default in input mixer 3 */
1460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1461 /* Enable unsolicited event for HP jack */
1462 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1463 /* Connect Internal HP to front */
1464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1465 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1466 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1467 /* Connect HP out to front */
1468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1470 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1475 * ALC888 Acer Aspire 6530G model
1478 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1479 /* Bias voltage on for external mic port */
1480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1481 /* Enable unsolicited event for HP jack */
1482 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1483 /* Enable speaker output */
1484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1486 /* Enable headphone output */
1487 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1489 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1494 * ALC889 Acer Aspire 8930G model
1497 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1498 /* Front Mic: set to PIN_IN (empty by default) */
1499 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1500 /* Unselect Front Mic by default in input mixer 3 */
1501 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1502 /* Enable unsolicited event for HP jack */
1503 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1504 /* Connect Internal Front to Front */
1505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1507 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1508 /* Connect Internal Rear to Rear */
1509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1511 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1512 /* Connect Internal CLFE to CLFE */
1513 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1514 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1515 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1516 /* Connect HP out to Front */
1517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1519 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1520 /* Enable all DACs */
1521 /* DAC DISABLE/MUTE 1? */
1522 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1523 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1524 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1525 /* DAC DISABLE/MUTE 2? */
1526 /* some bit here disables the other DACs. Init=0x4900 */
1527 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1528 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1529 /* Enable amplifiers */
1530 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1531 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1533 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1534 * which makes the stereo useless. However, either the mic or the ALC889
1535 * makes the signal become a difference/sum signal instead of standard
1536 * stereo, which is annoying. So instead we flip this bit which makes the
1537 * codec replicate the sum signal to both channels, turning it into a
1540 /* DMIC_CONTROL? Init value = 0x0001 */
1541 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1542 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1546 static struct hda_input_mux alc888_2_capture_sources[2] = {
1547 /* Front mic only available on one ADC */
1554 { "Front Mic", 0xb },
1567 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1568 /* Interal mic only available on one ADC */
1586 static struct hda_input_mux alc889_capture_sources[3] = {
1587 /* Digital mic only available on first "ADC" */
1594 { "Front Mic", 0xb },
1595 { "Input Mix", 0xa },
1604 { "Input Mix", 0xa },
1613 { "Input Mix", 0xa },
1618 static struct snd_kcontrol_new alc888_base_mixer[] = {
1619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1620 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1621 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1622 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1623 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1625 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1626 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1627 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1628 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1629 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1630 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1631 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1632 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1633 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1635 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1636 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1640 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1642 struct alc_spec *spec = codec->spec;
1644 spec->autocfg.hp_pins[0] = 0x15;
1645 spec->autocfg.speaker_pins[0] = 0x14;
1646 alc_automute_amp(codec);
1649 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1651 struct alc_spec *spec = codec->spec;
1653 spec->autocfg.hp_pins[0] = 0x15;
1654 spec->autocfg.speaker_pins[0] = 0x14;
1655 spec->autocfg.speaker_pins[1] = 0x16;
1656 spec->autocfg.speaker_pins[2] = 0x1b;
1657 alc_automute_amp(codec);
1661 * ALC880 3-stack model
1663 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1664 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1665 * F-Mic = 0x1b, HP = 0x19
1668 static hda_nid_t alc880_dac_nids[4] = {
1669 /* front, rear, clfe, rear_surr */
1670 0x02, 0x05, 0x04, 0x03
1673 static hda_nid_t alc880_adc_nids[3] = {
1678 /* The datasheet says the node 0x07 is connected from inputs,
1679 * but it shows zero connection in the real implementation on some devices.
1680 * Note: this is a 915GAV bug, fixed on 915GLV
1682 static hda_nid_t alc880_adc_nids_alt[2] = {
1687 #define ALC880_DIGOUT_NID 0x06
1688 #define ALC880_DIGIN_NID 0x0a
1690 static struct hda_input_mux alc880_capture_source = {
1694 { "Front Mic", 0x3 },
1700 /* channel source setting (2/6 channel selection for 3-stack) */
1702 static struct hda_verb alc880_threestack_ch2_init[] = {
1703 /* set line-in to input, mute it */
1704 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1705 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1706 /* set mic-in to input vref 80%, mute it */
1707 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1708 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1713 static struct hda_verb alc880_threestack_ch6_init[] = {
1714 /* set line-in to output, unmute it */
1715 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1716 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1717 /* set mic-in to output, unmute it */
1718 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1719 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1723 static struct hda_channel_mode alc880_threestack_modes[2] = {
1724 { 2, alc880_threestack_ch2_init },
1725 { 6, alc880_threestack_ch6_init },
1728 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1729 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1730 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1731 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1732 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1733 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1734 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1735 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1736 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1737 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1738 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1739 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1740 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1741 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1742 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1743 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1744 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1745 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1747 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1748 .name = "Channel Mode",
1749 .info = alc_ch_mode_info,
1750 .get = alc_ch_mode_get,
1751 .put = alc_ch_mode_put,
1756 /* capture mixer elements */
1757 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1758 struct snd_ctl_elem_info *uinfo)
1760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1761 struct alc_spec *spec = codec->spec;
1764 mutex_lock(&codec->control_mutex);
1765 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1767 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1768 mutex_unlock(&codec->control_mutex);
1772 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1773 unsigned int size, unsigned int __user *tlv)
1775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1776 struct alc_spec *spec = codec->spec;
1779 mutex_lock(&codec->control_mutex);
1780 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1782 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1783 mutex_unlock(&codec->control_mutex);
1787 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1788 struct snd_ctl_elem_value *ucontrol);
1790 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1791 struct snd_ctl_elem_value *ucontrol,
1794 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1795 struct alc_spec *spec = codec->spec;
1796 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1799 mutex_lock(&codec->control_mutex);
1800 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1802 err = func(kcontrol, ucontrol);
1803 mutex_unlock(&codec->control_mutex);
1807 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1808 struct snd_ctl_elem_value *ucontrol)
1810 return alc_cap_getput_caller(kcontrol, ucontrol,
1811 snd_hda_mixer_amp_volume_get);
1814 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1815 struct snd_ctl_elem_value *ucontrol)
1817 return alc_cap_getput_caller(kcontrol, ucontrol,
1818 snd_hda_mixer_amp_volume_put);
1821 /* capture mixer elements */
1822 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1824 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1825 struct snd_ctl_elem_value *ucontrol)
1827 return alc_cap_getput_caller(kcontrol, ucontrol,
1828 snd_hda_mixer_amp_switch_get);
1831 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1832 struct snd_ctl_elem_value *ucontrol)
1834 return alc_cap_getput_caller(kcontrol, ucontrol,
1835 snd_hda_mixer_amp_switch_put);
1838 #define _DEFINE_CAPMIX(num) \
1840 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1841 .name = "Capture Switch", \
1842 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1844 .info = alc_cap_sw_info, \
1845 .get = alc_cap_sw_get, \
1846 .put = alc_cap_sw_put, \
1849 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1850 .name = "Capture Volume", \
1851 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1852 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1853 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1855 .info = alc_cap_vol_info, \
1856 .get = alc_cap_vol_get, \
1857 .put = alc_cap_vol_put, \
1858 .tlv = { .c = alc_cap_vol_tlv }, \
1861 #define _DEFINE_CAPSRC(num) \
1863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1864 /* .name = "Capture Source", */ \
1865 .name = "Input Source", \
1867 .info = alc_mux_enum_info, \
1868 .get = alc_mux_enum_get, \
1869 .put = alc_mux_enum_put, \
1872 #define DEFINE_CAPMIX(num) \
1873 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1874 _DEFINE_CAPMIX(num), \
1875 _DEFINE_CAPSRC(num), \
1879 #define DEFINE_CAPMIX_NOSRC(num) \
1880 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1881 _DEFINE_CAPMIX(num), \
1885 /* up to three ADCs */
1889 DEFINE_CAPMIX_NOSRC(1);
1890 DEFINE_CAPMIX_NOSRC(2);
1891 DEFINE_CAPMIX_NOSRC(3);
1894 * ALC880 5-stack model
1896 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1898 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1899 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1902 /* additional mixers to alc880_three_stack_mixer */
1903 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1904 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1905 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1909 /* channel source setting (6/8 channel selection for 5-stack) */
1911 static struct hda_verb alc880_fivestack_ch6_init[] = {
1912 /* set line-in to input, mute it */
1913 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1914 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1919 static struct hda_verb alc880_fivestack_ch8_init[] = {
1920 /* set line-in to output, unmute it */
1921 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1922 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1926 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1927 { 6, alc880_fivestack_ch6_init },
1928 { 8, alc880_fivestack_ch8_init },
1933 * ALC880 6-stack model
1935 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1936 * Side = 0x05 (0x0f)
1937 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1938 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1941 static hda_nid_t alc880_6st_dac_nids[4] = {
1942 /* front, rear, clfe, rear_surr */
1943 0x02, 0x03, 0x04, 0x05
1946 static struct hda_input_mux alc880_6stack_capture_source = {
1950 { "Front Mic", 0x1 },
1956 /* fixed 8-channels */
1957 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1961 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1963 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1964 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1965 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1966 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1967 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1968 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1969 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1970 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1971 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1978 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1979 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1982 .name = "Channel Mode",
1983 .info = alc_ch_mode_info,
1984 .get = alc_ch_mode_get,
1985 .put = alc_ch_mode_put,
1994 * W810 has rear IO for:
1997 * Center/LFE (DAC 04)
2000 * The system also has a pair of internal speakers, and a headphone jack.
2001 * These are both connected to Line2 on the codec, hence to DAC 02.
2003 * There is a variable resistor to control the speaker or headphone
2004 * volume. This is a hardware-only device without a software API.
2006 * Plugging headphones in will disable the internal speakers. This is
2007 * implemented in hardware, not via the driver using jack sense. In
2008 * a similar fashion, plugging into the rear socket marked "front" will
2009 * disable both the speakers and headphones.
2011 * For input, there's a microphone jack, and an "audio in" jack.
2012 * These may not do anything useful with this driver yet, because I
2013 * haven't setup any initialization verbs for these yet...
2016 static hda_nid_t alc880_w810_dac_nids[3] = {
2017 /* front, rear/surround, clfe */
2021 /* fixed 6 channels */
2022 static struct hda_channel_mode alc880_w810_modes[1] = {
2026 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2027 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2030 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2031 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2032 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2033 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2034 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2035 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2036 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2044 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2045 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2049 static hda_nid_t alc880_z71v_dac_nids[1] = {
2052 #define ALC880_Z71V_HP_DAC 0x03
2054 /* fixed 2 channels */
2055 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2059 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2060 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2061 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2063 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2064 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2065 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2073 * ALC880 F1734 model
2075 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2076 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2079 static hda_nid_t alc880_f1734_dac_nids[1] = {
2082 #define ALC880_F1734_HP_DAC 0x02
2084 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2085 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2086 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2087 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2088 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2089 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2090 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2091 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2092 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2096 static struct hda_input_mux alc880_f1734_capture_source = {
2108 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2109 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2110 * Mic = 0x18, Line = 0x1a
2113 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2114 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2116 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2126 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2130 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2133 .name = "Channel Mode",
2134 .info = alc_ch_mode_info,
2135 .get = alc_ch_mode_get,
2136 .put = alc_ch_mode_put,
2142 * ALC880 ASUS W1V model
2144 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2145 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2146 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2149 /* additional mixers to alc880_asus_mixer */
2150 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2151 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2152 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2157 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2159 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2162 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2165 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2166 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2171 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2172 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2173 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2174 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2175 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2176 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2177 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2178 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2179 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2180 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2181 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2182 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2183 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2184 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2185 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2186 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2187 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2189 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2190 .name = "Channel Mode",
2191 .info = alc_ch_mode_info,
2192 .get = alc_ch_mode_get,
2193 .put = alc_ch_mode_put,
2198 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2199 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2200 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2201 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2202 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2205 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2206 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2207 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2208 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2212 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2213 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2214 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2215 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2223 * virtual master controls
2227 * slave controls for virtual master
2229 static const char *alc_slave_vols[] = {
2230 "Front Playback Volume",
2231 "Surround Playback Volume",
2232 "Center Playback Volume",
2233 "LFE Playback Volume",
2234 "Side Playback Volume",
2235 "Headphone Playback Volume",
2236 "Speaker Playback Volume",
2237 "Mono Playback Volume",
2238 "Line-Out Playback Volume",
2239 "PCM Playback Volume",
2243 static const char *alc_slave_sws[] = {
2244 "Front Playback Switch",
2245 "Surround Playback Switch",
2246 "Center Playback Switch",
2247 "LFE Playback Switch",
2248 "Side Playback Switch",
2249 "Headphone Playback Switch",
2250 "Speaker Playback Switch",
2251 "Mono Playback Switch",
2252 "IEC958 Playback Switch",
2257 * build control elements
2260 static void alc_free_kctls(struct hda_codec *codec);
2262 /* additional beep mixers; the actual parameters are overwritten at build */
2263 static struct snd_kcontrol_new alc_beep_mixer[] = {
2264 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2265 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2269 static int alc_build_controls(struct hda_codec *codec)
2271 struct alc_spec *spec = codec->spec;
2275 for (i = 0; i < spec->num_mixers; i++) {
2276 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2280 if (spec->cap_mixer) {
2281 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2285 if (spec->multiout.dig_out_nid) {
2286 err = snd_hda_create_spdif_out_ctls(codec,
2287 spec->multiout.dig_out_nid);
2290 if (!spec->no_analog) {
2291 err = snd_hda_create_spdif_share_sw(codec,
2295 spec->multiout.share_spdif = 1;
2298 if (spec->dig_in_nid) {
2299 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2304 /* create beep controls if needed */
2305 if (spec->beep_amp) {
2306 struct snd_kcontrol_new *knew;
2307 for (knew = alc_beep_mixer; knew->name; knew++) {
2308 struct snd_kcontrol *kctl;
2309 kctl = snd_ctl_new1(knew, codec);
2312 kctl->private_value = spec->beep_amp;
2313 err = snd_hda_ctl_add(codec, kctl);
2319 /* if we have no master control, let's create it */
2320 if (!spec->no_analog &&
2321 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2322 unsigned int vmaster_tlv[4];
2323 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2324 HDA_OUTPUT, vmaster_tlv);
2325 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2326 vmaster_tlv, alc_slave_vols);
2330 if (!spec->no_analog &&
2331 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2332 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2333 NULL, alc_slave_sws);
2338 alc_free_kctls(codec); /* no longer needed */
2344 * initialize the codec volumes, etc
2348 * generic initialization of ADC, input mixers and output mixers
2350 static struct hda_verb alc880_volume_init_verbs[] = {
2352 * Unmute ADC0-2 and set the default input to mic-in
2354 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2355 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2356 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2357 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2358 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2361 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2363 * Note: PASD motherboards uses the Line In 2 as the input for front
2366 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2367 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2368 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2369 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2370 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2376 * Set up output mixers (0x0c - 0x0f)
2378 /* set vol=0 to output mixers */
2379 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2380 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2381 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2382 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2383 /* set up input amps for analog loopback */
2384 /* Amp Indices: DAC = 0, mixer = 1 */
2385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2387 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2390 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2391 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2398 * 3-stack pin configuration:
2399 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2401 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2403 * preset connection lists of input pins
2404 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2406 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2407 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2408 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2411 * Set pin mode and muting
2413 /* set front pin widgets 0x14 for output */
2414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2415 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2416 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2417 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2418 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2419 /* Mic2 (as headphone out) for HP output */
2420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2422 /* Line In pin widget for input */
2423 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2424 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2425 /* Line2 (as front mic) pin widget for input and vref at 80% */
2426 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2427 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2428 /* CD pin widget for input */
2429 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2435 * 5-stack pin configuration:
2436 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2437 * line-in/side = 0x1a, f-mic = 0x1b
2439 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2441 * preset connection lists of input pins
2442 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2444 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2445 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2448 * Set pin mode and muting
2450 /* set pin widgets 0x14-0x17 for output */
2451 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2452 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2453 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2455 /* unmute pins for output (no gain on this amp) */
2456 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2457 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2459 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2461 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2462 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2464 /* Mic2 (as headphone out) for HP output */
2465 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2466 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2467 /* Line In pin widget for input */
2468 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2470 /* Line2 (as front mic) pin widget for input and vref at 80% */
2471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2472 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2473 /* CD pin widget for input */
2474 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2480 * W810 pin configuration:
2481 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2483 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2484 /* hphone/speaker input selector: front DAC */
2485 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2488 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2489 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2491 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2495 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2501 * Z71V pin configuration:
2502 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2504 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2506 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2519 * 6-stack pin configuration:
2520 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2521 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2523 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2524 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2527 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2529 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2531 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2532 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2533 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2535 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2537 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2538 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2541 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2543 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2549 * Uniwill pin configuration:
2550 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2553 static struct hda_verb alc880_uniwill_init_verbs[] = {
2554 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2560 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2561 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2562 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2563 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2565 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2567 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2573 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2574 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2577 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2578 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2579 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2581 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2589 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2591 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2592 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2594 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2595 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2596 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2597 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2598 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2599 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2600 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2601 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2602 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2604 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2607 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2608 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2609 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2610 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2611 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2612 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2614 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2615 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2620 static struct hda_verb alc880_beep_init_verbs[] = {
2621 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2625 /* auto-toggle front mic */
2626 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2628 unsigned int present;
2631 present = snd_hda_codec_read(codec, 0x18, 0,
2632 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2633 bits = present ? HDA_AMP_MUTE : 0;
2634 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2637 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2639 struct alc_spec *spec = codec->spec;
2641 spec->autocfg.hp_pins[0] = 0x14;
2642 spec->autocfg.speaker_pins[0] = 0x15;
2643 spec->autocfg.speaker_pins[0] = 0x16;
2644 alc_automute_amp(codec);
2645 alc880_uniwill_mic_automute(codec);
2648 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2651 /* Looks like the unsol event is incompatible with the standard
2652 * definition. 4bit tag is placed at 28 bit!
2654 switch (res >> 28) {
2655 case ALC880_MIC_EVENT:
2656 alc880_uniwill_mic_automute(codec);
2659 alc_automute_amp_unsol_event(codec, res);
2664 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2666 struct alc_spec *spec = codec->spec;
2668 spec->autocfg.hp_pins[0] = 0x14;
2669 spec->autocfg.speaker_pins[0] = 0x15;
2670 alc_automute_amp(codec);
2673 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2675 unsigned int present;
2677 present = snd_hda_codec_read(codec, 0x21, 0,
2678 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2679 present &= HDA_AMP_VOLMASK;
2680 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2681 HDA_AMP_VOLMASK, present);
2682 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2683 HDA_AMP_VOLMASK, present);
2686 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2689 /* Looks like the unsol event is incompatible with the standard
2690 * definition. 4bit tag is placed at 28 bit!
2692 if ((res >> 28) == ALC880_DCVOL_EVENT)
2693 alc880_uniwill_p53_dcvol_automute(codec);
2695 alc_automute_amp_unsol_event(codec, res);
2699 * F1734 pin configuration:
2700 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2702 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2703 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2704 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2705 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2706 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2707 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2709 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2710 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2711 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2714 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2716 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2717 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2718 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2719 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2720 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2721 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2722 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2724 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2725 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2731 * ASUS pin configuration:
2732 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2734 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2735 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2736 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2737 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2738 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2741 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2750 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2751 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2753 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2757 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2762 /* Enable GPIO mask and set output */
2763 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2764 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2765 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2767 /* Clevo m520g init */
2768 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2769 /* headphone output */
2770 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2772 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2773 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2776 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2778 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2779 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2780 /* Mic1 (rear panel) */
2781 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2782 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 /* Mic2 (front panel) */
2784 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2785 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2788 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2789 /* change to EAPD mode */
2790 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2791 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2796 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2797 /* change to EAPD mode */
2798 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2799 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2801 /* Headphone output */
2802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2807 /* Line In pin widget for input */
2808 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2809 /* CD pin widget for input */
2810 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2811 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2812 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 /* change to EAPD mode */
2815 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2816 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2822 * LG m1 express dual
2825 * Rear Line-In/Out (blue): 0x14
2826 * Build-in Mic-In: 0x15
2828 * HP-Out (green): 0x1b
2829 * Mic-In/Out (red): 0x19
2833 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2834 static hda_nid_t alc880_lg_dac_nids[3] = {
2838 /* seems analog CD is not working */
2839 static struct hda_input_mux alc880_lg_capture_source = {
2844 { "Internal Mic", 0x6 },
2848 /* 2,4,6 channel modes */
2849 static struct hda_verb alc880_lg_ch2_init[] = {
2850 /* set line-in and mic-in to input */
2851 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2852 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2856 static struct hda_verb alc880_lg_ch4_init[] = {
2857 /* set line-in to out and mic-in to input */
2858 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2859 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2863 static struct hda_verb alc880_lg_ch6_init[] = {
2864 /* set line-in and mic-in to output */
2865 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2866 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2870 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2871 { 2, alc880_lg_ch2_init },
2872 { 4, alc880_lg_ch4_init },
2873 { 6, alc880_lg_ch6_init },
2876 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2878 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2880 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2887 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2888 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2889 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2890 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2892 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2893 .name = "Channel Mode",
2894 .info = alc_ch_mode_info,
2895 .get = alc_ch_mode_get,
2896 .put = alc_ch_mode_put,
2901 static struct hda_verb alc880_lg_init_verbs[] = {
2902 /* set capture source to mic-in */
2903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2904 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2906 /* mute all amp mixer inputs */
2907 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2908 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2909 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2910 /* line-in to input */
2911 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2912 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2914 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2915 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2917 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2918 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2919 /* mic-in to input */
2920 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2921 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2922 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2924 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2925 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2926 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2932 /* toggle speaker-output according to the hp-jack state */
2933 static void alc880_lg_init_hook(struct hda_codec *codec)
2935 struct alc_spec *spec = codec->spec;
2937 spec->autocfg.hp_pins[0] = 0x1b;
2938 spec->autocfg.speaker_pins[0] = 0x17;
2939 alc_automute_amp(codec);
2948 * Built-in Mic-In: 0x19
2954 static struct hda_input_mux alc880_lg_lw_capture_source = {
2958 { "Internal Mic", 0x1 },
2963 #define alc880_lg_lw_modes alc880_threestack_modes
2965 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2966 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2967 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2968 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2969 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2970 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2971 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2972 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2973 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2976 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2978 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2979 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2981 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2982 .name = "Channel Mode",
2983 .info = alc_ch_mode_info,
2984 .get = alc_ch_mode_get,
2985 .put = alc_ch_mode_put,
2990 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2991 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2992 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2993 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2995 /* set capture source to mic-in */
2996 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2997 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2998 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3001 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3005 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3006 /* mic-in to input */
3007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3008 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3013 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3017 /* toggle speaker-output according to the hp-jack state */
3018 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
3020 struct alc_spec *spec = codec->spec;
3022 spec->autocfg.hp_pins[0] = 0x1b;
3023 spec->autocfg.speaker_pins[0] = 0x14;
3024 alc_automute_amp(codec);
3027 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3028 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3029 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3030 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3031 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3032 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3033 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3037 static struct hda_input_mux alc880_medion_rim_capture_source = {
3041 { "Internal Mic", 0x1 },
3045 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3046 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3052 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3053 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3054 /* Mic2 (as headphone out) for HP output */
3055 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3056 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3057 /* Internal Speaker */
3058 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3059 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3062 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3064 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3068 /* toggle speaker-output according to the hp-jack state */
3069 static void alc880_medion_rim_automute(struct hda_codec *codec)
3071 struct alc_spec *spec = codec->spec;
3072 alc_automute_amp(codec);
3074 if (spec->jack_present)
3075 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3077 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3080 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3083 /* Looks like the unsol event is incompatible with the standard
3084 * definition. 4bit tag is placed at 28 bit!
3086 if ((res >> 28) == ALC880_HP_EVENT)
3087 alc880_medion_rim_automute(codec);
3090 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3092 struct alc_spec *spec = codec->spec;
3094 spec->autocfg.hp_pins[0] = 0x14;
3095 spec->autocfg.speaker_pins[0] = 0x1b;
3096 alc880_medion_rim_automute(codec);
3099 #ifdef CONFIG_SND_HDA_POWER_SAVE
3100 static struct hda_amp_list alc880_loopbacks[] = {
3101 { 0x0b, HDA_INPUT, 0 },
3102 { 0x0b, HDA_INPUT, 1 },
3103 { 0x0b, HDA_INPUT, 2 },
3104 { 0x0b, HDA_INPUT, 3 },
3105 { 0x0b, HDA_INPUT, 4 },
3109 static struct hda_amp_list alc880_lg_loopbacks[] = {
3110 { 0x0b, HDA_INPUT, 1 },
3111 { 0x0b, HDA_INPUT, 6 },
3112 { 0x0b, HDA_INPUT, 7 },
3121 static int alc_init(struct hda_codec *codec)
3123 struct alc_spec *spec = codec->spec;
3127 alc_auto_init_amp(codec, spec->init_amp);
3129 for (i = 0; i < spec->num_init_verbs; i++)
3130 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3132 if (spec->init_hook)
3133 spec->init_hook(codec);
3138 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3140 struct alc_spec *spec = codec->spec;
3142 if (spec->unsol_event)
3143 spec->unsol_event(codec, res);
3146 #ifdef CONFIG_SND_HDA_POWER_SAVE
3147 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3149 struct alc_spec *spec = codec->spec;
3150 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3155 * Analog playback callbacks
3157 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3158 struct hda_codec *codec,
3159 struct snd_pcm_substream *substream)
3161 struct alc_spec *spec = codec->spec;
3162 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3166 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3167 struct hda_codec *codec,
3168 unsigned int stream_tag,
3169 unsigned int format,
3170 struct snd_pcm_substream *substream)
3172 struct alc_spec *spec = codec->spec;
3173 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3174 stream_tag, format, substream);
3177 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3178 struct hda_codec *codec,
3179 struct snd_pcm_substream *substream)
3181 struct alc_spec *spec = codec->spec;
3182 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3188 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3189 struct hda_codec *codec,
3190 struct snd_pcm_substream *substream)
3192 struct alc_spec *spec = codec->spec;
3193 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3196 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3197 struct hda_codec *codec,
3198 unsigned int stream_tag,
3199 unsigned int format,
3200 struct snd_pcm_substream *substream)
3202 struct alc_spec *spec = codec->spec;
3203 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3204 stream_tag, format, substream);
3207 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3208 struct hda_codec *codec,
3209 struct snd_pcm_substream *substream)
3211 struct alc_spec *spec = codec->spec;
3212 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3215 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3216 struct hda_codec *codec,
3217 struct snd_pcm_substream *substream)
3219 struct alc_spec *spec = codec->spec;
3220 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3226 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3227 struct hda_codec *codec,
3228 unsigned int stream_tag,
3229 unsigned int format,
3230 struct snd_pcm_substream *substream)
3232 struct alc_spec *spec = codec->spec;
3234 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3235 stream_tag, 0, format);
3239 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3240 struct hda_codec *codec,
3241 struct snd_pcm_substream *substream)
3243 struct alc_spec *spec = codec->spec;
3245 snd_hda_codec_cleanup_stream(codec,
3246 spec->adc_nids[substream->number + 1]);
3253 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3257 /* NID is set in alc_build_pcms */
3259 .open = alc880_playback_pcm_open,
3260 .prepare = alc880_playback_pcm_prepare,
3261 .cleanup = alc880_playback_pcm_cleanup
3265 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3269 /* NID is set in alc_build_pcms */
3272 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3276 /* NID is set in alc_build_pcms */
3279 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3280 .substreams = 2, /* can be overridden */
3283 /* NID is set in alc_build_pcms */
3285 .prepare = alc880_alt_capture_pcm_prepare,
3286 .cleanup = alc880_alt_capture_pcm_cleanup
3290 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3294 /* NID is set in alc_build_pcms */
3296 .open = alc880_dig_playback_pcm_open,
3297 .close = alc880_dig_playback_pcm_close,
3298 .prepare = alc880_dig_playback_pcm_prepare,
3299 .cleanup = alc880_dig_playback_pcm_cleanup
3303 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3307 /* NID is set in alc_build_pcms */
3310 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3311 static struct hda_pcm_stream alc_pcm_null_stream = {
3317 static int alc_build_pcms(struct hda_codec *codec)
3319 struct alc_spec *spec = codec->spec;
3320 struct hda_pcm *info = spec->pcm_rec;
3323 codec->num_pcms = 1;
3324 codec->pcm_info = info;
3326 if (spec->no_analog)
3329 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3330 "%s Analog", codec->chip_name);
3331 info->name = spec->stream_name_analog;
3333 if (spec->stream_analog_playback) {
3334 if (snd_BUG_ON(!spec->multiout.dac_nids))
3336 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3337 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3339 if (spec->stream_analog_capture) {
3340 if (snd_BUG_ON(!spec->adc_nids))
3342 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3343 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3346 if (spec->channel_mode) {
3347 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3348 for (i = 0; i < spec->num_channel_mode; i++) {
3349 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3350 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3356 /* SPDIF for stream index #1 */
3357 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3358 snprintf(spec->stream_name_digital,
3359 sizeof(spec->stream_name_digital),
3360 "%s Digital", codec->chip_name);
3361 codec->num_pcms = 2;
3362 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3363 info = spec->pcm_rec + 1;
3364 info->name = spec->stream_name_digital;
3365 if (spec->dig_out_type)
3366 info->pcm_type = spec->dig_out_type;
3368 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3369 if (spec->multiout.dig_out_nid &&
3370 spec->stream_digital_playback) {
3371 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3372 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3374 if (spec->dig_in_nid &&
3375 spec->stream_digital_capture) {
3376 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3377 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3379 /* FIXME: do we need this for all Realtek codec models? */
3380 codec->spdif_status_reset = 1;
3383 if (spec->no_analog)
3386 /* If the use of more than one ADC is requested for the current
3387 * model, configure a second analog capture-only PCM.
3389 /* Additional Analaog capture for index #2 */
3390 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3391 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3392 codec->num_pcms = 3;
3393 info = spec->pcm_rec + 2;
3394 info->name = spec->stream_name_analog;
3395 if (spec->alt_dac_nid) {
3396 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3397 *spec->stream_analog_alt_playback;
3398 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3401 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3402 alc_pcm_null_stream;
3403 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3405 if (spec->num_adc_nids > 1) {
3406 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3407 *spec->stream_analog_alt_capture;
3408 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3410 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3411 spec->num_adc_nids - 1;
3413 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3414 alc_pcm_null_stream;
3415 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3422 static void alc_free_kctls(struct hda_codec *codec)
3424 struct alc_spec *spec = codec->spec;
3426 if (spec->kctls.list) {
3427 struct snd_kcontrol_new *kctl = spec->kctls.list;
3429 for (i = 0; i < spec->kctls.used; i++)
3430 kfree(kctl[i].name);
3432 snd_array_free(&spec->kctls);
3435 static void alc_free(struct hda_codec *codec)
3437 struct alc_spec *spec = codec->spec;
3442 alc_free_kctls(codec);
3444 snd_hda_detach_beep_device(codec);
3447 #ifdef SND_HDA_NEEDS_RESUME
3448 static int alc_resume(struct hda_codec *codec)
3450 codec->patch_ops.init(codec);
3451 snd_hda_codec_resume_amp(codec);
3452 snd_hda_codec_resume_cache(codec);
3459 static struct hda_codec_ops alc_patch_ops = {
3460 .build_controls = alc_build_controls,
3461 .build_pcms = alc_build_pcms,
3464 .unsol_event = alc_unsol_event,
3465 #ifdef SND_HDA_NEEDS_RESUME
3466 .resume = alc_resume,
3468 #ifdef CONFIG_SND_HDA_POWER_SAVE
3469 .check_power_status = alc_check_power_status,
3475 * Test configuration for debugging
3477 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3480 #ifdef CONFIG_SND_DEBUG
3481 static hda_nid_t alc880_test_dac_nids[4] = {
3482 0x02, 0x03, 0x04, 0x05
3485 static struct hda_input_mux alc880_test_capture_source = {
3494 { "Surround", 0x6 },
3498 static struct hda_channel_mode alc880_test_modes[4] = {
3505 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3506 struct snd_ctl_elem_info *uinfo)
3508 static char *texts[] = {
3509 "N/A", "Line Out", "HP Out",
3510 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3512 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3514 uinfo->value.enumerated.items = 8;
3515 if (uinfo->value.enumerated.item >= 8)
3516 uinfo->value.enumerated.item = 7;
3517 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3521 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3522 struct snd_ctl_elem_value *ucontrol)
3524 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3525 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3526 unsigned int pin_ctl, item = 0;
3528 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3529 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3530 if (pin_ctl & AC_PINCTL_OUT_EN) {
3531 if (pin_ctl & AC_PINCTL_HP_EN)
3535 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3536 switch (pin_ctl & AC_PINCTL_VREFEN) {
3537 case AC_PINCTL_VREF_HIZ: item = 3; break;
3538 case AC_PINCTL_VREF_50: item = 4; break;
3539 case AC_PINCTL_VREF_GRD: item = 5; break;
3540 case AC_PINCTL_VREF_80: item = 6; break;
3541 case AC_PINCTL_VREF_100: item = 7; break;
3544 ucontrol->value.enumerated.item[0] = item;
3548 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3549 struct snd_ctl_elem_value *ucontrol)
3551 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3552 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3553 static unsigned int ctls[] = {
3554 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3555 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3556 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3557 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3558 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3559 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3561 unsigned int old_ctl, new_ctl;
3563 old_ctl = snd_hda_codec_read(codec, nid, 0,
3564 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3565 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3566 if (old_ctl != new_ctl) {
3568 snd_hda_codec_write_cache(codec, nid, 0,
3569 AC_VERB_SET_PIN_WIDGET_CONTROL,
3571 val = ucontrol->value.enumerated.item[0] >= 3 ?
3573 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3580 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3581 struct snd_ctl_elem_info *uinfo)
3583 static char *texts[] = {
3584 "Front", "Surround", "CLFE", "Side"
3586 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3588 uinfo->value.enumerated.items = 4;
3589 if (uinfo->value.enumerated.item >= 4)
3590 uinfo->value.enumerated.item = 3;
3591 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3595 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3596 struct snd_ctl_elem_value *ucontrol)
3598 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3599 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3602 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3603 ucontrol->value.enumerated.item[0] = sel & 3;
3607 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3608 struct snd_ctl_elem_value *ucontrol)
3610 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3611 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3614 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3615 if (ucontrol->value.enumerated.item[0] != sel) {
3616 sel = ucontrol->value.enumerated.item[0] & 3;
3617 snd_hda_codec_write_cache(codec, nid, 0,
3618 AC_VERB_SET_CONNECT_SEL, sel);
3624 #define PIN_CTL_TEST(xname,nid) { \
3625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3627 .info = alc_test_pin_ctl_info, \
3628 .get = alc_test_pin_ctl_get, \
3629 .put = alc_test_pin_ctl_put, \
3630 .private_value = nid \
3633 #define PIN_SRC_TEST(xname,nid) { \
3634 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3636 .info = alc_test_pin_src_info, \
3637 .get = alc_test_pin_src_get, \
3638 .put = alc_test_pin_src_put, \
3639 .private_value = nid \
3642 static struct snd_kcontrol_new alc880_test_mixer[] = {
3643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3644 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3645 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3646 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3647 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3648 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3649 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3650 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3651 PIN_CTL_TEST("Front Pin Mode", 0x14),
3652 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3653 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3654 PIN_CTL_TEST("Side Pin Mode", 0x17),
3655 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3656 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3657 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3658 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3659 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3660 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3661 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3662 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3663 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3664 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3665 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3666 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3667 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3668 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3669 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3670 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3675 .name = "Channel Mode",
3676 .info = alc_ch_mode_info,
3677 .get = alc_ch_mode_get,
3678 .put = alc_ch_mode_put,
3683 static struct hda_verb alc880_test_init_verbs[] = {
3684 /* Unmute inputs of 0x0c - 0x0f */
3685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3691 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3692 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3693 /* Vol output for 0x0c-0x0f */
3694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3696 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3698 /* Set output pins 0x14-0x17 */
3699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3701 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3702 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3703 /* Unmute output pins 0x14-0x17 */
3704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3705 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3706 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3707 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3708 /* Set input pins 0x18-0x1c */
3709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3710 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3711 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3713 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3714 /* Mute input pins 0x18-0x1b */
3715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3716 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3718 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3721 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3723 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3725 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3726 /* Analog input/passthru */
3727 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3728 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3729 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3730 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3731 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3739 static const char *alc880_models[ALC880_MODEL_LAST] = {
3740 [ALC880_3ST] = "3stack",
3741 [ALC880_TCL_S700] = "tcl",
3742 [ALC880_3ST_DIG] = "3stack-digout",
3743 [ALC880_CLEVO] = "clevo",
3744 [ALC880_5ST] = "5stack",
3745 [ALC880_5ST_DIG] = "5stack-digout",
3746 [ALC880_W810] = "w810",
3747 [ALC880_Z71V] = "z71v",
3748 [ALC880_6ST] = "6stack",
3749 [ALC880_6ST_DIG] = "6stack-digout",
3750 [ALC880_ASUS] = "asus",
3751 [ALC880_ASUS_W1V] = "asus-w1v",
3752 [ALC880_ASUS_DIG] = "asus-dig",
3753 [ALC880_ASUS_DIG2] = "asus-dig2",
3754 [ALC880_UNIWILL_DIG] = "uniwill",
3755 [ALC880_UNIWILL_P53] = "uniwill-p53",
3756 [ALC880_FUJITSU] = "fujitsu",
3757 [ALC880_F1734] = "F1734",
3759 [ALC880_LG_LW] = "lg-lw",
3760 [ALC880_MEDION_RIM] = "medion",
3761 #ifdef CONFIG_SND_DEBUG
3762 [ALC880_TEST] = "test",
3764 [ALC880_AUTO] = "auto",
3767 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3768 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3769 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3770 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3771 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3772 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3773 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3774 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3775 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3776 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3777 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3778 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3779 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3780 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3781 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3782 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3783 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3784 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3785 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3786 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3787 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3788 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3789 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3790 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3791 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3792 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3793 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3794 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3795 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3796 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3797 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3798 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3799 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3800 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3801 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3802 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3803 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3804 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3805 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3806 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3807 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3808 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3809 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3810 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3811 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3812 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3813 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3814 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3815 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3816 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3817 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3818 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3819 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3820 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3821 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3822 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3823 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3824 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3825 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3826 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3827 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3828 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3829 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3830 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3831 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3832 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3833 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3834 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3835 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3837 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3838 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3839 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3844 * ALC880 codec presets
3846 static struct alc_config_preset alc880_presets[] = {
3848 .mixers = { alc880_three_stack_mixer },
3849 .init_verbs = { alc880_volume_init_verbs,
3850 alc880_pin_3stack_init_verbs },
3851 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3852 .dac_nids = alc880_dac_nids,
3853 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3854 .channel_mode = alc880_threestack_modes,
3856 .input_mux = &alc880_capture_source,
3858 [ALC880_3ST_DIG] = {
3859 .mixers = { alc880_three_stack_mixer },
3860 .init_verbs = { alc880_volume_init_verbs,
3861 alc880_pin_3stack_init_verbs },
3862 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3863 .dac_nids = alc880_dac_nids,
3864 .dig_out_nid = ALC880_DIGOUT_NID,
3865 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3866 .channel_mode = alc880_threestack_modes,
3868 .input_mux = &alc880_capture_source,
3870 [ALC880_TCL_S700] = {
3871 .mixers = { alc880_tcl_s700_mixer },
3872 .init_verbs = { alc880_volume_init_verbs,
3873 alc880_pin_tcl_S700_init_verbs,
3874 alc880_gpio2_init_verbs },
3875 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3876 .dac_nids = alc880_dac_nids,
3877 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3878 .num_adc_nids = 1, /* single ADC */
3880 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3881 .channel_mode = alc880_2_jack_modes,
3882 .input_mux = &alc880_capture_source,
3885 .mixers = { alc880_three_stack_mixer,
3886 alc880_five_stack_mixer},
3887 .init_verbs = { alc880_volume_init_verbs,
3888 alc880_pin_5stack_init_verbs },
3889 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3890 .dac_nids = alc880_dac_nids,
3891 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3892 .channel_mode = alc880_fivestack_modes,
3893 .input_mux = &alc880_capture_source,
3895 [ALC880_5ST_DIG] = {
3896 .mixers = { alc880_three_stack_mixer,
3897 alc880_five_stack_mixer },
3898 .init_verbs = { alc880_volume_init_verbs,
3899 alc880_pin_5stack_init_verbs },
3900 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3901 .dac_nids = alc880_dac_nids,
3902 .dig_out_nid = ALC880_DIGOUT_NID,
3903 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3904 .channel_mode = alc880_fivestack_modes,
3905 .input_mux = &alc880_capture_source,
3908 .mixers = { alc880_six_stack_mixer },
3909 .init_verbs = { alc880_volume_init_verbs,
3910 alc880_pin_6stack_init_verbs },
3911 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3912 .dac_nids = alc880_6st_dac_nids,
3913 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3914 .channel_mode = alc880_sixstack_modes,
3915 .input_mux = &alc880_6stack_capture_source,
3917 [ALC880_6ST_DIG] = {
3918 .mixers = { alc880_six_stack_mixer },
3919 .init_verbs = { alc880_volume_init_verbs,
3920 alc880_pin_6stack_init_verbs },
3921 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3922 .dac_nids = alc880_6st_dac_nids,
3923 .dig_out_nid = ALC880_DIGOUT_NID,
3924 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3925 .channel_mode = alc880_sixstack_modes,
3926 .input_mux = &alc880_6stack_capture_source,
3929 .mixers = { alc880_w810_base_mixer },
3930 .init_verbs = { alc880_volume_init_verbs,
3931 alc880_pin_w810_init_verbs,
3932 alc880_gpio2_init_verbs },
3933 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3934 .dac_nids = alc880_w810_dac_nids,
3935 .dig_out_nid = ALC880_DIGOUT_NID,
3936 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3937 .channel_mode = alc880_w810_modes,
3938 .input_mux = &alc880_capture_source,
3941 .mixers = { alc880_z71v_mixer },
3942 .init_verbs = { alc880_volume_init_verbs,
3943 alc880_pin_z71v_init_verbs },
3944 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3945 .dac_nids = alc880_z71v_dac_nids,
3946 .dig_out_nid = ALC880_DIGOUT_NID,
3948 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3949 .channel_mode = alc880_2_jack_modes,
3950 .input_mux = &alc880_capture_source,
3953 .mixers = { alc880_f1734_mixer },
3954 .init_verbs = { alc880_volume_init_verbs,
3955 alc880_pin_f1734_init_verbs },
3956 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3957 .dac_nids = alc880_f1734_dac_nids,
3959 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3960 .channel_mode = alc880_2_jack_modes,
3961 .input_mux = &alc880_f1734_capture_source,
3962 .unsol_event = alc880_uniwill_p53_unsol_event,
3963 .init_hook = alc880_uniwill_p53_init_hook,
3966 .mixers = { alc880_asus_mixer },
3967 .init_verbs = { alc880_volume_init_verbs,
3968 alc880_pin_asus_init_verbs,
3969 alc880_gpio1_init_verbs },
3970 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3971 .dac_nids = alc880_asus_dac_nids,
3972 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3973 .channel_mode = alc880_asus_modes,
3975 .input_mux = &alc880_capture_source,
3977 [ALC880_ASUS_DIG] = {
3978 .mixers = { alc880_asus_mixer },
3979 .init_verbs = { alc880_volume_init_verbs,
3980 alc880_pin_asus_init_verbs,
3981 alc880_gpio1_init_verbs },
3982 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3983 .dac_nids = alc880_asus_dac_nids,
3984 .dig_out_nid = ALC880_DIGOUT_NID,
3985 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3986 .channel_mode = alc880_asus_modes,
3988 .input_mux = &alc880_capture_source,
3990 [ALC880_ASUS_DIG2] = {
3991 .mixers = { alc880_asus_mixer },
3992 .init_verbs = { alc880_volume_init_verbs,
3993 alc880_pin_asus_init_verbs,
3994 alc880_gpio2_init_verbs }, /* use GPIO2 */
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_W1V] = {
4004 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_pin_asus_init_verbs,
4007 alc880_gpio1_init_verbs },
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_UNIWILL_DIG] = {
4017 .mixers = { alc880_asus_mixer },
4018 .init_verbs = { alc880_volume_init_verbs,
4019 alc880_pin_asus_init_verbs },
4020 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4021 .dac_nids = alc880_asus_dac_nids,
4022 .dig_out_nid = ALC880_DIGOUT_NID,
4023 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4024 .channel_mode = alc880_asus_modes,
4026 .input_mux = &alc880_capture_source,
4028 [ALC880_UNIWILL] = {
4029 .mixers = { alc880_uniwill_mixer },
4030 .init_verbs = { alc880_volume_init_verbs,
4031 alc880_uniwill_init_verbs },
4032 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4033 .dac_nids = alc880_asus_dac_nids,
4034 .dig_out_nid = ALC880_DIGOUT_NID,
4035 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4036 .channel_mode = alc880_threestack_modes,
4038 .input_mux = &alc880_capture_source,
4039 .unsol_event = alc880_uniwill_unsol_event,
4040 .init_hook = alc880_uniwill_init_hook,
4042 [ALC880_UNIWILL_P53] = {
4043 .mixers = { alc880_uniwill_p53_mixer },
4044 .init_verbs = { alc880_volume_init_verbs,
4045 alc880_uniwill_p53_init_verbs },
4046 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4047 .dac_nids = alc880_asus_dac_nids,
4048 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4049 .channel_mode = alc880_threestack_modes,
4050 .input_mux = &alc880_capture_source,
4051 .unsol_event = alc880_uniwill_p53_unsol_event,
4052 .init_hook = alc880_uniwill_p53_init_hook,
4054 [ALC880_FUJITSU] = {
4055 .mixers = { alc880_fujitsu_mixer },
4056 .init_verbs = { alc880_volume_init_verbs,
4057 alc880_uniwill_p53_init_verbs,
4058 alc880_beep_init_verbs },
4059 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4060 .dac_nids = alc880_dac_nids,
4061 .dig_out_nid = ALC880_DIGOUT_NID,
4062 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4063 .channel_mode = alc880_2_jack_modes,
4064 .input_mux = &alc880_capture_source,
4065 .unsol_event = alc880_uniwill_p53_unsol_event,
4066 .init_hook = alc880_uniwill_p53_init_hook,
4069 .mixers = { alc880_three_stack_mixer },
4070 .init_verbs = { alc880_volume_init_verbs,
4071 alc880_pin_clevo_init_verbs },
4072 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4073 .dac_nids = alc880_dac_nids,
4075 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4076 .channel_mode = alc880_threestack_modes,
4078 .input_mux = &alc880_capture_source,
4081 .mixers = { alc880_lg_mixer },
4082 .init_verbs = { alc880_volume_init_verbs,
4083 alc880_lg_init_verbs },
4084 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4085 .dac_nids = alc880_lg_dac_nids,
4086 .dig_out_nid = ALC880_DIGOUT_NID,
4087 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4088 .channel_mode = alc880_lg_ch_modes,
4090 .input_mux = &alc880_lg_capture_source,
4091 .unsol_event = alc_automute_amp_unsol_event,
4092 .init_hook = alc880_lg_init_hook,
4093 #ifdef CONFIG_SND_HDA_POWER_SAVE
4094 .loopbacks = alc880_lg_loopbacks,
4098 .mixers = { alc880_lg_lw_mixer },
4099 .init_verbs = { alc880_volume_init_verbs,
4100 alc880_lg_lw_init_verbs },
4101 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4102 .dac_nids = alc880_dac_nids,
4103 .dig_out_nid = ALC880_DIGOUT_NID,
4104 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4105 .channel_mode = alc880_lg_lw_modes,
4106 .input_mux = &alc880_lg_lw_capture_source,
4107 .unsol_event = alc_automute_amp_unsol_event,
4108 .init_hook = alc880_lg_lw_init_hook,
4110 [ALC880_MEDION_RIM] = {
4111 .mixers = { alc880_medion_rim_mixer },
4112 .init_verbs = { alc880_volume_init_verbs,
4113 alc880_medion_rim_init_verbs,
4114 alc_gpio2_init_verbs },
4115 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4116 .dac_nids = alc880_dac_nids,
4117 .dig_out_nid = ALC880_DIGOUT_NID,
4118 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4119 .channel_mode = alc880_2_jack_modes,
4120 .input_mux = &alc880_medion_rim_capture_source,
4121 .unsol_event = alc880_medion_rim_unsol_event,
4122 .init_hook = alc880_medion_rim_init_hook,
4124 #ifdef CONFIG_SND_DEBUG
4126 .mixers = { alc880_test_mixer },
4127 .init_verbs = { alc880_test_init_verbs },
4128 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4129 .dac_nids = alc880_test_dac_nids,
4130 .dig_out_nid = ALC880_DIGOUT_NID,
4131 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4132 .channel_mode = alc880_test_modes,
4133 .input_mux = &alc880_test_capture_source,
4139 * Automatic parse of I/O pins from the BIOS configuration
4144 ALC_CTL_WIDGET_MUTE,
4147 static struct snd_kcontrol_new alc880_control_templates[] = {
4148 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4149 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4150 HDA_BIND_MUTE(NULL, 0, 0, 0),
4153 /* add dynamic controls */
4154 static int add_control(struct alc_spec *spec, int type, const char *name,
4157 struct snd_kcontrol_new *knew;
4159 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4160 knew = snd_array_new(&spec->kctls);
4163 *knew = alc880_control_templates[type];
4164 knew->name = kstrdup(name, GFP_KERNEL);
4167 knew->private_value = val;
4171 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4172 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4173 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4174 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4175 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4176 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4177 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4178 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4179 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4180 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4181 #define ALC880_PIN_CD_NID 0x1c
4183 /* fill in the dac_nids table from the parsed pin configuration */
4184 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4185 const struct auto_pin_cfg *cfg)
4191 memset(assigned, 0, sizeof(assigned));
4192 spec->multiout.dac_nids = spec->private_dac_nids;
4194 /* check the pins hardwired to audio widget */
4195 for (i = 0; i < cfg->line_outs; i++) {
4196 nid = cfg->line_out_pins[i];
4197 if (alc880_is_fixed_pin(nid)) {
4198 int idx = alc880_fixed_pin_idx(nid);
4199 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4203 /* left pins can be connect to any audio widget */
4204 for (i = 0; i < cfg->line_outs; i++) {
4205 nid = cfg->line_out_pins[i];
4206 if (alc880_is_fixed_pin(nid))
4208 /* search for an empty channel */
4209 for (j = 0; j < cfg->line_outs; j++) {
4211 spec->multiout.dac_nids[i] =
4212 alc880_idx_to_dac(j);
4218 spec->multiout.num_dacs = cfg->line_outs;
4222 /* add playback controls from the parsed DAC table */
4223 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4224 const struct auto_pin_cfg *cfg)
4227 static const char *chname[4] = {
4228 "Front", "Surround", NULL /*CLFE*/, "Side"
4233 for (i = 0; i < cfg->line_outs; i++) {
4234 if (!spec->multiout.dac_nids[i])
4236 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4239 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4240 "Center Playback Volume",
4241 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4245 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4246 "LFE Playback Volume",
4247 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4251 err = add_control(spec, ALC_CTL_BIND_MUTE,
4252 "Center Playback Switch",
4253 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4257 err = add_control(spec, ALC_CTL_BIND_MUTE,
4258 "LFE Playback Switch",
4259 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4264 sprintf(name, "%s Playback Volume", chname[i]);
4265 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4266 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4270 sprintf(name, "%s Playback Switch", chname[i]);
4271 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4272 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4281 /* add playback controls for speaker and HP outputs */
4282 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4292 if (alc880_is_fixed_pin(pin)) {
4293 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4294 /* specify the DAC as the extra output */
4295 if (!spec->multiout.hp_nid)
4296 spec->multiout.hp_nid = nid;
4298 spec->multiout.extra_out_nid[0] = nid;
4299 /* control HP volume/switch on the output mixer amp */
4300 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4301 sprintf(name, "%s Playback Volume", pfx);
4302 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4303 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4306 sprintf(name, "%s Playback Switch", pfx);
4307 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4308 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4311 } else if (alc880_is_multi_pin(pin)) {
4312 /* set manual connection */
4313 /* we have only a switch on HP-out PIN */
4314 sprintf(name, "%s Playback Switch", pfx);
4315 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4316 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4323 /* create input playback/capture controls for the given pin */
4324 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4325 const char *ctlname,
4326 int idx, hda_nid_t mix_nid)
4331 sprintf(name, "%s Playback Volume", ctlname);
4332 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4333 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4336 sprintf(name, "%s Playback Switch", ctlname);
4337 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4338 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4344 /* create playback/capture controls for input pins */
4345 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4346 const struct auto_pin_cfg *cfg)
4348 struct hda_input_mux *imux = &spec->private_imux[0];
4351 for (i = 0; i < AUTO_PIN_LAST; i++) {
4352 if (alc880_is_input_pin(cfg->input_pins[i])) {
4353 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4354 err = new_analog_input(spec, cfg->input_pins[i],
4355 auto_pin_cfg_labels[i],
4359 imux->items[imux->num_items].label =
4360 auto_pin_cfg_labels[i];
4361 imux->items[imux->num_items].index =
4362 alc880_input_pin_idx(cfg->input_pins[i]);
4369 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4370 unsigned int pin_type)
4372 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4375 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4379 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4380 hda_nid_t nid, int pin_type,
4383 alc_set_pin_output(codec, nid, pin_type);
4384 /* need the manual connection? */
4385 if (alc880_is_multi_pin(nid)) {
4386 struct alc_spec *spec = codec->spec;
4387 int idx = alc880_multi_pin_idx(nid);
4388 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4389 AC_VERB_SET_CONNECT_SEL,
4390 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4394 static int get_pin_type(int line_out_type)
4396 if (line_out_type == AUTO_PIN_HP_OUT)
4402 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4404 struct alc_spec *spec = codec->spec;
4407 for (i = 0; i < spec->autocfg.line_outs; i++) {
4408 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4409 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4410 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4414 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4416 struct alc_spec *spec = codec->spec;
4419 pin = spec->autocfg.speaker_pins[0];
4420 if (pin) /* connect to front */
4421 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4422 pin = spec->autocfg.hp_pins[0];
4423 if (pin) /* connect to front */
4424 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4427 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4429 struct alc_spec *spec = codec->spec;
4432 for (i = 0; i < AUTO_PIN_LAST; i++) {
4433 hda_nid_t nid = spec->autocfg.input_pins[i];
4434 if (alc880_is_input_pin(nid)) {
4435 alc_set_input_pin(codec, nid, i);
4436 if (nid != ALC880_PIN_CD_NID &&
4437 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4438 snd_hda_codec_write(codec, nid, 0,
4439 AC_VERB_SET_AMP_GAIN_MUTE,
4445 /* parse the BIOS configuration and set up the alc_spec */
4446 /* return 1 if successful, 0 if the proper config is not found,
4447 * or a negative error code
4449 static int alc880_parse_auto_config(struct hda_codec *codec)
4451 struct alc_spec *spec = codec->spec;
4453 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4455 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4459 if (!spec->autocfg.line_outs)
4460 return 0; /* can't find valid BIOS pin config */
4462 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4465 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4468 err = alc880_auto_create_extra_out(spec,
4469 spec->autocfg.speaker_pins[0],
4473 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4477 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4481 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4483 /* check multiple SPDIF-out (for recent codecs) */
4484 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4486 err = snd_hda_get_connections(codec,
4487 spec->autocfg.dig_out_pins[i],
4492 spec->multiout.dig_out_nid = dig_nid;
4494 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4495 spec->slave_dig_outs[i - 1] = dig_nid;
4496 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4500 if (spec->autocfg.dig_in_pin)
4501 spec->dig_in_nid = ALC880_DIGIN_NID;
4503 if (spec->kctls.list)
4504 add_mixer(spec, spec->kctls.list);
4506 add_verb(spec, alc880_volume_init_verbs);
4508 spec->num_mux_defs = 1;
4509 spec->input_mux = &spec->private_imux[0];
4511 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4516 /* additional initialization for auto-configuration model */
4517 static void alc880_auto_init(struct hda_codec *codec)
4519 struct alc_spec *spec = codec->spec;
4520 alc880_auto_init_multi_out(codec);
4521 alc880_auto_init_extra_out(codec);
4522 alc880_auto_init_analog_input(codec);
4523 if (spec->unsol_event)
4524 alc_inithook(codec);
4527 static void set_capture_mixer(struct alc_spec *spec)
4529 static struct snd_kcontrol_new *caps[2][3] = {
4530 { alc_capture_mixer_nosrc1,
4531 alc_capture_mixer_nosrc2,
4532 alc_capture_mixer_nosrc3 },
4533 { alc_capture_mixer1,
4535 alc_capture_mixer3 },
4537 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4539 if (spec->input_mux && spec->input_mux->num_items > 1)
4543 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4547 #define set_beep_amp(spec, nid, idx, dir) \
4548 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4551 * OK, here we have finally the patch for ALC880
4554 static int patch_alc880(struct hda_codec *codec)
4556 struct alc_spec *spec;
4560 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4566 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4569 if (board_config < 0) {
4570 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4571 "trying auto-probe from BIOS...\n", codec->chip_name);
4572 board_config = ALC880_AUTO;
4575 if (board_config == ALC880_AUTO) {
4576 /* automatic parse from the BIOS config */
4577 err = alc880_parse_auto_config(codec);
4583 "hda_codec: Cannot set up configuration "
4584 "from BIOS. Using 3-stack mode...\n");
4585 board_config = ALC880_3ST;
4589 err = snd_hda_attach_beep_device(codec, 0x1);
4595 if (board_config != ALC880_AUTO)
4596 setup_preset(spec, &alc880_presets[board_config]);
4598 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4599 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4600 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4602 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4603 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4605 if (!spec->adc_nids && spec->input_mux) {
4606 /* check whether NID 0x07 is valid */
4607 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4609 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4610 if (wcap != AC_WID_AUD_IN) {
4611 spec->adc_nids = alc880_adc_nids_alt;
4612 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4614 spec->adc_nids = alc880_adc_nids;
4615 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4618 set_capture_mixer(spec);
4619 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4621 spec->vmaster_nid = 0x0c;
4623 codec->patch_ops = alc_patch_ops;
4624 if (board_config == ALC880_AUTO)
4625 spec->init_hook = alc880_auto_init;
4626 #ifdef CONFIG_SND_HDA_POWER_SAVE
4627 if (!spec->loopback.amplist)
4628 spec->loopback.amplist = alc880_loopbacks;
4630 codec->proc_widget_hook = print_realtek_coef;
4640 static hda_nid_t alc260_dac_nids[1] = {
4645 static hda_nid_t alc260_adc_nids[1] = {
4650 static hda_nid_t alc260_adc_nids_alt[1] = {
4655 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4656 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4658 static hda_nid_t alc260_dual_adc_nids[2] = {
4663 #define ALC260_DIGOUT_NID 0x03
4664 #define ALC260_DIGIN_NID 0x06
4666 static struct hda_input_mux alc260_capture_source = {
4670 { "Front Mic", 0x1 },
4676 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4677 * headphone jack and the internal CD lines since these are the only pins at
4678 * which audio can appear. For flexibility, also allow the option of
4679 * recording the mixer output on the second ADC (ADC0 doesn't have a
4680 * connection to the mixer output).
4682 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4686 { "Mic/Line", 0x0 },
4688 { "Headphone", 0x2 },
4694 { "Mic/Line", 0x0 },
4696 { "Headphone", 0x2 },
4703 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4704 * the Fujitsu S702x, but jacks are marked differently.
4706 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4713 { "Headphone", 0x5 },
4722 { "Headphone", 0x6 },
4728 /* Maxdata Favorit 100XS */
4729 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4733 { "Line/Mic", 0x0 },
4740 { "Line/Mic", 0x0 },
4748 * This is just place-holder, so there's something for alc_build_pcms to look
4749 * at when it calculates the maximum number of channels. ALC260 has no mixer
4750 * element which allows changing the channel mode, so the verb list is
4753 static struct hda_channel_mode alc260_modes[1] = {
4758 /* Mixer combinations
4760 * basic: base_output + input + pc_beep + capture
4761 * HP: base_output + input + capture_alt
4762 * HP_3013: hp_3013 + input + capture
4763 * fujitsu: fujitsu + capture
4764 * acer: acer + capture
4767 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4768 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4769 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4770 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4771 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4772 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4773 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4777 static struct snd_kcontrol_new alc260_input_mixer[] = {
4778 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4779 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4780 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4781 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4782 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4783 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4784 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4785 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4789 /* update HP, line and mono out pins according to the master switch */
4790 static void alc260_hp_master_update(struct hda_codec *codec,
4791 hda_nid_t hp, hda_nid_t line,
4794 struct alc_spec *spec = codec->spec;
4795 unsigned int val = spec->master_sw ? PIN_HP : 0;
4796 /* change HP and line-out pins */
4797 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4799 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4801 /* mono (speaker) depending on the HP jack sense */
4802 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4803 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4807 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4808 struct snd_ctl_elem_value *ucontrol)
4810 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4811 struct alc_spec *spec = codec->spec;
4812 *ucontrol->value.integer.value = spec->master_sw;
4816 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4817 struct snd_ctl_elem_value *ucontrol)
4819 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4820 struct alc_spec *spec = codec->spec;
4821 int val = !!*ucontrol->value.integer.value;
4822 hda_nid_t hp, line, mono;
4824 if (val == spec->master_sw)
4826 spec->master_sw = val;
4827 hp = (kcontrol->private_value >> 16) & 0xff;
4828 line = (kcontrol->private_value >> 8) & 0xff;
4829 mono = kcontrol->private_value & 0xff;
4830 alc260_hp_master_update(codec, hp, line, mono);
4834 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4836 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4837 .name = "Master Playback Switch",
4838 .info = snd_ctl_boolean_mono_info,
4839 .get = alc260_hp_master_sw_get,
4840 .put = alc260_hp_master_sw_put,
4841 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4843 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4844 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4845 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4846 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4847 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4849 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4853 static struct hda_verb alc260_hp_unsol_verbs[] = {
4854 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4858 static void alc260_hp_automute(struct hda_codec *codec)
4860 struct alc_spec *spec = codec->spec;
4861 unsigned int present;
4863 present = snd_hda_codec_read(codec, 0x10, 0,
4864 AC_VERB_GET_PIN_SENSE, 0);
4865 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4866 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4869 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4871 if ((res >> 26) == ALC880_HP_EVENT)
4872 alc260_hp_automute(codec);
4875 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4877 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4878 .name = "Master Playback Switch",
4879 .info = snd_ctl_boolean_mono_info,
4880 .get = alc260_hp_master_sw_get,
4881 .put = alc260_hp_master_sw_put,
4882 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4884 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4885 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4886 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4887 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4888 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4889 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4890 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4891 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4895 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4896 .ops = &snd_hda_bind_vol,
4898 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4899 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4900 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4905 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4906 .ops = &snd_hda_bind_sw,
4908 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4909 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4914 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4915 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4916 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4917 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4918 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4922 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4923 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4927 static void alc260_hp_3013_automute(struct hda_codec *codec)
4929 struct alc_spec *spec = codec->spec;
4930 unsigned int present;
4932 present = snd_hda_codec_read(codec, 0x15, 0,
4933 AC_VERB_GET_PIN_SENSE, 0);
4934 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4935 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4938 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4941 if ((res >> 26) == ALC880_HP_EVENT)
4942 alc260_hp_3013_automute(codec);
4945 static void alc260_hp_3012_automute(struct hda_codec *codec)
4947 unsigned int present, bits;
4949 present = snd_hda_codec_read(codec, 0x10, 0,
4950 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4952 bits = present ? 0 : PIN_OUT;
4953 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4955 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4957 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4961 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4964 if ((res >> 26) == ALC880_HP_EVENT)
4965 alc260_hp_3012_automute(codec);
4968 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4969 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4971 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4972 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4973 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4974 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4975 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4976 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4977 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4978 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4979 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4980 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4981 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4985 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4986 * versions of the ALC260 don't act on requests to enable mic bias from NID
4987 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4988 * datasheet doesn't mention this restriction. At this stage it's not clear
4989 * whether this behaviour is intentional or is a hardware bug in chip
4990 * revisions available in early 2006. Therefore for now allow the
4991 * "Headphone Jack Mode" control to span all choices, but if it turns out
4992 * that the lack of mic bias for this NID is intentional we could change the
4993 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4995 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4996 * don't appear to make the mic bias available from the "line" jack, even
4997 * though the NID used for this jack (0x14) can supply it. The theory is
4998 * that perhaps Acer have included blocking capacitors between the ALC260
4999 * and the output jack. If this turns out to be the case for all such
5000 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5001 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5003 * The C20x Tablet series have a mono internal speaker which is controlled
5004 * via the chip's Mono sum widget and pin complex, so include the necessary
5005 * controls for such models. On models without a "mono speaker" the control
5006 * won't do anything.
5008 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5009 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5010 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5011 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5012 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5014 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5016 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5017 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5019 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5020 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5021 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5022 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5023 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5027 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5029 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5030 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5031 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5032 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5033 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5034 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5035 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5039 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5040 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5042 static struct snd_kcontrol_new alc260_will_mixer[] = {
5043 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5044 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5046 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5047 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5048 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5049 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5050 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5051 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5052 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5056 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5057 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5059 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5060 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5061 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5063 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5064 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5065 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5066 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5067 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5068 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5069 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5074 * initialization verbs
5076 static struct hda_verb alc260_init_verbs[] = {
5077 /* Line In pin widget for input */
5078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5079 /* CD pin widget for input */
5080 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5081 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5082 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5083 /* Mic2 (front panel) pin widget for input and vref at 80% */
5084 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5085 /* LINE-2 is used for line-out in rear */
5086 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5087 /* select line-out */
5088 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5090 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5092 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5094 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5095 /* mute capture amp left and right */
5096 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5097 /* set connection select to line in (default select for this ADC) */
5098 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5099 /* mute capture amp left and right */
5100 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5101 /* set connection select to line in (default select for this ADC) */
5102 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5103 /* set vol=0 Line-Out mixer amp left and right */
5104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5105 /* unmute pin widget amp left and right (no gain on this amp) */
5106 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5107 /* set vol=0 HP mixer amp left and right */
5108 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5109 /* unmute pin widget amp left and right (no gain on this amp) */
5110 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5111 /* set vol=0 Mono mixer amp left and right */
5112 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5113 /* unmute pin widget amp left and right (no gain on this amp) */
5114 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5115 /* unmute LINE-2 out pin */
5116 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5117 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5120 /* mute analog inputs */
5121 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5122 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5123 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5124 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5125 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5126 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5127 /* mute Front out path */
5128 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5130 /* mute Headphone out path */
5131 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5132 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5133 /* mute Mono out path */
5134 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5135 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5139 #if 0 /* should be identical with alc260_init_verbs? */
5140 static struct hda_verb alc260_hp_init_verbs[] = {
5141 /* Headphone and output */
5142 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5144 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5145 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5146 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5147 /* Mic2 (front panel) pin widget for input and vref at 80% */
5148 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5149 /* Line In pin widget for input */
5150 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5151 /* Line-2 pin widget for output */
5152 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5153 /* CD pin widget for input */
5154 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5155 /* unmute amp left and right */
5156 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5157 /* set connection select to line in (default select for this ADC) */
5158 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5159 /* unmute Line-Out mixer amp left and right (volume = 0) */
5160 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5161 /* mute pin widget amp left and right (no gain on this amp) */
5162 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5163 /* unmute HP mixer amp left and right (volume = 0) */
5164 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5165 /* mute pin widget amp left and right (no gain on this amp) */
5166 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5167 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5170 /* mute analog inputs */
5171 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5172 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5173 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5174 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5175 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5176 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5177 /* Unmute Front out path */
5178 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5179 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5180 /* Unmute Headphone out path */
5181 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5183 /* Unmute Mono out path */
5184 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5185 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5190 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5191 /* Line out and output */
5192 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5194 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5195 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5196 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5197 /* Mic2 (front panel) pin widget for input and vref at 80% */
5198 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5199 /* Line In pin widget for input */
5200 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5201 /* Headphone pin widget for output */
5202 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5203 /* CD pin widget for input */
5204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5205 /* unmute amp left and right */
5206 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5207 /* set connection select to line in (default select for this ADC) */
5208 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5209 /* unmute Line-Out mixer amp left and right (volume = 0) */
5210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5211 /* mute pin widget amp left and right (no gain on this amp) */
5212 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5213 /* unmute HP mixer amp left and right (volume = 0) */
5214 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5215 /* mute pin widget amp left and right (no gain on this amp) */
5216 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5217 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5220 /* mute analog inputs */
5221 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5222 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5223 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5224 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5225 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5226 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5227 /* Unmute Front out path */
5228 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5229 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5230 /* Unmute Headphone out path */
5231 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5232 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5233 /* Unmute Mono out path */
5234 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5235 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5239 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5240 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5241 * audio = 0x16, internal speaker = 0x10.
5243 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5244 /* Disable all GPIOs */
5245 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5246 /* Internal speaker is connected to headphone pin */
5247 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5248 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5250 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5251 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5252 /* Ensure all other unused pins are disabled and muted. */
5253 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5255 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5256 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5257 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5258 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5259 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5262 /* Disable digital (SPDIF) pins */
5263 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5264 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5266 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5267 * when acting as an output.
5269 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5271 /* Start with output sum widgets muted and their output gains at min */
5272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5274 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5276 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5278 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5279 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5280 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5282 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5283 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5284 /* Unmute Line1 pin widget output buffer since it starts as an output.
5285 * If the pin mode is changed by the user the pin mode control will
5286 * take care of enabling the pin's input/output buffers as needed.
5287 * Therefore there's no need to enable the input buffer at this
5290 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5291 /* Unmute input buffer of pin widget used for Line-in (no equiv
5294 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5296 /* Mute capture amp left and right */
5297 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5298 /* Set ADC connection select to match default mixer setting - line
5301 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5303 /* Do the same for the second ADC: mute capture input amp and
5304 * set ADC connection to line in (on mic1 pin)
5306 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5307 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5309 /* Mute all inputs to mixer widget (even unconnected ones) */
5310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5311 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5312 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5314 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5315 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5322 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5323 * similar laptops (adapted from Fujitsu init verbs).
5325 static struct hda_verb alc260_acer_init_verbs[] = {
5326 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5327 * the headphone jack. Turn this on and rely on the standard mute
5328 * methods whenever the user wants to turn these outputs off.
5330 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5331 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5332 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5333 /* Internal speaker/Headphone jack is connected to Line-out pin */
5334 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5335 /* Internal microphone/Mic jack is connected to Mic1 pin */
5336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5337 /* Line In jack is connected to Line1 pin */
5338 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5339 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5340 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5341 /* Ensure all other unused pins are disabled and muted. */
5342 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5343 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5344 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5345 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5346 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5348 /* Disable digital (SPDIF) pins */
5349 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5350 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5352 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5353 * bus when acting as outputs.
5355 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5356 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5358 /* Start with output sum widgets muted and their output gains at min */
5359 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5360 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5365 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5366 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5367 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5369 /* Unmute Line-out pin widget amp left and right
5370 * (no equiv mixer ctrl)
5372 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5373 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5374 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5375 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5376 * inputs. If the pin mode is changed by the user the pin mode control
5377 * will take care of enabling the pin's input/output buffers as needed.
5378 * Therefore there's no need to enable the input buffer at this
5381 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5382 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5384 /* Mute capture amp left and right */
5385 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5386 /* Set ADC connection select to match default mixer setting - mic
5389 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5391 /* Do similar with the second ADC: mute capture input amp and
5392 * set ADC connection to mic to match ALSA's default state.
5394 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5395 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5397 /* Mute all inputs to mixer widget (even unconnected ones) */
5398 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5399 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5401 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5403 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5404 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5410 /* Initialisation sequence for Maxdata Favorit 100XS
5411 * (adapted from Acer init verbs).
5413 static struct hda_verb alc260_favorit100_init_verbs[] = {
5414 /* GPIO 0 enables the output jack.
5415 * Turn this on and rely on the standard mute
5416 * methods whenever the user wants to turn these outputs off.
5418 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5419 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5420 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5421 /* Line/Mic input jack is connected to Mic1 pin */
5422 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5423 /* Ensure all other unused pins are disabled and muted. */
5424 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5425 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5426 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5427 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5428 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5429 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5430 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5431 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5433 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5434 /* Disable digital (SPDIF) pins */
5435 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5436 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5438 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5439 * bus when acting as outputs.
5441 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5442 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5444 /* Start with output sum widgets muted and their output gains at min */
5445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5447 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5450 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5453 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5455 /* Unmute Line-out pin widget amp left and right
5456 * (no equiv mixer ctrl)
5458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5459 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5460 * inputs. If the pin mode is changed by the user the pin mode control
5461 * will take care of enabling the pin's input/output buffers as needed.
5462 * Therefore there's no need to enable the input buffer at this
5465 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5467 /* Mute capture amp left and right */
5468 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5469 /* Set ADC connection select to match default mixer setting - mic
5472 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5474 /* Do similar with the second ADC: mute capture input amp and
5475 * set ADC connection to mic to match ALSA's default state.
5477 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5478 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5480 /* Mute all inputs to mixer widget (even unconnected ones) */
5481 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5484 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5485 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5487 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5493 static struct hda_verb alc260_will_verbs[] = {
5494 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5495 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5496 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5497 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5498 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5499 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5503 static struct hda_verb alc260_replacer_672v_verbs[] = {
5504 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5505 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5506 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5508 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5509 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5510 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5512 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5516 /* toggle speaker-output according to the hp-jack state */
5517 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5519 unsigned int present;
5521 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5522 present = snd_hda_codec_read(codec, 0x0f, 0,
5523 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5525 snd_hda_codec_write_cache(codec, 0x01, 0,
5526 AC_VERB_SET_GPIO_DATA, 1);
5527 snd_hda_codec_write_cache(codec, 0x0f, 0,
5528 AC_VERB_SET_PIN_WIDGET_CONTROL,
5531 snd_hda_codec_write_cache(codec, 0x01, 0,
5532 AC_VERB_SET_GPIO_DATA, 0);
5533 snd_hda_codec_write_cache(codec, 0x0f, 0,
5534 AC_VERB_SET_PIN_WIDGET_CONTROL,
5539 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5542 if ((res >> 26) == ALC880_HP_EVENT)
5543 alc260_replacer_672v_automute(codec);
5546 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5547 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5549 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5550 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5551 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5553 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5554 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5555 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5556 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5560 /* Test configuration for debugging, modelled after the ALC880 test
5563 #ifdef CONFIG_SND_DEBUG
5564 static hda_nid_t alc260_test_dac_nids[1] = {
5567 static hda_nid_t alc260_test_adc_nids[2] = {
5570 /* For testing the ALC260, each input MUX needs its own definition since
5571 * the signal assignments are different. This assumes that the first ADC
5574 static struct hda_input_mux alc260_test_capture_sources[2] = {
5578 { "MIC1 pin", 0x0 },
5579 { "MIC2 pin", 0x1 },
5580 { "LINE1 pin", 0x2 },
5581 { "LINE2 pin", 0x3 },
5583 { "LINE-OUT pin", 0x5 },
5584 { "HP-OUT pin", 0x6 },
5590 { "MIC1 pin", 0x0 },
5591 { "MIC2 pin", 0x1 },
5592 { "LINE1 pin", 0x2 },
5593 { "LINE2 pin", 0x3 },
5596 { "LINE-OUT pin", 0x6 },
5597 { "HP-OUT pin", 0x7 },
5601 static struct snd_kcontrol_new alc260_test_mixer[] = {
5602 /* Output driver widgets */
5603 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5604 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5605 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5606 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5607 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5608 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5610 /* Modes for retasking pin widgets
5611 * Note: the ALC260 doesn't seem to act on requests to enable mic
5612 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5613 * mention this restriction. At this stage it's not clear whether
5614 * this behaviour is intentional or is a hardware bug in chip
5615 * revisions available at least up until early 2006. Therefore for
5616 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5617 * choices, but if it turns out that the lack of mic bias for these
5618 * NIDs is intentional we could change their modes from
5619 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5621 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5622 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5623 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5624 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5625 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5626 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5628 /* Loopback mixer controls */
5629 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5630 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5631 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5632 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5633 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5634 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5635 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5636 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5637 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5638 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5639 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5640 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5641 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5642 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5644 /* Controls for GPIO pins, assuming they are configured as outputs */
5645 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5646 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5647 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5648 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5650 /* Switches to allow the digital IO pins to be enabled. The datasheet
5651 * is ambigious as to which NID is which; testing on laptops which
5652 * make this output available should provide clarification.
5654 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5655 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5657 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5658 * this output to turn on an external amplifier.
5660 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5661 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5665 static struct hda_verb alc260_test_init_verbs[] = {
5666 /* Enable all GPIOs as outputs with an initial value of 0 */
5667 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5668 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5669 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5671 /* Enable retasking pins as output, initially without power amp */
5672 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5673 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5675 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5676 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5677 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5679 /* Disable digital (SPDIF) pins initially, but users can enable
5680 * them via a mixer switch. In the case of SPDIF-out, this initverb
5681 * payload also sets the generation to 0, output to be in "consumer"
5682 * PCM format, copyright asserted, no pre-emphasis and no validity
5685 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5686 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5688 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5689 * OUT1 sum bus when acting as an output.
5691 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5692 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5693 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5694 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5696 /* Start with output sum widgets muted and their output gains at min */
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5698 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5699 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5701 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5702 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5704 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5705 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5707 /* Unmute retasking pin widget output buffers since the default
5708 * state appears to be output. As the pin mode is changed by the
5709 * user the pin mode control will take care of enabling the pin's
5710 * input/output buffers as needed.
5712 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5713 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5716 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5717 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5718 /* Also unmute the mono-out pin widget */
5719 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5721 /* Mute capture amp left and right */
5722 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 /* Set ADC connection select to match default mixer setting (mic1
5726 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5728 /* Do the same for the second ADC: mute capture input amp and
5729 * set ADC connection to mic1 pin
5731 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5734 /* Mute all inputs to mixer widget (even unconnected ones) */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5741 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5742 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5748 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5749 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5751 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5752 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5755 * for BIOS auto-configuration
5758 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5759 const char *pfx, int *vol_bits)
5762 unsigned long vol_val, sw_val;
5766 if (nid >= 0x0f && nid < 0x11) {
5767 nid_vol = nid - 0x7;
5768 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5769 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5770 } else if (nid == 0x11) {
5771 nid_vol = nid - 0x7;
5772 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5773 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5774 } else if (nid >= 0x12 && nid <= 0x15) {
5776 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5777 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5781 if (!(*vol_bits & (1 << nid_vol))) {
5782 /* first control for the volume widget */
5783 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5784 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5787 *vol_bits |= (1 << nid_vol);
5789 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5790 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5796 /* add playback controls from the parsed DAC table */
5797 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5798 const struct auto_pin_cfg *cfg)
5804 spec->multiout.num_dacs = 1;
5805 spec->multiout.dac_nids = spec->private_dac_nids;
5806 spec->multiout.dac_nids[0] = 0x02;
5808 nid = cfg->line_out_pins[0];
5810 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5815 nid = cfg->speaker_pins[0];
5817 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5822 nid = cfg->hp_pins[0];
5824 err = alc260_add_playback_controls(spec, nid, "Headphone",
5832 /* create playback/capture controls for input pins */
5833 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5834 const struct auto_pin_cfg *cfg)
5836 struct hda_input_mux *imux = &spec->private_imux[0];
5839 for (i = 0; i < AUTO_PIN_LAST; i++) {
5840 if (cfg->input_pins[i] >= 0x12) {
5841 idx = cfg->input_pins[i] - 0x12;
5842 err = new_analog_input(spec, cfg->input_pins[i],
5843 auto_pin_cfg_labels[i], idx,
5847 imux->items[imux->num_items].label =
5848 auto_pin_cfg_labels[i];
5849 imux->items[imux->num_items].index = idx;
5852 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5853 idx = cfg->input_pins[i] - 0x09;
5854 err = new_analog_input(spec, cfg->input_pins[i],
5855 auto_pin_cfg_labels[i], idx,
5859 imux->items[imux->num_items].label =
5860 auto_pin_cfg_labels[i];
5861 imux->items[imux->num_items].index = idx;
5868 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5869 hda_nid_t nid, int pin_type,
5872 alc_set_pin_output(codec, nid, pin_type);
5873 /* need the manual connection? */
5875 int idx = nid - 0x12;
5876 snd_hda_codec_write(codec, idx + 0x0b, 0,
5877 AC_VERB_SET_CONNECT_SEL, sel_idx);
5881 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5883 struct alc_spec *spec = codec->spec;
5886 nid = spec->autocfg.line_out_pins[0];
5888 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5889 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5892 nid = spec->autocfg.speaker_pins[0];
5894 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5896 nid = spec->autocfg.hp_pins[0];
5898 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5901 #define ALC260_PIN_CD_NID 0x16
5902 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5904 struct alc_spec *spec = codec->spec;
5907 for (i = 0; i < AUTO_PIN_LAST; i++) {
5908 hda_nid_t nid = spec->autocfg.input_pins[i];
5910 alc_set_input_pin(codec, nid, i);
5911 if (nid != ALC260_PIN_CD_NID &&
5912 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5913 snd_hda_codec_write(codec, nid, 0,
5914 AC_VERB_SET_AMP_GAIN_MUTE,
5921 * generic initialization of ADC, input mixers and output mixers
5923 static struct hda_verb alc260_volume_init_verbs[] = {
5925 * Unmute ADC0-1 and set the default input to mic-in
5927 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5928 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5929 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5930 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5932 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5934 * Note: PASD motherboards uses the Line In 2 as the input for
5935 * front panel mic (mic 2)
5937 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5938 /* mute analog inputs */
5939 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5940 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5946 * Set up output mixers (0x08 - 0x0a)
5948 /* set vol=0 to output mixers */
5949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5950 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5951 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5952 /* set up input amps for analog loopback */
5953 /* Amp Indices: DAC = 0, mixer = 1 */
5954 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5955 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5956 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5957 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5958 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5959 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5964 static int alc260_parse_auto_config(struct hda_codec *codec)
5966 struct alc_spec *spec = codec->spec;
5968 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5970 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5974 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5977 if (!spec->kctls.list)
5978 return 0; /* can't find valid BIOS pin config */
5979 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5983 spec->multiout.max_channels = 2;
5985 if (spec->autocfg.dig_outs)
5986 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5987 if (spec->kctls.list)
5988 add_mixer(spec, spec->kctls.list);
5990 add_verb(spec, alc260_volume_init_verbs);
5992 spec->num_mux_defs = 1;
5993 spec->input_mux = &spec->private_imux[0];
5995 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6000 /* additional initialization for auto-configuration model */
6001 static void alc260_auto_init(struct hda_codec *codec)
6003 struct alc_spec *spec = codec->spec;
6004 alc260_auto_init_multi_out(codec);
6005 alc260_auto_init_analog_input(codec);
6006 if (spec->unsol_event)
6007 alc_inithook(codec);
6010 #ifdef CONFIG_SND_HDA_POWER_SAVE
6011 static struct hda_amp_list alc260_loopbacks[] = {
6012 { 0x07, HDA_INPUT, 0 },
6013 { 0x07, HDA_INPUT, 1 },
6014 { 0x07, HDA_INPUT, 2 },
6015 { 0x07, HDA_INPUT, 3 },
6016 { 0x07, HDA_INPUT, 4 },
6022 * ALC260 configurations
6024 static const char *alc260_models[ALC260_MODEL_LAST] = {
6025 [ALC260_BASIC] = "basic",
6027 [ALC260_HP_3013] = "hp-3013",
6028 [ALC260_HP_DC7600] = "hp-dc7600",
6029 [ALC260_FUJITSU_S702X] = "fujitsu",
6030 [ALC260_ACER] = "acer",
6031 [ALC260_WILL] = "will",
6032 [ALC260_REPLACER_672V] = "replacer",
6033 [ALC260_FAVORIT100] = "favorit100",
6034 #ifdef CONFIG_SND_DEBUG
6035 [ALC260_TEST] = "test",
6037 [ALC260_AUTO] = "auto",
6040 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6041 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6042 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6043 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6044 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6045 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6046 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6047 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6048 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6049 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6050 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6051 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6052 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6053 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6054 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6055 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6056 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6057 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6058 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6059 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6063 static struct alc_config_preset alc260_presets[] = {
6065 .mixers = { alc260_base_output_mixer,
6066 alc260_input_mixer },
6067 .init_verbs = { alc260_init_verbs },
6068 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6069 .dac_nids = alc260_dac_nids,
6070 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6071 .adc_nids = alc260_adc_nids,
6072 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6073 .channel_mode = alc260_modes,
6074 .input_mux = &alc260_capture_source,
6077 .mixers = { alc260_hp_output_mixer,
6078 alc260_input_mixer },
6079 .init_verbs = { alc260_init_verbs,
6080 alc260_hp_unsol_verbs },
6081 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6082 .dac_nids = alc260_dac_nids,
6083 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6084 .adc_nids = alc260_adc_nids_alt,
6085 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6086 .channel_mode = alc260_modes,
6087 .input_mux = &alc260_capture_source,
6088 .unsol_event = alc260_hp_unsol_event,
6089 .init_hook = alc260_hp_automute,
6091 [ALC260_HP_DC7600] = {
6092 .mixers = { alc260_hp_dc7600_mixer,
6093 alc260_input_mixer },
6094 .init_verbs = { alc260_init_verbs,
6095 alc260_hp_dc7600_verbs },
6096 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6097 .dac_nids = alc260_dac_nids,
6098 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6099 .adc_nids = alc260_adc_nids_alt,
6100 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6101 .channel_mode = alc260_modes,
6102 .input_mux = &alc260_capture_source,
6103 .unsol_event = alc260_hp_3012_unsol_event,
6104 .init_hook = alc260_hp_3012_automute,
6106 [ALC260_HP_3013] = {
6107 .mixers = { alc260_hp_3013_mixer,
6108 alc260_input_mixer },
6109 .init_verbs = { alc260_hp_3013_init_verbs,
6110 alc260_hp_3013_unsol_verbs },
6111 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6112 .dac_nids = alc260_dac_nids,
6113 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6114 .adc_nids = alc260_adc_nids_alt,
6115 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6116 .channel_mode = alc260_modes,
6117 .input_mux = &alc260_capture_source,
6118 .unsol_event = alc260_hp_3013_unsol_event,
6119 .init_hook = alc260_hp_3013_automute,
6121 [ALC260_FUJITSU_S702X] = {
6122 .mixers = { alc260_fujitsu_mixer },
6123 .init_verbs = { alc260_fujitsu_init_verbs },
6124 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6125 .dac_nids = alc260_dac_nids,
6126 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6127 .adc_nids = alc260_dual_adc_nids,
6128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6129 .channel_mode = alc260_modes,
6130 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6131 .input_mux = alc260_fujitsu_capture_sources,
6134 .mixers = { alc260_acer_mixer },
6135 .init_verbs = { alc260_acer_init_verbs },
6136 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6137 .dac_nids = alc260_dac_nids,
6138 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6139 .adc_nids = alc260_dual_adc_nids,
6140 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6141 .channel_mode = alc260_modes,
6142 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6143 .input_mux = alc260_acer_capture_sources,
6145 [ALC260_FAVORIT100] = {
6146 .mixers = { alc260_favorit100_mixer },
6147 .init_verbs = { alc260_favorit100_init_verbs },
6148 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6149 .dac_nids = alc260_dac_nids,
6150 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6151 .adc_nids = alc260_dual_adc_nids,
6152 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6153 .channel_mode = alc260_modes,
6154 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6155 .input_mux = alc260_favorit100_capture_sources,
6158 .mixers = { alc260_will_mixer },
6159 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6160 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6161 .dac_nids = alc260_dac_nids,
6162 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6163 .adc_nids = alc260_adc_nids,
6164 .dig_out_nid = ALC260_DIGOUT_NID,
6165 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6166 .channel_mode = alc260_modes,
6167 .input_mux = &alc260_capture_source,
6169 [ALC260_REPLACER_672V] = {
6170 .mixers = { alc260_replacer_672v_mixer },
6171 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6172 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6173 .dac_nids = alc260_dac_nids,
6174 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6175 .adc_nids = alc260_adc_nids,
6176 .dig_out_nid = ALC260_DIGOUT_NID,
6177 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6178 .channel_mode = alc260_modes,
6179 .input_mux = &alc260_capture_source,
6180 .unsol_event = alc260_replacer_672v_unsol_event,
6181 .init_hook = alc260_replacer_672v_automute,
6183 #ifdef CONFIG_SND_DEBUG
6185 .mixers = { alc260_test_mixer },
6186 .init_verbs = { alc260_test_init_verbs },
6187 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6188 .dac_nids = alc260_test_dac_nids,
6189 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6190 .adc_nids = alc260_test_adc_nids,
6191 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6192 .channel_mode = alc260_modes,
6193 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6194 .input_mux = alc260_test_capture_sources,
6199 static int patch_alc260(struct hda_codec *codec)
6201 struct alc_spec *spec;
6202 int err, board_config;
6204 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6210 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6213 if (board_config < 0) {
6214 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6215 "trying auto-probe from BIOS...\n",
6217 board_config = ALC260_AUTO;
6220 if (board_config == ALC260_AUTO) {
6221 /* automatic parse from the BIOS config */
6222 err = alc260_parse_auto_config(codec);
6228 "hda_codec: Cannot set up configuration "
6229 "from BIOS. Using base mode...\n");
6230 board_config = ALC260_BASIC;
6234 err = snd_hda_attach_beep_device(codec, 0x1);
6240 if (board_config != ALC260_AUTO)
6241 setup_preset(spec, &alc260_presets[board_config]);
6243 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6244 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6246 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6247 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6249 if (!spec->adc_nids && spec->input_mux) {
6250 /* check whether NID 0x04 is valid */
6251 unsigned int wcap = get_wcaps(codec, 0x04);
6252 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6254 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6255 spec->adc_nids = alc260_adc_nids_alt;
6256 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6258 spec->adc_nids = alc260_adc_nids;
6259 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6262 set_capture_mixer(spec);
6263 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6265 spec->vmaster_nid = 0x08;
6267 codec->patch_ops = alc_patch_ops;
6268 if (board_config == ALC260_AUTO)
6269 spec->init_hook = alc260_auto_init;
6270 #ifdef CONFIG_SND_HDA_POWER_SAVE
6271 if (!spec->loopback.amplist)
6272 spec->loopback.amplist = alc260_loopbacks;
6274 codec->proc_widget_hook = print_realtek_coef;
6283 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6284 * configuration. Each pin widget can choose any input DACs and a mixer.
6285 * Each ADC is connected from a mixer of all inputs. This makes possible
6286 * 6-channel independent captures.
6288 * In addition, an independent DAC for the multi-playback (not used in this
6291 #define ALC882_DIGOUT_NID 0x06
6292 #define ALC882_DIGIN_NID 0x0a
6294 static struct hda_channel_mode alc882_ch_modes[1] = {
6298 static hda_nid_t alc882_dac_nids[4] = {
6299 /* front, rear, clfe, rear_surr */
6300 0x02, 0x03, 0x04, 0x05
6303 /* identical with ALC880 */
6304 #define alc882_adc_nids alc880_adc_nids
6305 #define alc882_adc_nids_alt alc880_adc_nids_alt
6307 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6308 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6311 /* FIXME: should be a matrix-type input source selection */
6313 static struct hda_input_mux alc882_capture_source = {
6317 { "Front Mic", 0x1 },
6323 static struct hda_input_mux mb5_capture_source = {
6335 static struct hda_verb alc882_3ST_ch2_init[] = {
6336 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6337 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6338 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6339 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6346 static struct hda_verb alc882_3ST_ch6_init[] = {
6347 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6348 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6349 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6350 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6351 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6352 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6356 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6357 { 2, alc882_3ST_ch2_init },
6358 { 6, alc882_3ST_ch6_init },
6364 static struct hda_verb alc882_sixstack_ch6_init[] = {
6365 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6366 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6367 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6368 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6375 static struct hda_verb alc882_sixstack_ch8_init[] = {
6376 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6377 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6378 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6379 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6383 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6384 { 6, alc882_sixstack_ch6_init },
6385 { 8, alc882_sixstack_ch8_init },
6389 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6395 static struct hda_verb alc885_mbp_ch2_init[] = {
6396 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6397 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6398 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6405 static struct hda_verb alc885_mbp_ch6_init[] = {
6406 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6407 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6408 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6409 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6410 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6414 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6415 { 2, alc885_mbp_ch2_init },
6416 { 6, alc885_mbp_ch6_init },
6421 * Speakers/Woofer/HP = Front
6424 static struct hda_verb alc885_mb5_ch2_init[] = {
6425 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6432 * Speakers/HP = Front
6436 static struct hda_verb alc885_mb5_ch6_init[] = {
6437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6438 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6439 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6443 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6444 { 2, alc885_mb5_ch2_init },
6445 { 6, alc885_mb5_ch6_init },
6448 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6449 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6451 static struct snd_kcontrol_new alc882_base_mixer[] = {
6452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6453 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6454 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6455 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6456 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6457 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6458 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6459 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6460 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6461 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6462 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6463 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6464 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6465 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6466 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6467 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6468 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6469 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6470 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6471 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6472 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6476 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6477 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6478 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6479 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6480 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6481 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6482 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6484 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6485 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6486 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6490 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6491 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6492 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6494 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6495 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6496 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6497 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6498 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6499 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6500 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6502 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6503 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6504 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6508 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6509 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6510 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6511 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6512 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6513 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6514 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6515 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6516 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6517 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6521 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6522 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6523 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6524 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6525 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6526 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6531 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6532 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6533 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6534 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6538 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6539 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6541 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6542 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6543 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6544 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6545 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6546 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6547 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6548 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6549 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6550 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6551 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6552 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6553 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6554 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6558 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6559 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6560 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6561 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6562 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6563 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6567 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6568 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6572 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6575 .name = "Channel Mode",
6576 .info = alc_ch_mode_info,
6577 .get = alc_ch_mode_get,
6578 .put = alc_ch_mode_put,
6583 static struct hda_verb alc882_init_verbs[] = {
6584 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6585 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6587 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6589 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6590 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6591 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6593 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6594 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6595 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6597 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6601 /* Front Pin: output 0 (0x0c) */
6602 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6603 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6604 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6605 /* Rear Pin: output 1 (0x0d) */
6606 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6607 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6608 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6609 /* CLFE Pin: output 2 (0x0e) */
6610 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6611 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6612 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6613 /* Side Pin: output 3 (0x0f) */
6614 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6615 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6616 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6617 /* Mic (rear) pin: input vref at 80% */
6618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6620 /* Front Mic pin: input vref at 80% */
6621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6623 /* Line In pin: input */
6624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6626 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6629 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6630 /* CD pin widget for input */
6631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6633 /* FIXME: use matrix-type input source selection */
6634 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6635 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6650 /* ADC1: mute amp left and right */
6651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6652 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6653 /* ADC2: mute amp left and right */
6654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6655 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6656 /* ADC3: mute amp left and right */
6657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6658 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6663 static struct hda_verb alc882_eapd_verbs[] = {
6664 /* change to EAPD mode */
6665 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6666 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6671 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6672 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6673 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6674 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6675 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6676 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6677 /* FIXME: this looks suspicious...
6678 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6679 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6684 static struct hda_verb alc882_macpro_init_verbs[] = {
6685 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6689 /* Front Pin: output 0 (0x0c) */
6690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6692 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6693 /* Front Mic pin: input vref at 80% */
6694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6696 /* Speaker: output */
6697 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6698 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6699 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6700 /* Headphone output (output 0 - 0x0c) */
6701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6703 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6705 /* FIXME: use matrix-type input source selection */
6706 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6707 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6716 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6722 /* ADC1: mute amp left and right */
6723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6724 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6725 /* ADC2: mute amp left and right */
6726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6727 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6728 /* ADC3: mute amp left and right */
6729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6730 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6736 static struct hda_verb alc885_mb5_init_verbs[] = {
6738 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6739 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6740 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6741 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6746 /* Surround mixer */
6747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6748 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6749 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6751 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6753 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6755 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6756 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6757 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6758 /* Front Pin (0x0c) */
6759 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6760 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6761 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6762 /* LFE Pin (0x0e) */
6763 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6764 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6765 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
6767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6768 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6769 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
6770 /* Front Mic pin: input vref at 80% */
6771 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6772 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6774 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6775 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6784 /* Macbook Pro rev3 */
6785 static struct hda_verb alc885_mbp3_init_verbs[] = {
6786 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6787 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6788 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6789 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6791 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6792 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6793 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6794 /* Front Pin: output 0 (0x0c) */
6795 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6796 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6797 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6798 /* HP Pin: output 0 (0x0d) */
6799 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6800 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6801 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6802 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6803 /* Mic (rear) pin: input vref at 80% */
6804 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6805 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6806 /* Front Mic pin: input vref at 80% */
6807 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6808 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6809 /* Line In pin: use output 1 when in LineOut mode */
6810 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6811 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6812 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6814 /* FIXME: use matrix-type input source selection */
6815 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6816 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6817 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6818 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6819 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6820 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6822 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6823 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6824 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6825 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6827 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6828 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6831 /* ADC1: mute amp left and right */
6832 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6833 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6834 /* ADC2: mute amp left and right */
6835 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6836 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6837 /* ADC3: mute amp left and right */
6838 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6839 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6844 /* iMac 24 mixer. */
6845 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6846 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6847 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6851 /* iMac 24 init verbs. */
6852 static struct hda_verb alc885_imac24_init_verbs[] = {
6853 /* Internal speakers: output 0 (0x0c) */
6854 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6855 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6856 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6857 /* Internal speakers: output 0 (0x0c) */
6858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6860 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6861 /* Headphone: output 0 (0x0c) */
6862 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6863 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6864 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6866 /* Front Mic: input vref at 80% */
6867 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6868 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6872 /* Toggle speaker-output according to the hp-jack state */
6873 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6875 struct alc_spec *spec = codec->spec;
6877 spec->autocfg.hp_pins[0] = 0x14;
6878 spec->autocfg.speaker_pins[0] = 0x18;
6879 spec->autocfg.speaker_pins[1] = 0x1a;
6880 alc_automute_amp(codec);
6883 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6885 struct alc_spec *spec = codec->spec;
6887 spec->autocfg.hp_pins[0] = 0x15;
6888 spec->autocfg.speaker_pins[0] = 0x14;
6889 alc_automute_amp(codec);
6893 static struct hda_verb alc882_targa_verbs[] = {
6894 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6895 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6897 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6900 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6901 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6902 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6904 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6905 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6906 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6907 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6911 /* toggle speaker-output according to the hp-jack state */
6912 static void alc882_targa_automute(struct hda_codec *codec)
6914 struct alc_spec *spec = codec->spec;
6915 alc_automute_amp(codec);
6916 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6917 spec->jack_present ? 1 : 3);
6920 static void alc882_targa_init_hook(struct hda_codec *codec)
6922 struct alc_spec *spec = codec->spec;
6924 spec->autocfg.hp_pins[0] = 0x14;
6925 spec->autocfg.speaker_pins[0] = 0x1b;
6926 alc882_targa_automute(codec);
6929 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6931 if ((res >> 26) == ALC880_HP_EVENT)
6932 alc882_targa_automute(codec);
6935 static struct hda_verb alc882_asus_a7j_verbs[] = {
6936 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6937 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6941 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6943 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6945 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6947 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6948 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6949 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6953 static struct hda_verb alc882_asus_a7m_verbs[] = {
6954 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6958 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6961 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6962 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6963 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6965 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6966 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6967 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6971 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6973 unsigned int gpiostate, gpiomask, gpiodir;
6975 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6976 AC_VERB_GET_GPIO_DATA, 0);
6979 gpiostate |= (1 << pin);
6981 gpiostate &= ~(1 << pin);
6983 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6984 AC_VERB_GET_GPIO_MASK, 0);
6985 gpiomask |= (1 << pin);
6987 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6988 AC_VERB_GET_GPIO_DIRECTION, 0);
6989 gpiodir |= (1 << pin);
6992 snd_hda_codec_write(codec, codec->afg, 0,
6993 AC_VERB_SET_GPIO_MASK, gpiomask);
6994 snd_hda_codec_write(codec, codec->afg, 0,
6995 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6999 snd_hda_codec_write(codec, codec->afg, 0,
7000 AC_VERB_SET_GPIO_DATA, gpiostate);
7003 /* set up GPIO at initialization */
7004 static void alc885_macpro_init_hook(struct hda_codec *codec)
7006 alc882_gpio_mute(codec, 0, 0);
7007 alc882_gpio_mute(codec, 1, 0);
7010 /* set up GPIO and update auto-muting at initialization */
7011 static void alc885_imac24_init_hook(struct hda_codec *codec)
7013 alc885_macpro_init_hook(codec);
7014 alc885_imac24_automute_init_hook(codec);
7018 * generic initialization of ADC, input mixers and output mixers
7020 static struct hda_verb alc882_auto_init_verbs[] = {
7022 * Unmute ADC0-2 and set the default input to mic-in
7024 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7025 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7026 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7027 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7028 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7029 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7031 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7033 * Note: PASD motherboards uses the Line In 2 as the input for
7034 * front panel mic (mic 2)
7036 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7044 * Set up output mixers (0x0c - 0x0f)
7046 /* set vol=0 to output mixers */
7047 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7048 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7050 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7051 /* set up input amps for analog loopback */
7052 /* Amp Indices: DAC = 0, mixer = 1 */
7053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7056 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7058 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7059 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7060 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7061 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7062 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7064 /* FIXME: use matrix-type input source selection */
7065 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7066 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7067 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7068 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7069 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7070 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7072 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7073 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7074 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7075 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7085 #ifdef CONFIG_SND_HDA_POWER_SAVE
7086 #define alc882_loopbacks alc880_loopbacks
7089 /* pcm configuration: identical with ALC880 */
7090 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7091 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7092 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7093 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7096 * configuration and preset
7098 static const char *alc882_models[ALC882_MODEL_LAST] = {
7099 [ALC882_3ST_DIG] = "3stack-dig",
7100 [ALC882_6ST_DIG] = "6stack-dig",
7101 [ALC882_ARIMA] = "arima",
7102 [ALC882_W2JC] = "w2jc",
7103 [ALC882_TARGA] = "targa",
7104 [ALC882_ASUS_A7J] = "asus-a7j",
7105 [ALC882_ASUS_A7M] = "asus-a7m",
7106 [ALC885_MACPRO] = "macpro",
7107 [ALC885_MB5] = "mb5",
7108 [ALC885_MBP3] = "mbp3",
7109 [ALC885_IMAC24] = "imac24",
7110 [ALC882_AUTO] = "auto",
7113 static struct snd_pci_quirk alc882_cfg_tbl[] = {
7114 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
7115 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
7116 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
7117 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
7118 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
7119 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
7120 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
7121 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
7122 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
7123 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
7124 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
7125 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
7129 static struct alc_config_preset alc882_presets[] = {
7130 [ALC882_3ST_DIG] = {
7131 .mixers = { alc882_base_mixer },
7132 .init_verbs = { alc882_init_verbs },
7133 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7134 .dac_nids = alc882_dac_nids,
7135 .dig_out_nid = ALC882_DIGOUT_NID,
7136 .dig_in_nid = ALC882_DIGIN_NID,
7137 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7138 .channel_mode = alc882_ch_modes,
7140 .input_mux = &alc882_capture_source,
7142 [ALC882_6ST_DIG] = {
7143 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7144 .init_verbs = { alc882_init_verbs },
7145 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7146 .dac_nids = alc882_dac_nids,
7147 .dig_out_nid = ALC882_DIGOUT_NID,
7148 .dig_in_nid = ALC882_DIGIN_NID,
7149 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7150 .channel_mode = alc882_sixstack_modes,
7151 .input_mux = &alc882_capture_source,
7154 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7155 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
7156 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7157 .dac_nids = alc882_dac_nids,
7158 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7159 .channel_mode = alc882_sixstack_modes,
7160 .input_mux = &alc882_capture_source,
7163 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
7164 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7165 alc880_gpio1_init_verbs },
7166 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7167 .dac_nids = alc882_dac_nids,
7168 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7169 .channel_mode = alc880_threestack_modes,
7171 .input_mux = &alc882_capture_source,
7172 .dig_out_nid = ALC882_DIGOUT_NID,
7175 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
7176 .init_verbs = { alc885_mbp3_init_verbs,
7177 alc880_gpio1_init_verbs },
7178 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7179 .dac_nids = alc882_dac_nids,
7180 .channel_mode = alc885_mbp_6ch_modes,
7181 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
7182 .input_mux = &alc882_capture_source,
7183 .dig_out_nid = ALC882_DIGOUT_NID,
7184 .dig_in_nid = ALC882_DIGIN_NID,
7185 .unsol_event = alc_automute_amp_unsol_event,
7186 .init_hook = alc885_mbp3_init_hook,
7189 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
7190 .init_verbs = { alc885_mb5_init_verbs,
7191 alc880_gpio1_init_verbs },
7192 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7193 .dac_nids = alc882_dac_nids,
7194 .channel_mode = alc885_mb5_6ch_modes,
7195 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
7196 .input_mux = &mb5_capture_source,
7197 .dig_out_nid = ALC882_DIGOUT_NID,
7198 .dig_in_nid = ALC882_DIGIN_NID,
7201 .mixers = { alc882_macpro_mixer },
7202 .init_verbs = { alc882_macpro_init_verbs },
7203 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7204 .dac_nids = alc882_dac_nids,
7205 .dig_out_nid = ALC882_DIGOUT_NID,
7206 .dig_in_nid = ALC882_DIGIN_NID,
7207 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7208 .channel_mode = alc882_ch_modes,
7209 .input_mux = &alc882_capture_source,
7210 .init_hook = alc885_macpro_init_hook,
7213 .mixers = { alc885_imac24_mixer },
7214 .init_verbs = { alc885_imac24_init_verbs },
7215 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7216 .dac_nids = alc882_dac_nids,
7217 .dig_out_nid = ALC882_DIGOUT_NID,
7218 .dig_in_nid = ALC882_DIGIN_NID,
7219 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7220 .channel_mode = alc882_ch_modes,
7221 .input_mux = &alc882_capture_source,
7222 .unsol_event = alc_automute_amp_unsol_event,
7223 .init_hook = alc885_imac24_init_hook,
7226 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7227 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7228 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7229 .dac_nids = alc882_dac_nids,
7230 .dig_out_nid = ALC882_DIGOUT_NID,
7231 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7232 .adc_nids = alc882_adc_nids,
7233 .capsrc_nids = alc882_capsrc_nids,
7234 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7235 .channel_mode = alc882_3ST_6ch_modes,
7237 .input_mux = &alc882_capture_source,
7238 .unsol_event = alc882_targa_unsol_event,
7239 .init_hook = alc882_targa_init_hook,
7241 [ALC882_ASUS_A7J] = {
7242 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7243 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7244 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7245 .dac_nids = alc882_dac_nids,
7246 .dig_out_nid = ALC882_DIGOUT_NID,
7247 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7248 .adc_nids = alc882_adc_nids,
7249 .capsrc_nids = alc882_capsrc_nids,
7250 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7251 .channel_mode = alc882_3ST_6ch_modes,
7253 .input_mux = &alc882_capture_source,
7255 [ALC882_ASUS_A7M] = {
7256 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7257 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7258 alc880_gpio1_init_verbs,
7259 alc882_asus_a7m_verbs },
7260 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7261 .dac_nids = alc882_dac_nids,
7262 .dig_out_nid = ALC882_DIGOUT_NID,
7263 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7264 .channel_mode = alc880_threestack_modes,
7266 .input_mux = &alc882_capture_source,
7275 PINFIX_ABIT_AW9D_MAX
7278 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7279 { 0x15, 0x01080104 }, /* side */
7280 { 0x16, 0x01011012 }, /* rear */
7281 { 0x17, 0x01016011 }, /* clfe */
7285 static const struct alc_pincfg *alc882_pin_fixes[] = {
7286 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7289 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7290 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7295 * BIOS auto configuration
7297 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7298 hda_nid_t nid, int pin_type,
7302 struct alc_spec *spec = codec->spec;
7305 alc_set_pin_output(codec, nid, pin_type);
7306 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7309 idx = spec->multiout.dac_nids[dac_idx] - 2;
7310 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7314 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7316 struct alc_spec *spec = codec->spec;
7319 for (i = 0; i <= HDA_SIDE; i++) {
7320 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7321 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7323 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7328 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7330 struct alc_spec *spec = codec->spec;
7333 pin = spec->autocfg.hp_pins[0];
7334 if (pin) /* connect to front */
7336 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7337 pin = spec->autocfg.speaker_pins[0];
7339 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7342 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7343 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7345 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7347 struct alc_spec *spec = codec->spec;
7350 for (i = 0; i < AUTO_PIN_LAST; i++) {
7351 hda_nid_t nid = spec->autocfg.input_pins[i];
7354 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7355 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7356 snd_hda_codec_write(codec, nid, 0,
7357 AC_VERB_SET_AMP_GAIN_MUTE,
7362 static void alc882_auto_init_input_src(struct hda_codec *codec)
7364 struct alc_spec *spec = codec->spec;
7367 for (c = 0; c < spec->num_adc_nids; c++) {
7368 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7369 hda_nid_t nid = spec->capsrc_nids[c];
7370 unsigned int mux_idx;
7371 const struct hda_input_mux *imux;
7372 int conns, mute, idx, item;
7374 conns = snd_hda_get_connections(codec, nid, conn_list,
7375 ARRAY_SIZE(conn_list));
7378 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7379 imux = &spec->input_mux[mux_idx];
7380 for (idx = 0; idx < conns; idx++) {
7381 /* if the current connection is the selected one,
7382 * unmute it as default - otherwise mute it
7384 mute = AMP_IN_MUTE(idx);
7385 for (item = 0; item < imux->num_items; item++) {
7386 if (imux->items[item].index == idx) {
7387 if (spec->cur_mux[c] == item)
7388 mute = AMP_IN_UNMUTE(idx);
7392 /* check if we have a selector or mixer
7393 * we could check for the widget type instead, but
7394 * just check for Amp-In presence (in case of mixer
7395 * without amp-in there is something wrong, this
7396 * function shouldn't be used or capsrc nid is wrong)
7398 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7399 snd_hda_codec_write(codec, nid, 0,
7400 AC_VERB_SET_AMP_GAIN_MUTE,
7402 else if (mute != AMP_IN_MUTE(idx))
7403 snd_hda_codec_write(codec, nid, 0,
7404 AC_VERB_SET_CONNECT_SEL,
7410 /* add mic boosts if needed */
7411 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7413 struct alc_spec *spec = codec->spec;
7417 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7418 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7419 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7421 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7425 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7426 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7427 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7429 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7436 /* almost identical with ALC880 parser... */
7437 static int alc882_parse_auto_config(struct hda_codec *codec)
7439 struct alc_spec *spec = codec->spec;
7440 int err = alc880_parse_auto_config(codec);
7445 return 0; /* no config found */
7447 err = alc_auto_add_mic_boost(codec);
7451 /* hack - override the init verbs */
7452 spec->init_verbs[0] = alc882_auto_init_verbs;
7454 return 1; /* config found */
7457 /* additional initialization for auto-configuration model */
7458 static void alc882_auto_init(struct hda_codec *codec)
7460 struct alc_spec *spec = codec->spec;
7461 alc882_auto_init_multi_out(codec);
7462 alc882_auto_init_hp_out(codec);
7463 alc882_auto_init_analog_input(codec);
7464 alc882_auto_init_input_src(codec);
7465 if (spec->unsol_event)
7466 alc_inithook(codec);
7469 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7471 static int patch_alc882(struct hda_codec *codec)
7473 struct alc_spec *spec;
7474 int err, board_config;
7476 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7482 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7486 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7487 /* Pick up systems that don't supply PCI SSID */
7488 switch (codec->subsystem_id) {
7489 case 0x106b0c00: /* Mac Pro */
7490 board_config = ALC885_MACPRO;
7492 case 0x106b1000: /* iMac 24 */
7493 case 0x106b2800: /* AppleTV */
7494 case 0x106b3e00: /* iMac 24 Aluminium */
7495 board_config = ALC885_IMAC24;
7497 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7498 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7499 case 0x106b00a4: /* MacbookPro4,1 */
7500 case 0x106b2c00: /* Macbook Pro rev3 */
7501 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7502 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7503 board_config = ALC885_MBP3;
7505 case 0x106b3f00: /* Macbook 5,1 */
7506 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7507 * seems not working, so apparently
7508 * no perfect solution yet
7510 board_config = ALC885_MB5;
7513 /* ALC889A is handled better as ALC888-compatible */
7514 if (codec->revision_id == 0x100101 ||
7515 codec->revision_id == 0x100103) {
7517 return patch_alc883(codec);
7519 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7520 "trying auto-probe from BIOS...\n",
7522 board_config = ALC882_AUTO;
7526 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7528 if (board_config == ALC882_AUTO) {
7529 /* automatic parse from the BIOS config */
7530 err = alc882_parse_auto_config(codec);
7536 "hda_codec: Cannot set up configuration "
7537 "from BIOS. Using base mode...\n");
7538 board_config = ALC882_3ST_DIG;
7542 err = snd_hda_attach_beep_device(codec, 0x1);
7548 if (board_config != ALC882_AUTO)
7549 setup_preset(spec, &alc882_presets[board_config]);
7551 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7552 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7553 /* FIXME: setup DAC5 */
7554 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7555 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7557 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7558 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7560 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7561 if (!spec->adc_nids && spec->input_mux) {
7562 /* check whether NID 0x07 is valid */
7563 unsigned int wcap = get_wcaps(codec, 0x07);
7565 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7566 if (wcap != AC_WID_AUD_IN) {
7567 spec->adc_nids = alc882_adc_nids_alt;
7568 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7569 spec->capsrc_nids = alc882_capsrc_nids_alt;
7571 spec->adc_nids = alc882_adc_nids;
7572 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7573 spec->capsrc_nids = alc882_capsrc_nids;
7576 set_capture_mixer(spec);
7577 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7579 spec->vmaster_nid = 0x0c;
7581 codec->patch_ops = alc_patch_ops;
7582 if (board_config == ALC882_AUTO)
7583 spec->init_hook = alc882_auto_init;
7584 #ifdef CONFIG_SND_HDA_POWER_SAVE
7585 if (!spec->loopback.amplist)
7586 spec->loopback.amplist = alc882_loopbacks;
7588 codec->proc_widget_hook = print_realtek_coef;
7596 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7597 * configuration. Each pin widget can choose any input DACs and a mixer.
7598 * Each ADC is connected from a mixer of all inputs. This makes possible
7599 * 6-channel independent captures.
7601 * In addition, an independent DAC for the multi-playback (not used in this
7604 #define ALC883_DIGOUT_NID 0x06
7605 #define ALC883_DIGIN_NID 0x0a
7607 #define ALC1200_DIGOUT_NID 0x10
7609 static hda_nid_t alc883_dac_nids[4] = {
7610 /* front, rear, clfe, rear_surr */
7611 0x02, 0x03, 0x04, 0x05
7614 static hda_nid_t alc883_adc_nids[2] = {
7619 static hda_nid_t alc883_adc_nids_alt[1] = {
7624 static hda_nid_t alc883_adc_nids_rev[2] = {
7629 #define alc889_adc_nids alc880_adc_nids
7631 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7633 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7635 #define alc889_capsrc_nids alc882_capsrc_nids
7638 /* FIXME: should be a matrix-type input source selection */
7640 static struct hda_input_mux alc883_capture_source = {
7644 { "Front Mic", 0x1 },
7650 static struct hda_input_mux alc883_3stack_6ch_intel = {
7654 { "Front Mic", 0x0 },
7660 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7668 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7678 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7686 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7690 { "Front Mic", 0x1 },
7695 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7703 static struct hda_input_mux alc889A_mb31_capture_source = {
7707 /* Front Mic (0x01) unused */
7709 /* Line 2 (0x03) unused */
7710 /* CD (0x04) unsused? */
7717 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7724 static struct hda_verb alc883_3ST_ch2_init[] = {
7725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7735 static struct hda_verb alc883_3ST_ch4_init[] = {
7736 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7737 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7740 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7747 static struct hda_verb alc883_3ST_ch6_init[] = {
7748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7750 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7751 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7752 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7753 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7757 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7758 { 2, alc883_3ST_ch2_init },
7759 { 4, alc883_3ST_ch4_init },
7760 { 6, alc883_3ST_ch6_init },
7767 static struct hda_verb alc883_4ST_ch2_init[] = {
7768 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7769 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7770 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7771 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7772 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7773 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7780 static struct hda_verb alc883_4ST_ch4_init[] = {
7781 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7782 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7783 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7784 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7785 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7786 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7787 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7794 static struct hda_verb alc883_4ST_ch6_init[] = {
7795 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7796 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7797 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7798 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7799 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7800 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7801 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7802 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7809 static struct hda_verb alc883_4ST_ch8_init[] = {
7810 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7811 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7812 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7813 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7814 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7815 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7816 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7817 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7818 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7822 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7823 { 2, alc883_4ST_ch2_init },
7824 { 4, alc883_4ST_ch4_init },
7825 { 6, alc883_4ST_ch6_init },
7826 { 8, alc883_4ST_ch8_init },
7833 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7834 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7835 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7844 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7845 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7846 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7847 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7848 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7849 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7856 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7857 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7858 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7859 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7860 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7861 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7862 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7866 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7867 { 2, alc883_3ST_ch2_intel_init },
7868 { 4, alc883_3ST_ch4_intel_init },
7869 { 6, alc883_3ST_ch6_intel_init },
7875 static struct hda_verb alc883_sixstack_ch6_init[] = {
7876 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7877 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7878 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7879 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7886 static struct hda_verb alc883_sixstack_ch8_init[] = {
7887 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7888 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7889 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7890 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7894 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7895 { 6, alc883_sixstack_ch6_init },
7896 { 8, alc883_sixstack_ch8_init },
7899 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7900 static struct hda_verb alc889A_mb31_ch2_init[] = {
7901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7902 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7903 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7904 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7908 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7909 static struct hda_verb alc889A_mb31_ch4_init[] = {
7910 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7911 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7912 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7913 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7917 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7918 static struct hda_verb alc889A_mb31_ch5_init[] = {
7919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7920 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7921 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7922 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7926 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7927 static struct hda_verb alc889A_mb31_ch6_init[] = {
7928 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7929 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7930 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7931 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7935 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7936 { 2, alc889A_mb31_ch2_init },
7937 { 4, alc889A_mb31_ch4_init },
7938 { 5, alc889A_mb31_ch5_init },
7939 { 6, alc889A_mb31_ch6_init },
7942 static struct hda_verb alc883_medion_eapd_verbs[] = {
7943 /* eanable EAPD on medion laptop */
7944 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7945 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7949 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7950 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7953 static struct snd_kcontrol_new alc883_base_mixer[] = {
7954 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7955 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7956 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7957 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7958 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7959 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7960 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7961 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7963 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7964 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7967 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7968 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7969 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7971 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7972 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7974 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7978 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7979 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7980 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7981 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7982 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7983 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7984 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7986 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7987 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7988 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7989 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7991 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7995 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7996 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7997 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7998 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7999 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8000 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8002 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8003 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8005 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8009 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8010 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8011 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8012 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8013 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8016 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8017 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8019 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8023 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8024 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8026 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8027 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8028 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8040 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8041 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8042 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8045 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8046 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8047 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8048 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8049 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8053 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8056 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8058 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8059 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8063 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8064 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8067 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8068 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8070 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8071 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8072 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8074 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8075 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8077 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8087 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8092 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8094 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8095 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8110 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8113 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8115 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8116 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8117 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8118 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8119 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8120 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8121 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8123 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8130 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8133 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8136 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8139 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8140 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8141 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8145 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8149 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8150 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8152 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8157 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8158 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8159 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8161 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8162 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8165 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8166 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8170 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8171 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8173 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8177 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8183 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8184 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8185 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8187 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8188 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8190 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8195 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8198 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8199 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8200 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8201 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8208 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8210 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8211 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8212 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8213 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8214 0x0d, 1, 0x0, HDA_OUTPUT),
8215 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8216 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8217 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8219 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8220 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8221 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8226 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8227 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8229 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8233 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8235 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8236 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8238 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8239 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8241 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8242 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8243 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8244 /* Output switches */
8245 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8246 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8247 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8250 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8255 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8259 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8260 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8261 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8269 static struct hda_bind_ctls alc883_bind_cap_vol = {
8270 .ops = &snd_hda_bind_vol,
8272 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8273 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8278 static struct hda_bind_ctls alc883_bind_cap_switch = {
8279 .ops = &snd_hda_bind_sw,
8281 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8282 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8287 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8288 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8289 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8290 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8291 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8292 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8299 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8300 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8301 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8304 /* .name = "Capture Source", */
8305 .name = "Input Source",
8307 .info = alc_mux_enum_info,
8308 .get = alc_mux_enum_get,
8309 .put = alc_mux_enum_put,
8314 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8317 .name = "Channel Mode",
8318 .info = alc_ch_mode_info,
8319 .get = alc_ch_mode_get,
8320 .put = alc_ch_mode_put,
8325 static struct hda_verb alc883_init_verbs[] = {
8326 /* ADC1: mute amp left and right */
8327 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8328 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8329 /* ADC2: mute amp left and right */
8330 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8331 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8332 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8337 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8346 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8349 /* mute analog input loopbacks */
8350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8351 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8356 /* Front Pin: output 0 (0x0c) */
8357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8358 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8359 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8360 /* Rear Pin: output 1 (0x0d) */
8361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8362 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8363 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8364 /* CLFE Pin: output 2 (0x0e) */
8365 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8366 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8367 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8368 /* Side Pin: output 3 (0x0f) */
8369 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8370 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8371 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8372 /* Mic (rear) pin: input vref at 80% */
8373 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8375 /* Front Mic pin: input vref at 80% */
8376 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8378 /* Line In pin: input */
8379 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8381 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8382 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8383 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8384 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8385 /* CD pin widget for input */
8386 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8388 /* FIXME: use matrix-type input source selection */
8389 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8391 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8396 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8397 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8403 /* toggle speaker-output according to the hp-jack state */
8404 static void alc883_mitac_init_hook(struct hda_codec *codec)
8406 struct alc_spec *spec = codec->spec;
8408 spec->autocfg.hp_pins[0] = 0x15;
8409 spec->autocfg.speaker_pins[0] = 0x14;
8410 spec->autocfg.speaker_pins[1] = 0x17;
8411 alc_automute_amp(codec);
8414 /* auto-toggle front mic */
8416 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8418 unsigned int present;
8421 present = snd_hda_codec_read(codec, 0x18, 0,
8422 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8423 bits = present ? HDA_AMP_MUTE : 0;
8424 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8428 static struct hda_verb alc883_mitac_verbs[] = {
8430 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8431 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8433 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8434 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8436 /* enable unsolicited event */
8437 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8438 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8443 static struct hda_verb alc883_clevo_m720_verbs[] = {
8445 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8446 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8448 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8451 /* enable unsolicited event */
8452 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8458 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8460 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8463 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8466 /* enable unsolicited event */
8467 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8472 static struct hda_verb alc883_targa_verbs[] = {
8473 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8479 /* Connect Line-Out side jack (SPDIF) to Side */
8480 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8481 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8482 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8483 /* Connect Mic jack to CLFE */
8484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8486 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8487 /* Connect Line-in jack to Surround */
8488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8490 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8491 /* Connect HP out jack to Front */
8492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8493 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8494 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8496 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8501 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8502 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8503 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8504 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8508 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8511 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8516 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8517 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8519 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8520 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8525 static struct hda_verb alc883_haier_w66_verbs[] = {
8526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8531 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8533 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8538 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8543 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8544 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8545 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8546 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8550 static struct hda_verb alc888_6st_dell_verbs[] = {
8551 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8555 static struct hda_verb alc883_vaiott_verbs[] = {
8557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8558 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8560 /* enable unsolicited event */
8561 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8566 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8568 struct alc_spec *spec = codec->spec;
8570 spec->autocfg.hp_pins[0] = 0x1b;
8571 spec->autocfg.speaker_pins[0] = 0x14;
8572 spec->autocfg.speaker_pins[1] = 0x16;
8573 spec->autocfg.speaker_pins[2] = 0x18;
8574 alc_automute_amp(codec);
8577 static struct hda_verb alc888_3st_hp_verbs[] = {
8578 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8579 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8580 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8581 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8588 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8589 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8590 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8591 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8592 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8599 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8600 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8601 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8602 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8603 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8604 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8611 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8612 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8613 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8614 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8615 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8616 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8617 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8621 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8622 { 2, alc888_3st_hp_2ch_init },
8623 { 4, alc888_3st_hp_4ch_init },
8624 { 6, alc888_3st_hp_6ch_init },
8627 /* toggle front-jack and RCA according to the hp-jack state */
8628 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8630 unsigned int present;
8632 present = snd_hda_codec_read(codec, 0x1b, 0,
8633 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8634 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8635 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8636 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8637 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8640 /* toggle RCA according to the front-jack state */
8641 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8643 unsigned int present;
8645 present = snd_hda_codec_read(codec, 0x14, 0,
8646 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8647 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8648 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8651 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8654 if ((res >> 26) == ALC880_HP_EVENT)
8655 alc888_lenovo_ms7195_front_automute(codec);
8656 if ((res >> 26) == ALC880_FRONT_EVENT)
8657 alc888_lenovo_ms7195_rca_automute(codec);
8660 static struct hda_verb alc883_medion_md2_verbs[] = {
8661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8666 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8670 /* toggle speaker-output according to the hp-jack state */
8671 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8673 struct alc_spec *spec = codec->spec;
8675 spec->autocfg.hp_pins[0] = 0x14;
8676 spec->autocfg.speaker_pins[0] = 0x15;
8677 alc_automute_amp(codec);
8680 /* toggle speaker-output according to the hp-jack state */
8681 #define alc883_targa_init_hook alc882_targa_init_hook
8682 #define alc883_targa_unsol_event alc882_targa_unsol_event
8684 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8686 unsigned int present;
8688 present = snd_hda_codec_read(codec, 0x18, 0,
8689 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8690 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8691 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8694 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8696 struct alc_spec *spec = codec->spec;
8698 spec->autocfg.hp_pins[0] = 0x15;
8699 spec->autocfg.speaker_pins[0] = 0x14;
8700 alc_automute_amp(codec);
8701 alc883_clevo_m720_mic_automute(codec);
8704 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8707 switch (res >> 26) {
8708 case ALC880_MIC_EVENT:
8709 alc883_clevo_m720_mic_automute(codec);
8712 alc_automute_amp_unsol_event(codec, res);
8717 /* toggle speaker-output according to the hp-jack state */
8718 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8720 struct alc_spec *spec = codec->spec;
8722 spec->autocfg.hp_pins[0] = 0x14;
8723 spec->autocfg.speaker_pins[0] = 0x15;
8724 alc_automute_amp(codec);
8727 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8729 struct alc_spec *spec = codec->spec;
8731 spec->autocfg.hp_pins[0] = 0x1b;
8732 spec->autocfg.speaker_pins[0] = 0x14;
8733 alc_automute_amp(codec);
8736 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8738 unsigned int present;
8741 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8742 & AC_PINSENSE_PRESENCE;
8743 bits = present ? HDA_AMP_MUTE : 0;
8744 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8745 HDA_AMP_MUTE, bits);
8748 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8750 unsigned int present;
8753 present = snd_hda_codec_read(codec, 0x1b, 0,
8754 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8755 bits = present ? HDA_AMP_MUTE : 0;
8756 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8757 HDA_AMP_MUTE, bits);
8758 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8759 HDA_AMP_MUTE, bits);
8762 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8765 if ((res >> 26) == ALC880_HP_EVENT)
8766 alc883_lenovo_101e_all_automute(codec);
8767 if ((res >> 26) == ALC880_FRONT_EVENT)
8768 alc883_lenovo_101e_ispeaker_automute(codec);
8771 /* toggle speaker-output according to the hp-jack state */
8772 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8774 struct alc_spec *spec = codec->spec;
8776 spec->autocfg.hp_pins[0] = 0x14;
8777 spec->autocfg.speaker_pins[0] = 0x15;
8778 spec->autocfg.speaker_pins[1] = 0x16;
8779 alc_automute_amp(codec);
8782 static struct hda_verb alc883_acer_eapd_verbs[] = {
8783 /* HP Pin: output 0 (0x0c) */
8784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8785 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8786 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8787 /* Front Pin: output 0 (0x0c) */
8788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8789 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8791 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8792 /* eanable EAPD on medion laptop */
8793 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8794 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8795 /* enable unsolicited event */
8796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8800 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8802 struct alc_spec *spec = codec->spec;
8804 spec->autocfg.hp_pins[0] = 0x1b;
8805 spec->autocfg.speaker_pins[0] = 0x14;
8806 spec->autocfg.speaker_pins[1] = 0x15;
8807 spec->autocfg.speaker_pins[2] = 0x16;
8808 spec->autocfg.speaker_pins[3] = 0x17;
8809 alc_automute_amp(codec);
8812 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8814 struct alc_spec *spec = codec->spec;
8816 spec->autocfg.hp_pins[0] = 0x1b;
8817 spec->autocfg.speaker_pins[0] = 0x14;
8818 spec->autocfg.speaker_pins[1] = 0x15;
8819 spec->autocfg.speaker_pins[2] = 0x16;
8820 spec->autocfg.speaker_pins[3] = 0x17;
8821 spec->autocfg.speaker_pins[4] = 0x1a;
8822 alc_automute_amp(codec);
8825 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8827 struct alc_spec *spec = codec->spec;
8829 spec->autocfg.hp_pins[0] = 0x15;
8830 spec->autocfg.speaker_pins[0] = 0x14;
8831 spec->autocfg.speaker_pins[1] = 0x17;
8832 alc_automute_amp(codec);
8836 * generic initialization of ADC, input mixers and output mixers
8838 static struct hda_verb alc883_auto_init_verbs[] = {
8840 * Unmute ADC0-2 and set the default input to mic-in
8842 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8843 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8844 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8845 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8847 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8849 * Note: PASD motherboards uses the Line In 2 as the input for
8850 * front panel mic (mic 2)
8852 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8853 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8854 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8855 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8856 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8857 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8860 * Set up output mixers (0x0c - 0x0f)
8862 /* set vol=0 to output mixers */
8863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8864 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8865 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8866 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8867 /* set up input amps for analog loopback */
8868 /* Amp Indices: DAC = 0, mixer = 1 */
8869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8871 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8872 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8873 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8874 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8875 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8876 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8877 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8878 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8880 /* FIXME: use matrix-type input source selection */
8881 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8883 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8884 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8885 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8886 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8887 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8890 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8891 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8892 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8893 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8898 static struct hda_verb alc888_asus_m90v_verbs[] = {
8899 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8901 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8902 /* enable unsolicited event */
8903 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8904 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8908 static void alc883_nb_mic_automute(struct hda_codec *codec)
8910 unsigned int present;
8912 present = snd_hda_codec_read(codec, 0x18, 0,
8913 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8914 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8915 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8916 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8917 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8920 static void alc883_M90V_init_hook(struct hda_codec *codec)
8922 struct alc_spec *spec = codec->spec;
8924 spec->autocfg.hp_pins[0] = 0x1b;
8925 spec->autocfg.speaker_pins[0] = 0x14;
8926 spec->autocfg.speaker_pins[1] = 0x15;
8927 spec->autocfg.speaker_pins[2] = 0x16;
8928 alc_automute_pin(codec);
8931 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8934 switch (res >> 26) {
8935 case ALC880_MIC_EVENT:
8936 alc883_nb_mic_automute(codec);
8939 alc_sku_unsol_event(codec, res);
8944 static void alc883_mode2_inithook(struct hda_codec *codec)
8946 alc883_M90V_init_hook(codec);
8947 alc883_nb_mic_automute(codec);
8950 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8954 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8955 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8956 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8957 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8958 /* enable unsolicited event */
8959 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8963 static void alc883_eee1601_inithook(struct hda_codec *codec)
8965 struct alc_spec *spec = codec->spec;
8967 spec->autocfg.hp_pins[0] = 0x14;
8968 spec->autocfg.speaker_pins[0] = 0x1b;
8969 alc_automute_pin(codec);
8972 static struct hda_verb alc889A_mb31_verbs[] = {
8973 /* Init rear pin (used as headphone output) */
8974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8976 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8977 /* Init line pin (used as output in 4ch and 6ch mode) */
8978 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8979 /* Init line 2 pin (used as headphone out by default) */
8980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8985 /* Mute speakers according to the headphone jack state */
8986 static void alc889A_mb31_automute(struct hda_codec *codec)
8988 unsigned int present;
8990 /* Mute only in 2ch or 4ch mode */
8991 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8993 present = snd_hda_codec_read(codec, 0x15, 0,
8994 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8995 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8996 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8997 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8998 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9002 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9004 if ((res >> 26) == ALC880_HP_EVENT)
9005 alc889A_mb31_automute(codec);
9008 #ifdef CONFIG_SND_HDA_POWER_SAVE
9009 #define alc883_loopbacks alc880_loopbacks
9012 /* pcm configuration: identical with ALC880 */
9013 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
9014 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
9015 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
9016 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
9017 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
9020 * configuration and preset
9022 static const char *alc883_models[ALC883_MODEL_LAST] = {
9023 [ALC883_3ST_2ch_DIG] = "3stack-dig",
9024 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9025 [ALC883_3ST_6ch] = "3stack-6ch",
9026 [ALC883_6ST_DIG] = "6stack-dig",
9027 [ALC883_TARGA_DIG] = "targa-dig",
9028 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9029 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9030 [ALC883_ACER] = "acer",
9031 [ALC883_ACER_ASPIRE] = "acer-aspire",
9032 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9033 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9034 [ALC883_MEDION] = "medion",
9035 [ALC883_MEDION_MD2] = "medion-md2",
9036 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9037 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9038 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9039 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9040 [ALC888_LENOVO_SKY] = "lenovo-sky",
9041 [ALC883_HAIER_W66] = "haier-w66",
9042 [ALC888_3ST_HP] = "3stack-hp",
9043 [ALC888_6ST_DELL] = "6stack-dell",
9044 [ALC883_MITAC] = "mitac",
9045 [ALC883_CLEVO_M720] = "clevo-m720",
9046 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9047 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9048 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9049 [ALC1200_ASUS_P5Q] = "asus-p5q",
9050 [ALC889A_MB31] = "mb31",
9051 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9052 [ALC883_AUTO] = "auto",
9055 static struct snd_pci_quirk alc883_cfg_tbl[] = {
9056 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
9057 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9058 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9059 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9060 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9061 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9062 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9063 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9064 ALC888_ACER_ASPIRE_4930G),
9065 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9066 ALC888_ACER_ASPIRE_4930G),
9067 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9068 ALC888_ACER_ASPIRE_8930G),
9069 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9070 ALC888_ACER_ASPIRE_8930G),
9071 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
9072 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
9073 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9074 ALC888_ACER_ASPIRE_4930G),
9075 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9076 ALC888_ACER_ASPIRE_6530G),
9077 /* default Acer -- disabled as it causes more problems.
9078 * model=auto should work fine now
9080 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9081 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9082 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9083 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9084 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9085 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9086 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9087 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9088 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9089 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9090 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9091 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9092 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9093 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9094 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
9095 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9096 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9097 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9098 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9099 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9100 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
9101 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9102 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9103 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9104 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9105 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9106 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9107 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9108 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9109 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9110 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9111 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9112 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9113 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9114 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9115 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9116 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9117 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9118 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9119 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9120 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9121 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9122 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9123 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9124 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9125 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9126 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9127 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9128 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9129 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9130 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9131 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9132 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9133 ALC883_FUJITSU_PI2515),
9134 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9135 ALC888_FUJITSU_XA3530),
9136 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9137 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9138 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9139 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9140 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9141 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9142 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9143 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9144 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9145 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9146 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9147 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9148 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
9149 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9150 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9154 static hda_nid_t alc883_slave_dig_outs[] = {
9155 ALC1200_DIGOUT_NID, 0,
9158 static hda_nid_t alc1200_slave_dig_outs[] = {
9159 ALC883_DIGOUT_NID, 0,
9162 static struct alc_config_preset alc883_presets[] = {
9163 [ALC883_3ST_2ch_DIG] = {
9164 .mixers = { alc883_3ST_2ch_mixer },
9165 .init_verbs = { alc883_init_verbs },
9166 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9167 .dac_nids = alc883_dac_nids,
9168 .dig_out_nid = ALC883_DIGOUT_NID,
9169 .dig_in_nid = ALC883_DIGIN_NID,
9170 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9171 .channel_mode = alc883_3ST_2ch_modes,
9172 .input_mux = &alc883_capture_source,
9174 [ALC883_3ST_6ch_DIG] = {
9175 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9176 .init_verbs = { alc883_init_verbs },
9177 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9178 .dac_nids = alc883_dac_nids,
9179 .dig_out_nid = ALC883_DIGOUT_NID,
9180 .dig_in_nid = ALC883_DIGIN_NID,
9181 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9182 .channel_mode = alc883_3ST_6ch_modes,
9184 .input_mux = &alc883_capture_source,
9186 [ALC883_3ST_6ch] = {
9187 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9188 .init_verbs = { alc883_init_verbs },
9189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9190 .dac_nids = alc883_dac_nids,
9191 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9192 .channel_mode = alc883_3ST_6ch_modes,
9194 .input_mux = &alc883_capture_source,
9196 [ALC883_3ST_6ch_INTEL] = {
9197 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9198 .init_verbs = { alc883_init_verbs },
9199 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9200 .dac_nids = alc883_dac_nids,
9201 .dig_out_nid = ALC883_DIGOUT_NID,
9202 .dig_in_nid = ALC883_DIGIN_NID,
9203 .slave_dig_outs = alc883_slave_dig_outs,
9204 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9205 .channel_mode = alc883_3ST_6ch_intel_modes,
9207 .input_mux = &alc883_3stack_6ch_intel,
9209 [ALC883_6ST_DIG] = {
9210 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9211 .init_verbs = { alc883_init_verbs },
9212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9213 .dac_nids = alc883_dac_nids,
9214 .dig_out_nid = ALC883_DIGOUT_NID,
9215 .dig_in_nid = ALC883_DIGIN_NID,
9216 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9217 .channel_mode = alc883_sixstack_modes,
9218 .input_mux = &alc883_capture_source,
9220 [ALC883_TARGA_DIG] = {
9221 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9222 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9223 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9224 .dac_nids = alc883_dac_nids,
9225 .dig_out_nid = ALC883_DIGOUT_NID,
9226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9227 .channel_mode = alc883_3ST_6ch_modes,
9229 .input_mux = &alc883_capture_source,
9230 .unsol_event = alc883_targa_unsol_event,
9231 .init_hook = alc883_targa_init_hook,
9233 [ALC883_TARGA_2ch_DIG] = {
9234 .mixers = { alc883_targa_2ch_mixer},
9235 .init_verbs = { alc883_init_verbs, alc883_targa_verbs},
9236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9237 .dac_nids = alc883_dac_nids,
9238 .adc_nids = alc883_adc_nids_alt,
9239 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9240 .dig_out_nid = ALC883_DIGOUT_NID,
9241 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9242 .channel_mode = alc883_3ST_2ch_modes,
9243 .input_mux = &alc883_capture_source,
9244 .unsol_event = alc883_targa_unsol_event,
9245 .init_hook = alc883_targa_init_hook,
9247 [ALC883_TARGA_8ch_DIG] = {
9248 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9249 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9250 alc883_targa_verbs },
9251 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9252 .dac_nids = alc883_dac_nids,
9253 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9254 .adc_nids = alc883_adc_nids_rev,
9255 .capsrc_nids = alc883_capsrc_nids_rev,
9256 .dig_out_nid = ALC883_DIGOUT_NID,
9257 .dig_in_nid = ALC883_DIGIN_NID,
9258 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9259 .channel_mode = alc883_4ST_8ch_modes,
9261 .input_mux = &alc883_capture_source,
9262 .unsol_event = alc883_targa_unsol_event,
9263 .init_hook = alc883_targa_init_hook,
9266 .mixers = { alc883_base_mixer },
9267 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9268 * and the headphone jack. Turn this on and rely on the
9269 * standard mute methods whenever the user wants to turn
9270 * these outputs off.
9272 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9274 .dac_nids = alc883_dac_nids,
9275 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9276 .channel_mode = alc883_3ST_2ch_modes,
9277 .input_mux = &alc883_capture_source,
9279 [ALC883_ACER_ASPIRE] = {
9280 .mixers = { alc883_acer_aspire_mixer },
9281 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9282 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9283 .dac_nids = alc883_dac_nids,
9284 .dig_out_nid = ALC883_DIGOUT_NID,
9285 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9286 .channel_mode = alc883_3ST_2ch_modes,
9287 .input_mux = &alc883_capture_source,
9288 .unsol_event = alc_automute_amp_unsol_event,
9289 .init_hook = alc883_acer_aspire_init_hook,
9291 [ALC888_ACER_ASPIRE_4930G] = {
9292 .mixers = { alc888_base_mixer,
9293 alc883_chmode_mixer },
9294 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9295 alc888_acer_aspire_4930g_verbs },
9296 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9297 .dac_nids = alc883_dac_nids,
9298 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9299 .adc_nids = alc883_adc_nids_rev,
9300 .capsrc_nids = alc883_capsrc_nids_rev,
9301 .dig_out_nid = ALC883_DIGOUT_NID,
9302 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9303 .channel_mode = alc883_3ST_6ch_modes,
9306 ARRAY_SIZE(alc888_2_capture_sources),
9307 .input_mux = alc888_2_capture_sources,
9308 .unsol_event = alc_automute_amp_unsol_event,
9309 .init_hook = alc888_acer_aspire_4930g_init_hook,
9311 [ALC888_ACER_ASPIRE_6530G] = {
9312 .mixers = { alc888_acer_aspire_6530_mixer },
9313 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9314 alc888_acer_aspire_6530g_verbs },
9315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9316 .dac_nids = alc883_dac_nids,
9317 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9318 .adc_nids = alc883_adc_nids_rev,
9319 .capsrc_nids = alc883_capsrc_nids_rev,
9320 .dig_out_nid = ALC883_DIGOUT_NID,
9321 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9322 .channel_mode = alc883_3ST_2ch_modes,
9324 ARRAY_SIZE(alc888_2_capture_sources),
9325 .input_mux = alc888_acer_aspire_6530_sources,
9326 .unsol_event = alc_automute_amp_unsol_event,
9327 .init_hook = alc888_acer_aspire_4930g_init_hook,
9329 [ALC888_ACER_ASPIRE_8930G] = {
9330 .mixers = { alc888_base_mixer,
9331 alc883_chmode_mixer },
9332 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9333 alc889_acer_aspire_8930g_verbs },
9334 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9335 .dac_nids = alc883_dac_nids,
9336 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9337 .adc_nids = alc889_adc_nids,
9338 .capsrc_nids = alc889_capsrc_nids,
9339 .dig_out_nid = ALC883_DIGOUT_NID,
9340 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9341 .channel_mode = alc883_3ST_6ch_modes,
9343 .const_channel_count = 6,
9345 ARRAY_SIZE(alc889_capture_sources),
9346 .input_mux = alc889_capture_sources,
9347 .unsol_event = alc_automute_amp_unsol_event,
9348 .init_hook = alc889_acer_aspire_8930g_init_hook,
9351 .mixers = { alc883_fivestack_mixer,
9352 alc883_chmode_mixer },
9353 .init_verbs = { alc883_init_verbs,
9354 alc883_medion_eapd_verbs },
9355 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9356 .dac_nids = alc883_dac_nids,
9357 .adc_nids = alc883_adc_nids_alt,
9358 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9359 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9360 .channel_mode = alc883_sixstack_modes,
9361 .input_mux = &alc883_capture_source,
9363 [ALC883_MEDION_MD2] = {
9364 .mixers = { alc883_medion_md2_mixer},
9365 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9366 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9367 .dac_nids = alc883_dac_nids,
9368 .dig_out_nid = ALC883_DIGOUT_NID,
9369 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9370 .channel_mode = alc883_3ST_2ch_modes,
9371 .input_mux = &alc883_capture_source,
9372 .unsol_event = alc_automute_amp_unsol_event,
9373 .init_hook = alc883_medion_md2_init_hook,
9375 [ALC883_LAPTOP_EAPD] = {
9376 .mixers = { alc883_base_mixer },
9377 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9378 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9379 .dac_nids = alc883_dac_nids,
9380 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9381 .channel_mode = alc883_3ST_2ch_modes,
9382 .input_mux = &alc883_capture_source,
9384 [ALC883_CLEVO_M720] = {
9385 .mixers = { alc883_clevo_m720_mixer },
9386 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9387 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9388 .dac_nids = alc883_dac_nids,
9389 .dig_out_nid = ALC883_DIGOUT_NID,
9390 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9391 .channel_mode = alc883_3ST_2ch_modes,
9392 .input_mux = &alc883_capture_source,
9393 .unsol_event = alc883_clevo_m720_unsol_event,
9394 .init_hook = alc883_clevo_m720_init_hook,
9396 [ALC883_LENOVO_101E_2ch] = {
9397 .mixers = { alc883_lenovo_101e_2ch_mixer},
9398 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9399 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9400 .dac_nids = alc883_dac_nids,
9401 .adc_nids = alc883_adc_nids_alt,
9402 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9404 .channel_mode = alc883_3ST_2ch_modes,
9405 .input_mux = &alc883_lenovo_101e_capture_source,
9406 .unsol_event = alc883_lenovo_101e_unsol_event,
9407 .init_hook = alc883_lenovo_101e_all_automute,
9409 [ALC883_LENOVO_NB0763] = {
9410 .mixers = { alc883_lenovo_nb0763_mixer },
9411 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9413 .dac_nids = alc883_dac_nids,
9414 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9415 .channel_mode = alc883_3ST_2ch_modes,
9417 .input_mux = &alc883_lenovo_nb0763_capture_source,
9418 .unsol_event = alc_automute_amp_unsol_event,
9419 .init_hook = alc883_medion_md2_init_hook,
9421 [ALC888_LENOVO_MS7195_DIG] = {
9422 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9423 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9425 .dac_nids = alc883_dac_nids,
9426 .dig_out_nid = ALC883_DIGOUT_NID,
9427 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9428 .channel_mode = alc883_3ST_6ch_modes,
9430 .input_mux = &alc883_capture_source,
9431 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9432 .init_hook = alc888_lenovo_ms7195_front_automute,
9434 [ALC883_HAIER_W66] = {
9435 .mixers = { alc883_targa_2ch_mixer},
9436 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9437 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9438 .dac_nids = alc883_dac_nids,
9439 .dig_out_nid = ALC883_DIGOUT_NID,
9440 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9441 .channel_mode = alc883_3ST_2ch_modes,
9442 .input_mux = &alc883_capture_source,
9443 .unsol_event = alc_automute_amp_unsol_event,
9444 .init_hook = alc883_haier_w66_init_hook,
9447 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9448 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9449 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9450 .dac_nids = alc883_dac_nids,
9451 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9452 .channel_mode = alc888_3st_hp_modes,
9454 .input_mux = &alc883_capture_source,
9455 .unsol_event = alc_automute_amp_unsol_event,
9456 .init_hook = alc888_3st_hp_init_hook,
9458 [ALC888_6ST_DELL] = {
9459 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9460 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9462 .dac_nids = alc883_dac_nids,
9463 .dig_out_nid = ALC883_DIGOUT_NID,
9464 .dig_in_nid = ALC883_DIGIN_NID,
9465 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9466 .channel_mode = alc883_sixstack_modes,
9467 .input_mux = &alc883_capture_source,
9468 .unsol_event = alc_automute_amp_unsol_event,
9469 .init_hook = alc888_6st_dell_init_hook,
9472 .mixers = { alc883_mitac_mixer },
9473 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9474 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9475 .dac_nids = alc883_dac_nids,
9476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9477 .channel_mode = alc883_3ST_2ch_modes,
9478 .input_mux = &alc883_capture_source,
9479 .unsol_event = alc_automute_amp_unsol_event,
9480 .init_hook = alc883_mitac_init_hook,
9482 [ALC883_FUJITSU_PI2515] = {
9483 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9484 .init_verbs = { alc883_init_verbs,
9485 alc883_2ch_fujitsu_pi2515_verbs},
9486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9487 .dac_nids = alc883_dac_nids,
9488 .dig_out_nid = ALC883_DIGOUT_NID,
9489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9490 .channel_mode = alc883_3ST_2ch_modes,
9491 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9492 .unsol_event = alc_automute_amp_unsol_event,
9493 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9495 [ALC888_FUJITSU_XA3530] = {
9496 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9497 .init_verbs = { alc883_init_verbs,
9498 alc888_fujitsu_xa3530_verbs },
9499 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9500 .dac_nids = alc883_dac_nids,
9501 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9502 .adc_nids = alc883_adc_nids_rev,
9503 .capsrc_nids = alc883_capsrc_nids_rev,
9504 .dig_out_nid = ALC883_DIGOUT_NID,
9505 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9506 .channel_mode = alc888_4ST_8ch_intel_modes,
9508 ARRAY_SIZE(alc888_2_capture_sources),
9509 .input_mux = alc888_2_capture_sources,
9510 .unsol_event = alc_automute_amp_unsol_event,
9511 .init_hook = alc888_fujitsu_xa3530_init_hook,
9513 [ALC888_LENOVO_SKY] = {
9514 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9515 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9516 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9517 .dac_nids = alc883_dac_nids,
9518 .dig_out_nid = ALC883_DIGOUT_NID,
9519 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9520 .channel_mode = alc883_sixstack_modes,
9522 .input_mux = &alc883_lenovo_sky_capture_source,
9523 .unsol_event = alc_automute_amp_unsol_event,
9524 .init_hook = alc888_lenovo_sky_init_hook,
9526 [ALC888_ASUS_M90V] = {
9527 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9528 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9529 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9530 .dac_nids = alc883_dac_nids,
9531 .dig_out_nid = ALC883_DIGOUT_NID,
9532 .dig_in_nid = ALC883_DIGIN_NID,
9533 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9534 .channel_mode = alc883_3ST_6ch_modes,
9536 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9537 .unsol_event = alc883_mode2_unsol_event,
9538 .init_hook = alc883_mode2_inithook,
9540 [ALC888_ASUS_EEE1601] = {
9541 .mixers = { alc883_asus_eee1601_mixer },
9542 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9543 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9544 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9545 .dac_nids = alc883_dac_nids,
9546 .dig_out_nid = ALC883_DIGOUT_NID,
9547 .dig_in_nid = ALC883_DIGIN_NID,
9548 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9549 .channel_mode = alc883_3ST_2ch_modes,
9551 .input_mux = &alc883_asus_eee1601_capture_source,
9552 .unsol_event = alc_sku_unsol_event,
9553 .init_hook = alc883_eee1601_inithook,
9555 [ALC1200_ASUS_P5Q] = {
9556 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9557 .init_verbs = { alc883_init_verbs },
9558 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9559 .dac_nids = alc883_dac_nids,
9560 .dig_out_nid = ALC1200_DIGOUT_NID,
9561 .dig_in_nid = ALC883_DIGIN_NID,
9562 .slave_dig_outs = alc1200_slave_dig_outs,
9563 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9564 .channel_mode = alc883_sixstack_modes,
9565 .input_mux = &alc883_capture_source,
9568 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9569 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9570 alc880_gpio1_init_verbs },
9571 .adc_nids = alc883_adc_nids,
9572 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9573 .dac_nids = alc883_dac_nids,
9574 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9575 .channel_mode = alc889A_mb31_6ch_modes,
9576 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9577 .input_mux = &alc889A_mb31_capture_source,
9578 .dig_out_nid = ALC883_DIGOUT_NID,
9579 .unsol_event = alc889A_mb31_unsol_event,
9580 .init_hook = alc889A_mb31_automute,
9582 [ALC883_SONY_VAIO_TT] = {
9583 .mixers = { alc883_vaiott_mixer },
9584 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9586 .dac_nids = alc883_dac_nids,
9587 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9588 .channel_mode = alc883_3ST_2ch_modes,
9589 .input_mux = &alc883_capture_source,
9590 .unsol_event = alc_automute_amp_unsol_event,
9591 .init_hook = alc883_vaiott_init_hook,
9597 * BIOS auto configuration
9599 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9600 hda_nid_t nid, int pin_type,
9604 struct alc_spec *spec = codec->spec;
9607 alc_set_pin_output(codec, nid, pin_type);
9608 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9611 idx = spec->multiout.dac_nids[dac_idx] - 2;
9612 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9616 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9618 struct alc_spec *spec = codec->spec;
9621 for (i = 0; i <= HDA_SIDE; i++) {
9622 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9623 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9625 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9630 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9632 struct alc_spec *spec = codec->spec;
9635 pin = spec->autocfg.hp_pins[0];
9636 if (pin) /* connect to front */
9638 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9639 pin = spec->autocfg.speaker_pins[0];
9641 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9644 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9645 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9647 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9649 struct alc_spec *spec = codec->spec;
9652 for (i = 0; i < AUTO_PIN_LAST; i++) {
9653 hda_nid_t nid = spec->autocfg.input_pins[i];
9654 if (alc883_is_input_pin(nid)) {
9655 alc_set_input_pin(codec, nid, i);
9656 if (nid != ALC883_PIN_CD_NID &&
9657 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9658 snd_hda_codec_write(codec, nid, 0,
9659 AC_VERB_SET_AMP_GAIN_MUTE,
9665 #define alc883_auto_init_input_src alc882_auto_init_input_src
9667 /* almost identical with ALC880 parser... */
9668 static int alc883_parse_auto_config(struct hda_codec *codec)
9670 struct alc_spec *spec = codec->spec;
9671 int err = alc880_parse_auto_config(codec);
9672 struct auto_pin_cfg *cfg = &spec->autocfg;
9678 return 0; /* no config found */
9680 err = alc_auto_add_mic_boost(codec);
9684 /* hack - override the init verbs */
9685 spec->init_verbs[0] = alc883_auto_init_verbs;
9687 /* setup input_mux for ALC889 */
9688 if (codec->vendor_id == 0x10ec0889) {
9689 /* digital-mic input pin is excluded in alc880_auto_create..()
9690 * because it's under 0x18
9692 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9693 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9694 struct hda_input_mux *imux = &spec->private_imux[0];
9695 for (i = 1; i < 3; i++)
9696 memcpy(&spec->private_imux[i],
9697 &spec->private_imux[0],
9698 sizeof(spec->private_imux[0]));
9699 imux->items[imux->num_items].label = "Int DMic";
9700 imux->items[imux->num_items].index = 0x0b;
9702 spec->num_mux_defs = 3;
9703 spec->input_mux = spec->private_imux;
9707 return 1; /* config found */
9710 /* additional initialization for auto-configuration model */
9711 static void alc883_auto_init(struct hda_codec *codec)
9713 struct alc_spec *spec = codec->spec;
9714 alc883_auto_init_multi_out(codec);
9715 alc883_auto_init_hp_out(codec);
9716 alc883_auto_init_analog_input(codec);
9717 alc883_auto_init_input_src(codec);
9718 if (spec->unsol_event)
9719 alc_inithook(codec);
9722 static int patch_alc883(struct hda_codec *codec)
9724 struct alc_spec *spec;
9725 int err, board_config;
9727 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9733 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9735 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9738 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) {
9739 /* Pick up systems that don't supply PCI SSID */
9740 switch (codec->subsystem_id) {
9741 case 0x106b3600: /* Macbook 3.1 */
9742 board_config = ALC889A_MB31;
9746 "hda_codec: Unknown model for %s, trying "
9747 "auto-probe from BIOS...\n", codec->chip_name);
9748 board_config = ALC883_AUTO;
9752 if (board_config == ALC883_AUTO) {
9753 /* automatic parse from the BIOS config */
9754 err = alc883_parse_auto_config(codec);
9760 "hda_codec: Cannot set up configuration "
9761 "from BIOS. Using base mode...\n");
9762 board_config = ALC883_3ST_2ch_DIG;
9766 err = snd_hda_attach_beep_device(codec, 0x1);
9772 if (board_config != ALC883_AUTO)
9773 setup_preset(spec, &alc883_presets[board_config]);
9775 switch (codec->vendor_id) {
9777 if (!spec->num_adc_nids) {
9778 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9779 spec->adc_nids = alc883_adc_nids;
9781 if (!spec->capsrc_nids)
9782 spec->capsrc_nids = alc883_capsrc_nids;
9783 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9784 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9787 if (!spec->num_adc_nids) {
9788 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9789 spec->adc_nids = alc889_adc_nids;
9791 if (!spec->capsrc_nids)
9792 spec->capsrc_nids = alc889_capsrc_nids;
9793 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9797 if (!spec->num_adc_nids) {
9798 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9799 spec->adc_nids = alc883_adc_nids;
9801 if (!spec->capsrc_nids)
9802 spec->capsrc_nids = alc883_capsrc_nids;
9803 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9807 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9808 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9809 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9811 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9812 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9814 if (!spec->cap_mixer)
9815 set_capture_mixer(spec);
9816 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9818 spec->vmaster_nid = 0x0c;
9820 codec->patch_ops = alc_patch_ops;
9821 if (board_config == ALC883_AUTO)
9822 spec->init_hook = alc883_auto_init;
9824 #ifdef CONFIG_SND_HDA_POWER_SAVE
9825 if (!spec->loopback.amplist)
9826 spec->loopback.amplist = alc883_loopbacks;
9828 codec->proc_widget_hook = print_realtek_coef;
9837 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9838 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9840 #define alc262_dac_nids alc260_dac_nids
9841 #define alc262_adc_nids alc882_adc_nids
9842 #define alc262_adc_nids_alt alc882_adc_nids_alt
9843 #define alc262_capsrc_nids alc882_capsrc_nids
9844 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9846 #define alc262_modes alc260_modes
9847 #define alc262_capture_source alc882_capture_source
9849 static hda_nid_t alc262_dmic_adc_nids[1] = {
9854 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9856 static struct snd_kcontrol_new alc262_base_mixer[] = {
9857 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9858 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9859 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9860 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9861 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9862 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9863 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9865 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9866 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9867 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9868 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9869 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9870 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9871 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9872 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9876 /* update HP, line and mono-out pins according to the master switch */
9877 static void alc262_hp_master_update(struct hda_codec *codec)
9879 struct alc_spec *spec = codec->spec;
9880 int val = spec->master_sw;
9883 snd_hda_codec_write_cache(codec, 0x1b, 0,
9884 AC_VERB_SET_PIN_WIDGET_CONTROL,
9886 snd_hda_codec_write_cache(codec, 0x15, 0,
9887 AC_VERB_SET_PIN_WIDGET_CONTROL,
9889 /* mono (speaker) depending on the HP jack sense */
9890 val = val && !spec->jack_present;
9891 snd_hda_codec_write_cache(codec, 0x16, 0,
9892 AC_VERB_SET_PIN_WIDGET_CONTROL,
9896 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9898 struct alc_spec *spec = codec->spec;
9899 unsigned int presence;
9900 presence = snd_hda_codec_read(codec, 0x1b, 0,
9901 AC_VERB_GET_PIN_SENSE, 0);
9902 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9903 alc262_hp_master_update(codec);
9906 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9908 if ((res >> 26) != ALC880_HP_EVENT)
9910 alc262_hp_bpc_automute(codec);
9913 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9915 struct alc_spec *spec = codec->spec;
9916 unsigned int presence;
9917 presence = snd_hda_codec_read(codec, 0x15, 0,
9918 AC_VERB_GET_PIN_SENSE, 0);
9919 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9920 alc262_hp_master_update(codec);
9923 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9926 if ((res >> 26) != ALC880_HP_EVENT)
9928 alc262_hp_wildwest_automute(codec);
9931 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9933 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9934 struct snd_ctl_elem_value *ucontrol)
9936 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9937 struct alc_spec *spec = codec->spec;
9938 int val = !!*ucontrol->value.integer.value;
9940 if (val == spec->master_sw)
9942 spec->master_sw = val;
9943 alc262_hp_master_update(codec);
9947 #define ALC262_HP_MASTER_SWITCH \
9949 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9950 .name = "Master Playback Switch", \
9951 .info = snd_ctl_boolean_mono_info, \
9952 .get = alc262_hp_master_sw_get, \
9953 .put = alc262_hp_master_sw_put, \
9956 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9957 ALC262_HP_MASTER_SWITCH,
9958 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9959 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9960 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9961 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9963 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9965 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9966 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9967 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9968 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9969 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9970 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9971 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9972 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9973 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9974 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9975 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9976 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9980 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9981 ALC262_HP_MASTER_SWITCH,
9982 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9983 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9984 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9985 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9986 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9988 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9990 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9991 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9992 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9993 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9994 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9995 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9996 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10000 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10001 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10002 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10003 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10007 /* mute/unmute internal speaker according to the hp jack and mute state */
10008 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
10010 struct alc_spec *spec = codec->spec;
10012 spec->autocfg.hp_pins[0] = 0x15;
10013 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10014 alc_automute_amp(codec);
10017 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10018 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10019 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10020 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10021 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10022 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10023 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10024 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10028 static struct hda_verb alc262_hp_t5735_verbs[] = {
10029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10032 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10036 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10037 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10038 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10039 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10040 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10046 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10047 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10049 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10050 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10051 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10052 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10055 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10060 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10067 /* bind hp and internal speaker mute (with plug check) as master switch */
10068 static void alc262_hippo_master_update(struct hda_codec *codec)
10070 struct alc_spec *spec = codec->spec;
10071 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10072 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10073 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10077 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10078 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10079 HDA_AMP_MUTE, mute);
10080 /* mute internal speaker per jack sense */
10081 if (spec->jack_present)
10082 mute = HDA_AMP_MUTE;
10084 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10085 HDA_AMP_MUTE, mute);
10086 if (speaker_nid && speaker_nid != line_nid)
10087 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10088 HDA_AMP_MUTE, mute);
10091 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10093 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10094 struct snd_ctl_elem_value *ucontrol)
10096 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10097 struct alc_spec *spec = codec->spec;
10098 int val = !!*ucontrol->value.integer.value;
10100 if (val == spec->master_sw)
10102 spec->master_sw = val;
10103 alc262_hippo_master_update(codec);
10107 #define ALC262_HIPPO_MASTER_SWITCH \
10109 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10110 .name = "Master Playback Switch", \
10111 .info = snd_ctl_boolean_mono_info, \
10112 .get = alc262_hippo_master_sw_get, \
10113 .put = alc262_hippo_master_sw_put, \
10116 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10117 ALC262_HIPPO_MASTER_SWITCH,
10118 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10124 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10126 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10127 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10128 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10129 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10133 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10134 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10135 ALC262_HIPPO_MASTER_SWITCH,
10136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10138 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10139 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10140 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10141 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10149 /* mute/unmute internal speaker according to the hp jack and mute state */
10150 static void alc262_hippo_automute(struct hda_codec *codec)
10152 struct alc_spec *spec = codec->spec;
10153 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10154 unsigned int present;
10156 /* need to execute and sync at first */
10157 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10158 present = snd_hda_codec_read(codec, hp_nid, 0,
10159 AC_VERB_GET_PIN_SENSE, 0);
10160 spec->jack_present = (present & 0x80000000) != 0;
10161 alc262_hippo_master_update(codec);
10164 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10166 if ((res >> 26) != ALC880_HP_EVENT)
10168 alc262_hippo_automute(codec);
10171 static void alc262_hippo_init_hook(struct hda_codec *codec)
10173 struct alc_spec *spec = codec->spec;
10175 spec->autocfg.hp_pins[0] = 0x15;
10176 spec->autocfg.speaker_pins[0] = 0x14;
10177 alc262_hippo_automute(codec);
10180 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10182 struct alc_spec *spec = codec->spec;
10184 spec->autocfg.hp_pins[0] = 0x1b;
10185 spec->autocfg.speaker_pins[0] = 0x14;
10186 alc262_hippo_automute(codec);
10190 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10191 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10192 ALC262_HIPPO_MASTER_SWITCH,
10193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10195 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10196 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10200 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10201 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10202 ALC262_HIPPO_MASTER_SWITCH,
10203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10206 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10207 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10211 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10212 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10213 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10214 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10215 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10220 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10221 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10227 static struct hda_verb alc262_tyan_verbs[] = {
10228 /* Headphone automute */
10229 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10230 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10231 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10233 /* P11 AUX_IN, white 4-pin connector */
10234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10235 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10236 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10237 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10242 /* unsolicited event for HP jack sensing */
10243 static void alc262_tyan_init_hook(struct hda_codec *codec)
10245 struct alc_spec *spec = codec->spec;
10247 spec->autocfg.hp_pins[0] = 0x1b;
10248 spec->autocfg.speaker_pins[0] = 0x15;
10249 alc_automute_amp(codec);
10253 #define alc262_capture_mixer alc882_capture_mixer
10254 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10257 * generic initialization of ADC, input mixers and output mixers
10259 static struct hda_verb alc262_init_verbs[] = {
10261 * Unmute ADC0-2 and set the default input to mic-in
10263 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10264 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10265 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10266 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10267 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10268 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10270 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10272 * Note: PASD motherboards uses the Line In 2 as the input for
10273 * front panel mic (mic 2)
10275 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10277 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10278 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10279 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10280 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10283 * Set up output mixers (0x0c - 0x0e)
10285 /* set vol=0 to output mixers */
10286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10288 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10289 /* set up input amps for analog loopback */
10290 /* Amp Indices: DAC = 0, mixer = 1 */
10291 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10292 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10298 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10300 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10301 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10302 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10303 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10305 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10309 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10311 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10312 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10314 /* FIXME: use matrix-type input source selection */
10315 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10316 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10317 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10318 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10319 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10320 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10322 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10323 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10324 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10325 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10327 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10328 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10329 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10330 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10335 static struct hda_verb alc262_eapd_verbs[] = {
10336 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10337 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10341 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10343 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10347 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10348 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10349 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10350 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10352 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10353 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10357 static struct hda_verb alc262_sony_unsol_verbs[] = {
10358 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10360 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10362 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10367 static struct hda_input_mux alc262_dmic_capture_source = {
10370 { "Int DMic", 0x9 },
10375 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10376 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10377 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10378 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10379 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10384 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10385 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10388 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10389 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10390 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10392 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10396 static void alc262_dmic_automute(struct hda_codec *codec)
10398 unsigned int present;
10400 present = snd_hda_codec_read(codec, 0x18, 0,
10401 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10402 snd_hda_codec_write(codec, 0x22, 0,
10403 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10407 /* unsolicited event for HP jack sensing */
10408 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10411 if ((res >> 26) == ALC880_MIC_EVENT)
10412 alc262_dmic_automute(codec);
10414 alc_sku_unsol_event(codec, res);
10417 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10419 struct alc_spec *spec = codec->spec;
10421 spec->autocfg.hp_pins[0] = 0x15;
10422 spec->autocfg.speaker_pins[0] = 0x14;
10423 alc_automute_pin(codec);
10424 alc262_dmic_automute(codec);
10430 * 0x16 = internal speaker
10431 * 0x18 = external mic
10434 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10435 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10436 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10439 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10440 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10447 static struct hda_verb alc262_nec_verbs[] = {
10448 /* Unmute Speaker */
10449 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10452 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10455 /* External mic to headphone */
10456 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10457 /* External mic to speaker */
10458 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10464 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10465 * 0x1b = port replicator headphone out
10468 #define ALC_HP_EVENT 0x37
10470 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10471 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10473 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10474 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10478 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10484 static struct hda_input_mux alc262_fujitsu_capture_source = {
10488 { "Int Mic", 0x1 },
10493 static struct hda_input_mux alc262_HP_capture_source = {
10497 { "Front Mic", 0x1 },
10504 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10508 { "Front Mic", 0x2 },
10514 /* mute/unmute internal speaker according to the hp jacks and mute state */
10515 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10517 struct alc_spec *spec = codec->spec;
10520 if (force || !spec->sense_updated) {
10521 unsigned int present;
10522 /* need to execute and sync at first */
10523 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10524 /* check laptop HP jack */
10525 present = snd_hda_codec_read(codec, 0x14, 0,
10526 AC_VERB_GET_PIN_SENSE, 0);
10527 /* need to execute and sync at first */
10528 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10529 /* check docking HP jack */
10530 present |= snd_hda_codec_read(codec, 0x1b, 0,
10531 AC_VERB_GET_PIN_SENSE, 0);
10532 if (present & AC_PINSENSE_PRESENCE)
10533 spec->jack_present = 1;
10535 spec->jack_present = 0;
10536 spec->sense_updated = 1;
10538 /* unmute internal speaker only if both HPs are unplugged and
10539 * master switch is on
10541 if (spec->jack_present)
10542 mute = HDA_AMP_MUTE;
10544 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10545 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10546 HDA_AMP_MUTE, mute);
10549 /* unsolicited event for HP jack sensing */
10550 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10553 if ((res >> 26) != ALC_HP_EVENT)
10555 alc262_fujitsu_automute(codec, 1);
10558 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10560 alc262_fujitsu_automute(codec, 1);
10563 /* bind volumes of both NID 0x0c and 0x0d */
10564 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10565 .ops = &snd_hda_bind_vol,
10567 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10568 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10573 /* mute/unmute internal speaker according to the hp jack and mute state */
10574 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10576 struct alc_spec *spec = codec->spec;
10579 if (force || !spec->sense_updated) {
10580 unsigned int present_int_hp;
10581 /* need to execute and sync at first */
10582 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10583 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10584 AC_VERB_GET_PIN_SENSE, 0);
10585 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10586 spec->sense_updated = 1;
10588 if (spec->jack_present) {
10589 /* mute internal speaker */
10590 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10591 HDA_AMP_MUTE, HDA_AMP_MUTE);
10592 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10593 HDA_AMP_MUTE, HDA_AMP_MUTE);
10595 /* unmute internal speaker if necessary */
10596 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10597 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10598 HDA_AMP_MUTE, mute);
10599 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10600 HDA_AMP_MUTE, mute);
10604 /* unsolicited event for HP jack sensing */
10605 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10608 if ((res >> 26) != ALC_HP_EVENT)
10610 alc262_lenovo_3000_automute(codec, 1);
10613 /* bind hp and internal speaker mute (with plug check) */
10614 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10615 struct snd_ctl_elem_value *ucontrol)
10617 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10618 long *valp = ucontrol->value.integer.value;
10621 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10623 valp ? 0 : HDA_AMP_MUTE);
10624 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10626 valp ? 0 : HDA_AMP_MUTE);
10629 alc262_fujitsu_automute(codec, 0);
10633 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10634 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10636 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10637 .name = "Master Playback Switch",
10638 .info = snd_hda_mixer_amp_switch_info,
10639 .get = snd_hda_mixer_amp_switch_get,
10640 .put = alc262_fujitsu_master_sw_put,
10641 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10643 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10644 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10647 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10648 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10649 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10650 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10654 /* bind hp and internal speaker mute (with plug check) */
10655 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10656 struct snd_ctl_elem_value *ucontrol)
10658 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10659 long *valp = ucontrol->value.integer.value;
10662 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10664 valp ? 0 : HDA_AMP_MUTE);
10667 alc262_lenovo_3000_automute(codec, 0);
10671 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10672 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10674 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10675 .name = "Master Playback Switch",
10676 .info = snd_hda_mixer_amp_switch_info,
10677 .get = snd_hda_mixer_amp_switch_get,
10678 .put = alc262_lenovo_3000_master_sw_put,
10679 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10681 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10682 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10683 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10684 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10685 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10686 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10687 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10688 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10692 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10693 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10694 ALC262_HIPPO_MASTER_SWITCH,
10695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10697 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10698 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10700 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10704 /* additional init verbs for Benq laptops */
10705 static struct hda_verb alc262_EAPD_verbs[] = {
10706 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10707 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10711 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10712 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10713 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10715 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10716 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10720 /* Samsung Q1 Ultra Vista model setup */
10721 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10722 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10723 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10724 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10726 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10727 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10731 static struct hda_verb alc262_ultra_verbs[] = {
10733 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10734 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10735 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10737 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10738 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10740 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10742 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10743 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10744 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10745 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10746 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10749 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10750 /* ADC, choose mic */
10751 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10752 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10753 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10754 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10755 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10756 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10757 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10758 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10759 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10760 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10764 /* mute/unmute internal speaker according to the hp jack and mute state */
10765 static void alc262_ultra_automute(struct hda_codec *codec)
10767 struct alc_spec *spec = codec->spec;
10771 /* auto-mute only when HP is used as HP */
10772 if (!spec->cur_mux[0]) {
10773 unsigned int present;
10774 /* need to execute and sync at first */
10775 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10776 present = snd_hda_codec_read(codec, 0x15, 0,
10777 AC_VERB_GET_PIN_SENSE, 0);
10778 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10779 if (spec->jack_present)
10780 mute = HDA_AMP_MUTE;
10782 /* mute/unmute internal speaker */
10783 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10784 HDA_AMP_MUTE, mute);
10785 /* mute/unmute HP */
10786 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10787 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10790 /* unsolicited event for HP jack sensing */
10791 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10794 if ((res >> 26) != ALC880_HP_EVENT)
10796 alc262_ultra_automute(codec);
10799 static struct hda_input_mux alc262_ultra_capture_source = {
10803 { "Headphone", 0x7 },
10807 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10808 struct snd_ctl_elem_value *ucontrol)
10810 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10811 struct alc_spec *spec = codec->spec;
10814 ret = alc_mux_enum_put(kcontrol, ucontrol);
10817 /* reprogram the HP pin as mic or HP according to the input source */
10818 snd_hda_codec_write_cache(codec, 0x15, 0,
10819 AC_VERB_SET_PIN_WIDGET_CONTROL,
10820 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10821 alc262_ultra_automute(codec); /* mute/unmute HP */
10825 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10826 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10827 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10830 .name = "Capture Source",
10831 .info = alc_mux_enum_info,
10832 .get = alc_mux_enum_get,
10833 .put = alc262_ultra_mux_enum_put,
10838 /* add playback controls from the parsed DAC table */
10839 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10840 const struct auto_pin_cfg *cfg)
10845 spec->multiout.num_dacs = 1; /* only use one dac */
10846 spec->multiout.dac_nids = spec->private_dac_nids;
10847 spec->multiout.dac_nids[0] = 2;
10849 nid = cfg->line_out_pins[0];
10851 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10852 "Front Playback Volume",
10853 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10856 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10857 "Front Playback Switch",
10858 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10863 nid = cfg->speaker_pins[0];
10866 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10867 "Speaker Playback Volume",
10868 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10872 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10873 "Speaker Playback Switch",
10874 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10879 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10880 "Speaker Playback Switch",
10881 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10887 nid = cfg->hp_pins[0];
10889 /* spec->multiout.hp_nid = 2; */
10891 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10892 "Headphone Playback Volume",
10893 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10897 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10898 "Headphone Playback Switch",
10899 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10904 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10905 "Headphone Playback Switch",
10906 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10915 /* identical with ALC880 */
10916 #define alc262_auto_create_analog_input_ctls \
10917 alc880_auto_create_analog_input_ctls
10920 * generic initialization of ADC, input mixers and output mixers
10922 static struct hda_verb alc262_volume_init_verbs[] = {
10924 * Unmute ADC0-2 and set the default input to mic-in
10926 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10928 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10929 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10930 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10931 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10933 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10935 * Note: PASD motherboards uses the Line In 2 as the input for
10936 * front panel mic (mic 2)
10938 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10940 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10941 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10942 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10943 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10946 * Set up output mixers (0x0c - 0x0f)
10948 /* set vol=0 to output mixers */
10949 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10950 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10953 /* set up input amps for analog loopback */
10954 /* Amp Indices: DAC = 0, mixer = 1 */
10955 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10956 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10957 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10958 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10959 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10960 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10962 /* FIXME: use matrix-type input source selection */
10963 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10964 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10965 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10966 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10967 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10968 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10970 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10971 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10972 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10973 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10975 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10976 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10977 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10978 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10983 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10985 * Unmute ADC0-2 and set the default input to mic-in
10987 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10988 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10989 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10991 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10994 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10996 * Note: PASD motherboards uses the Line In 2 as the input for
10997 * front panel mic (mic 2)
10999 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11005 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11006 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11009 * Set up output mixers (0x0c - 0x0e)
11011 /* set vol=0 to output mixers */
11012 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11013 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11014 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11016 /* set up input amps for analog loopback */
11017 /* Amp Indices: DAC = 0, mixer = 1 */
11018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11019 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11020 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11021 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11022 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11023 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11026 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11027 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11029 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11032 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11033 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11035 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11036 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11037 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11038 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11039 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11042 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11043 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11045 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11046 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11049 /* FIXME: use matrix-type input source selection */
11050 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11051 /* Input mixer1: only unmute Mic */
11052 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11053 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11054 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11055 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11056 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11057 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11058 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11059 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11060 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11064 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11065 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11066 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11067 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11068 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11069 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11070 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11072 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11073 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11074 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11082 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11087 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11089 * Unmute ADC0-2 and set the default input to mic-in
11091 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11092 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11093 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11094 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11095 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11096 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11098 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11100 * Note: PASD motherboards uses the Line In 2 as the input for front
11101 * panel mic (mic 2)
11103 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11104 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11113 * Set up output mixers (0x0c - 0x0e)
11115 /* set vol=0 to output mixers */
11116 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11117 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11118 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11120 /* set up input amps for analog loopback */
11121 /* Amp Indices: DAC = 0, mixer = 1 */
11122 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11124 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11125 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11126 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11127 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11130 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11131 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11132 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11133 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11134 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11135 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11136 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11138 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11141 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11142 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11144 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11145 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11146 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11147 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11148 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11149 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11151 /* FIXME: use matrix-type input source selection */
11152 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11153 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11154 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11158 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11159 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11160 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11162 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11163 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11164 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11165 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11166 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11167 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11168 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11170 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11171 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11172 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11173 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11174 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11175 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11178 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11183 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11185 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11186 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11187 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11189 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11190 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11191 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11192 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11194 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11195 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11196 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11201 #ifdef CONFIG_SND_HDA_POWER_SAVE
11202 #define alc262_loopbacks alc880_loopbacks
11205 /* pcm configuration: identical with ALC880 */
11206 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11207 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11208 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11209 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11212 * BIOS auto configuration
11214 static int alc262_parse_auto_config(struct hda_codec *codec)
11216 struct alc_spec *spec = codec->spec;
11218 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11220 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11224 if (!spec->autocfg.line_outs) {
11225 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11226 spec->multiout.max_channels = 2;
11227 spec->no_analog = 1;
11230 return 0; /* can't find valid BIOS pin config */
11232 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11235 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11239 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11242 if (spec->autocfg.dig_outs) {
11243 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11244 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11246 if (spec->autocfg.dig_in_pin)
11247 spec->dig_in_nid = ALC262_DIGIN_NID;
11249 if (spec->kctls.list)
11250 add_mixer(spec, spec->kctls.list);
11252 add_verb(spec, alc262_volume_init_verbs);
11253 spec->num_mux_defs = 1;
11254 spec->input_mux = &spec->private_imux[0];
11256 err = alc_auto_add_mic_boost(codec);
11260 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11265 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11266 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11267 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11268 #define alc262_auto_init_input_src alc882_auto_init_input_src
11271 /* init callback for auto-configuration model -- overriding the default init */
11272 static void alc262_auto_init(struct hda_codec *codec)
11274 struct alc_spec *spec = codec->spec;
11275 alc262_auto_init_multi_out(codec);
11276 alc262_auto_init_hp_out(codec);
11277 alc262_auto_init_analog_input(codec);
11278 alc262_auto_init_input_src(codec);
11279 if (spec->unsol_event)
11280 alc_inithook(codec);
11284 * configuration and preset
11286 static const char *alc262_models[ALC262_MODEL_LAST] = {
11287 [ALC262_BASIC] = "basic",
11288 [ALC262_HIPPO] = "hippo",
11289 [ALC262_HIPPO_1] = "hippo_1",
11290 [ALC262_FUJITSU] = "fujitsu",
11291 [ALC262_HP_BPC] = "hp-bpc",
11292 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11293 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11294 [ALC262_HP_RP5700] = "hp-rp5700",
11295 [ALC262_BENQ_ED8] = "benq",
11296 [ALC262_BENQ_T31] = "benq-t31",
11297 [ALC262_SONY_ASSAMD] = "sony-assamd",
11298 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11299 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11300 [ALC262_ULTRA] = "ultra",
11301 [ALC262_LENOVO_3000] = "lenovo-3000",
11302 [ALC262_NEC] = "nec",
11303 [ALC262_TYAN] = "tyan",
11304 [ALC262_AUTO] = "auto",
11307 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11308 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11309 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11310 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11312 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11314 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11316 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11317 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11318 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11319 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11320 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11321 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11322 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11323 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11324 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11325 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11326 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11327 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11328 ALC262_HP_TC_T5735),
11329 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11330 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11331 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11332 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11333 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11334 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11335 ALC262_SONY_ASSAMD),
11336 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11337 ALC262_TOSHIBA_RX1),
11338 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11339 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11340 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11341 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11342 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11344 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11345 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11346 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11347 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11348 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11352 static struct alc_config_preset alc262_presets[] = {
11354 .mixers = { alc262_base_mixer },
11355 .init_verbs = { alc262_init_verbs },
11356 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11357 .dac_nids = alc262_dac_nids,
11359 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11360 .channel_mode = alc262_modes,
11361 .input_mux = &alc262_capture_source,
11364 .mixers = { alc262_hippo_mixer },
11365 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11366 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11367 .dac_nids = alc262_dac_nids,
11369 .dig_out_nid = ALC262_DIGOUT_NID,
11370 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11371 .channel_mode = alc262_modes,
11372 .input_mux = &alc262_capture_source,
11373 .unsol_event = alc262_hippo_unsol_event,
11374 .init_hook = alc262_hippo_init_hook,
11376 [ALC262_HIPPO_1] = {
11377 .mixers = { alc262_hippo1_mixer },
11378 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11379 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11380 .dac_nids = alc262_dac_nids,
11382 .dig_out_nid = ALC262_DIGOUT_NID,
11383 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11384 .channel_mode = alc262_modes,
11385 .input_mux = &alc262_capture_source,
11386 .unsol_event = alc262_hippo_unsol_event,
11387 .init_hook = alc262_hippo1_init_hook,
11389 [ALC262_FUJITSU] = {
11390 .mixers = { alc262_fujitsu_mixer },
11391 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11392 alc262_fujitsu_unsol_verbs },
11393 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11394 .dac_nids = alc262_dac_nids,
11396 .dig_out_nid = ALC262_DIGOUT_NID,
11397 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11398 .channel_mode = alc262_modes,
11399 .input_mux = &alc262_fujitsu_capture_source,
11400 .unsol_event = alc262_fujitsu_unsol_event,
11401 .init_hook = alc262_fujitsu_init_hook,
11403 [ALC262_HP_BPC] = {
11404 .mixers = { alc262_HP_BPC_mixer },
11405 .init_verbs = { alc262_HP_BPC_init_verbs },
11406 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11407 .dac_nids = alc262_dac_nids,
11409 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11410 .channel_mode = alc262_modes,
11411 .input_mux = &alc262_HP_capture_source,
11412 .unsol_event = alc262_hp_bpc_unsol_event,
11413 .init_hook = alc262_hp_bpc_automute,
11415 [ALC262_HP_BPC_D7000_WF] = {
11416 .mixers = { alc262_HP_BPC_WildWest_mixer },
11417 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11418 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11419 .dac_nids = alc262_dac_nids,
11421 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11422 .channel_mode = alc262_modes,
11423 .input_mux = &alc262_HP_D7000_capture_source,
11424 .unsol_event = alc262_hp_wildwest_unsol_event,
11425 .init_hook = alc262_hp_wildwest_automute,
11427 [ALC262_HP_BPC_D7000_WL] = {
11428 .mixers = { alc262_HP_BPC_WildWest_mixer,
11429 alc262_HP_BPC_WildWest_option_mixer },
11430 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11431 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11432 .dac_nids = alc262_dac_nids,
11434 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11435 .channel_mode = alc262_modes,
11436 .input_mux = &alc262_HP_D7000_capture_source,
11437 .unsol_event = alc262_hp_wildwest_unsol_event,
11438 .init_hook = alc262_hp_wildwest_automute,
11440 [ALC262_HP_TC_T5735] = {
11441 .mixers = { alc262_hp_t5735_mixer },
11442 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11443 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11444 .dac_nids = alc262_dac_nids,
11446 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11447 .channel_mode = alc262_modes,
11448 .input_mux = &alc262_capture_source,
11449 .unsol_event = alc_automute_amp_unsol_event,
11450 .init_hook = alc262_hp_t5735_init_hook,
11452 [ALC262_HP_RP5700] = {
11453 .mixers = { alc262_hp_rp5700_mixer },
11454 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11455 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11456 .dac_nids = alc262_dac_nids,
11457 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11458 .channel_mode = alc262_modes,
11459 .input_mux = &alc262_hp_rp5700_capture_source,
11461 [ALC262_BENQ_ED8] = {
11462 .mixers = { alc262_base_mixer },
11463 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11464 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11465 .dac_nids = alc262_dac_nids,
11467 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11468 .channel_mode = alc262_modes,
11469 .input_mux = &alc262_capture_source,
11471 [ALC262_SONY_ASSAMD] = {
11472 .mixers = { alc262_sony_mixer },
11473 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11474 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11475 .dac_nids = alc262_dac_nids,
11477 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11478 .channel_mode = alc262_modes,
11479 .input_mux = &alc262_capture_source,
11480 .unsol_event = alc262_hippo_unsol_event,
11481 .init_hook = alc262_hippo_init_hook,
11483 [ALC262_BENQ_T31] = {
11484 .mixers = { alc262_benq_t31_mixer },
11485 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11486 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11487 .dac_nids = alc262_dac_nids,
11489 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11490 .channel_mode = alc262_modes,
11491 .input_mux = &alc262_capture_source,
11492 .unsol_event = alc262_hippo_unsol_event,
11493 .init_hook = alc262_hippo_init_hook,
11496 .mixers = { alc262_ultra_mixer },
11497 .cap_mixer = alc262_ultra_capture_mixer,
11498 .init_verbs = { alc262_ultra_verbs },
11499 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11500 .dac_nids = alc262_dac_nids,
11501 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11502 .channel_mode = alc262_modes,
11503 .input_mux = &alc262_ultra_capture_source,
11504 .adc_nids = alc262_adc_nids, /* ADC0 */
11505 .capsrc_nids = alc262_capsrc_nids,
11506 .num_adc_nids = 1, /* single ADC */
11507 .unsol_event = alc262_ultra_unsol_event,
11508 .init_hook = alc262_ultra_automute,
11510 [ALC262_LENOVO_3000] = {
11511 .mixers = { alc262_lenovo_3000_mixer },
11512 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11513 alc262_lenovo_3000_unsol_verbs },
11514 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11515 .dac_nids = alc262_dac_nids,
11517 .dig_out_nid = ALC262_DIGOUT_NID,
11518 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11519 .channel_mode = alc262_modes,
11520 .input_mux = &alc262_fujitsu_capture_source,
11521 .unsol_event = alc262_lenovo_3000_unsol_event,
11524 .mixers = { alc262_nec_mixer },
11525 .init_verbs = { alc262_nec_verbs },
11526 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11527 .dac_nids = alc262_dac_nids,
11529 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11530 .channel_mode = alc262_modes,
11531 .input_mux = &alc262_capture_source,
11533 [ALC262_TOSHIBA_S06] = {
11534 .mixers = { alc262_toshiba_s06_mixer },
11535 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11536 alc262_eapd_verbs },
11537 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11538 .capsrc_nids = alc262_dmic_capsrc_nids,
11539 .dac_nids = alc262_dac_nids,
11540 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11541 .dig_out_nid = ALC262_DIGOUT_NID,
11542 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11543 .channel_mode = alc262_modes,
11544 .input_mux = &alc262_dmic_capture_source,
11545 .unsol_event = alc262_toshiba_s06_unsol_event,
11546 .init_hook = alc262_toshiba_s06_init_hook,
11548 [ALC262_TOSHIBA_RX1] = {
11549 .mixers = { alc262_toshiba_rx1_mixer },
11550 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11551 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11552 .dac_nids = alc262_dac_nids,
11554 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11555 .channel_mode = alc262_modes,
11556 .input_mux = &alc262_capture_source,
11557 .unsol_event = alc262_hippo_unsol_event,
11558 .init_hook = alc262_hippo_init_hook,
11561 .mixers = { alc262_tyan_mixer },
11562 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11563 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11564 .dac_nids = alc262_dac_nids,
11566 .dig_out_nid = ALC262_DIGOUT_NID,
11567 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11568 .channel_mode = alc262_modes,
11569 .input_mux = &alc262_capture_source,
11570 .unsol_event = alc_automute_amp_unsol_event,
11571 .init_hook = alc262_tyan_init_hook,
11575 static int patch_alc262(struct hda_codec *codec)
11577 struct alc_spec *spec;
11581 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11585 codec->spec = spec;
11587 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11592 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11593 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11594 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11595 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11599 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11601 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11605 if (board_config < 0) {
11606 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11607 "trying auto-probe from BIOS...\n", codec->chip_name);
11608 board_config = ALC262_AUTO;
11611 if (board_config == ALC262_AUTO) {
11612 /* automatic parse from the BIOS config */
11613 err = alc262_parse_auto_config(codec);
11619 "hda_codec: Cannot set up configuration "
11620 "from BIOS. Using base mode...\n");
11621 board_config = ALC262_BASIC;
11625 if (!spec->no_analog) {
11626 err = snd_hda_attach_beep_device(codec, 0x1);
11633 if (board_config != ALC262_AUTO)
11634 setup_preset(spec, &alc262_presets[board_config]);
11636 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11637 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11639 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11640 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11642 spec->capture_style = CAPT_MIX;
11643 if (!spec->adc_nids && spec->input_mux) {
11644 /* check whether NID 0x07 is valid */
11645 unsigned int wcap = get_wcaps(codec, 0x07);
11648 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11649 if (wcap != AC_WID_AUD_IN) {
11650 spec->adc_nids = alc262_adc_nids_alt;
11651 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11652 spec->capsrc_nids = alc262_capsrc_nids_alt;
11654 spec->adc_nids = alc262_adc_nids;
11655 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11656 spec->capsrc_nids = alc262_capsrc_nids;
11659 if (!spec->cap_mixer && !spec->no_analog)
11660 set_capture_mixer(spec);
11661 if (!spec->no_analog)
11662 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11664 spec->vmaster_nid = 0x0c;
11666 codec->patch_ops = alc_patch_ops;
11667 if (board_config == ALC262_AUTO)
11668 spec->init_hook = alc262_auto_init;
11669 #ifdef CONFIG_SND_HDA_POWER_SAVE
11670 if (!spec->loopback.amplist)
11671 spec->loopback.amplist = alc262_loopbacks;
11673 codec->proc_widget_hook = print_realtek_coef;
11679 * ALC268 channel source setting (2 channel)
11681 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11682 #define alc268_modes alc260_modes
11684 static hda_nid_t alc268_dac_nids[2] = {
11689 static hda_nid_t alc268_adc_nids[2] = {
11694 static hda_nid_t alc268_adc_nids_alt[1] = {
11699 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11701 static struct snd_kcontrol_new alc268_base_mixer[] = {
11702 /* output mixer control */
11703 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11704 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11705 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11707 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11708 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11709 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11713 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11714 /* output mixer control */
11715 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11716 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11717 ALC262_HIPPO_MASTER_SWITCH,
11718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11719 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11720 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11724 /* bind Beep switches of both NID 0x0f and 0x10 */
11725 static struct hda_bind_ctls alc268_bind_beep_sw = {
11726 .ops = &snd_hda_bind_sw,
11728 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11729 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11734 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11735 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11736 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11740 static struct hda_verb alc268_eapd_verbs[] = {
11741 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11742 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11746 /* Toshiba specific */
11747 static struct hda_verb alc268_toshiba_verbs[] = {
11748 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11752 static struct hda_input_mux alc268_acer_lc_capture_source = {
11760 /* Acer specific */
11761 /* bind volumes of both NID 0x02 and 0x03 */
11762 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11763 .ops = &snd_hda_bind_vol,
11765 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11766 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11771 /* mute/unmute internal speaker according to the hp jack and mute state */
11772 static void alc268_acer_automute(struct hda_codec *codec, int force)
11774 struct alc_spec *spec = codec->spec;
11777 if (force || !spec->sense_updated) {
11778 unsigned int present;
11779 present = snd_hda_codec_read(codec, 0x14, 0,
11780 AC_VERB_GET_PIN_SENSE, 0);
11781 spec->jack_present = (present & 0x80000000) != 0;
11782 spec->sense_updated = 1;
11784 if (spec->jack_present)
11785 mute = HDA_AMP_MUTE; /* mute internal speaker */
11786 else /* unmute internal speaker if necessary */
11787 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11788 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11789 HDA_AMP_MUTE, mute);
11793 /* bind hp and internal speaker mute (with plug check) */
11794 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11795 struct snd_ctl_elem_value *ucontrol)
11797 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11798 long *valp = ucontrol->value.integer.value;
11801 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11803 valp[0] ? 0 : HDA_AMP_MUTE);
11804 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11806 valp[1] ? 0 : HDA_AMP_MUTE);
11808 alc268_acer_automute(codec, 0);
11812 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11813 /* output mixer control */
11814 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11816 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11817 .name = "Master Playback Switch",
11818 .info = snd_hda_mixer_amp_switch_info,
11819 .get = snd_hda_mixer_amp_switch_get,
11820 .put = alc268_acer_master_sw_put,
11821 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11823 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11827 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11828 /* output mixer control */
11829 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11831 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11832 .name = "Master Playback Switch",
11833 .info = snd_hda_mixer_amp_switch_info,
11834 .get = snd_hda_mixer_amp_switch_get,
11835 .put = alc268_acer_master_sw_put,
11836 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11838 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11839 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11840 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11844 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11845 /* output mixer control */
11846 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11848 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11849 .name = "Master Playback Switch",
11850 .info = snd_hda_mixer_amp_switch_info,
11851 .get = snd_hda_mixer_amp_switch_get,
11852 .put = alc268_acer_master_sw_put,
11853 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11855 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11856 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11860 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11861 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11862 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11863 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11864 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11865 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11866 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11870 static struct hda_verb alc268_acer_verbs[] = {
11871 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11872 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11875 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11877 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11881 /* unsolicited event for HP jack sensing */
11882 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11883 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11885 static void alc268_acer_unsol_event(struct hda_codec *codec,
11888 if ((res >> 26) != ALC880_HP_EVENT)
11890 alc268_acer_automute(codec, 1);
11893 static void alc268_acer_init_hook(struct hda_codec *codec)
11895 alc268_acer_automute(codec, 1);
11898 /* toggle speaker-output according to the hp-jack state */
11899 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11901 unsigned int present;
11902 unsigned char bits;
11904 present = snd_hda_codec_read(codec, 0x15, 0,
11905 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11906 bits = present ? AMP_IN_MUTE(0) : 0;
11907 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11908 AMP_IN_MUTE(0), bits);
11909 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11910 AMP_IN_MUTE(0), bits);
11914 static void alc268_acer_mic_automute(struct hda_codec *codec)
11916 unsigned int present;
11918 present = snd_hda_codec_read(codec, 0x18, 0,
11919 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11920 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11921 present ? 0x0 : 0x6);
11924 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11927 if ((res >> 26) == ALC880_HP_EVENT)
11928 alc268_aspire_one_speaker_automute(codec);
11929 if ((res >> 26) == ALC880_MIC_EVENT)
11930 alc268_acer_mic_automute(codec);
11933 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11935 alc268_aspire_one_speaker_automute(codec);
11936 alc268_acer_mic_automute(codec);
11939 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11940 /* output mixer control */
11941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11942 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11943 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11945 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11946 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11950 static struct hda_verb alc268_dell_verbs[] = {
11951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11952 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11953 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11957 /* mute/unmute internal speaker according to the hp jack and mute state */
11958 static void alc268_dell_init_hook(struct hda_codec *codec)
11960 struct alc_spec *spec = codec->spec;
11962 spec->autocfg.hp_pins[0] = 0x15;
11963 spec->autocfg.speaker_pins[0] = 0x14;
11964 alc_automute_pin(codec);
11967 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11968 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11969 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11970 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11971 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11972 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11973 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11974 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11975 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11979 static struct hda_verb alc267_quanta_il1_verbs[] = {
11980 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11981 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11985 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11987 unsigned int present;
11989 present = snd_hda_codec_read(codec, 0x18, 0,
11990 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11991 snd_hda_codec_write(codec, 0x23, 0,
11992 AC_VERB_SET_CONNECT_SEL,
11993 present ? 0x00 : 0x01);
11996 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11998 struct alc_spec *spec = codec->spec;
12000 spec->autocfg.hp_pins[0] = 0x15;
12001 spec->autocfg.speaker_pins[0] = 0x14;
12002 alc_automute_pin(codec);
12003 alc267_quanta_il1_mic_automute(codec);
12006 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
12009 switch (res >> 26) {
12010 case ALC880_MIC_EVENT:
12011 alc267_quanta_il1_mic_automute(codec);
12014 alc_sku_unsol_event(codec, res);
12020 * generic initialization of ADC, input mixers and output mixers
12022 static struct hda_verb alc268_base_init_verbs[] = {
12023 /* Unmute DAC0-1 and set vol = 0 */
12024 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12025 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12028 * Set up output mixers (0x0c - 0x0e)
12030 /* set vol=0 to output mixers */
12031 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12032 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12035 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12037 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12038 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12039 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12040 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12041 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12042 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12043 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12044 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12046 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12047 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12048 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12050 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12052 /* set PCBEEP vol = 0, mute connections */
12053 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12054 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12055 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12057 /* Unmute Selector 23h,24h and set the default input to mic-in */
12059 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12060 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12061 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12062 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12068 * generic initialization of ADC, input mixers and output mixers
12070 static struct hda_verb alc268_volume_init_verbs[] = {
12071 /* set output DAC */
12072 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12073 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12075 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12076 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12077 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12078 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12079 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12081 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12082 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12083 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12085 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12086 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12088 /* set PCBEEP vol = 0, mute connections */
12089 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12090 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12091 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12096 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12097 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12098 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12101 /* The multiple "Capture Source" controls confuse alsamixer
12102 * So call somewhat different..
12104 /* .name = "Capture Source", */
12105 .name = "Input Source",
12107 .info = alc_mux_enum_info,
12108 .get = alc_mux_enum_get,
12109 .put = alc_mux_enum_put,
12114 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12115 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12116 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12117 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12118 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12121 /* The multiple "Capture Source" controls confuse alsamixer
12122 * So call somewhat different..
12124 /* .name = "Capture Source", */
12125 .name = "Input Source",
12127 .info = alc_mux_enum_info,
12128 .get = alc_mux_enum_get,
12129 .put = alc_mux_enum_put,
12134 static struct hda_input_mux alc268_capture_source = {
12138 { "Front Mic", 0x1 },
12144 static struct hda_input_mux alc268_acer_capture_source = {
12148 { "Internal Mic", 0x1 },
12153 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12157 { "Internal Mic", 0x6 },
12162 #ifdef CONFIG_SND_DEBUG
12163 static struct snd_kcontrol_new alc268_test_mixer[] = {
12164 /* Volume widgets */
12165 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12166 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12167 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12168 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12169 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12170 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12171 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12172 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12173 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12174 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12175 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12176 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12177 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12178 /* The below appears problematic on some hardwares */
12179 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12180 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12181 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12182 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12183 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12185 /* Modes for retasking pin widgets */
12186 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12187 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12188 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12189 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12191 /* Controls for GPIO pins, assuming they are configured as outputs */
12192 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12193 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12194 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12195 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12197 /* Switches to allow the digital SPDIF output pin to be enabled.
12198 * The ALC268 does not have an SPDIF input.
12200 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12202 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12203 * this output to turn on an external amplifier.
12205 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12206 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12212 /* create input playback/capture controls for the given pin */
12213 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12214 const char *ctlname, int idx)
12219 sprintf(name, "%s Playback Volume", ctlname);
12221 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12222 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
12226 } else if (nid == 0x15) {
12227 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12228 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
12234 sprintf(name, "%s Playback Switch", ctlname);
12235 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12236 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12242 /* add playback controls from the parsed DAC table */
12243 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12244 const struct auto_pin_cfg *cfg)
12249 spec->multiout.num_dacs = 2; /* only use one dac */
12250 spec->multiout.dac_nids = spec->private_dac_nids;
12251 spec->multiout.dac_nids[0] = 2;
12252 spec->multiout.dac_nids[1] = 3;
12254 nid = cfg->line_out_pins[0];
12256 alc268_new_analog_output(spec, nid, "Front", 0);
12258 nid = cfg->speaker_pins[0];
12260 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12261 "Speaker Playback Volume",
12262 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12266 nid = cfg->hp_pins[0];
12268 alc268_new_analog_output(spec, nid, "Headphone", 0);
12270 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12272 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12273 "Mono Playback Switch",
12274 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
12281 /* create playback/capture controls for input pins */
12282 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12283 const struct auto_pin_cfg *cfg)
12285 struct hda_input_mux *imux = &spec->private_imux[0];
12288 for (i = 0; i < AUTO_PIN_LAST; i++) {
12289 switch(cfg->input_pins[i]) {
12291 idx1 = 0; /* Mic 1 */
12294 idx1 = 1; /* Mic 2 */
12297 idx1 = 2; /* Line In */
12304 idx1 = 6; /* digital mics */
12309 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12310 imux->items[imux->num_items].index = idx1;
12316 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12318 struct alc_spec *spec = codec->spec;
12319 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12320 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12321 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12322 unsigned int dac_vol1, dac_vol2;
12325 snd_hda_codec_write(codec, speaker_nid, 0,
12326 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12327 snd_hda_codec_write(codec, 0x0f, 0,
12328 AC_VERB_SET_AMP_GAIN_MUTE,
12330 snd_hda_codec_write(codec, 0x10, 0,
12331 AC_VERB_SET_AMP_GAIN_MUTE,
12334 snd_hda_codec_write(codec, 0x0f, 0,
12335 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12336 snd_hda_codec_write(codec, 0x10, 0,
12337 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12340 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12341 if (line_nid == 0x14)
12342 dac_vol2 = AMP_OUT_ZERO;
12343 else if (line_nid == 0x15)
12344 dac_vol1 = AMP_OUT_ZERO;
12345 if (hp_nid == 0x14)
12346 dac_vol2 = AMP_OUT_ZERO;
12347 else if (hp_nid == 0x15)
12348 dac_vol1 = AMP_OUT_ZERO;
12349 if (line_nid != 0x16 || hp_nid != 0x16 ||
12350 spec->autocfg.line_out_pins[1] != 0x16 ||
12351 spec->autocfg.line_out_pins[2] != 0x16)
12352 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12354 snd_hda_codec_write(codec, 0x02, 0,
12355 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12356 snd_hda_codec_write(codec, 0x03, 0,
12357 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12360 /* pcm configuration: identical with ALC880 */
12361 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12362 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12363 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12364 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12367 * BIOS auto configuration
12369 static int alc268_parse_auto_config(struct hda_codec *codec)
12371 struct alc_spec *spec = codec->spec;
12373 static hda_nid_t alc268_ignore[] = { 0 };
12375 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12379 if (!spec->autocfg.line_outs) {
12380 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12381 spec->multiout.max_channels = 2;
12382 spec->no_analog = 1;
12385 return 0; /* can't find valid BIOS pin config */
12387 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12390 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12394 spec->multiout.max_channels = 2;
12397 /* digital only support output */
12398 if (spec->autocfg.dig_outs) {
12399 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12400 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12402 if (spec->kctls.list)
12403 add_mixer(spec, spec->kctls.list);
12405 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12406 add_mixer(spec, alc268_beep_mixer);
12408 add_verb(spec, alc268_volume_init_verbs);
12409 spec->num_mux_defs = 1;
12410 spec->input_mux = &spec->private_imux[0];
12412 err = alc_auto_add_mic_boost(codec);
12419 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12420 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12421 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12423 /* init callback for auto-configuration model -- overriding the default init */
12424 static void alc268_auto_init(struct hda_codec *codec)
12426 struct alc_spec *spec = codec->spec;
12427 alc268_auto_init_multi_out(codec);
12428 alc268_auto_init_hp_out(codec);
12429 alc268_auto_init_mono_speaker_out(codec);
12430 alc268_auto_init_analog_input(codec);
12431 if (spec->unsol_event)
12432 alc_inithook(codec);
12436 * configuration and preset
12438 static const char *alc268_models[ALC268_MODEL_LAST] = {
12439 [ALC267_QUANTA_IL1] = "quanta-il1",
12440 [ALC268_3ST] = "3stack",
12441 [ALC268_TOSHIBA] = "toshiba",
12442 [ALC268_ACER] = "acer",
12443 [ALC268_ACER_DMIC] = "acer-dmic",
12444 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12445 [ALC268_DELL] = "dell",
12446 [ALC268_ZEPTO] = "zepto",
12447 #ifdef CONFIG_SND_DEBUG
12448 [ALC268_TEST] = "test",
12450 [ALC268_AUTO] = "auto",
12453 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12454 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12455 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12456 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12457 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12458 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12459 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12460 ALC268_ACER_ASPIRE_ONE),
12461 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12462 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12463 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12465 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12466 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12467 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12469 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12470 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12471 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12472 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12476 static struct alc_config_preset alc268_presets[] = {
12477 [ALC267_QUANTA_IL1] = {
12478 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12479 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12480 alc267_quanta_il1_verbs },
12481 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12482 .dac_nids = alc268_dac_nids,
12483 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12484 .adc_nids = alc268_adc_nids_alt,
12486 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12487 .channel_mode = alc268_modes,
12488 .input_mux = &alc268_capture_source,
12489 .unsol_event = alc267_quanta_il1_unsol_event,
12490 .init_hook = alc267_quanta_il1_init_hook,
12493 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12494 alc268_beep_mixer },
12495 .init_verbs = { alc268_base_init_verbs },
12496 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12497 .dac_nids = alc268_dac_nids,
12498 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12499 .adc_nids = alc268_adc_nids_alt,
12500 .capsrc_nids = alc268_capsrc_nids,
12502 .dig_out_nid = ALC268_DIGOUT_NID,
12503 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12504 .channel_mode = alc268_modes,
12505 .input_mux = &alc268_capture_source,
12507 [ALC268_TOSHIBA] = {
12508 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12509 alc268_beep_mixer },
12510 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12511 alc268_toshiba_verbs },
12512 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12513 .dac_nids = alc268_dac_nids,
12514 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12515 .adc_nids = alc268_adc_nids_alt,
12516 .capsrc_nids = alc268_capsrc_nids,
12518 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12519 .channel_mode = alc268_modes,
12520 .input_mux = &alc268_capture_source,
12521 .unsol_event = alc268_toshiba_unsol_event,
12522 .init_hook = alc268_toshiba_init_hook,
12525 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12526 alc268_beep_mixer },
12527 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12528 alc268_acer_verbs },
12529 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12530 .dac_nids = alc268_dac_nids,
12531 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12532 .adc_nids = alc268_adc_nids_alt,
12533 .capsrc_nids = alc268_capsrc_nids,
12535 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12536 .channel_mode = alc268_modes,
12537 .input_mux = &alc268_acer_capture_source,
12538 .unsol_event = alc268_acer_unsol_event,
12539 .init_hook = alc268_acer_init_hook,
12541 [ALC268_ACER_DMIC] = {
12542 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12543 alc268_beep_mixer },
12544 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12545 alc268_acer_verbs },
12546 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12547 .dac_nids = alc268_dac_nids,
12548 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12549 .adc_nids = alc268_adc_nids_alt,
12550 .capsrc_nids = alc268_capsrc_nids,
12552 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12553 .channel_mode = alc268_modes,
12554 .input_mux = &alc268_acer_dmic_capture_source,
12555 .unsol_event = alc268_acer_unsol_event,
12556 .init_hook = alc268_acer_init_hook,
12558 [ALC268_ACER_ASPIRE_ONE] = {
12559 .mixers = { alc268_acer_aspire_one_mixer,
12561 alc268_capture_alt_mixer },
12562 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12563 alc268_acer_aspire_one_verbs },
12564 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12565 .dac_nids = alc268_dac_nids,
12566 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12567 .adc_nids = alc268_adc_nids_alt,
12568 .capsrc_nids = alc268_capsrc_nids,
12570 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12571 .channel_mode = alc268_modes,
12572 .input_mux = &alc268_acer_lc_capture_source,
12573 .unsol_event = alc268_acer_lc_unsol_event,
12574 .init_hook = alc268_acer_lc_init_hook,
12577 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12578 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12579 alc268_dell_verbs },
12580 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12581 .dac_nids = alc268_dac_nids,
12583 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12584 .channel_mode = alc268_modes,
12585 .unsol_event = alc_sku_unsol_event,
12586 .init_hook = alc268_dell_init_hook,
12587 .input_mux = &alc268_capture_source,
12590 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12591 alc268_beep_mixer },
12592 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12593 alc268_toshiba_verbs },
12594 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12595 .dac_nids = alc268_dac_nids,
12596 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12597 .adc_nids = alc268_adc_nids_alt,
12598 .capsrc_nids = alc268_capsrc_nids,
12600 .dig_out_nid = ALC268_DIGOUT_NID,
12601 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12602 .channel_mode = alc268_modes,
12603 .input_mux = &alc268_capture_source,
12604 .unsol_event = alc268_toshiba_unsol_event,
12605 .init_hook = alc268_toshiba_init_hook
12607 #ifdef CONFIG_SND_DEBUG
12609 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12610 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12611 alc268_volume_init_verbs },
12612 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12613 .dac_nids = alc268_dac_nids,
12614 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12615 .adc_nids = alc268_adc_nids_alt,
12616 .capsrc_nids = alc268_capsrc_nids,
12618 .dig_out_nid = ALC268_DIGOUT_NID,
12619 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12620 .channel_mode = alc268_modes,
12621 .input_mux = &alc268_capture_source,
12626 static int patch_alc268(struct hda_codec *codec)
12628 struct alc_spec *spec;
12630 int i, has_beep, err;
12632 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12636 codec->spec = spec;
12638 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12642 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12643 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12644 "trying auto-probe from BIOS...\n", codec->chip_name);
12645 board_config = ALC268_AUTO;
12648 if (board_config == ALC268_AUTO) {
12649 /* automatic parse from the BIOS config */
12650 err = alc268_parse_auto_config(codec);
12656 "hda_codec: Cannot set up configuration "
12657 "from BIOS. Using base mode...\n");
12658 board_config = ALC268_3ST;
12662 if (board_config != ALC268_AUTO)
12663 setup_preset(spec, &alc268_presets[board_config]);
12665 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12666 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12667 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12669 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12672 for (i = 0; i < spec->num_mixers; i++) {
12673 if (spec->mixers[i] == alc268_beep_mixer) {
12680 err = snd_hda_attach_beep_device(codec, 0x1);
12685 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12686 /* override the amp caps for beep generator */
12687 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12688 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12689 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12690 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12691 (0 << AC_AMPCAP_MUTE_SHIFT));
12694 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12695 /* check whether NID 0x07 is valid */
12696 unsigned int wcap = get_wcaps(codec, 0x07);
12700 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12701 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12702 spec->adc_nids = alc268_adc_nids_alt;
12703 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12704 add_mixer(spec, alc268_capture_alt_mixer);
12706 spec->adc_nids = alc268_adc_nids;
12707 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12708 add_mixer(spec, alc268_capture_mixer);
12710 spec->capsrc_nids = alc268_capsrc_nids;
12711 /* set default input source */
12712 for (i = 0; i < spec->num_adc_nids; i++)
12713 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12714 0, AC_VERB_SET_CONNECT_SEL,
12715 spec->input_mux->items[0].index);
12718 spec->vmaster_nid = 0x02;
12720 codec->patch_ops = alc_patch_ops;
12721 if (board_config == ALC268_AUTO)
12722 spec->init_hook = alc268_auto_init;
12724 codec->proc_widget_hook = print_realtek_coef;
12730 * ALC269 channel source setting (2 channel)
12732 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12734 #define alc269_dac_nids alc260_dac_nids
12736 static hda_nid_t alc269_adc_nids[1] = {
12741 static hda_nid_t alc269_capsrc_nids[1] = {
12745 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12749 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12757 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12765 #define alc269_modes alc260_modes
12766 #define alc269_capture_source alc880_lg_lw_capture_source
12768 static struct snd_kcontrol_new alc269_base_mixer[] = {
12769 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12770 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12777 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12778 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12779 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12780 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12784 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12785 /* output mixer control */
12786 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12788 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12789 .name = "Master Playback Switch",
12790 .info = snd_hda_mixer_amp_switch_info,
12791 .get = snd_hda_mixer_amp_switch_get,
12792 .put = alc268_acer_master_sw_put,
12793 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12798 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12799 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12800 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12804 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12805 /* output mixer control */
12806 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12808 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12809 .name = "Master Playback Switch",
12810 .info = snd_hda_mixer_amp_switch_info,
12811 .get = snd_hda_mixer_amp_switch_get,
12812 .put = alc268_acer_master_sw_put,
12813 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12816 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12817 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12818 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12819 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12820 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12821 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12822 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12823 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12827 /* bind volumes of both NID 0x0c and 0x0d */
12828 static struct hda_bind_ctls alc269_epc_bind_vol = {
12829 .ops = &snd_hda_bind_vol,
12831 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12832 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12837 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12838 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12839 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12840 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12844 /* capture mixer elements */
12845 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12846 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12847 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12848 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12853 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12854 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12855 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12856 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12860 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12861 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12862 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12863 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12864 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12865 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12866 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12870 static struct hda_verb alc269_lifebook_verbs[] = {
12871 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12872 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12873 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12874 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12876 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12877 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12878 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12879 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12880 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12884 /* toggle speaker-output according to the hp-jack state */
12885 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12887 unsigned int present;
12888 unsigned char bits;
12890 present = snd_hda_codec_read(codec, 0x15, 0,
12891 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12892 bits = present ? AMP_IN_MUTE(0) : 0;
12893 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12894 AMP_IN_MUTE(0), bits);
12895 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12896 AMP_IN_MUTE(0), bits);
12898 snd_hda_codec_write(codec, 0x20, 0,
12899 AC_VERB_SET_COEF_INDEX, 0x0c);
12900 snd_hda_codec_write(codec, 0x20, 0,
12901 AC_VERB_SET_PROC_COEF, 0x680);
12903 snd_hda_codec_write(codec, 0x20, 0,
12904 AC_VERB_SET_COEF_INDEX, 0x0c);
12905 snd_hda_codec_write(codec, 0x20, 0,
12906 AC_VERB_SET_PROC_COEF, 0x480);
12909 /* toggle speaker-output according to the hp-jacks state */
12910 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12912 unsigned int present;
12913 unsigned char bits;
12915 /* Check laptop headphone socket */
12916 present = snd_hda_codec_read(codec, 0x15, 0,
12917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12919 /* Check port replicator headphone socket */
12920 present |= snd_hda_codec_read(codec, 0x1a, 0,
12921 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12923 bits = present ? AMP_IN_MUTE(0) : 0;
12924 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12925 AMP_IN_MUTE(0), bits);
12926 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12927 AMP_IN_MUTE(0), bits);
12929 snd_hda_codec_write(codec, 0x20, 0,
12930 AC_VERB_SET_COEF_INDEX, 0x0c);
12931 snd_hda_codec_write(codec, 0x20, 0,
12932 AC_VERB_SET_PROC_COEF, 0x680);
12934 snd_hda_codec_write(codec, 0x20, 0,
12935 AC_VERB_SET_COEF_INDEX, 0x0c);
12936 snd_hda_codec_write(codec, 0x20, 0,
12937 AC_VERB_SET_PROC_COEF, 0x480);
12940 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12942 unsigned int present;
12944 present = snd_hda_codec_read(codec, 0x18, 0,
12945 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12946 snd_hda_codec_write(codec, 0x23, 0,
12947 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12950 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12952 unsigned int present_laptop;
12953 unsigned int present_dock;
12955 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12956 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12958 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12959 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12961 /* Laptop mic port overrides dock mic port, design decision */
12963 snd_hda_codec_write(codec, 0x23, 0,
12964 AC_VERB_SET_CONNECT_SEL, 0x3);
12965 if (present_laptop)
12966 snd_hda_codec_write(codec, 0x23, 0,
12967 AC_VERB_SET_CONNECT_SEL, 0x0);
12968 if (!present_dock && !present_laptop)
12969 snd_hda_codec_write(codec, 0x23, 0,
12970 AC_VERB_SET_CONNECT_SEL, 0x1);
12973 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12976 if ((res >> 26) == ALC880_HP_EVENT)
12977 alc269_quanta_fl1_speaker_automute(codec);
12978 if ((res >> 26) == ALC880_MIC_EVENT)
12979 alc269_quanta_fl1_mic_automute(codec);
12982 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12985 if ((res >> 26) == ALC880_HP_EVENT)
12986 alc269_lifebook_speaker_automute(codec);
12987 if ((res >> 26) == ALC880_MIC_EVENT)
12988 alc269_lifebook_mic_autoswitch(codec);
12991 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12993 alc269_quanta_fl1_speaker_automute(codec);
12994 alc269_quanta_fl1_mic_automute(codec);
12997 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12999 alc269_lifebook_speaker_automute(codec);
13000 alc269_lifebook_mic_autoswitch(codec);
13003 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13004 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13005 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13006 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13007 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13008 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13009 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13010 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13014 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13015 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13016 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13017 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13019 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13020 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13024 /* toggle speaker-output according to the hp-jack state */
13025 static void alc269_speaker_automute(struct hda_codec *codec)
13027 unsigned int present;
13028 unsigned char bits;
13030 present = snd_hda_codec_read(codec, 0x15, 0,
13031 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13032 bits = present ? AMP_IN_MUTE(0) : 0;
13033 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13034 AMP_IN_MUTE(0), bits);
13035 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13036 AMP_IN_MUTE(0), bits);
13039 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
13041 unsigned int present;
13043 present = snd_hda_codec_read(codec, 0x18, 0,
13044 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13045 snd_hda_codec_write(codec, 0x23, 0,
13046 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
13049 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
13051 unsigned int present;
13053 present = snd_hda_codec_read(codec, 0x18, 0,
13054 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
13055 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13056 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
13057 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
13058 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
13061 /* unsolicited event for HP jack sensing */
13062 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
13065 if ((res >> 26) == ALC880_HP_EVENT)
13066 alc269_speaker_automute(codec);
13068 if ((res >> 26) == ALC880_MIC_EVENT)
13069 alc269_eeepc_dmic_automute(codec);
13072 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13074 alc269_speaker_automute(codec);
13075 alc269_eeepc_dmic_automute(codec);
13078 /* unsolicited event for HP jack sensing */
13079 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13082 if ((res >> 26) == ALC880_HP_EVENT)
13083 alc269_speaker_automute(codec);
13085 if ((res >> 26) == ALC880_MIC_EVENT)
13086 alc269_eeepc_amic_automute(codec);
13089 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13091 alc269_speaker_automute(codec);
13092 alc269_eeepc_amic_automute(codec);
13096 * generic initialization of ADC, input mixers and output mixers
13098 static struct hda_verb alc269_init_verbs[] = {
13100 * Unmute ADC0 and set the default input to mic-in
13102 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13104 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13105 * analog-loopback mixer widget
13106 * Note: PASD motherboards uses the Line In 2 as the input for
13107 * front panel mic (mic 2)
13109 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13113 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13114 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13117 * Set up output mixers (0x0c - 0x0e)
13119 /* set vol=0 to output mixers */
13120 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13121 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13123 /* set up input amps for analog loopback */
13124 /* Amp Indices: DAC = 0, mixer = 1 */
13125 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13126 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13127 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13128 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13129 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13130 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13132 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13133 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13134 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13135 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13136 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13137 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13140 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13142 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13143 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13144 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13145 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13146 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13148 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13149 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13151 /* FIXME: use matrix-type input source selection */
13152 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13153 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13154 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13155 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13156 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13157 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13160 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13161 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13165 /* add playback controls from the parsed DAC table */
13166 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13167 const struct auto_pin_cfg *cfg)
13172 spec->multiout.num_dacs = 1; /* only use one dac */
13173 spec->multiout.dac_nids = spec->private_dac_nids;
13174 spec->multiout.dac_nids[0] = 2;
13176 nid = cfg->line_out_pins[0];
13178 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13179 "Front Playback Volume",
13180 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13183 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13184 "Front Playback Switch",
13185 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13190 nid = cfg->speaker_pins[0];
13192 if (!cfg->line_out_pins[0]) {
13193 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13194 "Speaker Playback Volume",
13195 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13201 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13202 "Speaker Playback Switch",
13203 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13208 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13209 "Speaker Playback Switch",
13210 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13216 nid = cfg->hp_pins[0];
13218 /* spec->multiout.hp_nid = 2; */
13219 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13220 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13221 "Headphone Playback Volume",
13222 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13228 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13229 "Headphone Playback Switch",
13230 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13235 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13236 "Headphone Playback Switch",
13237 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13246 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
13247 const struct auto_pin_cfg *cfg)
13251 err = alc880_auto_create_analog_input_ctls(spec, cfg);
13254 /* digital-mic input pin is excluded in alc880_auto_create..()
13255 * because it's under 0x18
13257 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
13258 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
13259 struct hda_input_mux *imux = &spec->private_imux[0];
13260 imux->items[imux->num_items].label = "Int Mic";
13261 imux->items[imux->num_items].index = 0x05;
13267 #ifdef CONFIG_SND_HDA_POWER_SAVE
13268 #define alc269_loopbacks alc880_loopbacks
13271 /* pcm configuration: identical with ALC880 */
13272 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13273 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13274 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13275 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13277 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13281 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13282 /* NID is set in alc_build_pcms */
13284 .open = alc880_playback_pcm_open,
13285 .prepare = alc880_playback_pcm_prepare,
13286 .cleanup = alc880_playback_pcm_cleanup
13290 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13294 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13295 /* NID is set in alc_build_pcms */
13299 * BIOS auto configuration
13301 static int alc269_parse_auto_config(struct hda_codec *codec)
13303 struct alc_spec *spec = codec->spec;
13305 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13307 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13312 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13315 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13319 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13321 if (spec->autocfg.dig_outs)
13322 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13324 if (spec->kctls.list)
13325 add_mixer(spec, spec->kctls.list);
13327 add_verb(spec, alc269_init_verbs);
13328 spec->num_mux_defs = 1;
13329 spec->input_mux = &spec->private_imux[0];
13330 /* set default input source */
13331 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13332 0, AC_VERB_SET_CONNECT_SEL,
13333 spec->input_mux->items[0].index);
13335 err = alc_auto_add_mic_boost(codec);
13339 if (!spec->cap_mixer && !spec->no_analog)
13340 set_capture_mixer(spec);
13345 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13346 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13347 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13350 /* init callback for auto-configuration model -- overriding the default init */
13351 static void alc269_auto_init(struct hda_codec *codec)
13353 struct alc_spec *spec = codec->spec;
13354 alc269_auto_init_multi_out(codec);
13355 alc269_auto_init_hp_out(codec);
13356 alc269_auto_init_analog_input(codec);
13357 if (spec->unsol_event)
13358 alc_inithook(codec);
13362 * configuration and preset
13364 static const char *alc269_models[ALC269_MODEL_LAST] = {
13365 [ALC269_BASIC] = "basic",
13366 [ALC269_QUANTA_FL1] = "quanta",
13367 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13368 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13369 [ALC269_FUJITSU] = "fujitsu",
13370 [ALC269_LIFEBOOK] = "lifebook"
13373 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13374 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13375 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13376 ALC269_ASUS_EEEPC_P703),
13377 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13378 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13379 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13380 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13381 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13382 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13383 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13384 ALC269_ASUS_EEEPC_P901),
13385 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13386 ALC269_ASUS_EEEPC_P901),
13387 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13388 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13389 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13393 static struct alc_config_preset alc269_presets[] = {
13395 .mixers = { alc269_base_mixer },
13396 .init_verbs = { alc269_init_verbs },
13397 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13398 .dac_nids = alc269_dac_nids,
13400 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13401 .channel_mode = alc269_modes,
13402 .input_mux = &alc269_capture_source,
13404 [ALC269_QUANTA_FL1] = {
13405 .mixers = { alc269_quanta_fl1_mixer },
13406 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13407 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13408 .dac_nids = alc269_dac_nids,
13410 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13411 .channel_mode = alc269_modes,
13412 .input_mux = &alc269_capture_source,
13413 .unsol_event = alc269_quanta_fl1_unsol_event,
13414 .init_hook = alc269_quanta_fl1_init_hook,
13416 [ALC269_ASUS_EEEPC_P703] = {
13417 .mixers = { alc269_eeepc_mixer },
13418 .cap_mixer = alc269_epc_capture_mixer,
13419 .init_verbs = { alc269_init_verbs,
13420 alc269_eeepc_amic_init_verbs },
13421 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13422 .dac_nids = alc269_dac_nids,
13424 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13425 .channel_mode = alc269_modes,
13426 .input_mux = &alc269_eeepc_amic_capture_source,
13427 .unsol_event = alc269_eeepc_amic_unsol_event,
13428 .init_hook = alc269_eeepc_amic_inithook,
13430 [ALC269_ASUS_EEEPC_P901] = {
13431 .mixers = { alc269_eeepc_mixer },
13432 .cap_mixer = alc269_epc_capture_mixer,
13433 .init_verbs = { alc269_init_verbs,
13434 alc269_eeepc_dmic_init_verbs },
13435 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13436 .dac_nids = alc269_dac_nids,
13438 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13439 .channel_mode = alc269_modes,
13440 .input_mux = &alc269_eeepc_dmic_capture_source,
13441 .unsol_event = alc269_eeepc_dmic_unsol_event,
13442 .init_hook = alc269_eeepc_dmic_inithook,
13444 [ALC269_FUJITSU] = {
13445 .mixers = { alc269_fujitsu_mixer },
13446 .cap_mixer = alc269_epc_capture_mixer,
13447 .init_verbs = { alc269_init_verbs,
13448 alc269_eeepc_dmic_init_verbs },
13449 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13450 .dac_nids = alc269_dac_nids,
13452 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13453 .channel_mode = alc269_modes,
13454 .input_mux = &alc269_eeepc_dmic_capture_source,
13455 .unsol_event = alc269_eeepc_dmic_unsol_event,
13456 .init_hook = alc269_eeepc_dmic_inithook,
13458 [ALC269_LIFEBOOK] = {
13459 .mixers = { alc269_lifebook_mixer },
13460 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13461 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13462 .dac_nids = alc269_dac_nids,
13464 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13465 .channel_mode = alc269_modes,
13466 .input_mux = &alc269_capture_source,
13467 .unsol_event = alc269_lifebook_unsol_event,
13468 .init_hook = alc269_lifebook_init_hook,
13472 static int patch_alc269(struct hda_codec *codec)
13474 struct alc_spec *spec;
13478 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13482 codec->spec = spec;
13484 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13486 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13490 if (board_config < 0) {
13491 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13492 "trying auto-probe from BIOS...\n", codec->chip_name);
13493 board_config = ALC269_AUTO;
13496 if (board_config == ALC269_AUTO) {
13497 /* automatic parse from the BIOS config */
13498 err = alc269_parse_auto_config(codec);
13504 "hda_codec: Cannot set up configuration "
13505 "from BIOS. Using base mode...\n");
13506 board_config = ALC269_BASIC;
13510 err = snd_hda_attach_beep_device(codec, 0x1);
13516 if (board_config != ALC269_AUTO)
13517 setup_preset(spec, &alc269_presets[board_config]);
13519 if (codec->subsystem_id == 0x17aa3bf8) {
13520 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13521 * fix the sample rate of analog I/O to 44.1kHz
13523 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13524 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13526 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13527 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13529 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13530 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13532 spec->adc_nids = alc269_adc_nids;
13533 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13534 spec->capsrc_nids = alc269_capsrc_nids;
13535 if (!spec->cap_mixer)
13536 set_capture_mixer(spec);
13537 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13539 codec->patch_ops = alc_patch_ops;
13540 if (board_config == ALC269_AUTO)
13541 spec->init_hook = alc269_auto_init;
13542 #ifdef CONFIG_SND_HDA_POWER_SAVE
13543 if (!spec->loopback.amplist)
13544 spec->loopback.amplist = alc269_loopbacks;
13546 codec->proc_widget_hook = print_realtek_coef;
13552 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13556 * set the path ways for 2 channel output
13557 * need to set the codec line out and mic 1 pin widgets to inputs
13559 static struct hda_verb alc861_threestack_ch2_init[] = {
13560 /* set pin widget 1Ah (line in) for input */
13561 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13562 /* set pin widget 18h (mic1/2) for input, for mic also enable
13565 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13567 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13569 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13570 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13576 * need to set the codec line out and mic 1 pin widgets to outputs
13578 static struct hda_verb alc861_threestack_ch6_init[] = {
13579 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13580 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13581 /* set pin widget 18h (mic1) for output (CLFE)*/
13582 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13584 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13585 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13587 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13589 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13590 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13595 static struct hda_channel_mode alc861_threestack_modes[2] = {
13596 { 2, alc861_threestack_ch2_init },
13597 { 6, alc861_threestack_ch6_init },
13599 /* Set mic1 as input and unmute the mixer */
13600 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13601 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13602 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13605 /* Set mic1 as output and mute mixer */
13606 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13607 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13608 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13612 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13613 { 2, alc861_uniwill_m31_ch2_init },
13614 { 4, alc861_uniwill_m31_ch4_init },
13617 /* Set mic1 and line-in as input and unmute the mixer */
13618 static struct hda_verb alc861_asus_ch2_init[] = {
13619 /* set pin widget 1Ah (line in) for input */
13620 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13621 /* set pin widget 18h (mic1/2) for input, for mic also enable
13624 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13626 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13628 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13629 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13633 /* Set mic1 nad line-in as output and mute mixer */
13634 static struct hda_verb alc861_asus_ch6_init[] = {
13635 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13636 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13637 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13638 /* set pin widget 18h (mic1) for output (CLFE)*/
13639 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13640 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13641 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13642 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13644 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13646 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13647 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13652 static struct hda_channel_mode alc861_asus_modes[2] = {
13653 { 2, alc861_asus_ch2_init },
13654 { 6, alc861_asus_ch6_init },
13659 static struct snd_kcontrol_new alc861_base_mixer[] = {
13660 /* output mixer control */
13661 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13662 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13663 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13664 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13665 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13667 /*Input mixer control */
13668 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13669 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13670 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13671 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13672 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13673 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13674 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13675 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13676 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13677 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13682 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13683 /* output mixer control */
13684 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13685 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13686 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13687 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13688 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13690 /* Input mixer control */
13691 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13692 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13693 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13694 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13695 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13696 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13697 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13698 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13699 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13700 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13703 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13704 .name = "Channel Mode",
13705 .info = alc_ch_mode_info,
13706 .get = alc_ch_mode_get,
13707 .put = alc_ch_mode_put,
13708 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13713 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13714 /* output mixer control */
13715 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13717 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13722 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13723 /* output mixer control */
13724 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13725 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13726 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13727 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13728 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13730 /* Input mixer control */
13731 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13732 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13733 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13734 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13735 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13736 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13738 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13739 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13744 .name = "Channel Mode",
13745 .info = alc_ch_mode_info,
13746 .get = alc_ch_mode_get,
13747 .put = alc_ch_mode_put,
13748 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13753 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13754 /* output mixer control */
13755 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13756 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13757 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13758 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13759 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13761 /* Input mixer control */
13762 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13763 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13764 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13765 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13766 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13767 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13769 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13770 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13774 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13775 .name = "Channel Mode",
13776 .info = alc_ch_mode_info,
13777 .get = alc_ch_mode_get,
13778 .put = alc_ch_mode_put,
13779 .private_value = ARRAY_SIZE(alc861_asus_modes),
13784 /* additional mixer */
13785 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13786 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13787 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13792 * generic initialization of ADC, input mixers and output mixers
13794 static struct hda_verb alc861_base_init_verbs[] = {
13796 * Unmute ADC0 and set the default input to mic-in
13798 /* port-A for surround (rear panel) */
13799 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13800 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13801 /* port-B for mic-in (rear panel) with vref */
13802 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13803 /* port-C for line-in (rear panel) */
13804 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13805 /* port-D for Front */
13806 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13807 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13808 /* port-E for HP out (front panel) */
13809 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13810 /* route front PCM to HP */
13811 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13812 /* port-F for mic-in (front panel) with vref */
13813 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13814 /* port-G for CLFE (rear panel) */
13815 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13816 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13817 /* port-H for side (rear panel) */
13818 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13819 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13821 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13822 /* route front mic to ADC1*/
13823 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13824 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 /* Unmute DAC0~3 & spdif out*/
13827 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13828 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13829 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13830 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13831 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13833 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13834 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13835 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13836 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13837 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13839 /* Unmute Stereo Mixer 15 */
13840 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13841 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13842 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13843 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13845 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13846 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13847 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13848 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13849 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13850 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13851 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13852 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13853 /* hp used DAC 3 (Front) */
13854 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13855 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13860 static struct hda_verb alc861_threestack_init_verbs[] = {
13862 * Unmute ADC0 and set the default input to mic-in
13864 /* port-A for surround (rear panel) */
13865 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13866 /* port-B for mic-in (rear panel) with vref */
13867 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13868 /* port-C for line-in (rear panel) */
13869 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13870 /* port-D for Front */
13871 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13872 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13873 /* port-E for HP out (front panel) */
13874 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13875 /* route front PCM to HP */
13876 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13877 /* port-F for mic-in (front panel) with vref */
13878 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13879 /* port-G for CLFE (rear panel) */
13880 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13881 /* port-H for side (rear panel) */
13882 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13884 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13885 /* route front mic to ADC1*/
13886 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13887 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13888 /* Unmute DAC0~3 & spdif out*/
13889 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13890 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13891 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13892 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13895 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13896 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13897 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13898 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13899 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13901 /* Unmute Stereo Mixer 15 */
13902 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13903 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13904 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13907 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13908 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13909 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13911 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13912 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13913 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13914 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13915 /* hp used DAC 3 (Front) */
13916 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13917 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13921 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13923 * Unmute ADC0 and set the default input to mic-in
13925 /* port-A for surround (rear panel) */
13926 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13927 /* port-B for mic-in (rear panel) with vref */
13928 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13929 /* port-C for line-in (rear panel) */
13930 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13931 /* port-D for Front */
13932 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13933 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13934 /* port-E for HP out (front panel) */
13935 /* this has to be set to VREF80 */
13936 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13937 /* route front PCM to HP */
13938 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13939 /* port-F for mic-in (front panel) with vref */
13940 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13941 /* port-G for CLFE (rear panel) */
13942 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13943 /* port-H for side (rear panel) */
13944 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13946 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13947 /* route front mic to ADC1*/
13948 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13949 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13950 /* Unmute DAC0~3 & spdif out*/
13951 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13952 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13953 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13954 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13955 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13957 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13958 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13959 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13960 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13961 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13963 /* Unmute Stereo Mixer 15 */
13964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13966 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13967 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13969 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13970 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13971 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13972 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13973 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13974 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13976 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13977 /* hp used DAC 3 (Front) */
13978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13983 static struct hda_verb alc861_asus_init_verbs[] = {
13985 * Unmute ADC0 and set the default input to mic-in
13987 /* port-A for surround (rear panel)
13988 * according to codec#0 this is the HP jack
13990 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13991 /* route front PCM to HP */
13992 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13993 /* port-B for mic-in (rear panel) with vref */
13994 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13995 /* port-C for line-in (rear panel) */
13996 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13997 /* port-D for Front */
13998 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13999 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14000 /* port-E for HP out (front panel) */
14001 /* this has to be set to VREF80 */
14002 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14003 /* route front PCM to HP */
14004 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14005 /* port-F for mic-in (front panel) with vref */
14006 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14007 /* port-G for CLFE (rear panel) */
14008 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14009 /* port-H for side (rear panel) */
14010 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14012 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14013 /* route front mic to ADC1*/
14014 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14015 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14016 /* Unmute DAC0~3 & spdif out*/
14017 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14018 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14019 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14020 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14021 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14022 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14023 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14024 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14025 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14026 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14028 /* Unmute Stereo Mixer 15 */
14029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14032 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14034 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14035 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14036 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14037 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14038 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14040 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14041 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14042 /* hp used DAC 3 (Front) */
14043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14044 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14048 /* additional init verbs for ASUS laptops */
14049 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14050 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14051 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14056 * generic initialization of ADC, input mixers and output mixers
14058 static struct hda_verb alc861_auto_init_verbs[] = {
14060 * Unmute ADC0 and set the default input to mic-in
14062 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14063 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14065 /* Unmute DAC0~3 & spdif out*/
14066 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14067 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14068 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14069 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14070 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14072 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14073 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14074 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14075 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14076 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14078 /* Unmute Stereo Mixer 15 */
14079 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14082 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14084 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14086 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14087 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14088 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14089 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14090 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14091 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14093 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14094 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14095 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14097 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14098 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14099 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14100 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14102 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14107 static struct hda_verb alc861_toshiba_init_verbs[] = {
14108 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14113 /* toggle speaker-output according to the hp-jack state */
14114 static void alc861_toshiba_automute(struct hda_codec *codec)
14116 unsigned int present;
14118 present = snd_hda_codec_read(codec, 0x0f, 0,
14119 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14120 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14121 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14122 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14123 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14126 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14129 if ((res >> 26) == ALC880_HP_EVENT)
14130 alc861_toshiba_automute(codec);
14133 /* pcm configuration: identical with ALC880 */
14134 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14135 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14136 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14137 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14140 #define ALC861_DIGOUT_NID 0x07
14142 static struct hda_channel_mode alc861_8ch_modes[1] = {
14146 static hda_nid_t alc861_dac_nids[4] = {
14147 /* front, surround, clfe, side */
14148 0x03, 0x06, 0x05, 0x04
14151 static hda_nid_t alc660_dac_nids[3] = {
14152 /* front, clfe, surround */
14156 static hda_nid_t alc861_adc_nids[1] = {
14161 static struct hda_input_mux alc861_capture_source = {
14165 { "Front Mic", 0x3 },
14172 /* fill in the dac_nids table from the parsed pin configuration */
14173 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
14174 const struct auto_pin_cfg *cfg)
14179 spec->multiout.dac_nids = spec->private_dac_nids;
14180 for (i = 0; i < cfg->line_outs; i++) {
14181 nid = cfg->line_out_pins[i];
14183 if (i >= ARRAY_SIZE(alc861_dac_nids))
14185 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
14188 spec->multiout.num_dacs = cfg->line_outs;
14192 /* add playback controls from the parsed DAC table */
14193 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
14194 const struct auto_pin_cfg *cfg)
14197 static const char *chname[4] = {
14198 "Front", "Surround", NULL /*CLFE*/, "Side"
14203 for (i = 0; i < cfg->line_outs; i++) {
14204 nid = spec->multiout.dac_nids[i];
14209 err = add_control(spec, ALC_CTL_BIND_MUTE,
14210 "Center Playback Switch",
14211 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14215 err = add_control(spec, ALC_CTL_BIND_MUTE,
14216 "LFE Playback Switch",
14217 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14222 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
14224 if (nid == alc861_dac_nids[idx])
14226 sprintf(name, "%s Playback Switch", chname[idx]);
14227 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14228 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14237 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
14245 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14247 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14248 "Headphone Playback Switch",
14249 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14252 spec->multiout.hp_nid = nid;
14257 /* create playback/capture controls for input pins */
14258 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
14259 const struct auto_pin_cfg *cfg)
14261 struct hda_input_mux *imux = &spec->private_imux[0];
14262 int i, err, idx, idx1;
14264 for (i = 0; i < AUTO_PIN_LAST; i++) {
14265 switch (cfg->input_pins[i]) {
14268 idx = 2; /* Line In */
14272 idx = 2; /* Line In */
14276 idx = 1; /* Mic In */
14280 idx = 1; /* Mic In */
14290 err = new_analog_input(spec, cfg->input_pins[i],
14291 auto_pin_cfg_labels[i], idx, 0x15);
14295 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14296 imux->items[imux->num_items].index = idx1;
14302 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14304 int pin_type, int dac_idx)
14306 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14308 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14312 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14314 struct alc_spec *spec = codec->spec;
14317 for (i = 0; i < spec->autocfg.line_outs; i++) {
14318 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14319 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14321 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14322 spec->multiout.dac_nids[i]);
14326 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14328 struct alc_spec *spec = codec->spec;
14331 pin = spec->autocfg.hp_pins[0];
14332 if (pin) /* connect to front */
14333 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14334 spec->multiout.dac_nids[0]);
14335 pin = spec->autocfg.speaker_pins[0];
14337 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14340 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14342 struct alc_spec *spec = codec->spec;
14345 for (i = 0; i < AUTO_PIN_LAST; i++) {
14346 hda_nid_t nid = spec->autocfg.input_pins[i];
14347 if (nid >= 0x0c && nid <= 0x11)
14348 alc_set_input_pin(codec, nid, i);
14352 /* parse the BIOS configuration and set up the alc_spec */
14353 /* return 1 if successful, 0 if the proper config is not found,
14354 * or a negative error code
14356 static int alc861_parse_auto_config(struct hda_codec *codec)
14358 struct alc_spec *spec = codec->spec;
14360 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14362 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14366 if (!spec->autocfg.line_outs)
14367 return 0; /* can't find valid BIOS pin config */
14369 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14372 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14375 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14378 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14382 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14384 if (spec->autocfg.dig_outs)
14385 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14387 if (spec->kctls.list)
14388 add_mixer(spec, spec->kctls.list);
14390 add_verb(spec, alc861_auto_init_verbs);
14392 spec->num_mux_defs = 1;
14393 spec->input_mux = &spec->private_imux[0];
14395 spec->adc_nids = alc861_adc_nids;
14396 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14397 set_capture_mixer(spec);
14399 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14404 /* additional initialization for auto-configuration model */
14405 static void alc861_auto_init(struct hda_codec *codec)
14407 struct alc_spec *spec = codec->spec;
14408 alc861_auto_init_multi_out(codec);
14409 alc861_auto_init_hp_out(codec);
14410 alc861_auto_init_analog_input(codec);
14411 if (spec->unsol_event)
14412 alc_inithook(codec);
14415 #ifdef CONFIG_SND_HDA_POWER_SAVE
14416 static struct hda_amp_list alc861_loopbacks[] = {
14417 { 0x15, HDA_INPUT, 0 },
14418 { 0x15, HDA_INPUT, 1 },
14419 { 0x15, HDA_INPUT, 2 },
14420 { 0x15, HDA_INPUT, 3 },
14427 * configuration and preset
14429 static const char *alc861_models[ALC861_MODEL_LAST] = {
14430 [ALC861_3ST] = "3stack",
14431 [ALC660_3ST] = "3stack-660",
14432 [ALC861_3ST_DIG] = "3stack-dig",
14433 [ALC861_6ST_DIG] = "6stack-dig",
14434 [ALC861_UNIWILL_M31] = "uniwill-m31",
14435 [ALC861_TOSHIBA] = "toshiba",
14436 [ALC861_ASUS] = "asus",
14437 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14438 [ALC861_AUTO] = "auto",
14441 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14442 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14443 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14444 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14445 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14446 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14447 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14448 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14449 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14450 * Any other models that need this preset?
14452 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14453 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14454 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14455 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14456 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14457 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14458 /* FIXME: the below seems conflict */
14459 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14460 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14461 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14465 static struct alc_config_preset alc861_presets[] = {
14467 .mixers = { alc861_3ST_mixer },
14468 .init_verbs = { alc861_threestack_init_verbs },
14469 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14470 .dac_nids = alc861_dac_nids,
14471 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14472 .channel_mode = alc861_threestack_modes,
14474 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14475 .adc_nids = alc861_adc_nids,
14476 .input_mux = &alc861_capture_source,
14478 [ALC861_3ST_DIG] = {
14479 .mixers = { alc861_base_mixer },
14480 .init_verbs = { alc861_threestack_init_verbs },
14481 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14482 .dac_nids = alc861_dac_nids,
14483 .dig_out_nid = ALC861_DIGOUT_NID,
14484 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14485 .channel_mode = alc861_threestack_modes,
14487 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14488 .adc_nids = alc861_adc_nids,
14489 .input_mux = &alc861_capture_source,
14491 [ALC861_6ST_DIG] = {
14492 .mixers = { alc861_base_mixer },
14493 .init_verbs = { alc861_base_init_verbs },
14494 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14495 .dac_nids = alc861_dac_nids,
14496 .dig_out_nid = ALC861_DIGOUT_NID,
14497 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14498 .channel_mode = alc861_8ch_modes,
14499 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14500 .adc_nids = alc861_adc_nids,
14501 .input_mux = &alc861_capture_source,
14504 .mixers = { alc861_3ST_mixer },
14505 .init_verbs = { alc861_threestack_init_verbs },
14506 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14507 .dac_nids = alc660_dac_nids,
14508 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14509 .channel_mode = alc861_threestack_modes,
14511 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14512 .adc_nids = alc861_adc_nids,
14513 .input_mux = &alc861_capture_source,
14515 [ALC861_UNIWILL_M31] = {
14516 .mixers = { alc861_uniwill_m31_mixer },
14517 .init_verbs = { alc861_uniwill_m31_init_verbs },
14518 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14519 .dac_nids = alc861_dac_nids,
14520 .dig_out_nid = ALC861_DIGOUT_NID,
14521 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14522 .channel_mode = alc861_uniwill_m31_modes,
14524 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14525 .adc_nids = alc861_adc_nids,
14526 .input_mux = &alc861_capture_source,
14528 [ALC861_TOSHIBA] = {
14529 .mixers = { alc861_toshiba_mixer },
14530 .init_verbs = { alc861_base_init_verbs,
14531 alc861_toshiba_init_verbs },
14532 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14533 .dac_nids = alc861_dac_nids,
14534 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14535 .channel_mode = alc883_3ST_2ch_modes,
14536 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14537 .adc_nids = alc861_adc_nids,
14538 .input_mux = &alc861_capture_source,
14539 .unsol_event = alc861_toshiba_unsol_event,
14540 .init_hook = alc861_toshiba_automute,
14543 .mixers = { alc861_asus_mixer },
14544 .init_verbs = { alc861_asus_init_verbs },
14545 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14546 .dac_nids = alc861_dac_nids,
14547 .dig_out_nid = ALC861_DIGOUT_NID,
14548 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14549 .channel_mode = alc861_asus_modes,
14552 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14553 .adc_nids = alc861_adc_nids,
14554 .input_mux = &alc861_capture_source,
14556 [ALC861_ASUS_LAPTOP] = {
14557 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14558 .init_verbs = { alc861_asus_init_verbs,
14559 alc861_asus_laptop_init_verbs },
14560 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14561 .dac_nids = alc861_dac_nids,
14562 .dig_out_nid = ALC861_DIGOUT_NID,
14563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14564 .channel_mode = alc883_3ST_2ch_modes,
14566 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14567 .adc_nids = alc861_adc_nids,
14568 .input_mux = &alc861_capture_source,
14573 static int patch_alc861(struct hda_codec *codec)
14575 struct alc_spec *spec;
14579 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14583 codec->spec = spec;
14585 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14589 if (board_config < 0) {
14590 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14591 "trying auto-probe from BIOS...\n", codec->chip_name);
14592 board_config = ALC861_AUTO;
14595 if (board_config == ALC861_AUTO) {
14596 /* automatic parse from the BIOS config */
14597 err = alc861_parse_auto_config(codec);
14603 "hda_codec: Cannot set up configuration "
14604 "from BIOS. Using base mode...\n");
14605 board_config = ALC861_3ST_DIG;
14609 err = snd_hda_attach_beep_device(codec, 0x23);
14615 if (board_config != ALC861_AUTO)
14616 setup_preset(spec, &alc861_presets[board_config]);
14618 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14619 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14621 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14622 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14624 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14626 spec->vmaster_nid = 0x03;
14628 codec->patch_ops = alc_patch_ops;
14629 if (board_config == ALC861_AUTO)
14630 spec->init_hook = alc861_auto_init;
14631 #ifdef CONFIG_SND_HDA_POWER_SAVE
14632 if (!spec->loopback.amplist)
14633 spec->loopback.amplist = alc861_loopbacks;
14635 codec->proc_widget_hook = print_realtek_coef;
14641 * ALC861-VD support
14645 * In addition, an independent DAC
14647 #define ALC861VD_DIGOUT_NID 0x06
14649 static hda_nid_t alc861vd_dac_nids[4] = {
14650 /* front, surr, clfe, side surr */
14651 0x02, 0x03, 0x04, 0x05
14654 /* dac_nids for ALC660vd are in a different order - according to
14655 * Realtek's driver.
14656 * This should probably result in a different mixer for 6stack models
14657 * of ALC660vd codecs, but for now there is only 3stack mixer
14658 * - and it is the same as in 861vd.
14659 * adc_nids in ALC660vd are (is) the same as in 861vd
14661 static hda_nid_t alc660vd_dac_nids[3] = {
14662 /* front, rear, clfe, rear_surr */
14666 static hda_nid_t alc861vd_adc_nids[1] = {
14671 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14674 /* FIXME: should be a matrix-type input source selection */
14675 static struct hda_input_mux alc861vd_capture_source = {
14679 { "Front Mic", 0x1 },
14685 static struct hda_input_mux alc861vd_dallas_capture_source = {
14688 { "Ext Mic", 0x0 },
14689 { "Int Mic", 0x1 },
14693 static struct hda_input_mux alc861vd_hp_capture_source = {
14696 { "Front Mic", 0x0 },
14697 { "ATAPI Mic", 0x1 },
14704 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14711 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14712 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14713 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14714 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14715 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14722 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14723 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14724 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14725 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14726 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14730 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14731 { 6, alc861vd_6stack_ch6_init },
14732 { 8, alc861vd_6stack_ch8_init },
14735 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14738 .name = "Channel Mode",
14739 .info = alc_ch_mode_info,
14740 .get = alc_ch_mode_get,
14741 .put = alc_ch_mode_put,
14746 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14747 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14749 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14750 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14751 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14753 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14754 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14756 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14758 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14760 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14761 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14763 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14764 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14766 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14768 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14769 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14773 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14774 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14776 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14777 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14785 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14786 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14787 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14789 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14791 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14795 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14796 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14797 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14802 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14803 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14808 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14809 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14810 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14811 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14815 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14816 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14819 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14820 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14821 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14823 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14824 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14829 /* Pin assignment: Speaker=0x14, HP = 0x15,
14830 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14832 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14833 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14834 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14835 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14836 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14837 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14838 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14839 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14840 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14841 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14842 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14846 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14847 * Front Mic=0x18, ATAPI Mic = 0x19,
14849 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14850 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14851 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14852 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14853 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14854 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14855 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14856 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14857 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14863 * generic initialization of ADC, input mixers and output mixers
14865 static struct hda_verb alc861vd_volume_init_verbs[] = {
14867 * Unmute ADC0 and set the default input to mic-in
14869 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14870 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14872 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14873 * the analog-loopback mixer widget
14875 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14882 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14883 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14886 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14889 * Set up output mixers (0x02 - 0x05)
14891 /* set vol=0 to output mixers */
14892 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14893 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14894 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14895 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14897 /* set up input amps for analog loopback */
14898 /* Amp Indices: DAC = 0, mixer = 1 */
14899 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14900 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14901 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14902 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14903 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14904 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14905 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14906 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14912 * 3-stack pin configuration:
14913 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14915 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14917 * Set pin mode and muting
14919 /* set front pin widgets 0x14 for output */
14920 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14921 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14922 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14924 /* Mic (rear) pin: input vref at 80% */
14925 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14926 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14927 /* Front Mic pin: input vref at 80% */
14928 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14929 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14930 /* Line In pin: input */
14931 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14932 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14933 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14934 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14935 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14936 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14937 /* CD pin widget for input */
14938 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14944 * 6-stack pin configuration:
14946 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14948 * Set pin mode and muting
14950 /* set front pin widgets 0x14 for output */
14951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14952 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14953 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14955 /* Rear Pin: output 1 (0x0d) */
14956 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14958 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14959 /* CLFE Pin: output 2 (0x0e) */
14960 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14961 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14962 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14963 /* Side Pin: output 3 (0x0f) */
14964 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14965 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14966 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14968 /* Mic (rear) pin: input vref at 80% */
14969 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14970 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14971 /* Front Mic pin: input vref at 80% */
14972 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14973 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14974 /* Line In pin: input */
14975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14977 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14978 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14979 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14980 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14981 /* CD pin widget for input */
14982 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14987 static struct hda_verb alc861vd_eapd_verbs[] = {
14988 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14992 static struct hda_verb alc660vd_eapd_verbs[] = {
14993 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14994 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14998 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15000 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15002 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15003 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15007 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15009 unsigned int present;
15010 unsigned char bits;
15012 present = snd_hda_codec_read(codec, 0x18, 0,
15013 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
15014 bits = present ? HDA_AMP_MUTE : 0;
15015 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15016 HDA_AMP_MUTE, bits);
15019 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15021 struct alc_spec *spec = codec->spec;
15023 spec->autocfg.hp_pins[0] = 0x1b;
15024 spec->autocfg.speaker_pins[0] = 0x14;
15025 alc_automute_amp(codec);
15026 alc861vd_lenovo_mic_automute(codec);
15029 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15032 switch (res >> 26) {
15033 case ALC880_MIC_EVENT:
15034 alc861vd_lenovo_mic_automute(codec);
15037 alc_automute_amp_unsol_event(codec, res);
15042 static struct hda_verb alc861vd_dallas_verbs[] = {
15043 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15044 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15045 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15046 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15048 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15050 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15052 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15054 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15055 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15059 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15060 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15062 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15063 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15064 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15066 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15067 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15068 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15069 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15070 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15071 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15073 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15075 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15076 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15077 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15078 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15080 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15081 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15082 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15087 /* toggle speaker-output according to the hp-jack state */
15088 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15090 struct alc_spec *spec = codec->spec;
15092 spec->autocfg.hp_pins[0] = 0x15;
15093 spec->autocfg.speaker_pins[0] = 0x14;
15094 alc_automute_amp(codec);
15097 #ifdef CONFIG_SND_HDA_POWER_SAVE
15098 #define alc861vd_loopbacks alc880_loopbacks
15101 /* pcm configuration: identical with ALC880 */
15102 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15103 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15104 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15105 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15108 * configuration and preset
15110 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15111 [ALC660VD_3ST] = "3stack-660",
15112 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15113 [ALC660VD_ASUS_V1S] = "asus-v1s",
15114 [ALC861VD_3ST] = "3stack",
15115 [ALC861VD_3ST_DIG] = "3stack-digout",
15116 [ALC861VD_6ST_DIG] = "6stack-digout",
15117 [ALC861VD_LENOVO] = "lenovo",
15118 [ALC861VD_DALLAS] = "dallas",
15119 [ALC861VD_HP] = "hp",
15120 [ALC861VD_AUTO] = "auto",
15123 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15124 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15125 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15126 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15127 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15128 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15129 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15130 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15131 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15132 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15133 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
15134 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15135 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15136 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15137 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15138 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15142 static struct alc_config_preset alc861vd_presets[] = {
15144 .mixers = { alc861vd_3st_mixer },
15145 .init_verbs = { alc861vd_volume_init_verbs,
15146 alc861vd_3stack_init_verbs },
15147 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15148 .dac_nids = alc660vd_dac_nids,
15149 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15150 .channel_mode = alc861vd_3stack_2ch_modes,
15151 .input_mux = &alc861vd_capture_source,
15153 [ALC660VD_3ST_DIG] = {
15154 .mixers = { alc861vd_3st_mixer },
15155 .init_verbs = { alc861vd_volume_init_verbs,
15156 alc861vd_3stack_init_verbs },
15157 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15158 .dac_nids = alc660vd_dac_nids,
15159 .dig_out_nid = ALC861VD_DIGOUT_NID,
15160 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15161 .channel_mode = alc861vd_3stack_2ch_modes,
15162 .input_mux = &alc861vd_capture_source,
15165 .mixers = { alc861vd_3st_mixer },
15166 .init_verbs = { alc861vd_volume_init_verbs,
15167 alc861vd_3stack_init_verbs },
15168 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15169 .dac_nids = alc861vd_dac_nids,
15170 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15171 .channel_mode = alc861vd_3stack_2ch_modes,
15172 .input_mux = &alc861vd_capture_source,
15174 [ALC861VD_3ST_DIG] = {
15175 .mixers = { alc861vd_3st_mixer },
15176 .init_verbs = { alc861vd_volume_init_verbs,
15177 alc861vd_3stack_init_verbs },
15178 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15179 .dac_nids = alc861vd_dac_nids,
15180 .dig_out_nid = ALC861VD_DIGOUT_NID,
15181 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15182 .channel_mode = alc861vd_3stack_2ch_modes,
15183 .input_mux = &alc861vd_capture_source,
15185 [ALC861VD_6ST_DIG] = {
15186 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15187 .init_verbs = { alc861vd_volume_init_verbs,
15188 alc861vd_6stack_init_verbs },
15189 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15190 .dac_nids = alc861vd_dac_nids,
15191 .dig_out_nid = ALC861VD_DIGOUT_NID,
15192 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15193 .channel_mode = alc861vd_6stack_modes,
15194 .input_mux = &alc861vd_capture_source,
15196 [ALC861VD_LENOVO] = {
15197 .mixers = { alc861vd_lenovo_mixer },
15198 .init_verbs = { alc861vd_volume_init_verbs,
15199 alc861vd_3stack_init_verbs,
15200 alc861vd_eapd_verbs,
15201 alc861vd_lenovo_unsol_verbs },
15202 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15203 .dac_nids = alc660vd_dac_nids,
15204 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15205 .channel_mode = alc861vd_3stack_2ch_modes,
15206 .input_mux = &alc861vd_capture_source,
15207 .unsol_event = alc861vd_lenovo_unsol_event,
15208 .init_hook = alc861vd_lenovo_init_hook,
15210 [ALC861VD_DALLAS] = {
15211 .mixers = { alc861vd_dallas_mixer },
15212 .init_verbs = { alc861vd_dallas_verbs },
15213 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15214 .dac_nids = alc861vd_dac_nids,
15215 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15216 .channel_mode = alc861vd_3stack_2ch_modes,
15217 .input_mux = &alc861vd_dallas_capture_source,
15218 .unsol_event = alc_automute_amp_unsol_event,
15219 .init_hook = alc861vd_dallas_init_hook,
15222 .mixers = { alc861vd_hp_mixer },
15223 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15224 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15225 .dac_nids = alc861vd_dac_nids,
15226 .dig_out_nid = ALC861VD_DIGOUT_NID,
15227 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15228 .channel_mode = alc861vd_3stack_2ch_modes,
15229 .input_mux = &alc861vd_hp_capture_source,
15230 .unsol_event = alc_automute_amp_unsol_event,
15231 .init_hook = alc861vd_dallas_init_hook,
15233 [ALC660VD_ASUS_V1S] = {
15234 .mixers = { alc861vd_lenovo_mixer },
15235 .init_verbs = { alc861vd_volume_init_verbs,
15236 alc861vd_3stack_init_verbs,
15237 alc861vd_eapd_verbs,
15238 alc861vd_lenovo_unsol_verbs },
15239 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15240 .dac_nids = alc660vd_dac_nids,
15241 .dig_out_nid = ALC861VD_DIGOUT_NID,
15242 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15243 .channel_mode = alc861vd_3stack_2ch_modes,
15244 .input_mux = &alc861vd_capture_source,
15245 .unsol_event = alc861vd_lenovo_unsol_event,
15246 .init_hook = alc861vd_lenovo_init_hook,
15251 * BIOS auto configuration
15253 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15254 hda_nid_t nid, int pin_type, int dac_idx)
15256 alc_set_pin_output(codec, nid, pin_type);
15259 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15261 struct alc_spec *spec = codec->spec;
15264 for (i = 0; i <= HDA_SIDE; i++) {
15265 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15266 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15268 alc861vd_auto_set_output_and_unmute(codec, nid,
15274 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15276 struct alc_spec *spec = codec->spec;
15279 pin = spec->autocfg.hp_pins[0];
15280 if (pin) /* connect to front and use dac 0 */
15281 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15282 pin = spec->autocfg.speaker_pins[0];
15284 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15287 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15288 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15290 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15292 struct alc_spec *spec = codec->spec;
15295 for (i = 0; i < AUTO_PIN_LAST; i++) {
15296 hda_nid_t nid = spec->autocfg.input_pins[i];
15297 if (alc861vd_is_input_pin(nid)) {
15298 alc_set_input_pin(codec, nid, i);
15299 if (nid != ALC861VD_PIN_CD_NID &&
15300 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15301 snd_hda_codec_write(codec, nid, 0,
15302 AC_VERB_SET_AMP_GAIN_MUTE,
15308 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15310 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15311 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15313 /* add playback controls from the parsed DAC table */
15314 /* Based on ALC880 version. But ALC861VD has separate,
15315 * different NIDs for mute/unmute switch and volume control */
15316 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15317 const struct auto_pin_cfg *cfg)
15320 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15321 hda_nid_t nid_v, nid_s;
15324 for (i = 0; i < cfg->line_outs; i++) {
15325 if (!spec->multiout.dac_nids[i])
15327 nid_v = alc861vd_idx_to_mixer_vol(
15329 spec->multiout.dac_nids[i]));
15330 nid_s = alc861vd_idx_to_mixer_switch(
15332 spec->multiout.dac_nids[i]));
15336 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15337 "Center Playback Volume",
15338 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15342 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15343 "LFE Playback Volume",
15344 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15348 err = add_control(spec, ALC_CTL_BIND_MUTE,
15349 "Center Playback Switch",
15350 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15354 err = add_control(spec, ALC_CTL_BIND_MUTE,
15355 "LFE Playback Switch",
15356 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15361 sprintf(name, "%s Playback Volume", chname[i]);
15362 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15363 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15367 sprintf(name, "%s Playback Switch", chname[i]);
15368 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15369 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15378 /* add playback controls for speaker and HP outputs */
15379 /* Based on ALC880 version. But ALC861VD has separate,
15380 * different NIDs for mute/unmute switch and volume control */
15381 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15382 hda_nid_t pin, const char *pfx)
15384 hda_nid_t nid_v, nid_s;
15391 if (alc880_is_fixed_pin(pin)) {
15392 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15393 /* specify the DAC as the extra output */
15394 if (!spec->multiout.hp_nid)
15395 spec->multiout.hp_nid = nid_v;
15397 spec->multiout.extra_out_nid[0] = nid_v;
15398 /* control HP volume/switch on the output mixer amp */
15399 nid_v = alc861vd_idx_to_mixer_vol(
15400 alc880_fixed_pin_idx(pin));
15401 nid_s = alc861vd_idx_to_mixer_switch(
15402 alc880_fixed_pin_idx(pin));
15404 sprintf(name, "%s Playback Volume", pfx);
15405 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15406 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15409 sprintf(name, "%s Playback Switch", pfx);
15410 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15411 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15414 } else if (alc880_is_multi_pin(pin)) {
15415 /* set manual connection */
15416 /* we have only a switch on HP-out PIN */
15417 sprintf(name, "%s Playback Switch", pfx);
15418 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15419 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15426 /* parse the BIOS configuration and set up the alc_spec
15427 * return 1 if successful, 0 if the proper config is not found,
15428 * or a negative error code
15429 * Based on ALC880 version - had to change it to override
15430 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15431 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15433 struct alc_spec *spec = codec->spec;
15435 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15437 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15441 if (!spec->autocfg.line_outs)
15442 return 0; /* can't find valid BIOS pin config */
15444 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15447 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15450 err = alc861vd_auto_create_extra_out(spec,
15451 spec->autocfg.speaker_pins[0],
15455 err = alc861vd_auto_create_extra_out(spec,
15456 spec->autocfg.hp_pins[0],
15460 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15464 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15466 if (spec->autocfg.dig_outs)
15467 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15469 if (spec->kctls.list)
15470 add_mixer(spec, spec->kctls.list);
15472 add_verb(spec, alc861vd_volume_init_verbs);
15474 spec->num_mux_defs = 1;
15475 spec->input_mux = &spec->private_imux[0];
15477 err = alc_auto_add_mic_boost(codec);
15481 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15486 /* additional initialization for auto-configuration model */
15487 static void alc861vd_auto_init(struct hda_codec *codec)
15489 struct alc_spec *spec = codec->spec;
15490 alc861vd_auto_init_multi_out(codec);
15491 alc861vd_auto_init_hp_out(codec);
15492 alc861vd_auto_init_analog_input(codec);
15493 alc861vd_auto_init_input_src(codec);
15494 if (spec->unsol_event)
15495 alc_inithook(codec);
15498 static int patch_alc861vd(struct hda_codec *codec)
15500 struct alc_spec *spec;
15501 int err, board_config;
15503 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15507 codec->spec = spec;
15509 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15513 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15514 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15515 "trying auto-probe from BIOS...\n", codec->chip_name);
15516 board_config = ALC861VD_AUTO;
15519 if (board_config == ALC861VD_AUTO) {
15520 /* automatic parse from the BIOS config */
15521 err = alc861vd_parse_auto_config(codec);
15527 "hda_codec: Cannot set up configuration "
15528 "from BIOS. Using base mode...\n");
15529 board_config = ALC861VD_3ST;
15533 err = snd_hda_attach_beep_device(codec, 0x23);
15539 if (board_config != ALC861VD_AUTO)
15540 setup_preset(spec, &alc861vd_presets[board_config]);
15542 if (codec->vendor_id == 0x10ec0660) {
15543 /* always turn on EAPD */
15544 add_verb(spec, alc660vd_eapd_verbs);
15547 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15548 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15550 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15551 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15553 spec->adc_nids = alc861vd_adc_nids;
15554 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15555 spec->capsrc_nids = alc861vd_capsrc_nids;
15556 spec->capture_style = CAPT_MIX;
15558 set_capture_mixer(spec);
15559 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15561 spec->vmaster_nid = 0x02;
15563 codec->patch_ops = alc_patch_ops;
15565 if (board_config == ALC861VD_AUTO)
15566 spec->init_hook = alc861vd_auto_init;
15567 #ifdef CONFIG_SND_HDA_POWER_SAVE
15568 if (!spec->loopback.amplist)
15569 spec->loopback.amplist = alc861vd_loopbacks;
15571 codec->proc_widget_hook = print_realtek_coef;
15579 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15580 * configuration. Each pin widget can choose any input DACs and a mixer.
15581 * Each ADC is connected from a mixer of all inputs. This makes possible
15582 * 6-channel independent captures.
15584 * In addition, an independent DAC for the multi-playback (not used in this
15587 #define ALC662_DIGOUT_NID 0x06
15588 #define ALC662_DIGIN_NID 0x0a
15590 static hda_nid_t alc662_dac_nids[4] = {
15591 /* front, rear, clfe, rear_surr */
15595 static hda_nid_t alc272_dac_nids[2] = {
15599 static hda_nid_t alc662_adc_nids[1] = {
15604 static hda_nid_t alc272_adc_nids[1] = {
15609 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15610 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15614 /* FIXME: should be a matrix-type input source selection */
15615 static struct hda_input_mux alc662_capture_source = {
15619 { "Front Mic", 0x1 },
15625 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15633 static struct hda_input_mux alc662_eeepc_capture_source = {
15641 static struct hda_input_mux alc663_capture_source = {
15645 { "Front Mic", 0x1 },
15650 static struct hda_input_mux alc663_m51va_capture_source = {
15653 { "Ext-Mic", 0x0 },
15658 #if 1 /* set to 0 for testing other input sources below */
15659 static struct hda_input_mux alc272_nc10_capture_source = {
15662 { "Autoselect Mic", 0x0 },
15663 { "Internal Mic", 0x1 },
15667 static struct hda_input_mux alc272_nc10_capture_source = {
15670 { "Autoselect Mic", 0x0 },
15671 { "Internal Mic", 0x1 },
15672 { "In-0x02", 0x2 },
15673 { "In-0x03", 0x3 },
15674 { "In-0x04", 0x4 },
15675 { "In-0x05", 0x5 },
15676 { "In-0x06", 0x6 },
15677 { "In-0x07", 0x7 },
15678 { "In-0x08", 0x8 },
15679 { "In-0x09", 0x9 },
15680 { "In-0x0a", 0x0a },
15681 { "In-0x0b", 0x0b },
15682 { "In-0x0c", 0x0c },
15683 { "In-0x0d", 0x0d },
15684 { "In-0x0e", 0x0e },
15685 { "In-0x0f", 0x0f },
15693 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15700 static struct hda_verb alc662_3ST_ch2_init[] = {
15701 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15702 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15703 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15704 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15711 static struct hda_verb alc662_3ST_ch6_init[] = {
15712 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15713 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15714 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15715 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15716 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15717 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15721 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15722 { 2, alc662_3ST_ch2_init },
15723 { 6, alc662_3ST_ch6_init },
15729 static struct hda_verb alc662_sixstack_ch6_init[] = {
15730 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15731 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15732 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15739 static struct hda_verb alc662_sixstack_ch8_init[] = {
15740 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15741 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15742 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15746 static struct hda_channel_mode alc662_5stack_modes[2] = {
15747 { 2, alc662_sixstack_ch6_init },
15748 { 6, alc662_sixstack_ch8_init },
15751 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15752 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15755 static struct snd_kcontrol_new alc662_base_mixer[] = {
15756 /* output mixer control */
15757 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15758 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15759 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15760 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15761 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15762 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15763 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15764 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15765 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15767 /*Input mixer control */
15768 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15769 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15770 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15771 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15772 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15773 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15774 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15775 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15779 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15780 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15781 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15783 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15784 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15785 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15786 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15788 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15789 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15794 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15795 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15796 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15797 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15798 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15799 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15800 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15801 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15802 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15803 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15804 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15805 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15806 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15807 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15808 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15809 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15810 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15811 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15815 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15816 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15817 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15819 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15820 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15828 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15829 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15830 ALC262_HIPPO_MASTER_SWITCH,
15832 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15833 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15834 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15836 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15837 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15838 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15842 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15843 ALC262_HIPPO_MASTER_SWITCH,
15844 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15845 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15846 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15847 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15848 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15849 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15850 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15851 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15852 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15856 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15857 .ops = &snd_hda_bind_vol,
15859 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15860 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15865 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15866 .ops = &snd_hda_bind_sw,
15868 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15869 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15874 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15875 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15876 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15877 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15878 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15882 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15883 .ops = &snd_hda_bind_sw,
15885 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15886 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15887 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15892 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15893 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15894 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15897 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15898 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15903 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15904 .ops = &snd_hda_bind_sw,
15906 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15907 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15908 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15913 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15914 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15915 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15916 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15917 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15918 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15919 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15923 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15924 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15925 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15926 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15927 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15929 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15930 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15934 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15935 .ops = &snd_hda_bind_vol,
15937 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15938 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15943 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15944 .ops = &snd_hda_bind_sw,
15946 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15947 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15952 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15953 HDA_BIND_VOL("Master Playback Volume",
15954 &alc663_asus_two_bind_master_vol),
15955 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15956 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15957 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15958 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15959 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15963 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15964 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15965 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15966 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15967 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15968 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15969 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15973 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15974 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15975 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15976 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15977 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15980 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15982 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15983 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15987 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15988 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15989 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15990 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15993 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15994 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15995 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15996 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15997 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16001 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16003 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16004 .name = "Channel Mode",
16005 .info = alc_ch_mode_info,
16006 .get = alc_ch_mode_get,
16007 .put = alc_ch_mode_put,
16012 static struct hda_verb alc662_init_verbs[] = {
16013 /* ADC: mute amp left and right */
16014 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16015 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16016 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16018 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16024 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16025 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16026 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16027 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16028 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16029 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16031 /* Front Pin: output 0 (0x0c) */
16032 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16035 /* Rear Pin: output 1 (0x0d) */
16036 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16037 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16039 /* CLFE Pin: output 2 (0x0e) */
16040 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16041 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16043 /* Mic (rear) pin: input vref at 80% */
16044 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16045 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16046 /* Front Mic pin: input vref at 80% */
16047 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16048 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16049 /* Line In pin: input */
16050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16051 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16052 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16053 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16054 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16055 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16056 /* CD pin widget for input */
16057 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16059 /* FIXME: use matrix-type input source selection */
16060 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16062 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16063 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16065 /* always trun on EAPD */
16066 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16067 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16072 static struct hda_verb alc662_sue_init_verbs[] = {
16073 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16074 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16078 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16079 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16080 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16084 /* Set Unsolicited Event*/
16085 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16086 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16087 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16092 * generic initialization of ADC, input mixers and output mixers
16094 static struct hda_verb alc662_auto_init_verbs[] = {
16096 * Unmute ADC and set the default input to mic-in
16098 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16099 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16101 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16103 * Note: PASD motherboards uses the Line In 2 as the input for front
16104 * panel mic (mic 2)
16106 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16107 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16108 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16109 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16110 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16111 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16114 * Set up output mixers (0x0c - 0x0f)
16116 /* set vol=0 to output mixers */
16117 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16118 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16119 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16121 /* set up input amps for analog loopback */
16122 /* Amp Indices: DAC = 0, mixer = 1 */
16123 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16124 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16125 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16126 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16127 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16128 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16131 /* FIXME: use matrix-type input source selection */
16132 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16134 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16135 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16139 /* additional verbs for ALC663 */
16140 static struct hda_verb alc663_auto_init_verbs[] = {
16141 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16142 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16146 static struct hda_verb alc663_m51va_init_verbs[] = {
16147 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16148 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16149 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16150 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16151 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16153 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16154 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16155 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16159 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16160 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16161 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16162 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16163 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16164 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16165 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16166 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16170 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16171 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16172 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16173 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16174 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16175 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16176 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16177 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16178 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16182 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16183 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16184 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16186 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16187 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16188 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16189 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16193 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16194 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16195 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16196 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16197 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16201 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16202 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16203 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16204 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16205 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16209 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16210 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16211 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16212 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16213 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16214 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16215 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16216 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16217 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16218 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16219 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16220 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16221 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16225 static struct hda_verb alc663_g71v_init_verbs[] = {
16226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16227 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16228 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16230 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16231 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16232 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16234 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16235 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16236 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16240 static struct hda_verb alc663_g50v_init_verbs[] = {
16241 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16242 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16243 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16245 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16246 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16250 static struct hda_verb alc662_ecs_init_verbs[] = {
16251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16252 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16253 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16254 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16258 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16259 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16260 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16261 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16262 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16263 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16264 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16265 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16266 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16267 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16268 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16269 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16273 static struct hda_verb alc272_dell_init_verbs[] = {
16274 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16275 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16277 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16278 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16279 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16280 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16282 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16283 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16284 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16288 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16289 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16290 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16294 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16295 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16296 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16300 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16302 unsigned int present;
16303 unsigned char bits;
16305 present = snd_hda_codec_read(codec, 0x14, 0,
16306 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16307 bits = present ? HDA_AMP_MUTE : 0;
16308 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16309 HDA_AMP_MUTE, bits);
16312 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16314 unsigned int present;
16315 unsigned char bits;
16317 present = snd_hda_codec_read(codec, 0x1b, 0,
16318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16319 bits = present ? HDA_AMP_MUTE : 0;
16320 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16321 HDA_AMP_MUTE, bits);
16322 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16323 HDA_AMP_MUTE, bits);
16326 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16329 if ((res >> 26) == ALC880_HP_EVENT)
16330 alc662_lenovo_101e_all_automute(codec);
16331 if ((res >> 26) == ALC880_FRONT_EVENT)
16332 alc662_lenovo_101e_ispeaker_automute(codec);
16335 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16337 unsigned int present;
16339 present = snd_hda_codec_read(codec, 0x18, 0,
16340 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16341 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16342 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16343 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16344 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16345 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16346 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16347 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16348 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16351 /* unsolicited event for HP jack sensing */
16352 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16355 if ((res >> 26) == ALC880_MIC_EVENT)
16356 alc662_eeepc_mic_automute(codec);
16358 alc262_hippo_unsol_event(codec, res);
16361 static void alc662_eeepc_inithook(struct hda_codec *codec)
16363 alc262_hippo1_init_hook(codec);
16364 alc662_eeepc_mic_automute(codec);
16367 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16369 struct alc_spec *spec = codec->spec;
16371 spec->autocfg.hp_pins[0] = 0x14;
16372 spec->autocfg.speaker_pins[0] = 0x1b;
16373 alc262_hippo_master_update(codec);
16376 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16378 unsigned int present;
16379 unsigned char bits;
16381 present = snd_hda_codec_read(codec, 0x21, 0,
16382 AC_VERB_GET_PIN_SENSE, 0)
16383 & AC_PINSENSE_PRESENCE;
16384 bits = present ? HDA_AMP_MUTE : 0;
16385 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16386 AMP_IN_MUTE(0), bits);
16387 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16388 AMP_IN_MUTE(0), bits);
16391 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16393 unsigned int present;
16394 unsigned char bits;
16396 present = snd_hda_codec_read(codec, 0x21, 0,
16397 AC_VERB_GET_PIN_SENSE, 0)
16398 & AC_PINSENSE_PRESENCE;
16399 bits = present ? HDA_AMP_MUTE : 0;
16400 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16401 AMP_IN_MUTE(0), bits);
16402 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16403 AMP_IN_MUTE(0), bits);
16404 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16405 AMP_IN_MUTE(0), bits);
16406 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16407 AMP_IN_MUTE(0), bits);
16410 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16412 unsigned int present;
16413 unsigned char bits;
16415 present = snd_hda_codec_read(codec, 0x15, 0,
16416 AC_VERB_GET_PIN_SENSE, 0)
16417 & AC_PINSENSE_PRESENCE;
16418 bits = present ? HDA_AMP_MUTE : 0;
16419 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16420 AMP_IN_MUTE(0), bits);
16421 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16422 AMP_IN_MUTE(0), bits);
16423 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16424 AMP_IN_MUTE(0), bits);
16425 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16426 AMP_IN_MUTE(0), bits);
16429 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16431 unsigned int present;
16432 unsigned char bits;
16434 present = snd_hda_codec_read(codec, 0x1b, 0,
16435 AC_VERB_GET_PIN_SENSE, 0)
16436 & AC_PINSENSE_PRESENCE;
16437 bits = present ? 0 : PIN_OUT;
16438 snd_hda_codec_write(codec, 0x14, 0,
16439 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16442 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16444 unsigned int present1, present2;
16446 present1 = snd_hda_codec_read(codec, 0x21, 0,
16447 AC_VERB_GET_PIN_SENSE, 0)
16448 & AC_PINSENSE_PRESENCE;
16449 present2 = snd_hda_codec_read(codec, 0x15, 0,
16450 AC_VERB_GET_PIN_SENSE, 0)
16451 & AC_PINSENSE_PRESENCE;
16453 if (present1 || present2) {
16454 snd_hda_codec_write_cache(codec, 0x14, 0,
16455 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16457 snd_hda_codec_write_cache(codec, 0x14, 0,
16458 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16462 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16464 unsigned int present1, present2;
16466 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16467 AC_VERB_GET_PIN_SENSE, 0)
16468 & AC_PINSENSE_PRESENCE;
16469 present2 = snd_hda_codec_read(codec, 0x15, 0,
16470 AC_VERB_GET_PIN_SENSE, 0)
16471 & AC_PINSENSE_PRESENCE;
16473 if (present1 || present2) {
16474 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16475 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16476 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16477 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16479 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16480 AMP_IN_MUTE(0), 0);
16481 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16482 AMP_IN_MUTE(0), 0);
16486 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16488 unsigned int present;
16490 present = snd_hda_codec_read(codec, 0x18, 0,
16491 AC_VERB_GET_PIN_SENSE, 0)
16492 & AC_PINSENSE_PRESENCE;
16493 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16494 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16495 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16496 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16497 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16498 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16499 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16500 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16503 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16506 switch (res >> 26) {
16507 case ALC880_HP_EVENT:
16508 alc663_m51va_speaker_automute(codec);
16510 case ALC880_MIC_EVENT:
16511 alc663_m51va_mic_automute(codec);
16516 static void alc663_m51va_inithook(struct hda_codec *codec)
16518 alc663_m51va_speaker_automute(codec);
16519 alc663_m51va_mic_automute(codec);
16522 /* ***************** Mode1 ******************************/
16523 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16526 switch (res >> 26) {
16527 case ALC880_HP_EVENT:
16528 alc663_m51va_speaker_automute(codec);
16530 case ALC880_MIC_EVENT:
16531 alc662_eeepc_mic_automute(codec);
16536 static void alc663_mode1_inithook(struct hda_codec *codec)
16538 alc663_m51va_speaker_automute(codec);
16539 alc662_eeepc_mic_automute(codec);
16541 /* ***************** Mode2 ******************************/
16542 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16545 switch (res >> 26) {
16546 case ALC880_HP_EVENT:
16547 alc662_f5z_speaker_automute(codec);
16549 case ALC880_MIC_EVENT:
16550 alc662_eeepc_mic_automute(codec);
16555 static void alc662_mode2_inithook(struct hda_codec *codec)
16557 alc662_f5z_speaker_automute(codec);
16558 alc662_eeepc_mic_automute(codec);
16560 /* ***************** Mode3 ******************************/
16561 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16564 switch (res >> 26) {
16565 case ALC880_HP_EVENT:
16566 alc663_two_hp_m1_speaker_automute(codec);
16568 case ALC880_MIC_EVENT:
16569 alc662_eeepc_mic_automute(codec);
16574 static void alc663_mode3_inithook(struct hda_codec *codec)
16576 alc663_two_hp_m1_speaker_automute(codec);
16577 alc662_eeepc_mic_automute(codec);
16579 /* ***************** Mode4 ******************************/
16580 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16583 switch (res >> 26) {
16584 case ALC880_HP_EVENT:
16585 alc663_21jd_two_speaker_automute(codec);
16587 case ALC880_MIC_EVENT:
16588 alc662_eeepc_mic_automute(codec);
16593 static void alc663_mode4_inithook(struct hda_codec *codec)
16595 alc663_21jd_two_speaker_automute(codec);
16596 alc662_eeepc_mic_automute(codec);
16598 /* ***************** Mode5 ******************************/
16599 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16602 switch (res >> 26) {
16603 case ALC880_HP_EVENT:
16604 alc663_15jd_two_speaker_automute(codec);
16606 case ALC880_MIC_EVENT:
16607 alc662_eeepc_mic_automute(codec);
16612 static void alc663_mode5_inithook(struct hda_codec *codec)
16614 alc663_15jd_two_speaker_automute(codec);
16615 alc662_eeepc_mic_automute(codec);
16617 /* ***************** Mode6 ******************************/
16618 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16621 switch (res >> 26) {
16622 case ALC880_HP_EVENT:
16623 alc663_two_hp_m2_speaker_automute(codec);
16625 case ALC880_MIC_EVENT:
16626 alc662_eeepc_mic_automute(codec);
16631 static void alc663_mode6_inithook(struct hda_codec *codec)
16633 alc663_two_hp_m2_speaker_automute(codec);
16634 alc662_eeepc_mic_automute(codec);
16637 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16639 unsigned int present;
16640 unsigned char bits;
16642 present = snd_hda_codec_read(codec, 0x21, 0,
16643 AC_VERB_GET_PIN_SENSE, 0)
16644 & AC_PINSENSE_PRESENCE;
16645 bits = present ? HDA_AMP_MUTE : 0;
16646 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16647 HDA_AMP_MUTE, bits);
16648 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16649 HDA_AMP_MUTE, bits);
16652 static void alc663_g71v_front_automute(struct hda_codec *codec)
16654 unsigned int present;
16655 unsigned char bits;
16657 present = snd_hda_codec_read(codec, 0x15, 0,
16658 AC_VERB_GET_PIN_SENSE, 0)
16659 & AC_PINSENSE_PRESENCE;
16660 bits = present ? HDA_AMP_MUTE : 0;
16661 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16662 HDA_AMP_MUTE, bits);
16665 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16668 switch (res >> 26) {
16669 case ALC880_HP_EVENT:
16670 alc663_g71v_hp_automute(codec);
16672 case ALC880_FRONT_EVENT:
16673 alc663_g71v_front_automute(codec);
16675 case ALC880_MIC_EVENT:
16676 alc662_eeepc_mic_automute(codec);
16681 static void alc663_g71v_inithook(struct hda_codec *codec)
16683 alc663_g71v_front_automute(codec);
16684 alc663_g71v_hp_automute(codec);
16685 alc662_eeepc_mic_automute(codec);
16688 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16691 switch (res >> 26) {
16692 case ALC880_HP_EVENT:
16693 alc663_m51va_speaker_automute(codec);
16695 case ALC880_MIC_EVENT:
16696 alc662_eeepc_mic_automute(codec);
16701 static void alc663_g50v_inithook(struct hda_codec *codec)
16703 alc663_m51va_speaker_automute(codec);
16704 alc662_eeepc_mic_automute(codec);
16707 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16708 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16709 ALC262_HIPPO_MASTER_SWITCH,
16711 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16712 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16713 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16715 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16716 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16717 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16721 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16722 /* Master Playback automatically created from Speaker and Headphone */
16723 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16724 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16726 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16728 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16729 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16730 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16732 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16733 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16734 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16738 #ifdef CONFIG_SND_HDA_POWER_SAVE
16739 #define alc662_loopbacks alc880_loopbacks
16743 /* pcm configuration: identical with ALC880 */
16744 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16745 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16746 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16747 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16750 * configuration and preset
16752 static const char *alc662_models[ALC662_MODEL_LAST] = {
16753 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16754 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16755 [ALC662_3ST_6ch] = "3stack-6ch",
16756 [ALC662_5ST_DIG] = "6stack-dig",
16757 [ALC662_LENOVO_101E] = "lenovo-101e",
16758 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16759 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16760 [ALC662_ECS] = "ecs",
16761 [ALC663_ASUS_M51VA] = "m51va",
16762 [ALC663_ASUS_G71V] = "g71v",
16763 [ALC663_ASUS_H13] = "h13",
16764 [ALC663_ASUS_G50V] = "g50v",
16765 [ALC663_ASUS_MODE1] = "asus-mode1",
16766 [ALC662_ASUS_MODE2] = "asus-mode2",
16767 [ALC663_ASUS_MODE3] = "asus-mode3",
16768 [ALC663_ASUS_MODE4] = "asus-mode4",
16769 [ALC663_ASUS_MODE5] = "asus-mode5",
16770 [ALC663_ASUS_MODE6] = "asus-mode6",
16771 [ALC272_DELL] = "dell",
16772 [ALC272_DELL_ZM1] = "dell-zm1",
16773 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16774 [ALC662_AUTO] = "auto",
16777 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16778 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16779 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16780 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16781 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16782 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16783 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16784 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16785 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16786 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16787 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16788 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16789 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16790 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16791 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16792 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16793 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16794 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16795 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16796 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16797 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16798 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16799 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16800 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16801 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16802 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16803 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16804 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16805 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16806 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16807 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16808 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16809 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16810 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16811 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16812 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16813 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16814 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16815 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16816 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16817 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16818 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16819 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16820 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16821 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16822 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16823 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16824 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16825 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16826 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16827 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16828 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16829 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16830 ALC662_3ST_6ch_DIG),
16831 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16832 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16833 ALC662_3ST_6ch_DIG),
16834 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16835 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16836 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16837 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16838 ALC662_3ST_6ch_DIG),
16839 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16844 static struct alc_config_preset alc662_presets[] = {
16845 [ALC662_3ST_2ch_DIG] = {
16846 .mixers = { alc662_3ST_2ch_mixer },
16847 .init_verbs = { alc662_init_verbs },
16848 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16849 .dac_nids = alc662_dac_nids,
16850 .dig_out_nid = ALC662_DIGOUT_NID,
16851 .dig_in_nid = ALC662_DIGIN_NID,
16852 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16853 .channel_mode = alc662_3ST_2ch_modes,
16854 .input_mux = &alc662_capture_source,
16856 [ALC662_3ST_6ch_DIG] = {
16857 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16858 .init_verbs = { alc662_init_verbs },
16859 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16860 .dac_nids = alc662_dac_nids,
16861 .dig_out_nid = ALC662_DIGOUT_NID,
16862 .dig_in_nid = ALC662_DIGIN_NID,
16863 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16864 .channel_mode = alc662_3ST_6ch_modes,
16866 .input_mux = &alc662_capture_source,
16868 [ALC662_3ST_6ch] = {
16869 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16870 .init_verbs = { alc662_init_verbs },
16871 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16872 .dac_nids = alc662_dac_nids,
16873 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16874 .channel_mode = alc662_3ST_6ch_modes,
16876 .input_mux = &alc662_capture_source,
16878 [ALC662_5ST_DIG] = {
16879 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16880 .init_verbs = { alc662_init_verbs },
16881 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16882 .dac_nids = alc662_dac_nids,
16883 .dig_out_nid = ALC662_DIGOUT_NID,
16884 .dig_in_nid = ALC662_DIGIN_NID,
16885 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16886 .channel_mode = alc662_5stack_modes,
16887 .input_mux = &alc662_capture_source,
16889 [ALC662_LENOVO_101E] = {
16890 .mixers = { alc662_lenovo_101e_mixer },
16891 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16892 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16893 .dac_nids = alc662_dac_nids,
16894 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16895 .channel_mode = alc662_3ST_2ch_modes,
16896 .input_mux = &alc662_lenovo_101e_capture_source,
16897 .unsol_event = alc662_lenovo_101e_unsol_event,
16898 .init_hook = alc662_lenovo_101e_all_automute,
16900 [ALC662_ASUS_EEEPC_P701] = {
16901 .mixers = { alc662_eeepc_p701_mixer },
16902 .init_verbs = { alc662_init_verbs,
16903 alc662_eeepc_sue_init_verbs },
16904 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16905 .dac_nids = alc662_dac_nids,
16906 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16907 .channel_mode = alc662_3ST_2ch_modes,
16908 .input_mux = &alc662_eeepc_capture_source,
16909 .unsol_event = alc662_eeepc_unsol_event,
16910 .init_hook = alc662_eeepc_inithook,
16912 [ALC662_ASUS_EEEPC_EP20] = {
16913 .mixers = { alc662_eeepc_ep20_mixer,
16914 alc662_chmode_mixer },
16915 .init_verbs = { alc662_init_verbs,
16916 alc662_eeepc_ep20_sue_init_verbs },
16917 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16918 .dac_nids = alc662_dac_nids,
16919 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16920 .channel_mode = alc662_3ST_6ch_modes,
16921 .input_mux = &alc662_lenovo_101e_capture_source,
16922 .unsol_event = alc662_eeepc_unsol_event,
16923 .init_hook = alc662_eeepc_ep20_inithook,
16926 .mixers = { alc662_ecs_mixer },
16927 .init_verbs = { alc662_init_verbs,
16928 alc662_ecs_init_verbs },
16929 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16930 .dac_nids = alc662_dac_nids,
16931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16932 .channel_mode = alc662_3ST_2ch_modes,
16933 .input_mux = &alc662_eeepc_capture_source,
16934 .unsol_event = alc662_eeepc_unsol_event,
16935 .init_hook = alc662_eeepc_inithook,
16937 [ALC663_ASUS_M51VA] = {
16938 .mixers = { alc663_m51va_mixer },
16939 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16940 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16941 .dac_nids = alc662_dac_nids,
16942 .dig_out_nid = ALC662_DIGOUT_NID,
16943 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16944 .channel_mode = alc662_3ST_2ch_modes,
16945 .input_mux = &alc663_m51va_capture_source,
16946 .unsol_event = alc663_m51va_unsol_event,
16947 .init_hook = alc663_m51va_inithook,
16949 [ALC663_ASUS_G71V] = {
16950 .mixers = { alc663_g71v_mixer },
16951 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16952 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16953 .dac_nids = alc662_dac_nids,
16954 .dig_out_nid = ALC662_DIGOUT_NID,
16955 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16956 .channel_mode = alc662_3ST_2ch_modes,
16957 .input_mux = &alc662_eeepc_capture_source,
16958 .unsol_event = alc663_g71v_unsol_event,
16959 .init_hook = alc663_g71v_inithook,
16961 [ALC663_ASUS_H13] = {
16962 .mixers = { alc663_m51va_mixer },
16963 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16964 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16965 .dac_nids = alc662_dac_nids,
16966 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16967 .channel_mode = alc662_3ST_2ch_modes,
16968 .input_mux = &alc663_m51va_capture_source,
16969 .unsol_event = alc663_m51va_unsol_event,
16970 .init_hook = alc663_m51va_inithook,
16972 [ALC663_ASUS_G50V] = {
16973 .mixers = { alc663_g50v_mixer },
16974 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16976 .dac_nids = alc662_dac_nids,
16977 .dig_out_nid = ALC662_DIGOUT_NID,
16978 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16979 .channel_mode = alc662_3ST_6ch_modes,
16980 .input_mux = &alc663_capture_source,
16981 .unsol_event = alc663_g50v_unsol_event,
16982 .init_hook = alc663_g50v_inithook,
16984 [ALC663_ASUS_MODE1] = {
16985 .mixers = { alc663_m51va_mixer },
16986 .cap_mixer = alc662_auto_capture_mixer,
16987 .init_verbs = { alc662_init_verbs,
16988 alc663_21jd_amic_init_verbs },
16989 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16991 .dac_nids = alc662_dac_nids,
16992 .dig_out_nid = ALC662_DIGOUT_NID,
16993 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16994 .channel_mode = alc662_3ST_2ch_modes,
16995 .input_mux = &alc662_eeepc_capture_source,
16996 .unsol_event = alc663_mode1_unsol_event,
16997 .init_hook = alc663_mode1_inithook,
16999 [ALC662_ASUS_MODE2] = {
17000 .mixers = { alc662_1bjd_mixer },
17001 .cap_mixer = alc662_auto_capture_mixer,
17002 .init_verbs = { alc662_init_verbs,
17003 alc662_1bjd_amic_init_verbs },
17004 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17005 .dac_nids = alc662_dac_nids,
17006 .dig_out_nid = ALC662_DIGOUT_NID,
17007 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17008 .channel_mode = alc662_3ST_2ch_modes,
17009 .input_mux = &alc662_eeepc_capture_source,
17010 .unsol_event = alc662_mode2_unsol_event,
17011 .init_hook = alc662_mode2_inithook,
17013 [ALC663_ASUS_MODE3] = {
17014 .mixers = { alc663_two_hp_m1_mixer },
17015 .cap_mixer = alc662_auto_capture_mixer,
17016 .init_verbs = { alc662_init_verbs,
17017 alc663_two_hp_amic_m1_init_verbs },
17018 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17020 .dac_nids = alc662_dac_nids,
17021 .dig_out_nid = ALC662_DIGOUT_NID,
17022 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17023 .channel_mode = alc662_3ST_2ch_modes,
17024 .input_mux = &alc662_eeepc_capture_source,
17025 .unsol_event = alc663_mode3_unsol_event,
17026 .init_hook = alc663_mode3_inithook,
17028 [ALC663_ASUS_MODE4] = {
17029 .mixers = { alc663_asus_21jd_clfe_mixer },
17030 .cap_mixer = alc662_auto_capture_mixer,
17031 .init_verbs = { alc662_init_verbs,
17032 alc663_21jd_amic_init_verbs},
17033 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17035 .dac_nids = alc662_dac_nids,
17036 .dig_out_nid = ALC662_DIGOUT_NID,
17037 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17038 .channel_mode = alc662_3ST_2ch_modes,
17039 .input_mux = &alc662_eeepc_capture_source,
17040 .unsol_event = alc663_mode4_unsol_event,
17041 .init_hook = alc663_mode4_inithook,
17043 [ALC663_ASUS_MODE5] = {
17044 .mixers = { alc663_asus_15jd_clfe_mixer },
17045 .cap_mixer = alc662_auto_capture_mixer,
17046 .init_verbs = { alc662_init_verbs,
17047 alc663_15jd_amic_init_verbs },
17048 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17050 .dac_nids = alc662_dac_nids,
17051 .dig_out_nid = ALC662_DIGOUT_NID,
17052 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17053 .channel_mode = alc662_3ST_2ch_modes,
17054 .input_mux = &alc662_eeepc_capture_source,
17055 .unsol_event = alc663_mode5_unsol_event,
17056 .init_hook = alc663_mode5_inithook,
17058 [ALC663_ASUS_MODE6] = {
17059 .mixers = { alc663_two_hp_m2_mixer },
17060 .cap_mixer = alc662_auto_capture_mixer,
17061 .init_verbs = { alc662_init_verbs,
17062 alc663_two_hp_amic_m2_init_verbs },
17063 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17065 .dac_nids = alc662_dac_nids,
17066 .dig_out_nid = ALC662_DIGOUT_NID,
17067 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17068 .channel_mode = alc662_3ST_2ch_modes,
17069 .input_mux = &alc662_eeepc_capture_source,
17070 .unsol_event = alc663_mode6_unsol_event,
17071 .init_hook = alc663_mode6_inithook,
17074 .mixers = { alc663_m51va_mixer },
17075 .cap_mixer = alc272_auto_capture_mixer,
17076 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17077 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17078 .dac_nids = alc662_dac_nids,
17079 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17080 .adc_nids = alc272_adc_nids,
17081 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17082 .capsrc_nids = alc272_capsrc_nids,
17083 .channel_mode = alc662_3ST_2ch_modes,
17084 .input_mux = &alc663_m51va_capture_source,
17085 .unsol_event = alc663_m51va_unsol_event,
17086 .init_hook = alc663_m51va_inithook,
17088 [ALC272_DELL_ZM1] = {
17089 .mixers = { alc663_m51va_mixer },
17090 .cap_mixer = alc662_auto_capture_mixer,
17091 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17092 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17093 .dac_nids = alc662_dac_nids,
17094 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17095 .adc_nids = alc662_adc_nids,
17096 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
17097 .capsrc_nids = alc662_capsrc_nids,
17098 .channel_mode = alc662_3ST_2ch_modes,
17099 .input_mux = &alc663_m51va_capture_source,
17100 .unsol_event = alc663_m51va_unsol_event,
17101 .init_hook = alc663_m51va_inithook,
17103 [ALC272_SAMSUNG_NC10] = {
17104 .mixers = { alc272_nc10_mixer },
17105 .init_verbs = { alc662_init_verbs,
17106 alc663_21jd_amic_init_verbs },
17107 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17108 .dac_nids = alc272_dac_nids,
17109 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17110 .channel_mode = alc662_3ST_2ch_modes,
17111 .input_mux = &alc272_nc10_capture_source,
17112 .unsol_event = alc663_mode4_unsol_event,
17113 .init_hook = alc663_mode4_inithook,
17119 * BIOS auto configuration
17122 /* add playback controls from the parsed DAC table */
17123 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17124 const struct auto_pin_cfg *cfg)
17127 static const char *chname[4] = {
17128 "Front", "Surround", NULL /*CLFE*/, "Side"
17133 for (i = 0; i < cfg->line_outs; i++) {
17134 if (!spec->multiout.dac_nids[i])
17136 nid = alc880_idx_to_dac(i);
17139 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17140 "Center Playback Volume",
17141 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17145 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17146 "LFE Playback Volume",
17147 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17151 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17152 "Center Playback Switch",
17153 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17157 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17158 "LFE Playback Switch",
17159 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17164 sprintf(name, "%s Playback Volume", chname[i]);
17165 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17166 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17170 sprintf(name, "%s Playback Switch", chname[i]);
17171 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17172 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17181 /* add playback controls for speaker and HP outputs */
17182 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17193 /* ALC663 has a mono output pin on 0x17 */
17194 sprintf(name, "%s Playback Switch", pfx);
17195 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17196 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17200 if (alc880_is_fixed_pin(pin)) {
17201 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17202 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17203 /* specify the DAC as the extra output */
17204 if (!spec->multiout.hp_nid)
17205 spec->multiout.hp_nid = nid;
17207 spec->multiout.extra_out_nid[0] = nid;
17208 /* control HP volume/switch on the output mixer amp */
17209 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17210 sprintf(name, "%s Playback Volume", pfx);
17211 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17212 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17215 sprintf(name, "%s Playback Switch", pfx);
17216 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17217 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17220 } else if (alc880_is_multi_pin(pin)) {
17221 /* set manual connection */
17222 /* we have only a switch on HP-out PIN */
17223 sprintf(name, "%s Playback Switch", pfx);
17224 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17225 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17232 /* return the index of the src widget from the connection list of the nid.
17233 * return -1 if not found
17235 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17238 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17241 conns = snd_hda_get_connections(codec, nid, conn_list,
17242 ARRAY_SIZE(conn_list));
17245 for (i = 0; i < conns; i++)
17246 if (conn_list[i] == src)
17251 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17253 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17254 return (pincap & AC_PINCAP_IN) != 0;
17257 /* create playback/capture controls for input pins */
17258 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17259 const struct auto_pin_cfg *cfg)
17261 struct alc_spec *spec = codec->spec;
17262 struct hda_input_mux *imux = &spec->private_imux[0];
17265 for (i = 0; i < AUTO_PIN_LAST; i++) {
17266 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17267 idx = alc662_input_pin_idx(codec, 0x0b,
17268 cfg->input_pins[i]);
17270 err = new_analog_input(spec, cfg->input_pins[i],
17271 auto_pin_cfg_labels[i],
17276 idx = alc662_input_pin_idx(codec, 0x22,
17277 cfg->input_pins[i]);
17279 imux->items[imux->num_items].label =
17280 auto_pin_cfg_labels[i];
17281 imux->items[imux->num_items].index = idx;
17289 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17290 hda_nid_t nid, int pin_type,
17293 alc_set_pin_output(codec, nid, pin_type);
17294 /* need the manual connection? */
17295 if (alc880_is_multi_pin(nid)) {
17296 struct alc_spec *spec = codec->spec;
17297 int idx = alc880_multi_pin_idx(nid);
17298 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17299 AC_VERB_SET_CONNECT_SEL,
17300 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17304 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17306 struct alc_spec *spec = codec->spec;
17309 for (i = 0; i <= HDA_SIDE; i++) {
17310 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17311 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17313 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17318 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17320 struct alc_spec *spec = codec->spec;
17323 pin = spec->autocfg.hp_pins[0];
17324 if (pin) /* connect to front */
17326 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17327 pin = spec->autocfg.speaker_pins[0];
17329 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17332 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17334 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17336 struct alc_spec *spec = codec->spec;
17339 for (i = 0; i < AUTO_PIN_LAST; i++) {
17340 hda_nid_t nid = spec->autocfg.input_pins[i];
17341 if (alc662_is_input_pin(codec, nid)) {
17342 alc_set_input_pin(codec, nid, i);
17343 if (nid != ALC662_PIN_CD_NID &&
17344 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17345 snd_hda_codec_write(codec, nid, 0,
17346 AC_VERB_SET_AMP_GAIN_MUTE,
17352 #define alc662_auto_init_input_src alc882_auto_init_input_src
17354 static int alc662_parse_auto_config(struct hda_codec *codec)
17356 struct alc_spec *spec = codec->spec;
17358 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17360 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17364 if (!spec->autocfg.line_outs)
17365 return 0; /* can't find valid BIOS pin config */
17367 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17370 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17373 err = alc662_auto_create_extra_out(spec,
17374 spec->autocfg.speaker_pins[0],
17378 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17382 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17386 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17388 if (spec->autocfg.dig_outs)
17389 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17391 if (spec->kctls.list)
17392 add_mixer(spec, spec->kctls.list);
17394 spec->num_mux_defs = 1;
17395 spec->input_mux = &spec->private_imux[0];
17397 add_verb(spec, alc662_auto_init_verbs);
17398 if (codec->vendor_id == 0x10ec0663)
17399 add_verb(spec, alc663_auto_init_verbs);
17401 err = alc_auto_add_mic_boost(codec);
17405 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17410 /* additional initialization for auto-configuration model */
17411 static void alc662_auto_init(struct hda_codec *codec)
17413 struct alc_spec *spec = codec->spec;
17414 alc662_auto_init_multi_out(codec);
17415 alc662_auto_init_hp_out(codec);
17416 alc662_auto_init_analog_input(codec);
17417 alc662_auto_init_input_src(codec);
17418 if (spec->unsol_event)
17419 alc_inithook(codec);
17422 static int patch_alc662(struct hda_codec *codec)
17424 struct alc_spec *spec;
17425 int err, board_config;
17427 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17431 codec->spec = spec;
17433 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17435 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17438 if (board_config < 0) {
17439 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17440 "trying auto-probe from BIOS...\n", codec->chip_name);
17441 board_config = ALC662_AUTO;
17444 if (board_config == ALC662_AUTO) {
17445 /* automatic parse from the BIOS config */
17446 err = alc662_parse_auto_config(codec);
17452 "hda_codec: Cannot set up configuration "
17453 "from BIOS. Using base mode...\n");
17454 board_config = ALC662_3ST_2ch_DIG;
17458 err = snd_hda_attach_beep_device(codec, 0x1);
17464 if (board_config != ALC662_AUTO)
17465 setup_preset(spec, &alc662_presets[board_config]);
17467 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17468 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17470 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17471 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17473 spec->adc_nids = alc662_adc_nids;
17474 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17475 spec->capsrc_nids = alc662_capsrc_nids;
17476 spec->capture_style = CAPT_MIX;
17478 if (!spec->cap_mixer)
17479 set_capture_mixer(spec);
17480 if (codec->vendor_id == 0x10ec0662)
17481 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17483 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17485 spec->vmaster_nid = 0x02;
17487 codec->patch_ops = alc_patch_ops;
17488 if (board_config == ALC662_AUTO)
17489 spec->init_hook = alc662_auto_init;
17490 #ifdef CONFIG_SND_HDA_POWER_SAVE
17491 if (!spec->loopback.amplist)
17492 spec->loopback.amplist = alc662_loopbacks;
17494 codec->proc_widget_hook = print_realtek_coef;
17502 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17503 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17504 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17505 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17506 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17507 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17508 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17509 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17510 .patch = patch_alc861 },
17511 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17512 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17513 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17514 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17515 .patch = patch_alc883 },
17516 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17517 .patch = patch_alc662 },
17518 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17519 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17520 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17521 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17522 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17523 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17524 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17525 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17526 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17527 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17528 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17529 .patch = patch_alc883 },
17530 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17531 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17532 {} /* terminator */
17535 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17537 MODULE_LICENSE("GPL");
17538 MODULE_DESCRIPTION("Realtek HD-audio codec");
17540 static struct hda_codec_preset_list realtek_list = {
17541 .preset = snd_hda_preset_realtek,
17542 .owner = THIS_MODULE,
17545 static int __init patch_realtek_init(void)
17547 return snd_hda_add_codec_preset(&realtek_list);
17550 static void __exit patch_realtek_exit(void)
17552 snd_hda_delete_codec_preset(&realtek_list);
17555 module_init(patch_realtek_init)
17556 module_exit(patch_realtek_exit)