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_8930G,
231 ALC883_LENOVO_101E_2ch,
232 ALC883_LENOVO_NB0763,
233 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
252 /* styles of capture selection */
254 CAPT_MUX = 0, /* only mux based */
255 CAPT_MIX, /* only mixer based */
256 CAPT_1MUX_MIX, /* first mux and other mixers */
260 #define GPIO_MASK 0x03
262 /* extra amp-initialization sequence types */
272 /* codec parameterization */
273 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
274 unsigned int num_mixers;
275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
278 const struct hda_verb *init_verbs[5]; /* initialization verbs
282 unsigned int num_init_verbs;
284 char stream_name_analog[16]; /* analog PCM stream */
285 struct hda_pcm_stream *stream_analog_playback;
286 struct hda_pcm_stream *stream_analog_capture;
287 struct hda_pcm_stream *stream_analog_alt_playback;
288 struct hda_pcm_stream *stream_analog_alt_capture;
290 char stream_name_digital[16]; /* digital PCM stream */
291 struct hda_pcm_stream *stream_digital_playback;
292 struct hda_pcm_stream *stream_digital_capture;
295 struct hda_multi_out multiout; /* playback set-up
296 * max_channels, dacs must be set
297 * dig_out_nid and hp_nid are optional
299 hda_nid_t alt_dac_nid;
300 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
304 unsigned int num_adc_nids;
306 hda_nid_t *capsrc_nids;
307 hda_nid_t dig_in_nid; /* digital-in NID; optional */
308 int capture_style; /* capture style (CAPT_*) */
311 unsigned int num_mux_defs;
312 const struct hda_input_mux *input_mux;
313 unsigned int cur_mux[3];
316 const struct hda_channel_mode *channel_mode;
317 int num_channel_mode;
319 int const_channel_count;
320 int ext_channel_count;
322 /* PCM information */
323 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
325 /* dynamic controls, init_verbs and input_mux */
326 struct auto_pin_cfg autocfg;
327 struct snd_array kctls;
328 struct hda_input_mux private_imux[3];
329 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
332 void (*init_hook)(struct hda_codec *codec);
333 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
335 /* for pin sensing */
336 unsigned int sense_updated: 1;
337 unsigned int jack_present: 1;
338 unsigned int master_sw: 1;
341 unsigned int no_analog :1; /* digital I/O only */
344 /* for virtual master */
345 hda_nid_t vmaster_nid;
346 #ifdef CONFIG_SND_HDA_POWER_SAVE
347 struct hda_loopback_check loopback;
352 unsigned int pll_coef_idx, pll_coef_bit;
356 * configuration template - to be copied to the spec instance
358 struct alc_config_preset {
359 struct snd_kcontrol_new *mixers[5]; /* should be identical size
362 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
363 const struct hda_verb *init_verbs[5];
364 unsigned int num_dacs;
366 hda_nid_t dig_out_nid; /* optional */
367 hda_nid_t hp_nid; /* optional */
368 hda_nid_t *slave_dig_outs;
369 unsigned int num_adc_nids;
371 hda_nid_t *capsrc_nids;
372 hda_nid_t dig_in_nid;
373 unsigned int num_channel_mode;
374 const struct hda_channel_mode *channel_mode;
376 int const_channel_count;
377 unsigned int num_mux_defs;
378 const struct hda_input_mux *input_mux;
379 void (*unsol_event)(struct hda_codec *, unsigned int);
380 void (*init_hook)(struct hda_codec *);
381 #ifdef CONFIG_SND_HDA_POWER_SAVE
382 struct hda_amp_list *loopbacks;
390 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
391 struct snd_ctl_elem_info *uinfo)
393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
394 struct alc_spec *spec = codec->spec;
395 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
396 if (mux_idx >= spec->num_mux_defs)
398 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
401 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
402 struct snd_ctl_elem_value *ucontrol)
404 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
405 struct alc_spec *spec = codec->spec;
406 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
408 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
412 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
413 struct snd_ctl_elem_value *ucontrol)
415 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
416 struct alc_spec *spec = codec->spec;
417 const struct hda_input_mux *imux;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
419 unsigned int mux_idx;
420 hda_nid_t nid = spec->capsrc_nids ?
421 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
423 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
424 imux = &spec->input_mux[mux_idx];
426 if (spec->capture_style &&
427 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
428 /* Matrix-mixer style (e.g. ALC882) */
429 unsigned int *cur_val = &spec->cur_mux[adc_idx];
432 idx = ucontrol->value.enumerated.item[0];
433 if (idx >= imux->num_items)
434 idx = imux->num_items - 1;
437 for (i = 0; i < imux->num_items; i++) {
438 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
439 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
440 imux->items[i].index,
446 /* MUX style (e.g. ALC880) */
447 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
448 &spec->cur_mux[adc_idx]);
453 * channel mode setting
455 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
456 struct snd_ctl_elem_info *uinfo)
458 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
459 struct alc_spec *spec = codec->spec;
460 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
461 spec->num_channel_mode);
464 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
465 struct snd_ctl_elem_value *ucontrol)
467 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
468 struct alc_spec *spec = codec->spec;
469 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
470 spec->num_channel_mode,
471 spec->ext_channel_count);
474 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
475 struct snd_ctl_elem_value *ucontrol)
477 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
478 struct alc_spec *spec = codec->spec;
479 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
480 spec->num_channel_mode,
481 &spec->ext_channel_count);
482 if (err >= 0 && !spec->const_channel_count) {
483 spec->multiout.max_channels = spec->ext_channel_count;
484 if (spec->need_dac_fix)
485 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
491 * Control the mode of pin widget settings via the mixer. "pc" is used
492 * instead of "%" to avoid consequences of accidently treating the % as
493 * being part of a format specifier. Maximum allowed length of a value is
494 * 63 characters plus NULL terminator.
496 * Note: some retasking pin complexes seem to ignore requests for input
497 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
498 * are requested. Therefore order this list so that this behaviour will not
499 * cause problems when mixer clients move through the enum sequentially.
500 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
503 static char *alc_pin_mode_names[] = {
504 "Mic 50pc bias", "Mic 80pc bias",
505 "Line in", "Line out", "Headphone out",
507 static unsigned char alc_pin_mode_values[] = {
508 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
510 /* The control can present all 5 options, or it can limit the options based
511 * in the pin being assumed to be exclusively an input or an output pin. In
512 * addition, "input" pins may or may not process the mic bias option
513 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
514 * accept requests for bias as of chip versions up to March 2006) and/or
515 * wiring in the computer.
517 #define ALC_PIN_DIR_IN 0x00
518 #define ALC_PIN_DIR_OUT 0x01
519 #define ALC_PIN_DIR_INOUT 0x02
520 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
521 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
523 /* Info about the pin modes supported by the different pin direction modes.
524 * For each direction the minimum and maximum values are given.
526 static signed char alc_pin_mode_dir_info[5][2] = {
527 { 0, 2 }, /* ALC_PIN_DIR_IN */
528 { 3, 4 }, /* ALC_PIN_DIR_OUT */
529 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
530 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
531 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
533 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
534 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
535 #define alc_pin_mode_n_items(_dir) \
536 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
538 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
539 struct snd_ctl_elem_info *uinfo)
541 unsigned int item_num = uinfo->value.enumerated.item;
542 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
544 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
546 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
548 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
549 item_num = alc_pin_mode_min(dir);
550 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
554 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
555 struct snd_ctl_elem_value *ucontrol)
558 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
559 hda_nid_t nid = kcontrol->private_value & 0xffff;
560 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
561 long *valp = ucontrol->value.integer.value;
562 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
563 AC_VERB_GET_PIN_WIDGET_CONTROL,
566 /* Find enumerated value for current pinctl setting */
567 i = alc_pin_mode_min(dir);
568 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir))
570 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
574 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
575 struct snd_ctl_elem_value *ucontrol)
578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
579 hda_nid_t nid = kcontrol->private_value & 0xffff;
580 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
581 long val = *ucontrol->value.integer.value;
582 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
583 AC_VERB_GET_PIN_WIDGET_CONTROL,
586 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
587 val = alc_pin_mode_min(dir);
589 change = pinctl != alc_pin_mode_values[val];
591 /* Set pin mode to that requested */
592 snd_hda_codec_write_cache(codec, nid, 0,
593 AC_VERB_SET_PIN_WIDGET_CONTROL,
594 alc_pin_mode_values[val]);
596 /* Also enable the retasking pin's input/output as required
597 * for the requested pin mode. Enum values of 2 or less are
600 * Dynamically switching the input/output buffers probably
601 * reduces noise slightly (particularly on input) so we'll
602 * do it. However, having both input and output buffers
603 * enabled simultaneously doesn't seem to be problematic if
604 * this turns out to be necessary in the future.
607 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
608 HDA_AMP_MUTE, HDA_AMP_MUTE);
609 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
612 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
613 HDA_AMP_MUTE, HDA_AMP_MUTE);
614 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 #define ALC_PIN_MODE(xname, nid, dir) \
622 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
623 .info = alc_pin_mode_info, \
624 .get = alc_pin_mode_get, \
625 .put = alc_pin_mode_put, \
626 .private_value = nid | (dir<<16) }
628 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
629 * together using a mask with more than one bit set. This control is
630 * currently used only by the ALC260 test model. At this stage they are not
631 * needed for any "production" models.
633 #ifdef CONFIG_SND_DEBUG
634 #define alc_gpio_data_info snd_ctl_boolean_mono_info
636 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
637 struct snd_ctl_elem_value *ucontrol)
639 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
640 hda_nid_t nid = kcontrol->private_value & 0xffff;
641 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
642 long *valp = ucontrol->value.integer.value;
643 unsigned int val = snd_hda_codec_read(codec, nid, 0,
644 AC_VERB_GET_GPIO_DATA, 0x00);
646 *valp = (val & mask) != 0;
649 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
650 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long val = *ucontrol->value.integer.value;
657 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_GPIO_DATA,
661 /* Set/unset the masked GPIO bit(s) as needed */
662 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
667 snd_hda_codec_write_cache(codec, nid, 0,
668 AC_VERB_SET_GPIO_DATA, gpio_data);
672 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
673 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
674 .info = alc_gpio_data_info, \
675 .get = alc_gpio_data_get, \
676 .put = alc_gpio_data_put, \
677 .private_value = nid | (mask<<16) }
678 #endif /* CONFIG_SND_DEBUG */
680 /* A switch control to allow the enabling of the digital IO pins on the
681 * ALC260. This is incredibly simplistic; the intention of this control is
682 * to provide something in the test model allowing digital outputs to be
683 * identified if present. If models are found which can utilise these
684 * outputs a more complete mixer control can be devised for those models if
687 #ifdef CONFIG_SND_DEBUG
688 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
690 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
691 struct snd_ctl_elem_value *ucontrol)
693 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
694 hda_nid_t nid = kcontrol->private_value & 0xffff;
695 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
696 long *valp = ucontrol->value.integer.value;
697 unsigned int val = snd_hda_codec_read(codec, nid, 0,
698 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
700 *valp = (val & mask) != 0;
703 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
704 struct snd_ctl_elem_value *ucontrol)
707 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
708 hda_nid_t nid = kcontrol->private_value & 0xffff;
709 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
710 long val = *ucontrol->value.integer.value;
711 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
712 AC_VERB_GET_DIGI_CONVERT_1,
715 /* Set/unset the masked control bit(s) as needed */
716 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
721 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
726 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
727 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
728 .info = alc_spdif_ctrl_info, \
729 .get = alc_spdif_ctrl_get, \
730 .put = alc_spdif_ctrl_put, \
731 .private_value = nid | (mask<<16) }
732 #endif /* CONFIG_SND_DEBUG */
734 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
735 * Again, this is only used in the ALC26x test models to help identify when
736 * the EAPD line must be asserted for features to work.
738 #ifdef CONFIG_SND_DEBUG
739 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
741 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
742 struct snd_ctl_elem_value *ucontrol)
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
745 hda_nid_t nid = kcontrol->private_value & 0xffff;
746 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
747 long *valp = ucontrol->value.integer.value;
748 unsigned int val = snd_hda_codec_read(codec, nid, 0,
749 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
751 *valp = (val & mask) != 0;
755 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
756 struct snd_ctl_elem_value *ucontrol)
759 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
760 hda_nid_t nid = kcontrol->private_value & 0xffff;
761 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
762 long val = *ucontrol->value.integer.value;
763 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
764 AC_VERB_GET_EAPD_BTLENABLE,
767 /* Set/unset the masked control bit(s) as needed */
768 change = (!val ? 0 : mask) != (ctrl_data & mask);
773 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
779 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
780 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
781 .info = alc_eapd_ctrl_info, \
782 .get = alc_eapd_ctrl_get, \
783 .put = alc_eapd_ctrl_put, \
784 .private_value = nid | (mask<<16) }
785 #endif /* CONFIG_SND_DEBUG */
788 * set up the input pin config (depending on the given auto-pin type)
790 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
793 unsigned int val = PIN_IN;
795 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
797 pincap = snd_hda_query_pin_caps(codec, nid);
798 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
799 if (pincap & AC_PINCAP_VREF_80)
801 else if (pincap & AC_PINCAP_VREF_50)
803 else if (pincap & AC_PINCAP_VREF_100)
805 else if (pincap & AC_PINCAP_VREF_GRD)
808 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
813 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
815 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
817 spec->mixers[spec->num_mixers++] = mix;
820 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
822 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
824 spec->init_verbs[spec->num_init_verbs++] = verb;
827 #ifdef CONFIG_PROC_FS
831 static void print_realtek_coef(struct snd_info_buffer *buffer,
832 struct hda_codec *codec, hda_nid_t nid)
838 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
839 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
840 coeff = snd_hda_codec_read(codec, nid, 0,
841 AC_VERB_GET_COEF_INDEX, 0);
842 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
845 #define print_realtek_coef NULL
849 * set up from the preset table
851 static void setup_preset(struct alc_spec *spec,
852 const struct alc_config_preset *preset)
856 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
857 add_mixer(spec, preset->mixers[i]);
858 spec->cap_mixer = preset->cap_mixer;
859 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
861 add_verb(spec, preset->init_verbs[i]);
863 spec->channel_mode = preset->channel_mode;
864 spec->num_channel_mode = preset->num_channel_mode;
865 spec->need_dac_fix = preset->need_dac_fix;
866 spec->const_channel_count = preset->const_channel_count;
868 if (preset->const_channel_count)
869 spec->multiout.max_channels = preset->const_channel_count;
871 spec->multiout.max_channels = spec->channel_mode[0].channels;
872 spec->ext_channel_count = spec->channel_mode[0].channels;
874 spec->multiout.num_dacs = preset->num_dacs;
875 spec->multiout.dac_nids = preset->dac_nids;
876 spec->multiout.dig_out_nid = preset->dig_out_nid;
877 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
878 spec->multiout.hp_nid = preset->hp_nid;
880 spec->num_mux_defs = preset->num_mux_defs;
881 if (!spec->num_mux_defs)
882 spec->num_mux_defs = 1;
883 spec->input_mux = preset->input_mux;
885 spec->num_adc_nids = preset->num_adc_nids;
886 spec->adc_nids = preset->adc_nids;
887 spec->capsrc_nids = preset->capsrc_nids;
888 spec->dig_in_nid = preset->dig_in_nid;
890 spec->unsol_event = preset->unsol_event;
891 spec->init_hook = preset->init_hook;
892 #ifdef CONFIG_SND_HDA_POWER_SAVE
893 spec->loopback.amplist = preset->loopbacks;
897 /* Enable GPIO mask and set output */
898 static struct hda_verb alc_gpio1_init_verbs[] = {
899 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
900 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
901 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
905 static struct hda_verb alc_gpio2_init_verbs[] = {
906 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
907 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
908 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
912 static struct hda_verb alc_gpio3_init_verbs[] = {
913 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
914 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
915 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
920 * Fix hardware PLL issue
921 * On some codecs, the analog PLL gating control must be off while
922 * the default value is 1.
924 static void alc_fix_pll(struct hda_codec *codec)
926 struct alc_spec *spec = codec->spec;
931 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
933 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
934 AC_VERB_GET_PROC_COEF, 0);
935 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
937 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
938 val & ~(1 << spec->pll_coef_bit));
941 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
942 unsigned int coef_idx, unsigned int coef_bit)
944 struct alc_spec *spec = codec->spec;
946 spec->pll_coef_idx = coef_idx;
947 spec->pll_coef_bit = coef_bit;
951 static void alc_automute_pin(struct hda_codec *codec)
953 struct alc_spec *spec = codec->spec;
954 unsigned int present;
955 unsigned int nid = spec->autocfg.hp_pins[0];
958 /* need to execute and sync at first */
959 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
960 present = snd_hda_codec_read(codec, nid, 0,
961 AC_VERB_GET_PIN_SENSE, 0);
962 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
963 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
964 nid = spec->autocfg.speaker_pins[i];
967 snd_hda_codec_write(codec, nid, 0,
968 AC_VERB_SET_PIN_WIDGET_CONTROL,
969 spec->jack_present ? 0 : PIN_OUT);
973 #if 0 /* it's broken in some acses -- temporarily disabled */
974 static void alc_mic_automute(struct hda_codec *codec)
976 struct alc_spec *spec = codec->spec;
977 unsigned int present;
978 unsigned int mic_nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
979 unsigned int fmic_nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
980 unsigned int mix_nid = spec->capsrc_nids[0];
981 unsigned int capsrc_idx_mic, capsrc_idx_fmic;
983 capsrc_idx_mic = mic_nid - 0x18;
984 capsrc_idx_fmic = fmic_nid - 0x18;
985 present = snd_hda_codec_read(codec, mic_nid, 0,
986 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
987 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
988 0x7000 | (capsrc_idx_mic << 8) | (present ? 0 : 0x80));
989 snd_hda_codec_write(codec, mix_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
990 0x7000 | (capsrc_idx_fmic << 8) | (present ? 0x80 : 0));
991 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, capsrc_idx_fmic,
992 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
995 #define alc_mic_automute(codec) do {} while(0) /* NOP */
996 #endif /* disabled */
998 /* unsolicited event for HP jack sensing */
999 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1001 if (codec->vendor_id == 0x10ec0880)
1006 case ALC880_HP_EVENT:
1007 alc_automute_pin(codec);
1009 case ALC880_MIC_EVENT:
1010 alc_mic_automute(codec);
1015 static void alc_inithook(struct hda_codec *codec)
1017 alc_automute_pin(codec);
1018 alc_mic_automute(codec);
1021 /* additional initialization for ALC888 variants */
1022 static void alc888_coef_init(struct hda_codec *codec)
1026 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1027 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1028 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1029 if ((tmp & 0xf0) == 0x20)
1031 snd_hda_codec_read(codec, 0x20, 0,
1032 AC_VERB_SET_PROC_COEF, 0x830);
1035 snd_hda_codec_read(codec, 0x20, 0,
1036 AC_VERB_SET_PROC_COEF, 0x3030);
1039 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1044 case ALC_INIT_GPIO1:
1045 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1047 case ALC_INIT_GPIO2:
1048 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1050 case ALC_INIT_GPIO3:
1051 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1053 case ALC_INIT_DEFAULT:
1054 switch (codec->vendor_id) {
1056 snd_hda_codec_write(codec, 0x0f, 0,
1057 AC_VERB_SET_EAPD_BTLENABLE, 2);
1058 snd_hda_codec_write(codec, 0x10, 0,
1059 AC_VERB_SET_EAPD_BTLENABLE, 2);
1071 snd_hda_codec_write(codec, 0x14, 0,
1072 AC_VERB_SET_EAPD_BTLENABLE, 2);
1073 snd_hda_codec_write(codec, 0x15, 0,
1074 AC_VERB_SET_EAPD_BTLENABLE, 2);
1077 switch (codec->vendor_id) {
1079 snd_hda_codec_write(codec, 0x1a, 0,
1080 AC_VERB_SET_COEF_INDEX, 7);
1081 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1082 AC_VERB_GET_PROC_COEF, 0);
1083 snd_hda_codec_write(codec, 0x1a, 0,
1084 AC_VERB_SET_COEF_INDEX, 7);
1085 snd_hda_codec_write(codec, 0x1a, 0,
1086 AC_VERB_SET_PROC_COEF,
1096 snd_hda_codec_write(codec, 0x20, 0,
1097 AC_VERB_SET_COEF_INDEX, 7);
1098 tmp = snd_hda_codec_read(codec, 0x20, 0,
1099 AC_VERB_GET_PROC_COEF, 0);
1100 snd_hda_codec_write(codec, 0x20, 0,
1101 AC_VERB_SET_COEF_INDEX, 7);
1102 snd_hda_codec_write(codec, 0x20, 0,
1103 AC_VERB_SET_PROC_COEF,
1107 alc888_coef_init(codec);
1111 snd_hda_codec_write(codec, 0x20, 0,
1112 AC_VERB_SET_COEF_INDEX, 7);
1113 tmp = snd_hda_codec_read(codec, 0x20, 0,
1114 AC_VERB_GET_PROC_COEF, 0);
1115 snd_hda_codec_write(codec, 0x20, 0,
1116 AC_VERB_SET_COEF_INDEX, 7);
1117 snd_hda_codec_write(codec, 0x20, 0,
1118 AC_VERB_SET_PROC_COEF,
1126 static void alc_init_auto_hp(struct hda_codec *codec)
1128 struct alc_spec *spec = codec->spec;
1130 if (!spec->autocfg.hp_pins[0])
1133 if (!spec->autocfg.speaker_pins[0]) {
1134 if (spec->autocfg.line_out_pins[0] &&
1135 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1136 spec->autocfg.speaker_pins[0] =
1137 spec->autocfg.line_out_pins[0];
1142 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1143 spec->autocfg.hp_pins[0]);
1144 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1145 AC_VERB_SET_UNSOLICITED_ENABLE,
1146 AC_USRSP_EN | ALC880_HP_EVENT);
1147 spec->unsol_event = alc_sku_unsol_event;
1150 /* check subsystem ID and set up device-specific initialization;
1151 * return 1 if initialized, 0 if invalid SSID
1153 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1154 * 31 ~ 16 : Manufacture ID
1156 * 7 ~ 0 : Assembly ID
1157 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1159 static int alc_subsystem_id(struct hda_codec *codec,
1160 hda_nid_t porta, hda_nid_t porte,
1163 unsigned int ass, tmp, i;
1165 struct alc_spec *spec = codec->spec;
1167 ass = codec->subsystem_id & 0xffff;
1168 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1171 /* invalid SSID, check the special NID pin defcfg instead */
1173 * 31~30 : port conetcivity
1176 * 19~16 : Check sum (15:1)
1181 if (codec->vendor_id == 0x10ec0260)
1183 ass = snd_hda_codec_get_pincfg(codec, nid);
1184 snd_printd("realtek: No valid SSID, "
1185 "checking pincfg 0x%08x for NID 0x%x\n",
1187 if (!(ass & 1) && !(ass & 0x100000))
1189 if ((ass >> 30) != 1) /* no physical connection */
1194 for (i = 1; i < 16; i++) {
1198 if (((ass >> 16) & 0xf) != tmp)
1201 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1202 ass & 0xffff, codec->vendor_id);
1206 * 2 : 0 --> Desktop, 1 --> Laptop
1207 * 3~5 : External Amplifier control
1210 tmp = (ass & 0x38) >> 3; /* external Amp control */
1213 spec->init_amp = ALC_INIT_GPIO1;
1216 spec->init_amp = ALC_INIT_GPIO2;
1219 spec->init_amp = ALC_INIT_GPIO3;
1222 spec->init_amp = ALC_INIT_DEFAULT;
1226 /* is laptop or Desktop and enable the function "Mute internal speaker
1227 * when the external headphone out jack is plugged"
1229 if (!(ass & 0x8000))
1232 * 10~8 : Jack location
1233 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1235 * 15 : 1 --> enable the function "Mute internal speaker
1236 * when the external headphone out jack is plugged"
1238 if (!spec->autocfg.hp_pins[0]) {
1239 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1241 spec->autocfg.hp_pins[0] = porta;
1243 spec->autocfg.hp_pins[0] = porte;
1245 spec->autocfg.hp_pins[0] = portd;
1250 alc_init_auto_hp(codec);
1254 static void alc_ssid_check(struct hda_codec *codec,
1255 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1257 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1258 struct alc_spec *spec = codec->spec;
1259 snd_printd("realtek: "
1260 "Enable default setup for auto mode as fallback\n");
1261 spec->init_amp = ALC_INIT_DEFAULT;
1262 alc_init_auto_hp(codec);
1267 * Fix-up pin default configurations
1275 static void alc_fix_pincfg(struct hda_codec *codec,
1276 const struct snd_pci_quirk *quirk,
1277 const struct alc_pincfg **pinfix)
1279 const struct alc_pincfg *cfg;
1281 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1285 cfg = pinfix[quirk->value];
1286 for (; cfg->nid; cfg++)
1287 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1297 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1298 /* Mic-in jack as mic in */
1299 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1300 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1301 /* Line-in jack as Line in */
1302 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1303 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1304 /* Line-Out as Front */
1305 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1312 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1313 /* Mic-in jack as mic in */
1314 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1315 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1316 /* Line-in jack as Surround */
1317 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1318 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1319 /* Line-Out as Front */
1320 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1327 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1328 /* Mic-in jack as CLFE */
1329 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1330 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1331 /* Line-in jack as Surround */
1332 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1333 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1334 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1335 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1342 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1343 /* Mic-in jack as CLFE */
1344 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1345 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1346 /* Line-in jack as Surround */
1347 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1348 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1349 /* Line-Out as Side */
1350 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1354 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1355 { 2, alc888_4ST_ch2_intel_init },
1356 { 4, alc888_4ST_ch4_intel_init },
1357 { 6, alc888_4ST_ch6_intel_init },
1358 { 8, alc888_4ST_ch8_intel_init },
1362 * ALC888 Fujitsu Siemens Amillo xa3530
1365 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1366 /* Front Mic: set to PIN_IN (empty by default) */
1367 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1368 /* Connect Internal HP to Front */
1369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1370 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1371 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1372 /* Connect Bass HP to Front */
1373 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1374 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1375 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1376 /* Connect Line-Out side jack (SPDIF) to Side */
1377 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1378 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1379 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1380 /* Connect Mic jack to CLFE */
1381 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1382 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1383 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1384 /* Connect Line-in jack to Surround */
1385 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1386 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1387 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1388 /* Connect HP out jack to Front */
1389 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1390 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1391 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1392 /* Enable unsolicited event for HP jack and Line-out jack */
1393 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1394 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1398 static void alc_automute_amp(struct hda_codec *codec)
1400 struct alc_spec *spec = codec->spec;
1401 unsigned int val, mute;
1405 spec->jack_present = 0;
1406 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1407 nid = spec->autocfg.hp_pins[i];
1410 val = snd_hda_codec_read(codec, nid, 0,
1411 AC_VERB_GET_PIN_SENSE, 0);
1412 if (val & AC_PINSENSE_PRESENCE) {
1413 spec->jack_present = 1;
1418 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1419 /* Toggle internal speakers muting */
1420 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1421 nid = spec->autocfg.speaker_pins[i];
1424 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1425 HDA_AMP_MUTE, mute);
1429 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1432 if (codec->vendor_id == 0x10ec0880)
1436 if (res == ALC880_HP_EVENT)
1437 alc_automute_amp(codec);
1440 static void alc888_fujitsu_xa3530_init_hook(struct hda_codec *codec)
1442 struct alc_spec *spec = codec->spec;
1444 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1445 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1446 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1447 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1448 alc_automute_amp(codec);
1452 * ALC888 Acer Aspire 4930G model
1455 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1456 /* Front Mic: set to PIN_IN (empty by default) */
1457 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1458 /* Unselect Front Mic by default in input mixer 3 */
1459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1460 /* Enable unsolicited event for HP jack */
1461 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1462 /* Connect Internal HP to front */
1463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1464 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1465 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1466 /* Connect HP out to front */
1467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1474 * ALC889 Acer Aspire 8930G model
1477 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1478 /* Front Mic: set to PIN_IN (empty by default) */
1479 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1480 /* Unselect Front Mic by default in input mixer 3 */
1481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1482 /* Enable unsolicited event for HP jack */
1483 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1484 /* Connect Internal Front to Front */
1485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1486 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1487 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1488 /* Connect Internal Rear to Rear */
1489 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1490 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1491 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1492 /* Connect Internal CLFE to CLFE */
1493 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1494 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1496 /* Connect HP out to Front */
1497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1498 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1499 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1500 /* Enable all DACs */
1501 /* DAC DISABLE/MUTE 1? */
1502 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1503 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1504 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1505 /* DAC DISABLE/MUTE 2? */
1506 /* some bit here disables the other DACs. Init=0x4900 */
1507 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1508 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1509 /* Enable amplifiers */
1510 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1511 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1513 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1514 * which makes the stereo useless. However, either the mic or the ALC889
1515 * makes the signal become a difference/sum signal instead of standard
1516 * stereo, which is annoying. So instead we flip this bit which makes the
1517 * codec replicate the sum signal to both channels, turning it into a
1520 /* DMIC_CONTROL? Init value = 0x0001 */
1521 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1522 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1526 static struct hda_input_mux alc888_2_capture_sources[2] = {
1527 /* Front mic only available on one ADC */
1534 { "Front Mic", 0xb },
1547 static struct hda_input_mux alc889_capture_sources[3] = {
1548 /* Digital mic only available on first "ADC" */
1555 { "Front Mic", 0xb },
1556 { "Input Mix", 0xa },
1565 { "Input Mix", 0xa },
1574 { "Input Mix", 0xa },
1579 static struct snd_kcontrol_new alc888_base_mixer[] = {
1580 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1581 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1582 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1583 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1584 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1586 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1587 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1588 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1589 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1590 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1591 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1592 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1593 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1594 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1595 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1596 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1597 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1601 static void alc888_acer_aspire_4930g_init_hook(struct hda_codec *codec)
1603 struct alc_spec *spec = codec->spec;
1605 spec->autocfg.hp_pins[0] = 0x15;
1606 spec->autocfg.speaker_pins[0] = 0x14;
1607 alc_automute_amp(codec);
1610 static void alc889_acer_aspire_8930g_init_hook(struct hda_codec *codec)
1612 struct alc_spec *spec = codec->spec;
1614 spec->autocfg.hp_pins[0] = 0x15;
1615 spec->autocfg.speaker_pins[0] = 0x14;
1616 spec->autocfg.speaker_pins[1] = 0x16;
1617 spec->autocfg.speaker_pins[2] = 0x1b;
1618 alc_automute_amp(codec);
1622 * ALC880 3-stack model
1624 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1625 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1626 * F-Mic = 0x1b, HP = 0x19
1629 static hda_nid_t alc880_dac_nids[4] = {
1630 /* front, rear, clfe, rear_surr */
1631 0x02, 0x05, 0x04, 0x03
1634 static hda_nid_t alc880_adc_nids[3] = {
1639 /* The datasheet says the node 0x07 is connected from inputs,
1640 * but it shows zero connection in the real implementation on some devices.
1641 * Note: this is a 915GAV bug, fixed on 915GLV
1643 static hda_nid_t alc880_adc_nids_alt[2] = {
1648 #define ALC880_DIGOUT_NID 0x06
1649 #define ALC880_DIGIN_NID 0x0a
1651 static struct hda_input_mux alc880_capture_source = {
1655 { "Front Mic", 0x3 },
1661 /* channel source setting (2/6 channel selection for 3-stack) */
1663 static struct hda_verb alc880_threestack_ch2_init[] = {
1664 /* set line-in to input, mute it */
1665 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1666 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1667 /* set mic-in to input vref 80%, mute it */
1668 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1669 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1674 static struct hda_verb alc880_threestack_ch6_init[] = {
1675 /* set line-in to output, unmute it */
1676 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1677 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1678 /* set mic-in to output, unmute it */
1679 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1680 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1684 static struct hda_channel_mode alc880_threestack_modes[2] = {
1685 { 2, alc880_threestack_ch2_init },
1686 { 6, alc880_threestack_ch6_init },
1689 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1690 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1691 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1692 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1693 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1694 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1695 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1696 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1697 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1698 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1699 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1700 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1701 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1702 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1703 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1704 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1705 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1708 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1709 .name = "Channel Mode",
1710 .info = alc_ch_mode_info,
1711 .get = alc_ch_mode_get,
1712 .put = alc_ch_mode_put,
1717 /* capture mixer elements */
1718 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1719 struct snd_ctl_elem_info *uinfo)
1721 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1722 struct alc_spec *spec = codec->spec;
1725 mutex_lock(&codec->control_mutex);
1726 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1728 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1729 mutex_unlock(&codec->control_mutex);
1733 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1734 unsigned int size, unsigned int __user *tlv)
1736 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1737 struct alc_spec *spec = codec->spec;
1740 mutex_lock(&codec->control_mutex);
1741 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1743 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1744 mutex_unlock(&codec->control_mutex);
1748 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1749 struct snd_ctl_elem_value *ucontrol);
1751 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1752 struct snd_ctl_elem_value *ucontrol,
1755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1756 struct alc_spec *spec = codec->spec;
1757 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1760 mutex_lock(&codec->control_mutex);
1761 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1763 err = func(kcontrol, ucontrol);
1764 mutex_unlock(&codec->control_mutex);
1768 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1769 struct snd_ctl_elem_value *ucontrol)
1771 return alc_cap_getput_caller(kcontrol, ucontrol,
1772 snd_hda_mixer_amp_volume_get);
1775 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1776 struct snd_ctl_elem_value *ucontrol)
1778 return alc_cap_getput_caller(kcontrol, ucontrol,
1779 snd_hda_mixer_amp_volume_put);
1782 /* capture mixer elements */
1783 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1785 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1786 struct snd_ctl_elem_value *ucontrol)
1788 return alc_cap_getput_caller(kcontrol, ucontrol,
1789 snd_hda_mixer_amp_switch_get);
1792 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1793 struct snd_ctl_elem_value *ucontrol)
1795 return alc_cap_getput_caller(kcontrol, ucontrol,
1796 snd_hda_mixer_amp_switch_put);
1799 #define _DEFINE_CAPMIX(num) \
1801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1802 .name = "Capture Switch", \
1803 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1805 .info = alc_cap_sw_info, \
1806 .get = alc_cap_sw_get, \
1807 .put = alc_cap_sw_put, \
1810 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1811 .name = "Capture Volume", \
1812 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1813 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1814 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1816 .info = alc_cap_vol_info, \
1817 .get = alc_cap_vol_get, \
1818 .put = alc_cap_vol_put, \
1819 .tlv = { .c = alc_cap_vol_tlv }, \
1822 #define _DEFINE_CAPSRC(num) \
1824 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1825 /* .name = "Capture Source", */ \
1826 .name = "Input Source", \
1828 .info = alc_mux_enum_info, \
1829 .get = alc_mux_enum_get, \
1830 .put = alc_mux_enum_put, \
1833 #define DEFINE_CAPMIX(num) \
1834 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1835 _DEFINE_CAPMIX(num), \
1836 _DEFINE_CAPSRC(num), \
1840 #define DEFINE_CAPMIX_NOSRC(num) \
1841 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1842 _DEFINE_CAPMIX(num), \
1846 /* up to three ADCs */
1850 DEFINE_CAPMIX_NOSRC(1);
1851 DEFINE_CAPMIX_NOSRC(2);
1852 DEFINE_CAPMIX_NOSRC(3);
1855 * ALC880 5-stack model
1857 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
1859 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
1860 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
1863 /* additional mixers to alc880_three_stack_mixer */
1864 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
1865 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1866 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
1870 /* channel source setting (6/8 channel selection for 5-stack) */
1872 static struct hda_verb alc880_fivestack_ch6_init[] = {
1873 /* set line-in to input, mute it */
1874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1880 static struct hda_verb alc880_fivestack_ch8_init[] = {
1881 /* set line-in to output, unmute it */
1882 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1883 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1887 static struct hda_channel_mode alc880_fivestack_modes[2] = {
1888 { 6, alc880_fivestack_ch6_init },
1889 { 8, alc880_fivestack_ch8_init },
1894 * ALC880 6-stack model
1896 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
1897 * Side = 0x05 (0x0f)
1898 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
1899 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
1902 static hda_nid_t alc880_6st_dac_nids[4] = {
1903 /* front, rear, clfe, rear_surr */
1904 0x02, 0x03, 0x04, 0x05
1907 static struct hda_input_mux alc880_6stack_capture_source = {
1911 { "Front Mic", 0x1 },
1917 /* fixed 8-channels */
1918 static struct hda_channel_mode alc880_sixstack_modes[1] = {
1922 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
1923 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1924 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1925 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1926 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1927 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1928 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1929 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1930 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1931 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1932 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1939 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1940 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1943 .name = "Channel Mode",
1944 .info = alc_ch_mode_info,
1945 .get = alc_ch_mode_get,
1946 .put = alc_ch_mode_put,
1955 * W810 has rear IO for:
1958 * Center/LFE (DAC 04)
1961 * The system also has a pair of internal speakers, and a headphone jack.
1962 * These are both connected to Line2 on the codec, hence to DAC 02.
1964 * There is a variable resistor to control the speaker or headphone
1965 * volume. This is a hardware-only device without a software API.
1967 * Plugging headphones in will disable the internal speakers. This is
1968 * implemented in hardware, not via the driver using jack sense. In
1969 * a similar fashion, plugging into the rear socket marked "front" will
1970 * disable both the speakers and headphones.
1972 * For input, there's a microphone jack, and an "audio in" jack.
1973 * These may not do anything useful with this driver yet, because I
1974 * haven't setup any initialization verbs for these yet...
1977 static hda_nid_t alc880_w810_dac_nids[3] = {
1978 /* front, rear/surround, clfe */
1982 /* fixed 6 channels */
1983 static struct hda_channel_mode alc880_w810_modes[1] = {
1987 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
1988 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
1989 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1990 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1991 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1992 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1993 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1994 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1995 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1996 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1997 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2005 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2006 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2010 static hda_nid_t alc880_z71v_dac_nids[1] = {
2013 #define ALC880_Z71V_HP_DAC 0x03
2015 /* fixed 2 channels */
2016 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2020 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2021 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2022 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2023 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2024 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2025 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2026 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2027 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2028 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2034 * ALC880 F1734 model
2036 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2037 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2040 static hda_nid_t alc880_f1734_dac_nids[1] = {
2043 #define ALC880_F1734_HP_DAC 0x02
2045 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2046 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2047 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2048 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2049 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2050 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2051 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2057 static struct hda_input_mux alc880_f1734_capture_source = {
2069 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2070 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2071 * Mic = 0x18, Line = 0x1a
2074 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2075 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2077 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2078 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2079 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2080 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2081 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2082 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2083 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2084 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2085 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2086 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2087 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2088 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2089 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2090 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2094 .name = "Channel Mode",
2095 .info = alc_ch_mode_info,
2096 .get = alc_ch_mode_get,
2097 .put = alc_ch_mode_put,
2103 * ALC880 ASUS W1V model
2105 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2106 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2107 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2110 /* additional mixers to alc880_asus_mixer */
2111 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2112 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2113 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2118 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2120 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2123 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2126 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2127 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2132 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2133 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2134 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2135 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2138 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2139 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2140 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2151 .name = "Channel Mode",
2152 .info = alc_ch_mode_info,
2153 .get = alc_ch_mode_get,
2154 .put = alc_ch_mode_put,
2159 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2160 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2161 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2163 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2164 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2165 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2166 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2167 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2168 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2169 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2173 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2174 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2175 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2176 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2177 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2178 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2179 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2184 * virtual master controls
2188 * slave controls for virtual master
2190 static const char *alc_slave_vols[] = {
2191 "Front Playback Volume",
2192 "Surround Playback Volume",
2193 "Center Playback Volume",
2194 "LFE Playback Volume",
2195 "Side Playback Volume",
2196 "Headphone Playback Volume",
2197 "Speaker Playback Volume",
2198 "Mono Playback Volume",
2199 "Line-Out Playback Volume",
2200 "PCM Playback Volume",
2204 static const char *alc_slave_sws[] = {
2205 "Front Playback Switch",
2206 "Surround Playback Switch",
2207 "Center Playback Switch",
2208 "LFE Playback Switch",
2209 "Side Playback Switch",
2210 "Headphone Playback Switch",
2211 "Speaker Playback Switch",
2212 "Mono Playback Switch",
2213 "IEC958 Playback Switch",
2218 * build control elements
2221 static void alc_free_kctls(struct hda_codec *codec);
2223 /* additional beep mixers; the actual parameters are overwritten at build */
2224 static struct snd_kcontrol_new alc_beep_mixer[] = {
2225 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2226 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT),
2230 static int alc_build_controls(struct hda_codec *codec)
2232 struct alc_spec *spec = codec->spec;
2236 for (i = 0; i < spec->num_mixers; i++) {
2237 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2241 if (spec->cap_mixer) {
2242 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2246 if (spec->multiout.dig_out_nid) {
2247 err = snd_hda_create_spdif_out_ctls(codec,
2248 spec->multiout.dig_out_nid);
2251 if (!spec->no_analog) {
2252 err = snd_hda_create_spdif_share_sw(codec,
2256 spec->multiout.share_spdif = 1;
2259 if (spec->dig_in_nid) {
2260 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2265 /* create beep controls if needed */
2266 if (spec->beep_amp) {
2267 struct snd_kcontrol_new *knew;
2268 for (knew = alc_beep_mixer; knew->name; knew++) {
2269 struct snd_kcontrol *kctl;
2270 kctl = snd_ctl_new1(knew, codec);
2273 kctl->private_value = spec->beep_amp;
2274 err = snd_hda_ctl_add(codec, kctl);
2280 /* if we have no master control, let's create it */
2281 if (!spec->no_analog &&
2282 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2283 unsigned int vmaster_tlv[4];
2284 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2285 HDA_OUTPUT, vmaster_tlv);
2286 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2287 vmaster_tlv, alc_slave_vols);
2291 if (!spec->no_analog &&
2292 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2293 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2294 NULL, alc_slave_sws);
2299 alc_free_kctls(codec); /* no longer needed */
2305 * initialize the codec volumes, etc
2309 * generic initialization of ADC, input mixers and output mixers
2311 static struct hda_verb alc880_volume_init_verbs[] = {
2313 * Unmute ADC0-2 and set the default input to mic-in
2315 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2316 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2317 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2318 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2319 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2320 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2322 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2324 * Note: PASD motherboards uses the Line In 2 as the input for front
2327 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2332 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2333 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2337 * Set up output mixers (0x0c - 0x0f)
2339 /* set vol=0 to output mixers */
2340 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2343 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2344 /* set up input amps for analog loopback */
2345 /* Amp Indices: DAC = 0, mixer = 1 */
2346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2347 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2350 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2351 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2352 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2353 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2359 * 3-stack pin configuration:
2360 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2362 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2364 * preset connection lists of input pins
2365 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2367 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2368 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2369 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2372 * Set pin mode and muting
2374 /* set front pin widgets 0x14 for output */
2375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2376 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2377 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2378 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2379 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2380 /* Mic2 (as headphone out) for HP output */
2381 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2382 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2383 /* Line In pin widget for input */
2384 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2385 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2386 /* Line2 (as front mic) pin widget for input and vref at 80% */
2387 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2388 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2389 /* CD pin widget for input */
2390 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2396 * 5-stack pin configuration:
2397 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2398 * line-in/side = 0x1a, f-mic = 0x1b
2400 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2402 * preset connection lists of input pins
2403 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2405 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2406 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2409 * Set pin mode and muting
2411 /* set pin widgets 0x14-0x17 for output */
2412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2414 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2415 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2416 /* unmute pins for output (no gain on this amp) */
2417 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2419 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2420 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2422 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2423 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2425 /* Mic2 (as headphone out) for HP output */
2426 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2428 /* Line In pin widget for input */
2429 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2431 /* Line2 (as front mic) pin widget for input and vref at 80% */
2432 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2433 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2434 /* CD pin widget for input */
2435 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2441 * W810 pin configuration:
2442 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2444 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2445 /* hphone/speaker input selector: front DAC */
2446 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2448 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2450 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2451 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2452 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2456 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2462 * Z71V pin configuration:
2463 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2465 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2471 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2472 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2474 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2480 * 6-stack pin configuration:
2481 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2482 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2484 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2485 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
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},
2493 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2494 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2496 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2501 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2502 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2503 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2504 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2510 * Uniwill pin configuration:
2511 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2514 static struct hda_verb alc880_uniwill_init_verbs[] = {
2515 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2517 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2519 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2521 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2522 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2523 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2524 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2532 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2533 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2534 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2535 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2536 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2537 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2538 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2539 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2540 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2542 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2543 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2550 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2552 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2553 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2556 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2557 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2559 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2560 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2568 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2570 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2571 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2572 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2573 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2575 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2576 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2581 static struct hda_verb alc880_beep_init_verbs[] = {
2582 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2586 /* auto-toggle front mic */
2587 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2589 unsigned int present;
2592 present = snd_hda_codec_read(codec, 0x18, 0,
2593 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2594 bits = present ? HDA_AMP_MUTE : 0;
2595 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2598 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2600 struct alc_spec *spec = codec->spec;
2602 spec->autocfg.hp_pins[0] = 0x14;
2603 spec->autocfg.speaker_pins[0] = 0x15;
2604 spec->autocfg.speaker_pins[0] = 0x16;
2605 alc_automute_amp(codec);
2606 alc880_uniwill_mic_automute(codec);
2609 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2612 /* Looks like the unsol event is incompatible with the standard
2613 * definition. 4bit tag is placed at 28 bit!
2615 switch (res >> 28) {
2616 case ALC880_MIC_EVENT:
2617 alc880_uniwill_mic_automute(codec);
2620 alc_automute_amp_unsol_event(codec, res);
2625 static void alc880_uniwill_p53_init_hook(struct hda_codec *codec)
2627 struct alc_spec *spec = codec->spec;
2629 spec->autocfg.hp_pins[0] = 0x14;
2630 spec->autocfg.speaker_pins[0] = 0x15;
2631 alc_automute_amp(codec);
2634 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2636 unsigned int present;
2638 present = snd_hda_codec_read(codec, 0x21, 0,
2639 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2640 present &= HDA_AMP_VOLMASK;
2641 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2642 HDA_AMP_VOLMASK, present);
2643 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2644 HDA_AMP_VOLMASK, present);
2647 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2650 /* Looks like the unsol event is incompatible with the standard
2651 * definition. 4bit tag is placed at 28 bit!
2653 if ((res >> 28) == ALC880_DCVOL_EVENT)
2654 alc880_uniwill_p53_dcvol_automute(codec);
2656 alc_automute_amp_unsol_event(codec, res);
2660 * F1734 pin configuration:
2661 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2663 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2664 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2665 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2666 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2667 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2668 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2670 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2671 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2675 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2678 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2679 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2683 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2685 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2686 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2692 * ASUS pin configuration:
2693 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2695 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2696 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2697 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2698 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2699 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2701 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2702 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2704 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2705 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2706 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2707 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2708 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2710 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2712 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2714 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2715 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2716 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2717 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2718 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2723 /* Enable GPIO mask and set output */
2724 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
2725 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
2726 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
2728 /* Clevo m520g init */
2729 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
2730 /* headphone output */
2731 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2736 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2737 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2740 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 /* Mic1 (rear panel) */
2742 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2743 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 /* Mic2 (front panel) */
2745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2746 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2750 /* change to EAPD mode */
2751 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2752 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2757 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
2758 /* change to EAPD mode */
2759 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2760 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
2762 /* Headphone output */
2763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2765 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2766 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2768 /* Line In pin widget for input */
2769 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2770 /* CD pin widget for input */
2771 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2772 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2773 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2775 /* change to EAPD mode */
2776 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2777 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
2783 * LG m1 express dual
2786 * Rear Line-In/Out (blue): 0x14
2787 * Build-in Mic-In: 0x15
2789 * HP-Out (green): 0x1b
2790 * Mic-In/Out (red): 0x19
2794 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
2795 static hda_nid_t alc880_lg_dac_nids[3] = {
2799 /* seems analog CD is not working */
2800 static struct hda_input_mux alc880_lg_capture_source = {
2805 { "Internal Mic", 0x6 },
2809 /* 2,4,6 channel modes */
2810 static struct hda_verb alc880_lg_ch2_init[] = {
2811 /* set line-in and mic-in to input */
2812 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2813 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2817 static struct hda_verb alc880_lg_ch4_init[] = {
2818 /* set line-in to out and mic-in to input */
2819 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2820 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2824 static struct hda_verb alc880_lg_ch6_init[] = {
2825 /* set line-in and mic-in to output */
2826 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2827 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
2831 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
2832 { 2, alc880_lg_ch2_init },
2833 { 4, alc880_lg_ch4_init },
2834 { 6, alc880_lg_ch6_init },
2837 static struct snd_kcontrol_new alc880_lg_mixer[] = {
2838 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2839 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
2840 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2841 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
2842 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
2843 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2844 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2845 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2848 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
2849 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
2850 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
2851 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
2853 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2854 .name = "Channel Mode",
2855 .info = alc_ch_mode_info,
2856 .get = alc_ch_mode_get,
2857 .put = alc_ch_mode_put,
2862 static struct hda_verb alc880_lg_init_verbs[] = {
2863 /* set capture source to mic-in */
2864 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2865 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2866 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2867 /* mute all amp mixer inputs */
2868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
2869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2871 /* line-in to input */
2872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2873 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2878 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2879 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2880 /* mic-in to input */
2881 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
2882 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2883 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2885 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
2886 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2887 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2889 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2893 /* toggle speaker-output according to the hp-jack state */
2894 static void alc880_lg_init_hook(struct hda_codec *codec)
2896 struct alc_spec *spec = codec->spec;
2898 spec->autocfg.hp_pins[0] = 0x1b;
2899 spec->autocfg.speaker_pins[0] = 0x17;
2900 alc_automute_amp(codec);
2909 * Built-in Mic-In: 0x19
2915 static struct hda_input_mux alc880_lg_lw_capture_source = {
2919 { "Internal Mic", 0x1 },
2924 #define alc880_lg_lw_modes alc880_threestack_modes
2926 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
2927 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2928 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2929 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2930 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2931 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2932 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2933 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2934 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2935 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2936 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2939 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
2940 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
2942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2943 .name = "Channel Mode",
2944 .info = alc_ch_mode_info,
2945 .get = alc_ch_mode_get,
2946 .put = alc_ch_mode_put,
2951 static struct hda_verb alc880_lg_lw_init_verbs[] = {
2952 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2953 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2954 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2956 /* set capture source to mic-in */
2957 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2958 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2960 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2963 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2965 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2966 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2967 /* mic-in to input */
2968 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2969 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2974 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2978 /* toggle speaker-output according to the hp-jack state */
2979 static void alc880_lg_lw_init_hook(struct hda_codec *codec)
2981 struct alc_spec *spec = codec->spec;
2983 spec->autocfg.hp_pins[0] = 0x1b;
2984 spec->autocfg.speaker_pins[0] = 0x14;
2985 alc_automute_amp(codec);
2988 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
2989 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2990 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
2991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2992 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2993 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2994 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
2998 static struct hda_input_mux alc880_medion_rim_capture_source = {
3002 { "Internal Mic", 0x1 },
3006 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3007 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3009 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3012 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3013 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3014 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3015 /* Mic2 (as headphone out) for HP output */
3016 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3017 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3018 /* Internal Speaker */
3019 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3020 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3023 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3025 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3029 /* toggle speaker-output according to the hp-jack state */
3030 static void alc880_medion_rim_automute(struct hda_codec *codec)
3032 struct alc_spec *spec = codec->spec;
3033 alc_automute_amp(codec);
3035 if (spec->jack_present)
3036 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3038 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3041 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3044 /* Looks like the unsol event is incompatible with the standard
3045 * definition. 4bit tag is placed at 28 bit!
3047 if ((res >> 28) == ALC880_HP_EVENT)
3048 alc880_medion_rim_automute(codec);
3051 static void alc880_medion_rim_init_hook(struct hda_codec *codec)
3053 struct alc_spec *spec = codec->spec;
3055 spec->autocfg.hp_pins[0] = 0x14;
3056 spec->autocfg.speaker_pins[0] = 0x1b;
3057 alc880_medion_rim_automute(codec);
3060 #ifdef CONFIG_SND_HDA_POWER_SAVE
3061 static struct hda_amp_list alc880_loopbacks[] = {
3062 { 0x0b, HDA_INPUT, 0 },
3063 { 0x0b, HDA_INPUT, 1 },
3064 { 0x0b, HDA_INPUT, 2 },
3065 { 0x0b, HDA_INPUT, 3 },
3066 { 0x0b, HDA_INPUT, 4 },
3070 static struct hda_amp_list alc880_lg_loopbacks[] = {
3071 { 0x0b, HDA_INPUT, 1 },
3072 { 0x0b, HDA_INPUT, 6 },
3073 { 0x0b, HDA_INPUT, 7 },
3082 static int alc_init(struct hda_codec *codec)
3084 struct alc_spec *spec = codec->spec;
3088 alc_auto_init_amp(codec, spec->init_amp);
3090 for (i = 0; i < spec->num_init_verbs; i++)
3091 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3093 if (spec->init_hook)
3094 spec->init_hook(codec);
3099 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3101 struct alc_spec *spec = codec->spec;
3103 if (spec->unsol_event)
3104 spec->unsol_event(codec, res);
3107 #ifdef CONFIG_SND_HDA_POWER_SAVE
3108 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3110 struct alc_spec *spec = codec->spec;
3111 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3116 * Analog playback callbacks
3118 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3119 struct hda_codec *codec,
3120 struct snd_pcm_substream *substream)
3122 struct alc_spec *spec = codec->spec;
3123 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3127 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3128 struct hda_codec *codec,
3129 unsigned int stream_tag,
3130 unsigned int format,
3131 struct snd_pcm_substream *substream)
3133 struct alc_spec *spec = codec->spec;
3134 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3135 stream_tag, format, substream);
3138 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3139 struct hda_codec *codec,
3140 struct snd_pcm_substream *substream)
3142 struct alc_spec *spec = codec->spec;
3143 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3149 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3150 struct hda_codec *codec,
3151 struct snd_pcm_substream *substream)
3153 struct alc_spec *spec = codec->spec;
3154 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3157 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3158 struct hda_codec *codec,
3159 unsigned int stream_tag,
3160 unsigned int format,
3161 struct snd_pcm_substream *substream)
3163 struct alc_spec *spec = codec->spec;
3164 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3165 stream_tag, format, substream);
3168 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3169 struct hda_codec *codec,
3170 struct snd_pcm_substream *substream)
3172 struct alc_spec *spec = codec->spec;
3173 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3176 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3177 struct hda_codec *codec,
3178 struct snd_pcm_substream *substream)
3180 struct alc_spec *spec = codec->spec;
3181 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3187 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3188 struct hda_codec *codec,
3189 unsigned int stream_tag,
3190 unsigned int format,
3191 struct snd_pcm_substream *substream)
3193 struct alc_spec *spec = codec->spec;
3195 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3196 stream_tag, 0, format);
3200 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3201 struct hda_codec *codec,
3202 struct snd_pcm_substream *substream)
3204 struct alc_spec *spec = codec->spec;
3206 snd_hda_codec_cleanup_stream(codec,
3207 spec->adc_nids[substream->number + 1]);
3214 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3218 /* NID is set in alc_build_pcms */
3220 .open = alc880_playback_pcm_open,
3221 .prepare = alc880_playback_pcm_prepare,
3222 .cleanup = alc880_playback_pcm_cleanup
3226 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3230 /* NID is set in alc_build_pcms */
3233 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3237 /* NID is set in alc_build_pcms */
3240 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3241 .substreams = 2, /* can be overridden */
3244 /* NID is set in alc_build_pcms */
3246 .prepare = alc880_alt_capture_pcm_prepare,
3247 .cleanup = alc880_alt_capture_pcm_cleanup
3251 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3255 /* NID is set in alc_build_pcms */
3257 .open = alc880_dig_playback_pcm_open,
3258 .close = alc880_dig_playback_pcm_close,
3259 .prepare = alc880_dig_playback_pcm_prepare,
3260 .cleanup = alc880_dig_playback_pcm_cleanup
3264 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3268 /* NID is set in alc_build_pcms */
3271 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3272 static struct hda_pcm_stream alc_pcm_null_stream = {
3278 static int alc_build_pcms(struct hda_codec *codec)
3280 struct alc_spec *spec = codec->spec;
3281 struct hda_pcm *info = spec->pcm_rec;
3284 codec->num_pcms = 1;
3285 codec->pcm_info = info;
3287 if (spec->no_analog)
3290 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3291 "%s Analog", codec->chip_name);
3292 info->name = spec->stream_name_analog;
3294 if (spec->stream_analog_playback) {
3295 if (snd_BUG_ON(!spec->multiout.dac_nids))
3297 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3298 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3300 if (spec->stream_analog_capture) {
3301 if (snd_BUG_ON(!spec->adc_nids))
3303 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3304 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3307 if (spec->channel_mode) {
3308 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3309 for (i = 0; i < spec->num_channel_mode; i++) {
3310 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3311 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3317 /* SPDIF for stream index #1 */
3318 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3319 snprintf(spec->stream_name_digital,
3320 sizeof(spec->stream_name_digital),
3321 "%s Digital", codec->chip_name);
3322 codec->num_pcms = 2;
3323 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3324 info = spec->pcm_rec + 1;
3325 info->name = spec->stream_name_digital;
3326 if (spec->dig_out_type)
3327 info->pcm_type = spec->dig_out_type;
3329 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3330 if (spec->multiout.dig_out_nid &&
3331 spec->stream_digital_playback) {
3332 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3333 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3335 if (spec->dig_in_nid &&
3336 spec->stream_digital_capture) {
3337 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3338 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3340 /* FIXME: do we need this for all Realtek codec models? */
3341 codec->spdif_status_reset = 1;
3344 if (spec->no_analog)
3347 /* If the use of more than one ADC is requested for the current
3348 * model, configure a second analog capture-only PCM.
3350 /* Additional Analaog capture for index #2 */
3351 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3352 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3353 codec->num_pcms = 3;
3354 info = spec->pcm_rec + 2;
3355 info->name = spec->stream_name_analog;
3356 if (spec->alt_dac_nid) {
3357 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3358 *spec->stream_analog_alt_playback;
3359 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3362 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3363 alc_pcm_null_stream;
3364 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3366 if (spec->num_adc_nids > 1) {
3367 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3368 *spec->stream_analog_alt_capture;
3369 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3371 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3372 spec->num_adc_nids - 1;
3374 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3375 alc_pcm_null_stream;
3376 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3383 static void alc_free_kctls(struct hda_codec *codec)
3385 struct alc_spec *spec = codec->spec;
3387 if (spec->kctls.list) {
3388 struct snd_kcontrol_new *kctl = spec->kctls.list;
3390 for (i = 0; i < spec->kctls.used; i++)
3391 kfree(kctl[i].name);
3393 snd_array_free(&spec->kctls);
3396 static void alc_free(struct hda_codec *codec)
3398 struct alc_spec *spec = codec->spec;
3403 alc_free_kctls(codec);
3405 snd_hda_detach_beep_device(codec);
3408 #ifdef SND_HDA_NEEDS_RESUME
3409 static int alc_resume(struct hda_codec *codec)
3411 codec->patch_ops.init(codec);
3412 snd_hda_codec_resume_amp(codec);
3413 snd_hda_codec_resume_cache(codec);
3420 static struct hda_codec_ops alc_patch_ops = {
3421 .build_controls = alc_build_controls,
3422 .build_pcms = alc_build_pcms,
3425 .unsol_event = alc_unsol_event,
3426 #ifdef SND_HDA_NEEDS_RESUME
3427 .resume = alc_resume,
3429 #ifdef CONFIG_SND_HDA_POWER_SAVE
3430 .check_power_status = alc_check_power_status,
3436 * Test configuration for debugging
3438 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3441 #ifdef CONFIG_SND_DEBUG
3442 static hda_nid_t alc880_test_dac_nids[4] = {
3443 0x02, 0x03, 0x04, 0x05
3446 static struct hda_input_mux alc880_test_capture_source = {
3455 { "Surround", 0x6 },
3459 static struct hda_channel_mode alc880_test_modes[4] = {
3466 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3467 struct snd_ctl_elem_info *uinfo)
3469 static char *texts[] = {
3470 "N/A", "Line Out", "HP Out",
3471 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3473 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3475 uinfo->value.enumerated.items = 8;
3476 if (uinfo->value.enumerated.item >= 8)
3477 uinfo->value.enumerated.item = 7;
3478 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3482 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3483 struct snd_ctl_elem_value *ucontrol)
3485 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3486 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3487 unsigned int pin_ctl, item = 0;
3489 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3490 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3491 if (pin_ctl & AC_PINCTL_OUT_EN) {
3492 if (pin_ctl & AC_PINCTL_HP_EN)
3496 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3497 switch (pin_ctl & AC_PINCTL_VREFEN) {
3498 case AC_PINCTL_VREF_HIZ: item = 3; break;
3499 case AC_PINCTL_VREF_50: item = 4; break;
3500 case AC_PINCTL_VREF_GRD: item = 5; break;
3501 case AC_PINCTL_VREF_80: item = 6; break;
3502 case AC_PINCTL_VREF_100: item = 7; break;
3505 ucontrol->value.enumerated.item[0] = item;
3509 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3510 struct snd_ctl_elem_value *ucontrol)
3512 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3513 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3514 static unsigned int ctls[] = {
3515 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3516 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3517 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3518 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3519 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3520 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3522 unsigned int old_ctl, new_ctl;
3524 old_ctl = snd_hda_codec_read(codec, nid, 0,
3525 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3526 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3527 if (old_ctl != new_ctl) {
3529 snd_hda_codec_write_cache(codec, nid, 0,
3530 AC_VERB_SET_PIN_WIDGET_CONTROL,
3532 val = ucontrol->value.enumerated.item[0] >= 3 ?
3534 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3541 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3542 struct snd_ctl_elem_info *uinfo)
3544 static char *texts[] = {
3545 "Front", "Surround", "CLFE", "Side"
3547 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3549 uinfo->value.enumerated.items = 4;
3550 if (uinfo->value.enumerated.item >= 4)
3551 uinfo->value.enumerated.item = 3;
3552 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3556 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3557 struct snd_ctl_elem_value *ucontrol)
3559 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3560 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3563 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3564 ucontrol->value.enumerated.item[0] = sel & 3;
3568 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3569 struct snd_ctl_elem_value *ucontrol)
3571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3572 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3575 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3576 if (ucontrol->value.enumerated.item[0] != sel) {
3577 sel = ucontrol->value.enumerated.item[0] & 3;
3578 snd_hda_codec_write_cache(codec, nid, 0,
3579 AC_VERB_SET_CONNECT_SEL, sel);
3585 #define PIN_CTL_TEST(xname,nid) { \
3586 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3588 .info = alc_test_pin_ctl_info, \
3589 .get = alc_test_pin_ctl_get, \
3590 .put = alc_test_pin_ctl_put, \
3591 .private_value = nid \
3594 #define PIN_SRC_TEST(xname,nid) { \
3595 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3597 .info = alc_test_pin_src_info, \
3598 .get = alc_test_pin_src_get, \
3599 .put = alc_test_pin_src_put, \
3600 .private_value = nid \
3603 static struct snd_kcontrol_new alc880_test_mixer[] = {
3604 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3605 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3606 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3607 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3608 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3609 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3610 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3611 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3612 PIN_CTL_TEST("Front Pin Mode", 0x14),
3613 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3614 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3615 PIN_CTL_TEST("Side Pin Mode", 0x17),
3616 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3617 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3618 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3619 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3620 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3621 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3622 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3623 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3624 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3625 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3626 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3627 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3628 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3629 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3630 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3631 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3632 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3633 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3635 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3636 .name = "Channel Mode",
3637 .info = alc_ch_mode_info,
3638 .get = alc_ch_mode_get,
3639 .put = alc_ch_mode_put,
3644 static struct hda_verb alc880_test_init_verbs[] = {
3645 /* Unmute inputs of 0x0c - 0x0f */
3646 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3648 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3650 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3651 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3652 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3653 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3654 /* Vol output for 0x0c-0x0f */
3655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3659 /* Set output pins 0x14-0x17 */
3660 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3662 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3663 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3664 /* Unmute output pins 0x14-0x17 */
3665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3667 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3668 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3669 /* Set input pins 0x18-0x1c */
3670 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3671 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3672 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3674 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3675 /* Mute input pins 0x18-0x1b */
3676 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3677 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3679 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3681 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3682 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3683 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3684 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3686 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3687 /* Analog input/passthru */
3688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3689 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3690 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3691 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3692 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3700 static const char *alc880_models[ALC880_MODEL_LAST] = {
3701 [ALC880_3ST] = "3stack",
3702 [ALC880_TCL_S700] = "tcl",
3703 [ALC880_3ST_DIG] = "3stack-digout",
3704 [ALC880_CLEVO] = "clevo",
3705 [ALC880_5ST] = "5stack",
3706 [ALC880_5ST_DIG] = "5stack-digout",
3707 [ALC880_W810] = "w810",
3708 [ALC880_Z71V] = "z71v",
3709 [ALC880_6ST] = "6stack",
3710 [ALC880_6ST_DIG] = "6stack-digout",
3711 [ALC880_ASUS] = "asus",
3712 [ALC880_ASUS_W1V] = "asus-w1v",
3713 [ALC880_ASUS_DIG] = "asus-dig",
3714 [ALC880_ASUS_DIG2] = "asus-dig2",
3715 [ALC880_UNIWILL_DIG] = "uniwill",
3716 [ALC880_UNIWILL_P53] = "uniwill-p53",
3717 [ALC880_FUJITSU] = "fujitsu",
3718 [ALC880_F1734] = "F1734",
3720 [ALC880_LG_LW] = "lg-lw",
3721 [ALC880_MEDION_RIM] = "medion",
3722 #ifdef CONFIG_SND_DEBUG
3723 [ALC880_TEST] = "test",
3725 [ALC880_AUTO] = "auto",
3728 static struct snd_pci_quirk alc880_cfg_tbl[] = {
3729 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
3730 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
3731 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
3732 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
3733 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
3734 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
3735 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
3736 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
3737 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
3738 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
3739 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
3740 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
3741 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
3742 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
3743 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
3744 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
3745 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
3746 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
3747 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
3748 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
3749 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
3750 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
3751 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
3752 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
3753 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
3754 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
3755 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
3756 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
3757 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
3758 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
3759 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
3760 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
3761 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
3762 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
3763 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
3764 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
3765 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
3766 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
3767 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
3768 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
3769 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
3770 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
3771 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
3772 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
3773 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
3774 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
3775 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
3776 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
3777 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
3778 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
3779 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
3780 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
3781 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
3782 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
3783 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
3784 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
3785 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
3786 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
3787 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
3788 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
3789 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
3790 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
3791 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
3792 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
3793 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
3794 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
3795 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
3796 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
3798 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
3799 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
3800 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
3805 * ALC880 codec presets
3807 static struct alc_config_preset alc880_presets[] = {
3809 .mixers = { alc880_three_stack_mixer },
3810 .init_verbs = { alc880_volume_init_verbs,
3811 alc880_pin_3stack_init_verbs },
3812 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3813 .dac_nids = alc880_dac_nids,
3814 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3815 .channel_mode = alc880_threestack_modes,
3817 .input_mux = &alc880_capture_source,
3819 [ALC880_3ST_DIG] = {
3820 .mixers = { alc880_three_stack_mixer },
3821 .init_verbs = { alc880_volume_init_verbs,
3822 alc880_pin_3stack_init_verbs },
3823 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3824 .dac_nids = alc880_dac_nids,
3825 .dig_out_nid = ALC880_DIGOUT_NID,
3826 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3827 .channel_mode = alc880_threestack_modes,
3829 .input_mux = &alc880_capture_source,
3831 [ALC880_TCL_S700] = {
3832 .mixers = { alc880_tcl_s700_mixer },
3833 .init_verbs = { alc880_volume_init_verbs,
3834 alc880_pin_tcl_S700_init_verbs,
3835 alc880_gpio2_init_verbs },
3836 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3837 .dac_nids = alc880_dac_nids,
3838 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
3839 .num_adc_nids = 1, /* single ADC */
3841 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3842 .channel_mode = alc880_2_jack_modes,
3843 .input_mux = &alc880_capture_source,
3846 .mixers = { alc880_three_stack_mixer,
3847 alc880_five_stack_mixer},
3848 .init_verbs = { alc880_volume_init_verbs,
3849 alc880_pin_5stack_init_verbs },
3850 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3851 .dac_nids = alc880_dac_nids,
3852 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3853 .channel_mode = alc880_fivestack_modes,
3854 .input_mux = &alc880_capture_source,
3856 [ALC880_5ST_DIG] = {
3857 .mixers = { alc880_three_stack_mixer,
3858 alc880_five_stack_mixer },
3859 .init_verbs = { alc880_volume_init_verbs,
3860 alc880_pin_5stack_init_verbs },
3861 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
3862 .dac_nids = alc880_dac_nids,
3863 .dig_out_nid = ALC880_DIGOUT_NID,
3864 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
3865 .channel_mode = alc880_fivestack_modes,
3866 .input_mux = &alc880_capture_source,
3869 .mixers = { alc880_six_stack_mixer },
3870 .init_verbs = { alc880_volume_init_verbs,
3871 alc880_pin_6stack_init_verbs },
3872 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3873 .dac_nids = alc880_6st_dac_nids,
3874 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3875 .channel_mode = alc880_sixstack_modes,
3876 .input_mux = &alc880_6stack_capture_source,
3878 [ALC880_6ST_DIG] = {
3879 .mixers = { alc880_six_stack_mixer },
3880 .init_verbs = { alc880_volume_init_verbs,
3881 alc880_pin_6stack_init_verbs },
3882 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
3883 .dac_nids = alc880_6st_dac_nids,
3884 .dig_out_nid = ALC880_DIGOUT_NID,
3885 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
3886 .channel_mode = alc880_sixstack_modes,
3887 .input_mux = &alc880_6stack_capture_source,
3890 .mixers = { alc880_w810_base_mixer },
3891 .init_verbs = { alc880_volume_init_verbs,
3892 alc880_pin_w810_init_verbs,
3893 alc880_gpio2_init_verbs },
3894 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
3895 .dac_nids = alc880_w810_dac_nids,
3896 .dig_out_nid = ALC880_DIGOUT_NID,
3897 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
3898 .channel_mode = alc880_w810_modes,
3899 .input_mux = &alc880_capture_source,
3902 .mixers = { alc880_z71v_mixer },
3903 .init_verbs = { alc880_volume_init_verbs,
3904 alc880_pin_z71v_init_verbs },
3905 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
3906 .dac_nids = alc880_z71v_dac_nids,
3907 .dig_out_nid = ALC880_DIGOUT_NID,
3909 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3910 .channel_mode = alc880_2_jack_modes,
3911 .input_mux = &alc880_capture_source,
3914 .mixers = { alc880_f1734_mixer },
3915 .init_verbs = { alc880_volume_init_verbs,
3916 alc880_pin_f1734_init_verbs },
3917 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
3918 .dac_nids = alc880_f1734_dac_nids,
3920 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
3921 .channel_mode = alc880_2_jack_modes,
3922 .input_mux = &alc880_f1734_capture_source,
3923 .unsol_event = alc880_uniwill_p53_unsol_event,
3924 .init_hook = alc880_uniwill_p53_init_hook,
3927 .mixers = { alc880_asus_mixer },
3928 .init_verbs = { alc880_volume_init_verbs,
3929 alc880_pin_asus_init_verbs,
3930 alc880_gpio1_init_verbs },
3931 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3932 .dac_nids = alc880_asus_dac_nids,
3933 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3934 .channel_mode = alc880_asus_modes,
3936 .input_mux = &alc880_capture_source,
3938 [ALC880_ASUS_DIG] = {
3939 .mixers = { alc880_asus_mixer },
3940 .init_verbs = { alc880_volume_init_verbs,
3941 alc880_pin_asus_init_verbs,
3942 alc880_gpio1_init_verbs },
3943 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3944 .dac_nids = alc880_asus_dac_nids,
3945 .dig_out_nid = ALC880_DIGOUT_NID,
3946 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3947 .channel_mode = alc880_asus_modes,
3949 .input_mux = &alc880_capture_source,
3951 [ALC880_ASUS_DIG2] = {
3952 .mixers = { alc880_asus_mixer },
3953 .init_verbs = { alc880_volume_init_verbs,
3954 alc880_pin_asus_init_verbs,
3955 alc880_gpio2_init_verbs }, /* use GPIO2 */
3956 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3957 .dac_nids = alc880_asus_dac_nids,
3958 .dig_out_nid = ALC880_DIGOUT_NID,
3959 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3960 .channel_mode = alc880_asus_modes,
3962 .input_mux = &alc880_capture_source,
3964 [ALC880_ASUS_W1V] = {
3965 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
3966 .init_verbs = { alc880_volume_init_verbs,
3967 alc880_pin_asus_init_verbs,
3968 alc880_gpio1_init_verbs },
3969 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3970 .dac_nids = alc880_asus_dac_nids,
3971 .dig_out_nid = ALC880_DIGOUT_NID,
3972 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3973 .channel_mode = alc880_asus_modes,
3975 .input_mux = &alc880_capture_source,
3977 [ALC880_UNIWILL_DIG] = {
3978 .mixers = { alc880_asus_mixer },
3979 .init_verbs = { alc880_volume_init_verbs,
3980 alc880_pin_asus_init_verbs },
3981 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3982 .dac_nids = alc880_asus_dac_nids,
3983 .dig_out_nid = ALC880_DIGOUT_NID,
3984 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
3985 .channel_mode = alc880_asus_modes,
3987 .input_mux = &alc880_capture_source,
3989 [ALC880_UNIWILL] = {
3990 .mixers = { alc880_uniwill_mixer },
3991 .init_verbs = { alc880_volume_init_verbs,
3992 alc880_uniwill_init_verbs },
3993 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
3994 .dac_nids = alc880_asus_dac_nids,
3995 .dig_out_nid = ALC880_DIGOUT_NID,
3996 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3997 .channel_mode = alc880_threestack_modes,
3999 .input_mux = &alc880_capture_source,
4000 .unsol_event = alc880_uniwill_unsol_event,
4001 .init_hook = alc880_uniwill_init_hook,
4003 [ALC880_UNIWILL_P53] = {
4004 .mixers = { alc880_uniwill_p53_mixer },
4005 .init_verbs = { alc880_volume_init_verbs,
4006 alc880_uniwill_p53_init_verbs },
4007 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4008 .dac_nids = alc880_asus_dac_nids,
4009 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4010 .channel_mode = alc880_threestack_modes,
4011 .input_mux = &alc880_capture_source,
4012 .unsol_event = alc880_uniwill_p53_unsol_event,
4013 .init_hook = alc880_uniwill_p53_init_hook,
4015 [ALC880_FUJITSU] = {
4016 .mixers = { alc880_fujitsu_mixer },
4017 .init_verbs = { alc880_volume_init_verbs,
4018 alc880_uniwill_p53_init_verbs,
4019 alc880_beep_init_verbs },
4020 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4021 .dac_nids = alc880_dac_nids,
4022 .dig_out_nid = ALC880_DIGOUT_NID,
4023 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4024 .channel_mode = alc880_2_jack_modes,
4025 .input_mux = &alc880_capture_source,
4026 .unsol_event = alc880_uniwill_p53_unsol_event,
4027 .init_hook = alc880_uniwill_p53_init_hook,
4030 .mixers = { alc880_three_stack_mixer },
4031 .init_verbs = { alc880_volume_init_verbs,
4032 alc880_pin_clevo_init_verbs },
4033 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4034 .dac_nids = alc880_dac_nids,
4036 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4037 .channel_mode = alc880_threestack_modes,
4039 .input_mux = &alc880_capture_source,
4042 .mixers = { alc880_lg_mixer },
4043 .init_verbs = { alc880_volume_init_verbs,
4044 alc880_lg_init_verbs },
4045 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4046 .dac_nids = alc880_lg_dac_nids,
4047 .dig_out_nid = ALC880_DIGOUT_NID,
4048 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4049 .channel_mode = alc880_lg_ch_modes,
4051 .input_mux = &alc880_lg_capture_source,
4052 .unsol_event = alc_automute_amp_unsol_event,
4053 .init_hook = alc880_lg_init_hook,
4054 #ifdef CONFIG_SND_HDA_POWER_SAVE
4055 .loopbacks = alc880_lg_loopbacks,
4059 .mixers = { alc880_lg_lw_mixer },
4060 .init_verbs = { alc880_volume_init_verbs,
4061 alc880_lg_lw_init_verbs },
4062 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4063 .dac_nids = alc880_dac_nids,
4064 .dig_out_nid = ALC880_DIGOUT_NID,
4065 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4066 .channel_mode = alc880_lg_lw_modes,
4067 .input_mux = &alc880_lg_lw_capture_source,
4068 .unsol_event = alc_automute_amp_unsol_event,
4069 .init_hook = alc880_lg_lw_init_hook,
4071 [ALC880_MEDION_RIM] = {
4072 .mixers = { alc880_medion_rim_mixer },
4073 .init_verbs = { alc880_volume_init_verbs,
4074 alc880_medion_rim_init_verbs,
4075 alc_gpio2_init_verbs },
4076 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4077 .dac_nids = alc880_dac_nids,
4078 .dig_out_nid = ALC880_DIGOUT_NID,
4079 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4080 .channel_mode = alc880_2_jack_modes,
4081 .input_mux = &alc880_medion_rim_capture_source,
4082 .unsol_event = alc880_medion_rim_unsol_event,
4083 .init_hook = alc880_medion_rim_init_hook,
4085 #ifdef CONFIG_SND_DEBUG
4087 .mixers = { alc880_test_mixer },
4088 .init_verbs = { alc880_test_init_verbs },
4089 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4090 .dac_nids = alc880_test_dac_nids,
4091 .dig_out_nid = ALC880_DIGOUT_NID,
4092 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4093 .channel_mode = alc880_test_modes,
4094 .input_mux = &alc880_test_capture_source,
4100 * Automatic parse of I/O pins from the BIOS configuration
4105 ALC_CTL_WIDGET_MUTE,
4108 static struct snd_kcontrol_new alc880_control_templates[] = {
4109 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4110 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4111 HDA_BIND_MUTE(NULL, 0, 0, 0),
4114 /* add dynamic controls */
4115 static int add_control(struct alc_spec *spec, int type, const char *name,
4118 struct snd_kcontrol_new *knew;
4120 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4121 knew = snd_array_new(&spec->kctls);
4124 *knew = alc880_control_templates[type];
4125 knew->name = kstrdup(name, GFP_KERNEL);
4128 knew->private_value = val;
4132 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4133 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4134 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4135 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4136 #define alc880_is_input_pin(nid) ((nid) >= 0x18)
4137 #define alc880_input_pin_idx(nid) ((nid) - 0x18)
4138 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4139 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4140 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4141 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4142 #define ALC880_PIN_CD_NID 0x1c
4144 /* fill in the dac_nids table from the parsed pin configuration */
4145 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4146 const struct auto_pin_cfg *cfg)
4152 memset(assigned, 0, sizeof(assigned));
4153 spec->multiout.dac_nids = spec->private_dac_nids;
4155 /* check the pins hardwired to audio widget */
4156 for (i = 0; i < cfg->line_outs; i++) {
4157 nid = cfg->line_out_pins[i];
4158 if (alc880_is_fixed_pin(nid)) {
4159 int idx = alc880_fixed_pin_idx(nid);
4160 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4164 /* left pins can be connect to any audio widget */
4165 for (i = 0; i < cfg->line_outs; i++) {
4166 nid = cfg->line_out_pins[i];
4167 if (alc880_is_fixed_pin(nid))
4169 /* search for an empty channel */
4170 for (j = 0; j < cfg->line_outs; j++) {
4172 spec->multiout.dac_nids[i] =
4173 alc880_idx_to_dac(j);
4179 spec->multiout.num_dacs = cfg->line_outs;
4183 /* add playback controls from the parsed DAC table */
4184 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4185 const struct auto_pin_cfg *cfg)
4188 static const char *chname[4] = {
4189 "Front", "Surround", NULL /*CLFE*/, "Side"
4194 for (i = 0; i < cfg->line_outs; i++) {
4195 if (!spec->multiout.dac_nids[i])
4197 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4200 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4201 "Center Playback Volume",
4202 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4206 err = add_control(spec, ALC_CTL_WIDGET_VOL,
4207 "LFE Playback Volume",
4208 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4212 err = add_control(spec, ALC_CTL_BIND_MUTE,
4213 "Center Playback Switch",
4214 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4218 err = add_control(spec, ALC_CTL_BIND_MUTE,
4219 "LFE Playback Switch",
4220 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4225 sprintf(name, "%s Playback Volume", chname[i]);
4226 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4227 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4231 sprintf(name, "%s Playback Switch", chname[i]);
4232 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4233 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4242 /* add playback controls for speaker and HP outputs */
4243 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4253 if (alc880_is_fixed_pin(pin)) {
4254 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4255 /* specify the DAC as the extra output */
4256 if (!spec->multiout.hp_nid)
4257 spec->multiout.hp_nid = nid;
4259 spec->multiout.extra_out_nid[0] = nid;
4260 /* control HP volume/switch on the output mixer amp */
4261 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4262 sprintf(name, "%s Playback Volume", pfx);
4263 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4264 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4267 sprintf(name, "%s Playback Switch", pfx);
4268 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
4269 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4272 } else if (alc880_is_multi_pin(pin)) {
4273 /* set manual connection */
4274 /* we have only a switch on HP-out PIN */
4275 sprintf(name, "%s Playback Switch", pfx);
4276 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4277 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4284 /* create input playback/capture controls for the given pin */
4285 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4286 const char *ctlname,
4287 int idx, hda_nid_t mix_nid)
4292 sprintf(name, "%s Playback Volume", ctlname);
4293 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
4294 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4297 sprintf(name, "%s Playback Switch", ctlname);
4298 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
4299 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4305 /* create playback/capture controls for input pins */
4306 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4307 const struct auto_pin_cfg *cfg)
4309 struct hda_input_mux *imux = &spec->private_imux[0];
4312 for (i = 0; i < AUTO_PIN_LAST; i++) {
4313 if (alc880_is_input_pin(cfg->input_pins[i])) {
4314 idx = alc880_input_pin_idx(cfg->input_pins[i]);
4315 err = new_analog_input(spec, cfg->input_pins[i],
4316 auto_pin_cfg_labels[i],
4320 imux->items[imux->num_items].label =
4321 auto_pin_cfg_labels[i];
4322 imux->items[imux->num_items].index =
4323 alc880_input_pin_idx(cfg->input_pins[i]);
4330 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4331 unsigned int pin_type)
4333 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4336 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4340 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4341 hda_nid_t nid, int pin_type,
4344 alc_set_pin_output(codec, nid, pin_type);
4345 /* need the manual connection? */
4346 if (alc880_is_multi_pin(nid)) {
4347 struct alc_spec *spec = codec->spec;
4348 int idx = alc880_multi_pin_idx(nid);
4349 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4350 AC_VERB_SET_CONNECT_SEL,
4351 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4355 static int get_pin_type(int line_out_type)
4357 if (line_out_type == AUTO_PIN_HP_OUT)
4363 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4365 struct alc_spec *spec = codec->spec;
4368 for (i = 0; i < spec->autocfg.line_outs; i++) {
4369 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4370 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4371 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4375 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4377 struct alc_spec *spec = codec->spec;
4380 pin = spec->autocfg.speaker_pins[0];
4381 if (pin) /* connect to front */
4382 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4383 pin = spec->autocfg.hp_pins[0];
4384 if (pin) /* connect to front */
4385 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4388 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4390 struct alc_spec *spec = codec->spec;
4393 for (i = 0; i < AUTO_PIN_LAST; i++) {
4394 hda_nid_t nid = spec->autocfg.input_pins[i];
4395 if (alc880_is_input_pin(nid)) {
4396 alc_set_input_pin(codec, nid, i);
4397 if (nid != ALC880_PIN_CD_NID &&
4398 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4399 snd_hda_codec_write(codec, nid, 0,
4400 AC_VERB_SET_AMP_GAIN_MUTE,
4406 /* parse the BIOS configuration and set up the alc_spec */
4407 /* return 1 if successful, 0 if the proper config is not found,
4408 * or a negative error code
4410 static int alc880_parse_auto_config(struct hda_codec *codec)
4412 struct alc_spec *spec = codec->spec;
4414 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4416 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4420 if (!spec->autocfg.line_outs)
4421 return 0; /* can't find valid BIOS pin config */
4423 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4426 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4429 err = alc880_auto_create_extra_out(spec,
4430 spec->autocfg.speaker_pins[0],
4434 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4438 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
4442 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4444 /* check multiple SPDIF-out (for recent codecs) */
4445 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4447 err = snd_hda_get_connections(codec,
4448 spec->autocfg.dig_out_pins[i],
4453 spec->multiout.dig_out_nid = dig_nid;
4455 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4456 spec->slave_dig_outs[i - 1] = dig_nid;
4457 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
4461 if (spec->autocfg.dig_in_pin)
4462 spec->dig_in_nid = ALC880_DIGIN_NID;
4464 if (spec->kctls.list)
4465 add_mixer(spec, spec->kctls.list);
4467 add_verb(spec, alc880_volume_init_verbs);
4469 spec->num_mux_defs = 1;
4470 spec->input_mux = &spec->private_imux[0];
4472 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4477 /* additional initialization for auto-configuration model */
4478 static void alc880_auto_init(struct hda_codec *codec)
4480 struct alc_spec *spec = codec->spec;
4481 alc880_auto_init_multi_out(codec);
4482 alc880_auto_init_extra_out(codec);
4483 alc880_auto_init_analog_input(codec);
4484 if (spec->unsol_event)
4485 alc_inithook(codec);
4488 static void set_capture_mixer(struct alc_spec *spec)
4490 static struct snd_kcontrol_new *caps[2][3] = {
4491 { alc_capture_mixer_nosrc1,
4492 alc_capture_mixer_nosrc2,
4493 alc_capture_mixer_nosrc3 },
4494 { alc_capture_mixer1,
4496 alc_capture_mixer3 },
4498 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4500 if (spec->input_mux && spec->input_mux->num_items > 1)
4504 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4508 #define set_beep_amp(spec, nid, idx, dir) \
4509 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4512 * OK, here we have finally the patch for ALC880
4515 static int patch_alc880(struct hda_codec *codec)
4517 struct alc_spec *spec;
4521 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4527 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4530 if (board_config < 0) {
4531 printk(KERN_INFO "hda_codec: Unknown model for %s, "
4532 "trying auto-probe from BIOS...\n", codec->chip_name);
4533 board_config = ALC880_AUTO;
4536 if (board_config == ALC880_AUTO) {
4537 /* automatic parse from the BIOS config */
4538 err = alc880_parse_auto_config(codec);
4544 "hda_codec: Cannot set up configuration "
4545 "from BIOS. Using 3-stack mode...\n");
4546 board_config = ALC880_3ST;
4550 err = snd_hda_attach_beep_device(codec, 0x1);
4556 if (board_config != ALC880_AUTO)
4557 setup_preset(spec, &alc880_presets[board_config]);
4559 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4560 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4561 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4563 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4564 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4566 if (!spec->adc_nids && spec->input_mux) {
4567 /* check whether NID 0x07 is valid */
4568 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4570 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
4571 if (wcap != AC_WID_AUD_IN) {
4572 spec->adc_nids = alc880_adc_nids_alt;
4573 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4575 spec->adc_nids = alc880_adc_nids;
4576 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4579 set_capture_mixer(spec);
4580 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4582 spec->vmaster_nid = 0x0c;
4584 codec->patch_ops = alc_patch_ops;
4585 if (board_config == ALC880_AUTO)
4586 spec->init_hook = alc880_auto_init;
4587 #ifdef CONFIG_SND_HDA_POWER_SAVE
4588 if (!spec->loopback.amplist)
4589 spec->loopback.amplist = alc880_loopbacks;
4591 codec->proc_widget_hook = print_realtek_coef;
4601 static hda_nid_t alc260_dac_nids[1] = {
4606 static hda_nid_t alc260_adc_nids[1] = {
4611 static hda_nid_t alc260_adc_nids_alt[1] = {
4616 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4617 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4619 static hda_nid_t alc260_dual_adc_nids[2] = {
4624 #define ALC260_DIGOUT_NID 0x03
4625 #define ALC260_DIGIN_NID 0x06
4627 static struct hda_input_mux alc260_capture_source = {
4631 { "Front Mic", 0x1 },
4637 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
4638 * headphone jack and the internal CD lines since these are the only pins at
4639 * which audio can appear. For flexibility, also allow the option of
4640 * recording the mixer output on the second ADC (ADC0 doesn't have a
4641 * connection to the mixer output).
4643 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
4647 { "Mic/Line", 0x0 },
4649 { "Headphone", 0x2 },
4655 { "Mic/Line", 0x0 },
4657 { "Headphone", 0x2 },
4664 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
4665 * the Fujitsu S702x, but jacks are marked differently.
4667 static struct hda_input_mux alc260_acer_capture_sources[2] = {
4674 { "Headphone", 0x5 },
4683 { "Headphone", 0x6 },
4689 /* Maxdata Favorit 100XS */
4690 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
4694 { "Line/Mic", 0x0 },
4701 { "Line/Mic", 0x0 },
4709 * This is just place-holder, so there's something for alc_build_pcms to look
4710 * at when it calculates the maximum number of channels. ALC260 has no mixer
4711 * element which allows changing the channel mode, so the verb list is
4714 static struct hda_channel_mode alc260_modes[1] = {
4719 /* Mixer combinations
4721 * basic: base_output + input + pc_beep + capture
4722 * HP: base_output + input + capture_alt
4723 * HP_3013: hp_3013 + input + capture
4724 * fujitsu: fujitsu + capture
4725 * acer: acer + capture
4728 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
4729 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4730 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4731 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4732 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4733 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4734 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4738 static struct snd_kcontrol_new alc260_input_mixer[] = {
4739 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4740 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4741 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4742 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4744 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4745 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
4746 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
4750 /* update HP, line and mono out pins according to the master switch */
4751 static void alc260_hp_master_update(struct hda_codec *codec,
4752 hda_nid_t hp, hda_nid_t line,
4755 struct alc_spec *spec = codec->spec;
4756 unsigned int val = spec->master_sw ? PIN_HP : 0;
4757 /* change HP and line-out pins */
4758 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4760 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4762 /* mono (speaker) depending on the HP jack sense */
4763 val = (val && !spec->jack_present) ? PIN_OUT : 0;
4764 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4768 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
4769 struct snd_ctl_elem_value *ucontrol)
4771 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4772 struct alc_spec *spec = codec->spec;
4773 *ucontrol->value.integer.value = spec->master_sw;
4777 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
4778 struct snd_ctl_elem_value *ucontrol)
4780 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4781 struct alc_spec *spec = codec->spec;
4782 int val = !!*ucontrol->value.integer.value;
4783 hda_nid_t hp, line, mono;
4785 if (val == spec->master_sw)
4787 spec->master_sw = val;
4788 hp = (kcontrol->private_value >> 16) & 0xff;
4789 line = (kcontrol->private_value >> 8) & 0xff;
4790 mono = kcontrol->private_value & 0xff;
4791 alc260_hp_master_update(codec, hp, line, mono);
4795 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
4797 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4798 .name = "Master Playback Switch",
4799 .info = snd_ctl_boolean_mono_info,
4800 .get = alc260_hp_master_sw_get,
4801 .put = alc260_hp_master_sw_put,
4802 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
4804 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4805 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
4806 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4807 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
4808 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4810 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
4814 static struct hda_verb alc260_hp_unsol_verbs[] = {
4815 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4819 static void alc260_hp_automute(struct hda_codec *codec)
4821 struct alc_spec *spec = codec->spec;
4822 unsigned int present;
4824 present = snd_hda_codec_read(codec, 0x10, 0,
4825 AC_VERB_GET_PIN_SENSE, 0);
4826 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4827 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
4830 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
4832 if ((res >> 26) == ALC880_HP_EVENT)
4833 alc260_hp_automute(codec);
4836 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
4838 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4839 .name = "Master Playback Switch",
4840 .info = snd_ctl_boolean_mono_info,
4841 .get = alc260_hp_master_sw_get,
4842 .put = alc260_hp_master_sw_put,
4843 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
4845 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4846 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4847 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
4848 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
4849 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4850 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4851 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
4852 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
4856 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
4857 .ops = &snd_hda_bind_vol,
4859 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
4860 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
4861 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
4866 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
4867 .ops = &snd_hda_bind_sw,
4869 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
4870 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
4875 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
4876 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
4877 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
4878 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
4879 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
4883 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
4884 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
4888 static void alc260_hp_3013_automute(struct hda_codec *codec)
4890 struct alc_spec *spec = codec->spec;
4891 unsigned int present;
4893 present = snd_hda_codec_read(codec, 0x15, 0,
4894 AC_VERB_GET_PIN_SENSE, 0);
4895 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
4896 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
4899 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
4902 if ((res >> 26) == ALC880_HP_EVENT)
4903 alc260_hp_3013_automute(codec);
4906 static void alc260_hp_3012_automute(struct hda_codec *codec)
4908 unsigned int present, bits;
4910 present = snd_hda_codec_read(codec, 0x10, 0,
4911 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
4913 bits = present ? 0 : PIN_OUT;
4914 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4916 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4918 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4922 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
4925 if ((res >> 26) == ALC880_HP_EVENT)
4926 alc260_hp_3012_automute(codec);
4929 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
4930 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
4932 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
4933 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4934 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
4935 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4936 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4937 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4938 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
4939 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
4940 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
4941 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
4942 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
4946 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
4947 * versions of the ALC260 don't act on requests to enable mic bias from NID
4948 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
4949 * datasheet doesn't mention this restriction. At this stage it's not clear
4950 * whether this behaviour is intentional or is a hardware bug in chip
4951 * revisions available in early 2006. Therefore for now allow the
4952 * "Headphone Jack Mode" control to span all choices, but if it turns out
4953 * that the lack of mic bias for this NID is intentional we could change the
4954 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
4956 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
4957 * don't appear to make the mic bias available from the "line" jack, even
4958 * though the NID used for this jack (0x14) can supply it. The theory is
4959 * that perhaps Acer have included blocking capacitors between the ALC260
4960 * and the output jack. If this turns out to be the case for all such
4961 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
4962 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
4964 * The C20x Tablet series have a mono internal speaker which is controlled
4965 * via the chip's Mono sum widget and pin complex, so include the necessary
4966 * controls for such models. On models without a "mono speaker" the control
4967 * won't do anything.
4969 static struct snd_kcontrol_new alc260_acer_mixer[] = {
4970 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4971 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4972 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4973 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
4975 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
4977 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
4978 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
4979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4980 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4981 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
4982 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
4983 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
4984 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
4988 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
4990 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
4991 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
4992 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
4993 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
4994 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
4995 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
4996 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5000 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5001 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5003 static struct snd_kcontrol_new alc260_will_mixer[] = {
5004 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5005 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5006 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5007 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5008 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5009 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5010 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5011 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5012 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5013 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5017 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5018 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5020 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5021 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5022 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5024 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5025 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5026 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5027 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5028 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5029 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5030 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5035 * initialization verbs
5037 static struct hda_verb alc260_init_verbs[] = {
5038 /* Line In pin widget for input */
5039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5040 /* CD pin widget for input */
5041 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5042 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5043 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5044 /* Mic2 (front panel) pin widget for input and vref at 80% */
5045 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5046 /* LINE-2 is used for line-out in rear */
5047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5048 /* select line-out */
5049 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5051 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5053 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5055 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5056 /* mute capture amp left and right */
5057 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5058 /* set connection select to line in (default select for this ADC) */
5059 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5060 /* mute capture amp left and right */
5061 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5062 /* set connection select to line in (default select for this ADC) */
5063 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5064 /* set vol=0 Line-Out mixer amp left and right */
5065 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5066 /* unmute pin widget amp left and right (no gain on this amp) */
5067 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5068 /* set vol=0 HP mixer amp left and right */
5069 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5070 /* unmute pin widget amp left and right (no gain on this amp) */
5071 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5072 /* set vol=0 Mono mixer amp left and right */
5073 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5074 /* unmute pin widget amp left and right (no gain on this amp) */
5075 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5076 /* unmute LINE-2 out pin */
5077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5078 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5081 /* mute analog inputs */
5082 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5083 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5084 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5085 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5086 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5087 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5088 /* mute Front out path */
5089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5090 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5091 /* mute Headphone out path */
5092 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5093 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5094 /* mute Mono out path */
5095 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5096 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5100 #if 0 /* should be identical with alc260_init_verbs? */
5101 static struct hda_verb alc260_hp_init_verbs[] = {
5102 /* Headphone and output */
5103 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5105 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5106 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5107 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5108 /* Mic2 (front panel) pin widget for input and vref at 80% */
5109 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5110 /* Line In pin widget for input */
5111 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5112 /* Line-2 pin widget for output */
5113 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5114 /* CD pin widget for input */
5115 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5116 /* unmute amp left and right */
5117 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5118 /* set connection select to line in (default select for this ADC) */
5119 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5120 /* unmute Line-Out mixer amp left and right (volume = 0) */
5121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5122 /* mute pin widget amp left and right (no gain on this amp) */
5123 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5124 /* unmute HP mixer amp left and right (volume = 0) */
5125 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5126 /* mute pin widget amp left and right (no gain on this amp) */
5127 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5128 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5131 /* mute analog inputs */
5132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5135 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5136 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5137 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5138 /* Unmute Front out path */
5139 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5141 /* Unmute Headphone out path */
5142 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5144 /* Unmute Mono out path */
5145 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5146 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5151 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5152 /* Line out and output */
5153 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5155 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5156 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5157 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5158 /* Mic2 (front panel) pin widget for input and vref at 80% */
5159 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5160 /* Line In pin widget for input */
5161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5162 /* Headphone pin widget for output */
5163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5164 /* CD pin widget for input */
5165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5166 /* unmute amp left and right */
5167 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5168 /* set connection select to line in (default select for this ADC) */
5169 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5170 /* unmute Line-Out mixer amp left and right (volume = 0) */
5171 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5172 /* mute pin widget amp left and right (no gain on this amp) */
5173 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5174 /* unmute HP mixer amp left and right (volume = 0) */
5175 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5176 /* mute pin widget amp left and right (no gain on this amp) */
5177 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5178 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5181 /* mute analog inputs */
5182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5185 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5186 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5187 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5188 /* Unmute Front out path */
5189 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5190 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5191 /* Unmute Headphone out path */
5192 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5193 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5194 /* Unmute Mono out path */
5195 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5196 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5200 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5201 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5202 * audio = 0x16, internal speaker = 0x10.
5204 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5205 /* Disable all GPIOs */
5206 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5207 /* Internal speaker is connected to headphone pin */
5208 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5209 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5211 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5212 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5213 /* Ensure all other unused pins are disabled and muted. */
5214 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5216 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5217 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5218 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5219 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5220 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5223 /* Disable digital (SPDIF) pins */
5224 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5225 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5227 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5228 * when acting as an output.
5230 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5232 /* Start with output sum widgets muted and their output gains at min */
5233 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5234 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5236 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5239 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5240 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5243 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5244 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5245 /* Unmute Line1 pin widget output buffer since it starts as an output.
5246 * If the pin mode is changed by the user the pin mode control will
5247 * take care of enabling the pin's input/output buffers as needed.
5248 * Therefore there's no need to enable the input buffer at this
5251 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5252 /* Unmute input buffer of pin widget used for Line-in (no equiv
5255 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5257 /* Mute capture amp left and right */
5258 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5259 /* Set ADC connection select to match default mixer setting - line
5262 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5264 /* Do the same for the second ADC: mute capture input amp and
5265 * set ADC connection to line in (on mic1 pin)
5267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5268 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5270 /* Mute all inputs to mixer widget (even unconnected ones) */
5271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5283 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5284 * similar laptops (adapted from Fujitsu init verbs).
5286 static struct hda_verb alc260_acer_init_verbs[] = {
5287 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5288 * the headphone jack. Turn this on and rely on the standard mute
5289 * methods whenever the user wants to turn these outputs off.
5291 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5292 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5293 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5294 /* Internal speaker/Headphone jack is connected to Line-out pin */
5295 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5296 /* Internal microphone/Mic jack is connected to Mic1 pin */
5297 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5298 /* Line In jack is connected to Line1 pin */
5299 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5300 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5301 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5302 /* Ensure all other unused pins are disabled and muted. */
5303 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5304 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5305 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5306 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5309 /* Disable digital (SPDIF) pins */
5310 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5311 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5313 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5314 * bus when acting as outputs.
5316 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5317 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5319 /* Start with output sum widgets muted and their output gains at min */
5320 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5323 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5325 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5326 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5327 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5328 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5330 /* Unmute Line-out pin widget amp left and right
5331 * (no equiv mixer ctrl)
5333 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5334 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5335 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5336 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5337 * inputs. If the pin mode is changed by the user the pin mode control
5338 * will take care of enabling the pin's input/output buffers as needed.
5339 * Therefore there's no need to enable the input buffer at this
5342 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5343 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5345 /* Mute capture amp left and right */
5346 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5347 /* Set ADC connection select to match default mixer setting - mic
5350 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5352 /* Do similar with the second ADC: mute capture input amp and
5353 * set ADC connection to mic to match ALSA's default state.
5355 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5356 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5358 /* Mute all inputs to mixer widget (even unconnected ones) */
5359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5361 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5362 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5364 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5371 /* Initialisation sequence for Maxdata Favorit 100XS
5372 * (adapted from Acer init verbs).
5374 static struct hda_verb alc260_favorit100_init_verbs[] = {
5375 /* GPIO 0 enables the output jack.
5376 * Turn this on and rely on the standard mute
5377 * methods whenever the user wants to turn these outputs off.
5379 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5380 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5381 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5382 /* Line/Mic input jack is connected to Mic1 pin */
5383 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5384 /* Ensure all other unused pins are disabled and muted. */
5385 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5386 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5387 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5388 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5389 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5390 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5391 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5392 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5394 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5395 /* Disable digital (SPDIF) pins */
5396 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5397 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5399 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5400 * bus when acting as outputs.
5402 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5403 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5405 /* Start with output sum widgets muted and their output gains at min */
5406 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5407 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5409 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5411 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5412 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5413 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5414 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5416 /* Unmute Line-out pin widget amp left and right
5417 * (no equiv mixer ctrl)
5419 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5420 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5421 * inputs. If the pin mode is changed by the user the pin mode control
5422 * will take care of enabling the pin's input/output buffers as needed.
5423 * Therefore there's no need to enable the input buffer at this
5426 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5428 /* Mute capture amp left and right */
5429 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5430 /* Set ADC connection select to match default mixer setting - mic
5433 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5435 /* Do similar with the second ADC: mute capture input amp and
5436 * set ADC connection to mic to match ALSA's default state.
5438 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5439 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5441 /* Mute all inputs to mixer widget (even unconnected ones) */
5442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5447 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5448 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5449 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5454 static struct hda_verb alc260_will_verbs[] = {
5455 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5456 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5457 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5458 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5459 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5460 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5464 static struct hda_verb alc260_replacer_672v_verbs[] = {
5465 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5466 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5467 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5469 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5470 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5471 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5473 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5477 /* toggle speaker-output according to the hp-jack state */
5478 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5480 unsigned int present;
5482 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5483 present = snd_hda_codec_read(codec, 0x0f, 0,
5484 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5486 snd_hda_codec_write_cache(codec, 0x01, 0,
5487 AC_VERB_SET_GPIO_DATA, 1);
5488 snd_hda_codec_write_cache(codec, 0x0f, 0,
5489 AC_VERB_SET_PIN_WIDGET_CONTROL,
5492 snd_hda_codec_write_cache(codec, 0x01, 0,
5493 AC_VERB_SET_GPIO_DATA, 0);
5494 snd_hda_codec_write_cache(codec, 0x0f, 0,
5495 AC_VERB_SET_PIN_WIDGET_CONTROL,
5500 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5503 if ((res >> 26) == ALC880_HP_EVENT)
5504 alc260_replacer_672v_automute(codec);
5507 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5508 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5510 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5511 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5512 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5514 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5515 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5516 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5517 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5521 /* Test configuration for debugging, modelled after the ALC880 test
5524 #ifdef CONFIG_SND_DEBUG
5525 static hda_nid_t alc260_test_dac_nids[1] = {
5528 static hda_nid_t alc260_test_adc_nids[2] = {
5531 /* For testing the ALC260, each input MUX needs its own definition since
5532 * the signal assignments are different. This assumes that the first ADC
5535 static struct hda_input_mux alc260_test_capture_sources[2] = {
5539 { "MIC1 pin", 0x0 },
5540 { "MIC2 pin", 0x1 },
5541 { "LINE1 pin", 0x2 },
5542 { "LINE2 pin", 0x3 },
5544 { "LINE-OUT pin", 0x5 },
5545 { "HP-OUT pin", 0x6 },
5551 { "MIC1 pin", 0x0 },
5552 { "MIC2 pin", 0x1 },
5553 { "LINE1 pin", 0x2 },
5554 { "LINE2 pin", 0x3 },
5557 { "LINE-OUT pin", 0x6 },
5558 { "HP-OUT pin", 0x7 },
5562 static struct snd_kcontrol_new alc260_test_mixer[] = {
5563 /* Output driver widgets */
5564 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5565 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5566 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5567 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5568 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5569 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5571 /* Modes for retasking pin widgets
5572 * Note: the ALC260 doesn't seem to act on requests to enable mic
5573 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5574 * mention this restriction. At this stage it's not clear whether
5575 * this behaviour is intentional or is a hardware bug in chip
5576 * revisions available at least up until early 2006. Therefore for
5577 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5578 * choices, but if it turns out that the lack of mic bias for these
5579 * NIDs is intentional we could change their modes from
5580 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5582 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5583 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5584 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5585 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5586 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5587 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5589 /* Loopback mixer controls */
5590 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5591 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5592 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5593 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5594 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5595 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5596 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5597 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5598 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5599 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5600 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5601 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5602 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5603 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5605 /* Controls for GPIO pins, assuming they are configured as outputs */
5606 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5607 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5608 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5609 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5611 /* Switches to allow the digital IO pins to be enabled. The datasheet
5612 * is ambigious as to which NID is which; testing on laptops which
5613 * make this output available should provide clarification.
5615 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5616 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5618 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5619 * this output to turn on an external amplifier.
5621 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5622 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5626 static struct hda_verb alc260_test_init_verbs[] = {
5627 /* Enable all GPIOs as outputs with an initial value of 0 */
5628 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5629 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5630 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5632 /* Enable retasking pins as output, initially without power amp */
5633 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5634 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5636 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5637 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5638 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5640 /* Disable digital (SPDIF) pins initially, but users can enable
5641 * them via a mixer switch. In the case of SPDIF-out, this initverb
5642 * payload also sets the generation to 0, output to be in "consumer"
5643 * PCM format, copyright asserted, no pre-emphasis and no validity
5646 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5647 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5649 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
5650 * OUT1 sum bus when acting as an output.
5652 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5653 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
5654 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5655 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
5657 /* Start with output sum widgets muted and their output gains at min */
5658 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5659 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5660 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5661 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5662 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5663 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5664 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5668 /* Unmute retasking pin widget output buffers since the default
5669 * state appears to be output. As the pin mode is changed by the
5670 * user the pin mode control will take care of enabling the pin's
5671 * input/output buffers as needed.
5673 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5674 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5676 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5677 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5678 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5679 /* Also unmute the mono-out pin widget */
5680 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5682 /* Mute capture amp left and right */
5683 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5684 /* Set ADC connection select to match default mixer setting (mic1
5687 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5689 /* Do the same for the second ADC: mute capture input amp and
5690 * set ADC connection to mic1 pin
5692 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5693 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5695 /* Mute all inputs to mixer widget (even unconnected ones) */
5696 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5697 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5698 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5699 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5700 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5701 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5709 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
5710 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
5712 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
5713 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
5716 * for BIOS auto-configuration
5719 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
5720 const char *pfx, int *vol_bits)
5723 unsigned long vol_val, sw_val;
5727 if (nid >= 0x0f && nid < 0x11) {
5728 nid_vol = nid - 0x7;
5729 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5730 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5731 } else if (nid == 0x11) {
5732 nid_vol = nid - 0x7;
5733 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
5734 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
5735 } else if (nid >= 0x12 && nid <= 0x15) {
5737 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
5738 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
5742 if (!(*vol_bits & (1 << nid_vol))) {
5743 /* first control for the volume widget */
5744 snprintf(name, sizeof(name), "%s Playback Volume", pfx);
5745 err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val);
5748 *vol_bits |= (1 << nid_vol);
5750 snprintf(name, sizeof(name), "%s Playback Switch", pfx);
5751 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val);
5757 /* add playback controls from the parsed DAC table */
5758 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5759 const struct auto_pin_cfg *cfg)
5765 spec->multiout.num_dacs = 1;
5766 spec->multiout.dac_nids = spec->private_dac_nids;
5767 spec->multiout.dac_nids[0] = 0x02;
5769 nid = cfg->line_out_pins[0];
5771 err = alc260_add_playback_controls(spec, nid, "Front", &vols);
5776 nid = cfg->speaker_pins[0];
5778 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
5783 nid = cfg->hp_pins[0];
5785 err = alc260_add_playback_controls(spec, nid, "Headphone",
5793 /* create playback/capture controls for input pins */
5794 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5795 const struct auto_pin_cfg *cfg)
5797 struct hda_input_mux *imux = &spec->private_imux[0];
5800 for (i = 0; i < AUTO_PIN_LAST; i++) {
5801 if (cfg->input_pins[i] >= 0x12) {
5802 idx = cfg->input_pins[i] - 0x12;
5803 err = new_analog_input(spec, cfg->input_pins[i],
5804 auto_pin_cfg_labels[i], idx,
5808 imux->items[imux->num_items].label =
5809 auto_pin_cfg_labels[i];
5810 imux->items[imux->num_items].index = idx;
5813 if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){
5814 idx = cfg->input_pins[i] - 0x09;
5815 err = new_analog_input(spec, cfg->input_pins[i],
5816 auto_pin_cfg_labels[i], idx,
5820 imux->items[imux->num_items].label =
5821 auto_pin_cfg_labels[i];
5822 imux->items[imux->num_items].index = idx;
5829 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
5830 hda_nid_t nid, int pin_type,
5833 alc_set_pin_output(codec, nid, pin_type);
5834 /* need the manual connection? */
5836 int idx = nid - 0x12;
5837 snd_hda_codec_write(codec, idx + 0x0b, 0,
5838 AC_VERB_SET_CONNECT_SEL, sel_idx);
5842 static void alc260_auto_init_multi_out(struct hda_codec *codec)
5844 struct alc_spec *spec = codec->spec;
5847 nid = spec->autocfg.line_out_pins[0];
5849 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5850 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
5853 nid = spec->autocfg.speaker_pins[0];
5855 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
5857 nid = spec->autocfg.hp_pins[0];
5859 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
5862 #define ALC260_PIN_CD_NID 0x16
5863 static void alc260_auto_init_analog_input(struct hda_codec *codec)
5865 struct alc_spec *spec = codec->spec;
5868 for (i = 0; i < AUTO_PIN_LAST; i++) {
5869 hda_nid_t nid = spec->autocfg.input_pins[i];
5871 alc_set_input_pin(codec, nid, i);
5872 if (nid != ALC260_PIN_CD_NID &&
5873 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5874 snd_hda_codec_write(codec, nid, 0,
5875 AC_VERB_SET_AMP_GAIN_MUTE,
5882 * generic initialization of ADC, input mixers and output mixers
5884 static struct hda_verb alc260_volume_init_verbs[] = {
5886 * Unmute ADC0-1 and set the default input to mic-in
5888 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5889 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5890 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5891 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5893 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
5895 * Note: PASD motherboards uses the Line In 2 as the input for
5896 * front panel mic (mic 2)
5898 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
5899 /* mute analog inputs */
5900 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5901 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5902 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5903 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5907 * Set up output mixers (0x08 - 0x0a)
5909 /* set vol=0 to output mixers */
5910 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5911 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5912 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5913 /* set up input amps for analog loopback */
5914 /* Amp Indices: DAC = 0, mixer = 1 */
5915 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5916 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5917 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5918 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5919 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5920 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
5925 static int alc260_parse_auto_config(struct hda_codec *codec)
5927 struct alc_spec *spec = codec->spec;
5929 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
5931 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5935 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
5938 if (!spec->kctls.list)
5939 return 0; /* can't find valid BIOS pin config */
5940 err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg);
5944 spec->multiout.max_channels = 2;
5946 if (spec->autocfg.dig_outs)
5947 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
5948 if (spec->kctls.list)
5949 add_mixer(spec, spec->kctls.list);
5951 add_verb(spec, alc260_volume_init_verbs);
5953 spec->num_mux_defs = 1;
5954 spec->input_mux = &spec->private_imux[0];
5956 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
5961 /* additional initialization for auto-configuration model */
5962 static void alc260_auto_init(struct hda_codec *codec)
5964 struct alc_spec *spec = codec->spec;
5965 alc260_auto_init_multi_out(codec);
5966 alc260_auto_init_analog_input(codec);
5967 if (spec->unsol_event)
5968 alc_inithook(codec);
5971 #ifdef CONFIG_SND_HDA_POWER_SAVE
5972 static struct hda_amp_list alc260_loopbacks[] = {
5973 { 0x07, HDA_INPUT, 0 },
5974 { 0x07, HDA_INPUT, 1 },
5975 { 0x07, HDA_INPUT, 2 },
5976 { 0x07, HDA_INPUT, 3 },
5977 { 0x07, HDA_INPUT, 4 },
5983 * ALC260 configurations
5985 static const char *alc260_models[ALC260_MODEL_LAST] = {
5986 [ALC260_BASIC] = "basic",
5988 [ALC260_HP_3013] = "hp-3013",
5989 [ALC260_HP_DC7600] = "hp-dc7600",
5990 [ALC260_FUJITSU_S702X] = "fujitsu",
5991 [ALC260_ACER] = "acer",
5992 [ALC260_WILL] = "will",
5993 [ALC260_REPLACER_672V] = "replacer",
5994 [ALC260_FAVORIT100] = "favorit100",
5995 #ifdef CONFIG_SND_DEBUG
5996 [ALC260_TEST] = "test",
5998 [ALC260_AUTO] = "auto",
6001 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6002 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6003 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6004 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6005 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6006 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013),
6007 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6008 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6009 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6010 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6011 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6012 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6013 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6014 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6015 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6016 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6017 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6018 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6019 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6020 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6024 static struct alc_config_preset alc260_presets[] = {
6026 .mixers = { alc260_base_output_mixer,
6027 alc260_input_mixer },
6028 .init_verbs = { alc260_init_verbs },
6029 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6030 .dac_nids = alc260_dac_nids,
6031 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6032 .adc_nids = alc260_adc_nids,
6033 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6034 .channel_mode = alc260_modes,
6035 .input_mux = &alc260_capture_source,
6038 .mixers = { alc260_hp_output_mixer,
6039 alc260_input_mixer },
6040 .init_verbs = { alc260_init_verbs,
6041 alc260_hp_unsol_verbs },
6042 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6043 .dac_nids = alc260_dac_nids,
6044 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6045 .adc_nids = alc260_adc_nids_alt,
6046 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6047 .channel_mode = alc260_modes,
6048 .input_mux = &alc260_capture_source,
6049 .unsol_event = alc260_hp_unsol_event,
6050 .init_hook = alc260_hp_automute,
6052 [ALC260_HP_DC7600] = {
6053 .mixers = { alc260_hp_dc7600_mixer,
6054 alc260_input_mixer },
6055 .init_verbs = { alc260_init_verbs,
6056 alc260_hp_dc7600_verbs },
6057 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6058 .dac_nids = alc260_dac_nids,
6059 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6060 .adc_nids = alc260_adc_nids_alt,
6061 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6062 .channel_mode = alc260_modes,
6063 .input_mux = &alc260_capture_source,
6064 .unsol_event = alc260_hp_3012_unsol_event,
6065 .init_hook = alc260_hp_3012_automute,
6067 [ALC260_HP_3013] = {
6068 .mixers = { alc260_hp_3013_mixer,
6069 alc260_input_mixer },
6070 .init_verbs = { alc260_hp_3013_init_verbs,
6071 alc260_hp_3013_unsol_verbs },
6072 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6073 .dac_nids = alc260_dac_nids,
6074 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6075 .adc_nids = alc260_adc_nids_alt,
6076 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6077 .channel_mode = alc260_modes,
6078 .input_mux = &alc260_capture_source,
6079 .unsol_event = alc260_hp_3013_unsol_event,
6080 .init_hook = alc260_hp_3013_automute,
6082 [ALC260_FUJITSU_S702X] = {
6083 .mixers = { alc260_fujitsu_mixer },
6084 .init_verbs = { alc260_fujitsu_init_verbs },
6085 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6086 .dac_nids = alc260_dac_nids,
6087 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6088 .adc_nids = alc260_dual_adc_nids,
6089 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6090 .channel_mode = alc260_modes,
6091 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6092 .input_mux = alc260_fujitsu_capture_sources,
6095 .mixers = { alc260_acer_mixer },
6096 .init_verbs = { alc260_acer_init_verbs },
6097 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6098 .dac_nids = alc260_dac_nids,
6099 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6100 .adc_nids = alc260_dual_adc_nids,
6101 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6102 .channel_mode = alc260_modes,
6103 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6104 .input_mux = alc260_acer_capture_sources,
6106 [ALC260_FAVORIT100] = {
6107 .mixers = { alc260_favorit100_mixer },
6108 .init_verbs = { alc260_favorit100_init_verbs },
6109 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6110 .dac_nids = alc260_dac_nids,
6111 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6112 .adc_nids = alc260_dual_adc_nids,
6113 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6114 .channel_mode = alc260_modes,
6115 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6116 .input_mux = alc260_favorit100_capture_sources,
6119 .mixers = { alc260_will_mixer },
6120 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6121 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6122 .dac_nids = alc260_dac_nids,
6123 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6124 .adc_nids = alc260_adc_nids,
6125 .dig_out_nid = ALC260_DIGOUT_NID,
6126 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6127 .channel_mode = alc260_modes,
6128 .input_mux = &alc260_capture_source,
6130 [ALC260_REPLACER_672V] = {
6131 .mixers = { alc260_replacer_672v_mixer },
6132 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6133 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6134 .dac_nids = alc260_dac_nids,
6135 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6136 .adc_nids = alc260_adc_nids,
6137 .dig_out_nid = ALC260_DIGOUT_NID,
6138 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6139 .channel_mode = alc260_modes,
6140 .input_mux = &alc260_capture_source,
6141 .unsol_event = alc260_replacer_672v_unsol_event,
6142 .init_hook = alc260_replacer_672v_automute,
6144 #ifdef CONFIG_SND_DEBUG
6146 .mixers = { alc260_test_mixer },
6147 .init_verbs = { alc260_test_init_verbs },
6148 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6149 .dac_nids = alc260_test_dac_nids,
6150 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6151 .adc_nids = alc260_test_adc_nids,
6152 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6153 .channel_mode = alc260_modes,
6154 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6155 .input_mux = alc260_test_capture_sources,
6160 static int patch_alc260(struct hda_codec *codec)
6162 struct alc_spec *spec;
6163 int err, board_config;
6165 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6171 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6174 if (board_config < 0) {
6175 snd_printd(KERN_INFO "hda_codec: Unknown model for %s, "
6176 "trying auto-probe from BIOS...\n",
6178 board_config = ALC260_AUTO;
6181 if (board_config == ALC260_AUTO) {
6182 /* automatic parse from the BIOS config */
6183 err = alc260_parse_auto_config(codec);
6189 "hda_codec: Cannot set up configuration "
6190 "from BIOS. Using base mode...\n");
6191 board_config = ALC260_BASIC;
6195 err = snd_hda_attach_beep_device(codec, 0x1);
6201 if (board_config != ALC260_AUTO)
6202 setup_preset(spec, &alc260_presets[board_config]);
6204 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6205 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6207 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6208 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6210 if (!spec->adc_nids && spec->input_mux) {
6211 /* check whether NID 0x04 is valid */
6212 unsigned int wcap = get_wcaps(codec, 0x04);
6213 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
6215 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6216 spec->adc_nids = alc260_adc_nids_alt;
6217 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6219 spec->adc_nids = alc260_adc_nids;
6220 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6223 set_capture_mixer(spec);
6224 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6226 spec->vmaster_nid = 0x08;
6228 codec->patch_ops = alc_patch_ops;
6229 if (board_config == ALC260_AUTO)
6230 spec->init_hook = alc260_auto_init;
6231 #ifdef CONFIG_SND_HDA_POWER_SAVE
6232 if (!spec->loopback.amplist)
6233 spec->loopback.amplist = alc260_loopbacks;
6235 codec->proc_widget_hook = print_realtek_coef;
6244 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6245 * configuration. Each pin widget can choose any input DACs and a mixer.
6246 * Each ADC is connected from a mixer of all inputs. This makes possible
6247 * 6-channel independent captures.
6249 * In addition, an independent DAC for the multi-playback (not used in this
6252 #define ALC882_DIGOUT_NID 0x06
6253 #define ALC882_DIGIN_NID 0x0a
6255 static struct hda_channel_mode alc882_ch_modes[1] = {
6259 static hda_nid_t alc882_dac_nids[4] = {
6260 /* front, rear, clfe, rear_surr */
6261 0x02, 0x03, 0x04, 0x05
6264 /* identical with ALC880 */
6265 #define alc882_adc_nids alc880_adc_nids
6266 #define alc882_adc_nids_alt alc880_adc_nids_alt
6268 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6269 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6272 /* FIXME: should be a matrix-type input source selection */
6274 static struct hda_input_mux alc882_capture_source = {
6278 { "Front Mic", 0x1 },
6284 static struct hda_input_mux mb5_capture_source = {
6296 static struct hda_verb alc882_3ST_ch2_init[] = {
6297 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6298 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6299 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6300 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6307 static struct hda_verb alc882_3ST_ch6_init[] = {
6308 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6309 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6310 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6311 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6312 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6313 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6317 static struct hda_channel_mode alc882_3ST_6ch_modes[2] = {
6318 { 2, alc882_3ST_ch2_init },
6319 { 6, alc882_3ST_ch6_init },
6325 static struct hda_verb alc882_sixstack_ch6_init[] = {
6326 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6327 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6328 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6329 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6336 static struct hda_verb alc882_sixstack_ch8_init[] = {
6337 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6338 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6339 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6340 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6344 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6345 { 6, alc882_sixstack_ch6_init },
6346 { 8, alc882_sixstack_ch8_init },
6350 * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic
6356 static struct hda_verb alc885_mbp_ch2_init[] = {
6357 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6358 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6359 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6366 static struct hda_verb alc885_mbp_ch6_init[] = {
6367 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6368 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6369 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6370 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6371 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6375 static struct hda_channel_mode alc885_mbp_6ch_modes[2] = {
6376 { 2, alc885_mbp_ch2_init },
6377 { 6, alc885_mbp_ch6_init },
6382 * Speakers/Woofer/HP = Front
6385 static struct hda_verb alc885_mb5_ch2_init[] = {
6386 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6393 * Speakers/HP = Front
6397 static struct hda_verb alc885_mb5_ch6_init[] = {
6398 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6400 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6404 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6405 { 2, alc885_mb5_ch2_init },
6406 { 6, alc885_mb5_ch6_init },
6409 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
6410 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
6412 static struct snd_kcontrol_new alc882_base_mixer[] = {
6413 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6414 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6415 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
6416 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
6417 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
6418 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
6419 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
6420 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
6421 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
6422 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
6423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6424 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6425 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6426 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6427 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6428 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6429 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6431 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6432 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6433 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6437 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
6438 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6439 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6440 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
6441 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6442 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6443 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6444 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
6445 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
6446 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
6447 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
6451 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
6452 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6453 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
6454 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
6455 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
6456 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
6457 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
6458 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
6459 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
6460 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6461 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
6463 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
6464 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
6465 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
6469 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
6470 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6471 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6474 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6475 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6476 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6477 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6478 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6482 static struct snd_kcontrol_new alc882_targa_mixer[] = {
6483 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6484 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6485 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
6486 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6487 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6488 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6489 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6490 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6491 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6492 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6493 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
6494 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
6495 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
6499 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
6500 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
6502 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
6503 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6504 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
6505 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6506 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
6507 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6508 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6509 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6510 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6511 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
6512 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
6513 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6514 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6515 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6519 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
6520 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6521 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6522 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
6523 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
6524 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
6525 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
6526 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
6527 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
6528 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
6529 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
6533 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
6535 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6536 .name = "Channel Mode",
6537 .info = alc_ch_mode_info,
6538 .get = alc_ch_mode_get,
6539 .put = alc_ch_mode_put,
6544 static struct hda_verb alc882_init_verbs[] = {
6545 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6546 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6547 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6548 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6550 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6551 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6552 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6555 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6556 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6559 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6560 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6562 /* Front Pin: output 0 (0x0c) */
6563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6566 /* Rear Pin: output 1 (0x0d) */
6567 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6568 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6569 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6570 /* CLFE Pin: output 2 (0x0e) */
6571 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6572 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6573 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
6574 /* Side Pin: output 3 (0x0f) */
6575 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6576 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6577 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
6578 /* Mic (rear) pin: input vref at 80% */
6579 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6580 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6581 /* Front Mic pin: input vref at 80% */
6582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6583 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6584 /* Line In pin: input */
6585 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6586 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6587 /* Line-2 In: Headphone output (output 0 - 0x0c) */
6588 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6589 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6590 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
6591 /* CD pin widget for input */
6592 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6594 /* FIXME: use matrix-type input source selection */
6595 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6596 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6598 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6599 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6600 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6603 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6604 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6605 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6608 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6609 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6611 /* ADC1: mute amp left and right */
6612 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6613 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6614 /* ADC2: mute amp left and right */
6615 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6616 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6617 /* ADC3: mute amp left and right */
6618 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6619 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6624 static struct hda_verb alc882_eapd_verbs[] = {
6625 /* change to EAPD mode */
6626 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
6627 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
6632 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
6633 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6634 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
6635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
6636 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
6637 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
6638 /* FIXME: this looks suspicious...
6639 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT),
6640 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT),
6645 static struct hda_verb alc882_macpro_init_verbs[] = {
6646 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6649 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6650 /* Front Pin: output 0 (0x0c) */
6651 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6652 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6653 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6654 /* Front Mic pin: input vref at 80% */
6655 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6656 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6657 /* Speaker: output */
6658 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6659 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6660 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
6661 /* Headphone output (output 0 - 0x0c) */
6662 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6664 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6666 /* FIXME: use matrix-type input source selection */
6667 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6668 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6669 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6670 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6671 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6672 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6674 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6675 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6676 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6677 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6679 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6683 /* ADC1: mute amp left and right */
6684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6685 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6686 /* ADC2: mute amp left and right */
6687 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6688 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6689 /* ADC3: mute amp left and right */
6690 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6691 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6697 static struct hda_verb alc885_mb5_init_verbs[] = {
6699 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6700 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6701 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6702 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6704 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6705 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6706 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6707 /* Surround mixer */
6708 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6709 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6710 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6712 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6713 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6714 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6716 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6717 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6718 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6719 /* Front Pin (0x0c) */
6720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6722 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6723 /* LFE Pin (0x0e) */
6724 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
6725 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6726 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
6728 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6730 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
6731 /* Front Mic pin: input vref at 80% */
6732 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6733 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6735 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6736 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6738 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6739 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6740 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6741 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6745 /* Macbook Pro rev3 */
6746 static struct hda_verb alc885_mbp3_init_verbs[] = {
6747 /* Front mixer: unmute input/output amp left and right (volume = 0) */
6748 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6749 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6754 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6755 /* Front Pin: output 0 (0x0c) */
6756 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6758 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6759 /* HP Pin: output 0 (0x0d) */
6760 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
6761 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
6763 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6764 /* Mic (rear) pin: input vref at 80% */
6765 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6766 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6767 /* Front Mic pin: input vref at 80% */
6768 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6769 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6770 /* Line In pin: use output 1 when in LineOut mode */
6771 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6772 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6773 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
6775 /* FIXME: use matrix-type input source selection */
6776 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
6777 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
6778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6780 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6781 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6785 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6786 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6790 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6791 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6792 /* ADC1: mute amp left and right */
6793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6794 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6795 /* ADC2: mute amp left and right */
6796 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6797 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6798 /* ADC3: mute amp left and right */
6799 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6800 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6805 /* iMac 24 mixer. */
6806 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
6807 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
6808 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
6812 /* iMac 24 init verbs. */
6813 static struct hda_verb alc885_imac24_init_verbs[] = {
6814 /* Internal speakers: output 0 (0x0c) */
6815 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6816 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6817 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
6818 /* Internal speakers: output 0 (0x0c) */
6819 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6820 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6821 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
6822 /* Headphone: output 0 (0x0c) */
6823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6825 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
6826 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6827 /* Front Mic: input vref at 80% */
6828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6833 /* Toggle speaker-output according to the hp-jack state */
6834 static void alc885_imac24_automute_init_hook(struct hda_codec *codec)
6836 struct alc_spec *spec = codec->spec;
6838 spec->autocfg.hp_pins[0] = 0x14;
6839 spec->autocfg.speaker_pins[0] = 0x18;
6840 spec->autocfg.speaker_pins[1] = 0x1a;
6841 alc_automute_amp(codec);
6844 static void alc885_mbp3_init_hook(struct hda_codec *codec)
6846 struct alc_spec *spec = codec->spec;
6848 spec->autocfg.hp_pins[0] = 0x15;
6849 spec->autocfg.speaker_pins[0] = 0x14;
6850 alc_automute_amp(codec);
6854 static struct hda_verb alc882_targa_verbs[] = {
6855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6856 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6858 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6859 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6861 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6865 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
6866 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
6867 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
6868 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
6872 /* toggle speaker-output according to the hp-jack state */
6873 static void alc882_targa_automute(struct hda_codec *codec)
6875 struct alc_spec *spec = codec->spec;
6876 alc_automute_amp(codec);
6877 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6878 spec->jack_present ? 1 : 3);
6881 static void alc882_targa_init_hook(struct hda_codec *codec)
6883 struct alc_spec *spec = codec->spec;
6885 spec->autocfg.hp_pins[0] = 0x14;
6886 spec->autocfg.speaker_pins[0] = 0x1b;
6887 alc882_targa_automute(codec);
6890 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
6892 if ((res >> 26) == ALC880_HP_EVENT)
6893 alc882_targa_automute(codec);
6896 static struct hda_verb alc882_asus_a7j_verbs[] = {
6897 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6898 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6900 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6902 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6904 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6905 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6906 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6908 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6909 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6910 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6914 static struct hda_verb alc882_asus_a7m_verbs[] = {
6915 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6916 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6918 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6919 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6920 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6922 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6924 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
6926 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
6927 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
6928 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
6932 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
6934 unsigned int gpiostate, gpiomask, gpiodir;
6936 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
6937 AC_VERB_GET_GPIO_DATA, 0);
6940 gpiostate |= (1 << pin);
6942 gpiostate &= ~(1 << pin);
6944 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
6945 AC_VERB_GET_GPIO_MASK, 0);
6946 gpiomask |= (1 << pin);
6948 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
6949 AC_VERB_GET_GPIO_DIRECTION, 0);
6950 gpiodir |= (1 << pin);
6953 snd_hda_codec_write(codec, codec->afg, 0,
6954 AC_VERB_SET_GPIO_MASK, gpiomask);
6955 snd_hda_codec_write(codec, codec->afg, 0,
6956 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
6960 snd_hda_codec_write(codec, codec->afg, 0,
6961 AC_VERB_SET_GPIO_DATA, gpiostate);
6964 /* set up GPIO at initialization */
6965 static void alc885_macpro_init_hook(struct hda_codec *codec)
6967 alc882_gpio_mute(codec, 0, 0);
6968 alc882_gpio_mute(codec, 1, 0);
6971 /* set up GPIO and update auto-muting at initialization */
6972 static void alc885_imac24_init_hook(struct hda_codec *codec)
6974 alc885_macpro_init_hook(codec);
6975 alc885_imac24_automute_init_hook(codec);
6979 * generic initialization of ADC, input mixers and output mixers
6981 static struct hda_verb alc882_auto_init_verbs[] = {
6983 * Unmute ADC0-2 and set the default input to mic-in
6985 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
6986 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6987 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
6988 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6989 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
6990 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6992 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6994 * Note: PASD motherboards uses the Line In 2 as the input for
6995 * front panel mic (mic 2)
6997 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6998 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6999 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7005 * Set up output mixers (0x0c - 0x0f)
7007 /* set vol=0 to output mixers */
7008 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7009 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7010 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7011 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7012 /* set up input amps for analog loopback */
7013 /* Amp Indices: DAC = 0, mixer = 1 */
7014 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7015 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7016 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7017 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7019 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7022 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7023 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7025 /* FIXME: use matrix-type input source selection */
7026 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7027 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7028 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7029 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7030 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7031 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7034 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7035 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7036 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7039 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7046 #ifdef CONFIG_SND_HDA_POWER_SAVE
7047 #define alc882_loopbacks alc880_loopbacks
7050 /* pcm configuration: identiacal with ALC880 */
7051 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
7052 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
7053 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
7054 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
7057 * configuration and preset
7059 static const char *alc882_models[ALC882_MODEL_LAST] = {
7060 [ALC882_3ST_DIG] = "3stack-dig",
7061 [ALC882_6ST_DIG] = "6stack-dig",
7062 [ALC882_ARIMA] = "arima",
7063 [ALC882_W2JC] = "w2jc",
7064 [ALC882_TARGA] = "targa",
7065 [ALC882_ASUS_A7J] = "asus-a7j",
7066 [ALC882_ASUS_A7M] = "asus-a7m",
7067 [ALC885_MACPRO] = "macpro",
7068 [ALC885_MB5] = "mb5",
7069 [ALC885_MBP3] = "mbp3",
7070 [ALC885_IMAC24] = "imac24",
7071 [ALC882_AUTO] = "auto",
7074 static struct snd_pci_quirk alc882_cfg_tbl[] = {
7075 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
7076 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
7077 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
7078 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
7079 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
7080 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
7081 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
7082 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
7083 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
7084 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
7085 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
7086 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA),
7090 static struct alc_config_preset alc882_presets[] = {
7091 [ALC882_3ST_DIG] = {
7092 .mixers = { alc882_base_mixer },
7093 .init_verbs = { alc882_init_verbs },
7094 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7095 .dac_nids = alc882_dac_nids,
7096 .dig_out_nid = ALC882_DIGOUT_NID,
7097 .dig_in_nid = ALC882_DIGIN_NID,
7098 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7099 .channel_mode = alc882_ch_modes,
7101 .input_mux = &alc882_capture_source,
7103 [ALC882_6ST_DIG] = {
7104 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7105 .init_verbs = { alc882_init_verbs },
7106 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7107 .dac_nids = alc882_dac_nids,
7108 .dig_out_nid = ALC882_DIGOUT_NID,
7109 .dig_in_nid = ALC882_DIGIN_NID,
7110 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7111 .channel_mode = alc882_sixstack_modes,
7112 .input_mux = &alc882_capture_source,
7115 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
7116 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs },
7117 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7118 .dac_nids = alc882_dac_nids,
7119 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
7120 .channel_mode = alc882_sixstack_modes,
7121 .input_mux = &alc882_capture_source,
7124 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
7125 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7126 alc880_gpio1_init_verbs },
7127 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7128 .dac_nids = alc882_dac_nids,
7129 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7130 .channel_mode = alc880_threestack_modes,
7132 .input_mux = &alc882_capture_source,
7133 .dig_out_nid = ALC882_DIGOUT_NID,
7136 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
7137 .init_verbs = { alc885_mbp3_init_verbs,
7138 alc880_gpio1_init_verbs },
7139 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7140 .dac_nids = alc882_dac_nids,
7141 .channel_mode = alc885_mbp_6ch_modes,
7142 .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes),
7143 .input_mux = &alc882_capture_source,
7144 .dig_out_nid = ALC882_DIGOUT_NID,
7145 .dig_in_nid = ALC882_DIGIN_NID,
7146 .unsol_event = alc_automute_amp_unsol_event,
7147 .init_hook = alc885_mbp3_init_hook,
7150 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
7151 .init_verbs = { alc885_mb5_init_verbs,
7152 alc880_gpio1_init_verbs },
7153 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7154 .dac_nids = alc882_dac_nids,
7155 .channel_mode = alc885_mb5_6ch_modes,
7156 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
7157 .input_mux = &mb5_capture_source,
7158 .dig_out_nid = ALC882_DIGOUT_NID,
7159 .dig_in_nid = ALC882_DIGIN_NID,
7162 .mixers = { alc882_macpro_mixer },
7163 .init_verbs = { alc882_macpro_init_verbs },
7164 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7165 .dac_nids = alc882_dac_nids,
7166 .dig_out_nid = ALC882_DIGOUT_NID,
7167 .dig_in_nid = ALC882_DIGIN_NID,
7168 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7169 .channel_mode = alc882_ch_modes,
7170 .input_mux = &alc882_capture_source,
7171 .init_hook = alc885_macpro_init_hook,
7174 .mixers = { alc885_imac24_mixer },
7175 .init_verbs = { alc885_imac24_init_verbs },
7176 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7177 .dac_nids = alc882_dac_nids,
7178 .dig_out_nid = ALC882_DIGOUT_NID,
7179 .dig_in_nid = ALC882_DIGIN_NID,
7180 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
7181 .channel_mode = alc882_ch_modes,
7182 .input_mux = &alc882_capture_source,
7183 .unsol_event = alc_automute_amp_unsol_event,
7184 .init_hook = alc885_imac24_init_hook,
7187 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
7188 .init_verbs = { alc882_init_verbs, alc882_targa_verbs},
7189 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7190 .dac_nids = alc882_dac_nids,
7191 .dig_out_nid = ALC882_DIGOUT_NID,
7192 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7193 .adc_nids = alc882_adc_nids,
7194 .capsrc_nids = alc882_capsrc_nids,
7195 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7196 .channel_mode = alc882_3ST_6ch_modes,
7198 .input_mux = &alc882_capture_source,
7199 .unsol_event = alc882_targa_unsol_event,
7200 .init_hook = alc882_targa_init_hook,
7202 [ALC882_ASUS_A7J] = {
7203 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
7204 .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs},
7205 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7206 .dac_nids = alc882_dac_nids,
7207 .dig_out_nid = ALC882_DIGOUT_NID,
7208 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
7209 .adc_nids = alc882_adc_nids,
7210 .capsrc_nids = alc882_capsrc_nids,
7211 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
7212 .channel_mode = alc882_3ST_6ch_modes,
7214 .input_mux = &alc882_capture_source,
7216 [ALC882_ASUS_A7M] = {
7217 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
7218 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs,
7219 alc880_gpio1_init_verbs,
7220 alc882_asus_a7m_verbs },
7221 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
7222 .dac_nids = alc882_dac_nids,
7223 .dig_out_nid = ALC882_DIGOUT_NID,
7224 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
7225 .channel_mode = alc880_threestack_modes,
7227 .input_mux = &alc882_capture_source,
7236 PINFIX_ABIT_AW9D_MAX
7239 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
7240 { 0x15, 0x01080104 }, /* side */
7241 { 0x16, 0x01011012 }, /* rear */
7242 { 0x17, 0x01016011 }, /* clfe */
7246 static const struct alc_pincfg *alc882_pin_fixes[] = {
7247 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix,
7250 static struct snd_pci_quirk alc882_pinfix_tbl[] = {
7251 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
7256 * BIOS auto configuration
7258 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
7259 hda_nid_t nid, int pin_type,
7263 struct alc_spec *spec = codec->spec;
7266 alc_set_pin_output(codec, nid, pin_type);
7267 if (spec->multiout.dac_nids[dac_idx] == 0x25)
7270 idx = spec->multiout.dac_nids[dac_idx] - 2;
7271 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
7275 static void alc882_auto_init_multi_out(struct hda_codec *codec)
7277 struct alc_spec *spec = codec->spec;
7280 for (i = 0; i <= HDA_SIDE; i++) {
7281 hda_nid_t nid = spec->autocfg.line_out_pins[i];
7282 int pin_type = get_pin_type(spec->autocfg.line_out_type);
7284 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
7289 static void alc882_auto_init_hp_out(struct hda_codec *codec)
7291 struct alc_spec *spec = codec->spec;
7294 pin = spec->autocfg.hp_pins[0];
7295 if (pin) /* connect to front */
7297 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
7298 pin = spec->autocfg.speaker_pins[0];
7300 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
7303 #define alc882_is_input_pin(nid) alc880_is_input_pin(nid)
7304 #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID
7306 static void alc882_auto_init_analog_input(struct hda_codec *codec)
7308 struct alc_spec *spec = codec->spec;
7311 for (i = 0; i < AUTO_PIN_LAST; i++) {
7312 hda_nid_t nid = spec->autocfg.input_pins[i];
7315 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/);
7316 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
7317 snd_hda_codec_write(codec, nid, 0,
7318 AC_VERB_SET_AMP_GAIN_MUTE,
7323 static void alc882_auto_init_input_src(struct hda_codec *codec)
7325 struct alc_spec *spec = codec->spec;
7328 for (c = 0; c < spec->num_adc_nids; c++) {
7329 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
7330 hda_nid_t nid = spec->capsrc_nids[c];
7331 unsigned int mux_idx;
7332 const struct hda_input_mux *imux;
7333 int conns, mute, idx, item;
7335 conns = snd_hda_get_connections(codec, nid, conn_list,
7336 ARRAY_SIZE(conn_list));
7339 mux_idx = c >= spec->num_mux_defs ? 0 : c;
7340 imux = &spec->input_mux[mux_idx];
7341 for (idx = 0; idx < conns; idx++) {
7342 /* if the current connection is the selected one,
7343 * unmute it as default - otherwise mute it
7345 mute = AMP_IN_MUTE(idx);
7346 for (item = 0; item < imux->num_items; item++) {
7347 if (imux->items[item].index == idx) {
7348 if (spec->cur_mux[c] == item)
7349 mute = AMP_IN_UNMUTE(idx);
7353 /* check if we have a selector or mixer
7354 * we could check for the widget type instead, but
7355 * just check for Amp-In presence (in case of mixer
7356 * without amp-in there is something wrong, this
7357 * function shouldn't be used or capsrc nid is wrong)
7359 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
7360 snd_hda_codec_write(codec, nid, 0,
7361 AC_VERB_SET_AMP_GAIN_MUTE,
7363 else if (mute != AMP_IN_MUTE(idx))
7364 snd_hda_codec_write(codec, nid, 0,
7365 AC_VERB_SET_CONNECT_SEL,
7371 /* add mic boosts if needed */
7372 static int alc_auto_add_mic_boost(struct hda_codec *codec)
7374 struct alc_spec *spec = codec->spec;
7378 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
7379 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7380 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7382 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7386 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
7387 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
7388 err = add_control(spec, ALC_CTL_WIDGET_VOL,
7390 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
7397 /* almost identical with ALC880 parser... */
7398 static int alc882_parse_auto_config(struct hda_codec *codec)
7400 struct alc_spec *spec = codec->spec;
7401 int err = alc880_parse_auto_config(codec);
7406 return 0; /* no config found */
7408 err = alc_auto_add_mic_boost(codec);
7412 /* hack - override the init verbs */
7413 spec->init_verbs[0] = alc882_auto_init_verbs;
7415 return 1; /* config found */
7418 /* additional initialization for auto-configuration model */
7419 static void alc882_auto_init(struct hda_codec *codec)
7421 struct alc_spec *spec = codec->spec;
7422 alc882_auto_init_multi_out(codec);
7423 alc882_auto_init_hp_out(codec);
7424 alc882_auto_init_analog_input(codec);
7425 alc882_auto_init_input_src(codec);
7426 if (spec->unsol_event)
7427 alc_inithook(codec);
7430 static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */
7432 static int patch_alc882(struct hda_codec *codec)
7434 struct alc_spec *spec;
7435 int err, board_config;
7437 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7443 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
7447 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
7448 /* Pick up systems that don't supply PCI SSID */
7449 switch (codec->subsystem_id) {
7450 case 0x106b0c00: /* Mac Pro */
7451 board_config = ALC885_MACPRO;
7453 case 0x106b1000: /* iMac 24 */
7454 case 0x106b2800: /* AppleTV */
7455 case 0x106b3e00: /* iMac 24 Aluminium */
7456 board_config = ALC885_IMAC24;
7458 case 0x106b00a0: /* MacBookPro3,1 - Another revision */
7459 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
7460 case 0x106b00a4: /* MacbookPro4,1 */
7461 case 0x106b2c00: /* Macbook Pro rev3 */
7462 /* Macbook 3.1 (0x106b3600) is handled by patch_alc883() */
7463 case 0x106b3800: /* MacbookPro4,1 - latter revision */
7464 board_config = ALC885_MBP3;
7466 case 0x106b3f00: /* Macbook 5,1 */
7467 case 0x106b4000: /* Macbook Pro 5,1 - FIXME: HP jack sense
7468 * seems not working, so apparently
7469 * no perfect solution yet
7471 board_config = ALC885_MB5;
7474 /* ALC889A is handled better as ALC888-compatible */
7475 if (codec->revision_id == 0x100101 ||
7476 codec->revision_id == 0x100103) {
7478 return patch_alc883(codec);
7480 printk(KERN_INFO "hda_codec: Unknown model for %s, "
7481 "trying auto-probe from BIOS...\n",
7483 board_config = ALC882_AUTO;
7487 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes);
7489 if (board_config == ALC882_AUTO) {
7490 /* automatic parse from the BIOS config */
7491 err = alc882_parse_auto_config(codec);
7497 "hda_codec: Cannot set up configuration "
7498 "from BIOS. Using base mode...\n");
7499 board_config = ALC882_3ST_DIG;
7503 err = snd_hda_attach_beep_device(codec, 0x1);
7509 if (board_config != ALC882_AUTO)
7510 setup_preset(spec, &alc882_presets[board_config]);
7512 spec->stream_analog_playback = &alc882_pcm_analog_playback;
7513 spec->stream_analog_capture = &alc882_pcm_analog_capture;
7514 /* FIXME: setup DAC5 */
7515 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
7516 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
7518 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7519 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7521 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7522 if (!spec->adc_nids && spec->input_mux) {
7523 /* check whether NID 0x07 is valid */
7524 unsigned int wcap = get_wcaps(codec, 0x07);
7526 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
7527 if (wcap != AC_WID_AUD_IN) {
7528 spec->adc_nids = alc882_adc_nids_alt;
7529 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt);
7530 spec->capsrc_nids = alc882_capsrc_nids_alt;
7532 spec->adc_nids = alc882_adc_nids;
7533 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids);
7534 spec->capsrc_nids = alc882_capsrc_nids;
7537 set_capture_mixer(spec);
7538 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7540 spec->vmaster_nid = 0x0c;
7542 codec->patch_ops = alc_patch_ops;
7543 if (board_config == ALC882_AUTO)
7544 spec->init_hook = alc882_auto_init;
7545 #ifdef CONFIG_SND_HDA_POWER_SAVE
7546 if (!spec->loopback.amplist)
7547 spec->loopback.amplist = alc882_loopbacks;
7549 codec->proc_widget_hook = print_realtek_coef;
7557 * ALC883 is almost identical with ALC880 but has cleaner and more flexible
7558 * configuration. Each pin widget can choose any input DACs and a mixer.
7559 * Each ADC is connected from a mixer of all inputs. This makes possible
7560 * 6-channel independent captures.
7562 * In addition, an independent DAC for the multi-playback (not used in this
7565 #define ALC883_DIGOUT_NID 0x06
7566 #define ALC883_DIGIN_NID 0x0a
7568 #define ALC1200_DIGOUT_NID 0x10
7570 static hda_nid_t alc883_dac_nids[4] = {
7571 /* front, rear, clfe, rear_surr */
7572 0x02, 0x03, 0x04, 0x05
7575 static hda_nid_t alc883_adc_nids[2] = {
7580 static hda_nid_t alc883_adc_nids_alt[1] = {
7585 static hda_nid_t alc883_adc_nids_rev[2] = {
7590 #define alc889_adc_nids alc880_adc_nids
7592 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7594 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7596 #define alc889_capsrc_nids alc882_capsrc_nids
7599 /* FIXME: should be a matrix-type input source selection */
7601 static struct hda_input_mux alc883_capture_source = {
7605 { "Front Mic", 0x1 },
7611 static struct hda_input_mux alc883_3stack_6ch_intel = {
7615 { "Front Mic", 0x0 },
7621 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7629 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7639 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7647 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7651 { "Front Mic", 0x1 },
7656 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7664 static struct hda_input_mux alc889A_mb31_capture_source = {
7668 /* Front Mic (0x01) unused */
7670 /* Line 2 (0x03) unused */
7671 /* CD (0x04) unsused? */
7678 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7685 static struct hda_verb alc883_3ST_ch2_init[] = {
7686 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7687 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7688 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7689 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7696 static struct hda_verb alc883_3ST_ch4_init[] = {
7697 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7698 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7699 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7700 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7701 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7708 static struct hda_verb alc883_3ST_ch6_init[] = {
7709 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7710 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7711 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7712 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7713 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7714 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7718 static struct hda_channel_mode alc883_3ST_6ch_modes[3] = {
7719 { 2, alc883_3ST_ch2_init },
7720 { 4, alc883_3ST_ch4_init },
7721 { 6, alc883_3ST_ch6_init },
7728 static struct hda_verb alc883_4ST_ch2_init[] = {
7729 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7730 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7731 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7732 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7733 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7734 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7741 static struct hda_verb alc883_4ST_ch4_init[] = {
7742 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7743 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7744 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7745 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7746 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7747 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7748 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7755 static struct hda_verb alc883_4ST_ch6_init[] = {
7756 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7757 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7758 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7759 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7760 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7761 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7762 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7763 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7770 static struct hda_verb alc883_4ST_ch8_init[] = {
7771 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7772 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7773 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7774 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7775 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7776 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7777 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7778 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7779 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7783 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7784 { 2, alc883_4ST_ch2_init },
7785 { 4, alc883_4ST_ch4_init },
7786 { 6, alc883_4ST_ch6_init },
7787 { 8, alc883_4ST_ch8_init },
7794 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7795 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7796 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7797 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7798 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7805 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7806 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7807 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7808 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7809 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7810 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7817 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7818 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7819 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7820 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7821 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7822 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7823 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7827 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7828 { 2, alc883_3ST_ch2_intel_init },
7829 { 4, alc883_3ST_ch4_intel_init },
7830 { 6, alc883_3ST_ch6_intel_init },
7836 static struct hda_verb alc883_sixstack_ch6_init[] = {
7837 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7838 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7839 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7840 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7847 static struct hda_verb alc883_sixstack_ch8_init[] = {
7848 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7849 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7850 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7851 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7855 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7856 { 6, alc883_sixstack_ch6_init },
7857 { 8, alc883_sixstack_ch8_init },
7860 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7861 static struct hda_verb alc889A_mb31_ch2_init[] = {
7862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7863 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7864 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7865 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7869 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7870 static struct hda_verb alc889A_mb31_ch4_init[] = {
7871 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7873 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7874 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7878 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7879 static struct hda_verb alc889A_mb31_ch5_init[] = {
7880 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7881 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7882 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7883 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7887 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7888 static struct hda_verb alc889A_mb31_ch6_init[] = {
7889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7890 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7891 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7892 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7896 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7897 { 2, alc889A_mb31_ch2_init },
7898 { 4, alc889A_mb31_ch4_init },
7899 { 5, alc889A_mb31_ch5_init },
7900 { 6, alc889A_mb31_ch6_init },
7903 static struct hda_verb alc883_medion_eapd_verbs[] = {
7904 /* eanable EAPD on medion laptop */
7905 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7906 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7910 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7911 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7914 static struct snd_kcontrol_new alc883_base_mixer[] = {
7915 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7916 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7917 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7918 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7919 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7920 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7921 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7922 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7924 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7926 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7927 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7929 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7931 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7933 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7934 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7935 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7939 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7940 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7941 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7942 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7943 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7944 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7945 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7946 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7947 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7948 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7950 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7951 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7952 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7956 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7957 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7958 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7959 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7960 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7961 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7962 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7963 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7964 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7965 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7966 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7970 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7972 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7973 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7974 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7975 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7977 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7979 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7980 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7984 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7995 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7997 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8001 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8002 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8003 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8004 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8005 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8006 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8007 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8008 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8009 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8010 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8011 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8012 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8013 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8014 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8016 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8017 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8018 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8019 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8020 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8024 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8025 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8026 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8029 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8031 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8032 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8033 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8034 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8038 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8039 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8040 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8042 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8044 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8048 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8049 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8050 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8052 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8053 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8054 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8055 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8056 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8057 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8061 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8067 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8071 static struct snd_kcontrol_new alc883_tagra_mixer[] = {
8072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8074 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8075 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8076 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8077 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8078 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8080 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8081 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8082 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8084 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8085 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8087 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8091 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
8092 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8102 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8106 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8108 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8118 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8119 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8120 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8126 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8127 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8131 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8132 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8134 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8135 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8136 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8138 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8139 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8140 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8144 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8145 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8146 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8156 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8158 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8160 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8161 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8162 0x0d, 1, 0x0, HDA_OUTPUT),
8163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8166 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8167 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8168 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8169 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8171 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8177 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8181 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8189 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8191 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8192 /* Output switches */
8193 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8194 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8195 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8207 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8210 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8211 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8212 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8213 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8217 static struct hda_bind_ctls alc883_bind_cap_vol = {
8218 .ops = &snd_hda_bind_vol,
8220 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8221 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8226 static struct hda_bind_ctls alc883_bind_cap_switch = {
8227 .ops = &snd_hda_bind_sw,
8229 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8230 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8235 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8237 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8239 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8240 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8247 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8248 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8249 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8252 /* .name = "Capture Source", */
8253 .name = "Input Source",
8255 .info = alc_mux_enum_info,
8256 .get = alc_mux_enum_get,
8257 .put = alc_mux_enum_put,
8262 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8265 .name = "Channel Mode",
8266 .info = alc_ch_mode_info,
8267 .get = alc_ch_mode_get,
8268 .put = alc_ch_mode_put,
8273 static struct hda_verb alc883_init_verbs[] = {
8274 /* ADC1: mute amp left and right */
8275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8276 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8277 /* ADC2: mute amp left and right */
8278 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8279 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8280 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8282 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8283 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8285 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8286 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8287 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8290 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8291 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8293 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8294 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8295 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8297 /* mute analog input loopbacks */
8298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8299 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8304 /* Front Pin: output 0 (0x0c) */
8305 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8306 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8307 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8308 /* Rear Pin: output 1 (0x0d) */
8309 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8310 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8311 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8312 /* CLFE Pin: output 2 (0x0e) */
8313 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8314 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8315 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8316 /* Side Pin: output 3 (0x0f) */
8317 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8318 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8319 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8320 /* Mic (rear) pin: input vref at 80% */
8321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8323 /* Front Mic pin: input vref at 80% */
8324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8326 /* Line In pin: input */
8327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8329 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8331 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8332 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8333 /* CD pin widget for input */
8334 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8336 /* FIXME: use matrix-type input source selection */
8337 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8344 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8345 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8351 /* toggle speaker-output according to the hp-jack state */
8352 static void alc883_mitac_init_hook(struct hda_codec *codec)
8354 struct alc_spec *spec = codec->spec;
8356 spec->autocfg.hp_pins[0] = 0x15;
8357 spec->autocfg.speaker_pins[0] = 0x14;
8358 spec->autocfg.speaker_pins[1] = 0x17;
8359 alc_automute_amp(codec);
8362 /* auto-toggle front mic */
8364 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8366 unsigned int present;
8369 present = snd_hda_codec_read(codec, 0x18, 0,
8370 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8371 bits = present ? HDA_AMP_MUTE : 0;
8372 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8376 static struct hda_verb alc883_mitac_verbs[] = {
8378 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8379 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8381 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8382 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8384 /* enable unsolicited event */
8385 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8386 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8391 static struct hda_verb alc883_clevo_m720_verbs[] = {
8393 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8394 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8396 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8397 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8399 /* enable unsolicited event */
8400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8406 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8408 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8412 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8414 /* enable unsolicited event */
8415 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8420 static struct hda_verb alc883_tagra_verbs[] = {
8421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8427 /* Connect Line-Out side jack (SPDIF) to Side */
8428 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8429 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8430 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8431 /* Connect Mic jack to CLFE */
8432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8433 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8434 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8435 /* Connect Line-in jack to Surround */
8436 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8437 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8438 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8439 /* Connect HP out jack to Front */
8440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8441 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8442 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8444 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8449 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8451 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8452 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8456 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8457 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8459 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8460 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8464 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8467 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8468 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8469 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8473 static struct hda_verb alc883_haier_w66_verbs[] = {
8474 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8479 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8480 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8481 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8482 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8486 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8487 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8489 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8490 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8493 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8494 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8498 static struct hda_verb alc888_6st_dell_verbs[] = {
8499 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8503 static struct hda_verb alc883_vaiott_verbs[] = {
8505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8506 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8508 /* enable unsolicited event */
8509 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8514 static void alc888_3st_hp_init_hook(struct hda_codec *codec)
8516 struct alc_spec *spec = codec->spec;
8518 spec->autocfg.hp_pins[0] = 0x1b;
8519 spec->autocfg.speaker_pins[0] = 0x14;
8520 spec->autocfg.speaker_pins[1] = 0x16;
8521 spec->autocfg.speaker_pins[2] = 0x18;
8522 alc_automute_amp(codec);
8525 static struct hda_verb alc888_3st_hp_verbs[] = {
8526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8527 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8528 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8529 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8536 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8537 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8538 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8539 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8540 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8547 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8548 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8549 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8550 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8551 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8552 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8559 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8560 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8561 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8562 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8563 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8564 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8565 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8569 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8570 { 2, alc888_3st_hp_2ch_init },
8571 { 4, alc888_3st_hp_4ch_init },
8572 { 6, alc888_3st_hp_6ch_init },
8575 /* toggle front-jack and RCA according to the hp-jack state */
8576 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8578 unsigned int present;
8580 present = snd_hda_codec_read(codec, 0x1b, 0,
8581 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8582 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8583 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8584 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8585 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8588 /* toggle RCA according to the front-jack state */
8589 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8591 unsigned int present;
8593 present = snd_hda_codec_read(codec, 0x14, 0,
8594 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8595 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8596 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8599 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8602 if ((res >> 26) == ALC880_HP_EVENT)
8603 alc888_lenovo_ms7195_front_automute(codec);
8604 if ((res >> 26) == ALC880_FRONT_EVENT)
8605 alc888_lenovo_ms7195_rca_automute(codec);
8608 static struct hda_verb alc883_medion_md2_verbs[] = {
8609 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8612 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8614 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8618 /* toggle speaker-output according to the hp-jack state */
8619 static void alc883_medion_md2_init_hook(struct hda_codec *codec)
8621 struct alc_spec *spec = codec->spec;
8623 spec->autocfg.hp_pins[0] = 0x14;
8624 spec->autocfg.speaker_pins[0] = 0x15;
8625 alc_automute_amp(codec);
8628 /* toggle speaker-output according to the hp-jack state */
8629 #define alc883_tagra_init_hook alc882_targa_init_hook
8630 #define alc883_tagra_unsol_event alc882_targa_unsol_event
8632 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8634 unsigned int present;
8636 present = snd_hda_codec_read(codec, 0x18, 0,
8637 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8638 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8639 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8642 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8644 struct alc_spec *spec = codec->spec;
8646 spec->autocfg.hp_pins[0] = 0x15;
8647 spec->autocfg.speaker_pins[0] = 0x14;
8648 alc_automute_amp(codec);
8649 alc883_clevo_m720_mic_automute(codec);
8652 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8655 switch (res >> 26) {
8656 case ALC880_MIC_EVENT:
8657 alc883_clevo_m720_mic_automute(codec);
8660 alc_automute_amp_unsol_event(codec, res);
8665 /* toggle speaker-output according to the hp-jack state */
8666 static void alc883_2ch_fujitsu_pi2515_init_hook(struct hda_codec *codec)
8668 struct alc_spec *spec = codec->spec;
8670 spec->autocfg.hp_pins[0] = 0x14;
8671 spec->autocfg.speaker_pins[0] = 0x15;
8672 alc_automute_amp(codec);
8675 static void alc883_haier_w66_init_hook(struct hda_codec *codec)
8677 struct alc_spec *spec = codec->spec;
8679 spec->autocfg.hp_pins[0] = 0x1b;
8680 spec->autocfg.speaker_pins[0] = 0x14;
8681 alc_automute_amp(codec);
8684 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8686 unsigned int present;
8689 present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0)
8690 & AC_PINSENSE_PRESENCE;
8691 bits = present ? HDA_AMP_MUTE : 0;
8692 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8693 HDA_AMP_MUTE, bits);
8696 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8698 unsigned int present;
8701 present = snd_hda_codec_read(codec, 0x1b, 0,
8702 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8703 bits = present ? HDA_AMP_MUTE : 0;
8704 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8705 HDA_AMP_MUTE, bits);
8706 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8707 HDA_AMP_MUTE, bits);
8710 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8713 if ((res >> 26) == ALC880_HP_EVENT)
8714 alc883_lenovo_101e_all_automute(codec);
8715 if ((res >> 26) == ALC880_FRONT_EVENT)
8716 alc883_lenovo_101e_ispeaker_automute(codec);
8719 /* toggle speaker-output according to the hp-jack state */
8720 static void alc883_acer_aspire_init_hook(struct hda_codec *codec)
8722 struct alc_spec *spec = codec->spec;
8724 spec->autocfg.hp_pins[0] = 0x14;
8725 spec->autocfg.speaker_pins[0] = 0x15;
8726 spec->autocfg.speaker_pins[1] = 0x16;
8727 alc_automute_amp(codec);
8730 static struct hda_verb alc883_acer_eapd_verbs[] = {
8731 /* HP Pin: output 0 (0x0c) */
8732 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8734 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8735 /* Front Pin: output 0 (0x0c) */
8736 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8737 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8738 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8739 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8740 /* eanable EAPD on medion laptop */
8741 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8742 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8743 /* enable unsolicited event */
8744 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8748 static void alc888_6st_dell_init_hook(struct hda_codec *codec)
8750 struct alc_spec *spec = codec->spec;
8752 spec->autocfg.hp_pins[0] = 0x1b;
8753 spec->autocfg.speaker_pins[0] = 0x14;
8754 spec->autocfg.speaker_pins[1] = 0x15;
8755 spec->autocfg.speaker_pins[2] = 0x16;
8756 spec->autocfg.speaker_pins[3] = 0x17;
8757 alc_automute_amp(codec);
8760 static void alc888_lenovo_sky_init_hook(struct hda_codec *codec)
8762 struct alc_spec *spec = codec->spec;
8764 spec->autocfg.hp_pins[0] = 0x1b;
8765 spec->autocfg.speaker_pins[0] = 0x14;
8766 spec->autocfg.speaker_pins[1] = 0x15;
8767 spec->autocfg.speaker_pins[2] = 0x16;
8768 spec->autocfg.speaker_pins[3] = 0x17;
8769 spec->autocfg.speaker_pins[4] = 0x1a;
8770 alc_automute_amp(codec);
8773 static void alc883_vaiott_init_hook(struct hda_codec *codec)
8775 struct alc_spec *spec = codec->spec;
8777 spec->autocfg.hp_pins[0] = 0x15;
8778 spec->autocfg.speaker_pins[0] = 0x14;
8779 spec->autocfg.speaker_pins[1] = 0x17;
8780 alc_automute_amp(codec);
8784 * generic initialization of ADC, input mixers and output mixers
8786 static struct hda_verb alc883_auto_init_verbs[] = {
8788 * Unmute ADC0-2 and set the default input to mic-in
8790 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8791 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8792 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8795 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8797 * Note: PASD motherboards uses the Line In 2 as the input for
8798 * front panel mic (mic 2)
8800 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8801 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8802 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8808 * Set up output mixers (0x0c - 0x0f)
8810 /* set vol=0 to output mixers */
8811 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8813 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8814 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8815 /* set up input amps for analog loopback */
8816 /* Amp Indices: DAC = 0, mixer = 1 */
8817 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8818 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8819 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8820 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8821 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8822 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8823 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8824 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8825 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8826 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8828 /* FIXME: use matrix-type input source selection */
8829 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8831 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8832 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8833 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8834 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8835 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8838 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8839 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8840 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */
8841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
8846 static struct hda_verb alc888_asus_m90v_verbs[] = {
8847 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8848 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8849 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8850 /* enable unsolicited event */
8851 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8852 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8856 static void alc883_nb_mic_automute(struct hda_codec *codec)
8858 unsigned int present;
8860 present = snd_hda_codec_read(codec, 0x18, 0,
8861 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
8862 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8863 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
8864 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
8865 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
8868 static void alc883_M90V_init_hook(struct hda_codec *codec)
8870 struct alc_spec *spec = codec->spec;
8872 spec->autocfg.hp_pins[0] = 0x1b;
8873 spec->autocfg.speaker_pins[0] = 0x14;
8874 spec->autocfg.speaker_pins[1] = 0x15;
8875 spec->autocfg.speaker_pins[2] = 0x16;
8876 alc_automute_pin(codec);
8879 static void alc883_mode2_unsol_event(struct hda_codec *codec,
8882 switch (res >> 26) {
8883 case ALC880_MIC_EVENT:
8884 alc883_nb_mic_automute(codec);
8887 alc_sku_unsol_event(codec, res);
8892 static void alc883_mode2_inithook(struct hda_codec *codec)
8894 alc883_M90V_init_hook(codec);
8895 alc883_nb_mic_automute(codec);
8898 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8900 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8901 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8902 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8903 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8904 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8905 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8906 /* enable unsolicited event */
8907 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8911 static void alc883_eee1601_inithook(struct hda_codec *codec)
8913 struct alc_spec *spec = codec->spec;
8915 spec->autocfg.hp_pins[0] = 0x14;
8916 spec->autocfg.speaker_pins[0] = 0x1b;
8917 alc_automute_pin(codec);
8920 static struct hda_verb alc889A_mb31_verbs[] = {
8921 /* Init rear pin (used as headphone output) */
8922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8923 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8924 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8925 /* Init line pin (used as output in 4ch and 6ch mode) */
8926 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8927 /* Init line 2 pin (used as headphone out by default) */
8928 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8929 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8933 /* Mute speakers according to the headphone jack state */
8934 static void alc889A_mb31_automute(struct hda_codec *codec)
8936 unsigned int present;
8938 /* Mute only in 2ch or 4ch mode */
8939 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8941 present = snd_hda_codec_read(codec, 0x15, 0,
8942 AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE;
8943 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8944 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8945 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8946 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8950 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8952 if ((res >> 26) == ALC880_HP_EVENT)
8953 alc889A_mb31_automute(codec);
8956 #ifdef CONFIG_SND_HDA_POWER_SAVE
8957 #define alc883_loopbacks alc880_loopbacks
8960 /* pcm configuration: identiacal with ALC880 */
8961 #define alc883_pcm_analog_playback alc880_pcm_analog_playback
8962 #define alc883_pcm_analog_capture alc880_pcm_analog_capture
8963 #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
8964 #define alc883_pcm_digital_playback alc880_pcm_digital_playback
8965 #define alc883_pcm_digital_capture alc880_pcm_digital_capture
8968 * configuration and preset
8970 static const char *alc883_models[ALC883_MODEL_LAST] = {
8971 [ALC883_3ST_2ch_DIG] = "3stack-dig",
8972 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8973 [ALC883_3ST_6ch] = "3stack-6ch",
8974 [ALC883_6ST_DIG] = "6stack-dig",
8975 [ALC883_TARGA_DIG] = "targa-dig",
8976 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8977 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8978 [ALC883_ACER] = "acer",
8979 [ALC883_ACER_ASPIRE] = "acer-aspire",
8980 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8981 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8982 [ALC883_MEDION] = "medion",
8983 [ALC883_MEDION_MD2] = "medion-md2",
8984 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8985 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8986 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8987 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8988 [ALC888_LENOVO_SKY] = "lenovo-sky",
8989 [ALC883_HAIER_W66] = "haier-w66",
8990 [ALC888_3ST_HP] = "3stack-hp",
8991 [ALC888_6ST_DELL] = "6stack-dell",
8992 [ALC883_MITAC] = "mitac",
8993 [ALC883_CLEVO_M720] = "clevo-m720",
8994 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8995 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8996 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8997 [ALC1200_ASUS_P5Q] = "asus-p5q",
8998 [ALC889A_MB31] = "mb31",
8999 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9000 [ALC883_AUTO] = "auto",
9003 static struct snd_pci_quirk alc883_cfg_tbl[] = {
9004 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG),
9005 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9006 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9007 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9008 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9009 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9010 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9011 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9012 ALC888_ACER_ASPIRE_4930G),
9013 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9014 ALC888_ACER_ASPIRE_4930G),
9015 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9016 ALC888_ACER_ASPIRE_8930G),
9017 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO),
9018 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO),
9019 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9020 ALC888_ACER_ASPIRE_4930G),
9021 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9022 ALC888_ACER_ASPIRE_4930G),
9023 /* default Acer -- disabled as it causes more problems.
9024 * model=auto should work fine now
9026 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9027 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9028 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9029 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9030 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9031 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9032 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9033 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9034 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9035 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9036 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9037 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9038 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9039 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9040 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG),
9041 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9042 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9043 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9044 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9045 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9046 SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG),
9047 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9048 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9049 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9050 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9051 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9052 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9053 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9054 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9055 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9056 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9057 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9058 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9059 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9060 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9061 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9062 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9063 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9064 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9065 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9066 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9067 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9068 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9069 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9070 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9071 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9072 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9073 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9074 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9075 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9076 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9077 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9078 ALC883_FUJITSU_PI2515),
9079 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9080 ALC888_FUJITSU_XA3530),
9081 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9082 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9083 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9084 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9085 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9086 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9087 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9088 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9089 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9090 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9091 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9092 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9093 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),
9094 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9095 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9099 static hda_nid_t alc883_slave_dig_outs[] = {
9100 ALC1200_DIGOUT_NID, 0,
9103 static hda_nid_t alc1200_slave_dig_outs[] = {
9104 ALC883_DIGOUT_NID, 0,
9107 static struct alc_config_preset alc883_presets[] = {
9108 [ALC883_3ST_2ch_DIG] = {
9109 .mixers = { alc883_3ST_2ch_mixer },
9110 .init_verbs = { alc883_init_verbs },
9111 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9112 .dac_nids = alc883_dac_nids,
9113 .dig_out_nid = ALC883_DIGOUT_NID,
9114 .dig_in_nid = ALC883_DIGIN_NID,
9115 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9116 .channel_mode = alc883_3ST_2ch_modes,
9117 .input_mux = &alc883_capture_source,
9119 [ALC883_3ST_6ch_DIG] = {
9120 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9121 .init_verbs = { alc883_init_verbs },
9122 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9123 .dac_nids = alc883_dac_nids,
9124 .dig_out_nid = ALC883_DIGOUT_NID,
9125 .dig_in_nid = ALC883_DIGIN_NID,
9126 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9127 .channel_mode = alc883_3ST_6ch_modes,
9129 .input_mux = &alc883_capture_source,
9131 [ALC883_3ST_6ch] = {
9132 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9133 .init_verbs = { alc883_init_verbs },
9134 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9135 .dac_nids = alc883_dac_nids,
9136 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9137 .channel_mode = alc883_3ST_6ch_modes,
9139 .input_mux = &alc883_capture_source,
9141 [ALC883_3ST_6ch_INTEL] = {
9142 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9143 .init_verbs = { alc883_init_verbs },
9144 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9145 .dac_nids = alc883_dac_nids,
9146 .dig_out_nid = ALC883_DIGOUT_NID,
9147 .dig_in_nid = ALC883_DIGIN_NID,
9148 .slave_dig_outs = alc883_slave_dig_outs,
9149 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9150 .channel_mode = alc883_3ST_6ch_intel_modes,
9152 .input_mux = &alc883_3stack_6ch_intel,
9154 [ALC883_6ST_DIG] = {
9155 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9156 .init_verbs = { alc883_init_verbs },
9157 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9158 .dac_nids = alc883_dac_nids,
9159 .dig_out_nid = ALC883_DIGOUT_NID,
9160 .dig_in_nid = ALC883_DIGIN_NID,
9161 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9162 .channel_mode = alc883_sixstack_modes,
9163 .input_mux = &alc883_capture_source,
9165 [ALC883_TARGA_DIG] = {
9166 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer },
9167 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
9168 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9169 .dac_nids = alc883_dac_nids,
9170 .dig_out_nid = ALC883_DIGOUT_NID,
9171 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9172 .channel_mode = alc883_3ST_6ch_modes,
9174 .input_mux = &alc883_capture_source,
9175 .unsol_event = alc883_tagra_unsol_event,
9176 .init_hook = alc883_tagra_init_hook,
9178 [ALC883_TARGA_2ch_DIG] = {
9179 .mixers = { alc883_tagra_2ch_mixer},
9180 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs},
9181 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9182 .dac_nids = alc883_dac_nids,
9183 .adc_nids = alc883_adc_nids_alt,
9184 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9185 .dig_out_nid = ALC883_DIGOUT_NID,
9186 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9187 .channel_mode = alc883_3ST_2ch_modes,
9188 .input_mux = &alc883_capture_source,
9189 .unsol_event = alc883_tagra_unsol_event,
9190 .init_hook = alc883_tagra_init_hook,
9192 [ALC883_TARGA_8ch_DIG] = {
9193 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9194 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9195 alc883_tagra_verbs },
9196 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9197 .dac_nids = alc883_dac_nids,
9198 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9199 .adc_nids = alc883_adc_nids_rev,
9200 .capsrc_nids = alc883_capsrc_nids_rev,
9201 .dig_out_nid = ALC883_DIGOUT_NID,
9202 .dig_in_nid = ALC883_DIGIN_NID,
9203 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9204 .channel_mode = alc883_4ST_8ch_modes,
9206 .input_mux = &alc883_capture_source,
9207 .unsol_event = alc883_tagra_unsol_event,
9208 .init_hook = alc883_tagra_init_hook,
9211 .mixers = { alc883_base_mixer },
9212 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9213 * and the headphone jack. Turn this on and rely on the
9214 * standard mute methods whenever the user wants to turn
9215 * these outputs off.
9217 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9218 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9219 .dac_nids = alc883_dac_nids,
9220 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9221 .channel_mode = alc883_3ST_2ch_modes,
9222 .input_mux = &alc883_capture_source,
9224 [ALC883_ACER_ASPIRE] = {
9225 .mixers = { alc883_acer_aspire_mixer },
9226 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9227 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9228 .dac_nids = alc883_dac_nids,
9229 .dig_out_nid = ALC883_DIGOUT_NID,
9230 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9231 .channel_mode = alc883_3ST_2ch_modes,
9232 .input_mux = &alc883_capture_source,
9233 .unsol_event = alc_automute_amp_unsol_event,
9234 .init_hook = alc883_acer_aspire_init_hook,
9236 [ALC888_ACER_ASPIRE_4930G] = {
9237 .mixers = { alc888_base_mixer,
9238 alc883_chmode_mixer },
9239 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9240 alc888_acer_aspire_4930g_verbs },
9241 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9242 .dac_nids = alc883_dac_nids,
9243 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9244 .adc_nids = alc883_adc_nids_rev,
9245 .capsrc_nids = alc883_capsrc_nids_rev,
9246 .dig_out_nid = ALC883_DIGOUT_NID,
9247 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9248 .channel_mode = alc883_3ST_6ch_modes,
9251 ARRAY_SIZE(alc888_2_capture_sources),
9252 .input_mux = alc888_2_capture_sources,
9253 .unsol_event = alc_automute_amp_unsol_event,
9254 .init_hook = alc888_acer_aspire_4930g_init_hook,
9256 [ALC888_ACER_ASPIRE_8930G] = {
9257 .mixers = { alc888_base_mixer,
9258 alc883_chmode_mixer },
9259 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9260 alc889_acer_aspire_8930g_verbs },
9261 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9262 .dac_nids = alc883_dac_nids,
9263 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9264 .adc_nids = alc889_adc_nids,
9265 .capsrc_nids = alc889_capsrc_nids,
9266 .dig_out_nid = ALC883_DIGOUT_NID,
9267 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9268 .channel_mode = alc883_3ST_6ch_modes,
9270 .const_channel_count = 6,
9272 ARRAY_SIZE(alc889_capture_sources),
9273 .input_mux = alc889_capture_sources,
9274 .unsol_event = alc_automute_amp_unsol_event,
9275 .init_hook = alc889_acer_aspire_8930g_init_hook,
9278 .mixers = { alc883_fivestack_mixer,
9279 alc883_chmode_mixer },
9280 .init_verbs = { alc883_init_verbs,
9281 alc883_medion_eapd_verbs },
9282 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9283 .dac_nids = alc883_dac_nids,
9284 .adc_nids = alc883_adc_nids_alt,
9285 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9286 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9287 .channel_mode = alc883_sixstack_modes,
9288 .input_mux = &alc883_capture_source,
9290 [ALC883_MEDION_MD2] = {
9291 .mixers = { alc883_medion_md2_mixer},
9292 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9293 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9294 .dac_nids = alc883_dac_nids,
9295 .dig_out_nid = ALC883_DIGOUT_NID,
9296 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9297 .channel_mode = alc883_3ST_2ch_modes,
9298 .input_mux = &alc883_capture_source,
9299 .unsol_event = alc_automute_amp_unsol_event,
9300 .init_hook = alc883_medion_md2_init_hook,
9302 [ALC883_LAPTOP_EAPD] = {
9303 .mixers = { alc883_base_mixer },
9304 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9305 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9306 .dac_nids = alc883_dac_nids,
9307 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9308 .channel_mode = alc883_3ST_2ch_modes,
9309 .input_mux = &alc883_capture_source,
9311 [ALC883_CLEVO_M720] = {
9312 .mixers = { alc883_clevo_m720_mixer },
9313 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9314 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9315 .dac_nids = alc883_dac_nids,
9316 .dig_out_nid = ALC883_DIGOUT_NID,
9317 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9318 .channel_mode = alc883_3ST_2ch_modes,
9319 .input_mux = &alc883_capture_source,
9320 .unsol_event = alc883_clevo_m720_unsol_event,
9321 .init_hook = alc883_clevo_m720_init_hook,
9323 [ALC883_LENOVO_101E_2ch] = {
9324 .mixers = { alc883_lenovo_101e_2ch_mixer},
9325 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .adc_nids = alc883_adc_nids_alt,
9329 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9331 .channel_mode = alc883_3ST_2ch_modes,
9332 .input_mux = &alc883_lenovo_101e_capture_source,
9333 .unsol_event = alc883_lenovo_101e_unsol_event,
9334 .init_hook = alc883_lenovo_101e_all_automute,
9336 [ALC883_LENOVO_NB0763] = {
9337 .mixers = { alc883_lenovo_nb0763_mixer },
9338 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9340 .dac_nids = alc883_dac_nids,
9341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9342 .channel_mode = alc883_3ST_2ch_modes,
9344 .input_mux = &alc883_lenovo_nb0763_capture_source,
9345 .unsol_event = alc_automute_amp_unsol_event,
9346 .init_hook = alc883_medion_md2_init_hook,
9348 [ALC888_LENOVO_MS7195_DIG] = {
9349 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9352 .dac_nids = alc883_dac_nids,
9353 .dig_out_nid = ALC883_DIGOUT_NID,
9354 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9355 .channel_mode = alc883_3ST_6ch_modes,
9357 .input_mux = &alc883_capture_source,
9358 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9359 .init_hook = alc888_lenovo_ms7195_front_automute,
9361 [ALC883_HAIER_W66] = {
9362 .mixers = { alc883_tagra_2ch_mixer},
9363 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9364 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9365 .dac_nids = alc883_dac_nids,
9366 .dig_out_nid = ALC883_DIGOUT_NID,
9367 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9368 .channel_mode = alc883_3ST_2ch_modes,
9369 .input_mux = &alc883_capture_source,
9370 .unsol_event = alc_automute_amp_unsol_event,
9371 .init_hook = alc883_haier_w66_init_hook,
9374 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9375 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9376 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9377 .dac_nids = alc883_dac_nids,
9378 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9379 .channel_mode = alc888_3st_hp_modes,
9381 .input_mux = &alc883_capture_source,
9382 .unsol_event = alc_automute_amp_unsol_event,
9383 .init_hook = alc888_3st_hp_init_hook,
9385 [ALC888_6ST_DELL] = {
9386 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9387 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9389 .dac_nids = alc883_dac_nids,
9390 .dig_out_nid = ALC883_DIGOUT_NID,
9391 .dig_in_nid = ALC883_DIGIN_NID,
9392 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9393 .channel_mode = alc883_sixstack_modes,
9394 .input_mux = &alc883_capture_source,
9395 .unsol_event = alc_automute_amp_unsol_event,
9396 .init_hook = alc888_6st_dell_init_hook,
9399 .mixers = { alc883_mitac_mixer },
9400 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9401 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9402 .dac_nids = alc883_dac_nids,
9403 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9404 .channel_mode = alc883_3ST_2ch_modes,
9405 .input_mux = &alc883_capture_source,
9406 .unsol_event = alc_automute_amp_unsol_event,
9407 .init_hook = alc883_mitac_init_hook,
9409 [ALC883_FUJITSU_PI2515] = {
9410 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9411 .init_verbs = { alc883_init_verbs,
9412 alc883_2ch_fujitsu_pi2515_verbs},
9413 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9414 .dac_nids = alc883_dac_nids,
9415 .dig_out_nid = ALC883_DIGOUT_NID,
9416 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9417 .channel_mode = alc883_3ST_2ch_modes,
9418 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9419 .unsol_event = alc_automute_amp_unsol_event,
9420 .init_hook = alc883_2ch_fujitsu_pi2515_init_hook,
9422 [ALC888_FUJITSU_XA3530] = {
9423 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9424 .init_verbs = { alc883_init_verbs,
9425 alc888_fujitsu_xa3530_verbs },
9426 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9427 .dac_nids = alc883_dac_nids,
9428 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9429 .adc_nids = alc883_adc_nids_rev,
9430 .capsrc_nids = alc883_capsrc_nids_rev,
9431 .dig_out_nid = ALC883_DIGOUT_NID,
9432 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9433 .channel_mode = alc888_4ST_8ch_intel_modes,
9435 ARRAY_SIZE(alc888_2_capture_sources),
9436 .input_mux = alc888_2_capture_sources,
9437 .unsol_event = alc_automute_amp_unsol_event,
9438 .init_hook = alc888_fujitsu_xa3530_init_hook,
9440 [ALC888_LENOVO_SKY] = {
9441 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9442 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9444 .dac_nids = alc883_dac_nids,
9445 .dig_out_nid = ALC883_DIGOUT_NID,
9446 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9447 .channel_mode = alc883_sixstack_modes,
9449 .input_mux = &alc883_lenovo_sky_capture_source,
9450 .unsol_event = alc_automute_amp_unsol_event,
9451 .init_hook = alc888_lenovo_sky_init_hook,
9453 [ALC888_ASUS_M90V] = {
9454 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9455 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9456 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9457 .dac_nids = alc883_dac_nids,
9458 .dig_out_nid = ALC883_DIGOUT_NID,
9459 .dig_in_nid = ALC883_DIGIN_NID,
9460 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9461 .channel_mode = alc883_3ST_6ch_modes,
9463 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9464 .unsol_event = alc883_mode2_unsol_event,
9465 .init_hook = alc883_mode2_inithook,
9467 [ALC888_ASUS_EEE1601] = {
9468 .mixers = { alc883_asus_eee1601_mixer },
9469 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9470 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9471 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9472 .dac_nids = alc883_dac_nids,
9473 .dig_out_nid = ALC883_DIGOUT_NID,
9474 .dig_in_nid = ALC883_DIGIN_NID,
9475 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9476 .channel_mode = alc883_3ST_2ch_modes,
9478 .input_mux = &alc883_asus_eee1601_capture_source,
9479 .unsol_event = alc_sku_unsol_event,
9480 .init_hook = alc883_eee1601_inithook,
9482 [ALC1200_ASUS_P5Q] = {
9483 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9484 .init_verbs = { alc883_init_verbs },
9485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9486 .dac_nids = alc883_dac_nids,
9487 .dig_out_nid = ALC1200_DIGOUT_NID,
9488 .dig_in_nid = ALC883_DIGIN_NID,
9489 .slave_dig_outs = alc1200_slave_dig_outs,
9490 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9491 .channel_mode = alc883_sixstack_modes,
9492 .input_mux = &alc883_capture_source,
9495 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9496 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9497 alc880_gpio1_init_verbs },
9498 .adc_nids = alc883_adc_nids,
9499 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9500 .dac_nids = alc883_dac_nids,
9501 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9502 .channel_mode = alc889A_mb31_6ch_modes,
9503 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9504 .input_mux = &alc889A_mb31_capture_source,
9505 .dig_out_nid = ALC883_DIGOUT_NID,
9506 .unsol_event = alc889A_mb31_unsol_event,
9507 .init_hook = alc889A_mb31_automute,
9509 [ALC883_SONY_VAIO_TT] = {
9510 .mixers = { alc883_vaiott_mixer },
9511 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9513 .dac_nids = alc883_dac_nids,
9514 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9515 .channel_mode = alc883_3ST_2ch_modes,
9516 .input_mux = &alc883_capture_source,
9517 .unsol_event = alc_automute_amp_unsol_event,
9518 .init_hook = alc883_vaiott_init_hook,
9524 * BIOS auto configuration
9526 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec,
9527 hda_nid_t nid, int pin_type,
9531 struct alc_spec *spec = codec->spec;
9534 alc_set_pin_output(codec, nid, pin_type);
9535 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9538 idx = spec->multiout.dac_nids[dac_idx] - 2;
9539 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9543 static void alc883_auto_init_multi_out(struct hda_codec *codec)
9545 struct alc_spec *spec = codec->spec;
9548 for (i = 0; i <= HDA_SIDE; i++) {
9549 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9550 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9552 alc883_auto_set_output_and_unmute(codec, nid, pin_type,
9557 static void alc883_auto_init_hp_out(struct hda_codec *codec)
9559 struct alc_spec *spec = codec->spec;
9562 pin = spec->autocfg.hp_pins[0];
9563 if (pin) /* connect to front */
9565 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9566 pin = spec->autocfg.speaker_pins[0];
9568 alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9571 #define alc883_is_input_pin(nid) alc880_is_input_pin(nid)
9572 #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID
9574 static void alc883_auto_init_analog_input(struct hda_codec *codec)
9576 struct alc_spec *spec = codec->spec;
9579 for (i = 0; i < AUTO_PIN_LAST; i++) {
9580 hda_nid_t nid = spec->autocfg.input_pins[i];
9581 if (alc883_is_input_pin(nid)) {
9582 alc_set_input_pin(codec, nid, i);
9583 if (nid != ALC883_PIN_CD_NID &&
9584 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
9585 snd_hda_codec_write(codec, nid, 0,
9586 AC_VERB_SET_AMP_GAIN_MUTE,
9592 #define alc883_auto_init_input_src alc882_auto_init_input_src
9594 /* almost identical with ALC880 parser... */
9595 static int alc883_parse_auto_config(struct hda_codec *codec)
9597 struct alc_spec *spec = codec->spec;
9598 int err = alc880_parse_auto_config(codec);
9599 struct auto_pin_cfg *cfg = &spec->autocfg;
9605 return 0; /* no config found */
9607 err = alc_auto_add_mic_boost(codec);
9611 /* hack - override the init verbs */
9612 spec->init_verbs[0] = alc883_auto_init_verbs;
9614 /* setup input_mux for ALC889 */
9615 if (codec->vendor_id == 0x10ec0889) {
9616 /* digital-mic input pin is excluded in alc880_auto_create..()
9617 * because it's under 0x18
9619 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9620 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9621 struct hda_input_mux *imux = &spec->private_imux[0];
9622 for (i = 1; i < 3; i++)
9623 memcpy(&spec->private_imux[i],
9624 &spec->private_imux[0],
9625 sizeof(spec->private_imux[0]));
9626 imux->items[imux->num_items].label = "Int DMic";
9627 imux->items[imux->num_items].index = 0x0b;
9629 spec->num_mux_defs = 3;
9630 spec->input_mux = spec->private_imux;
9634 return 1; /* config found */
9637 /* additional initialization for auto-configuration model */
9638 static void alc883_auto_init(struct hda_codec *codec)
9640 struct alc_spec *spec = codec->spec;
9641 alc883_auto_init_multi_out(codec);
9642 alc883_auto_init_hp_out(codec);
9643 alc883_auto_init_analog_input(codec);
9644 alc883_auto_init_input_src(codec);
9645 if (spec->unsol_event)
9646 alc_inithook(codec);
9649 static int patch_alc883(struct hda_codec *codec)
9651 struct alc_spec *spec;
9652 int err, board_config;
9654 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
9660 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
9662 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST,
9665 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) {
9666 /* Pick up systems that don't supply PCI SSID */
9667 switch (codec->subsystem_id) {
9668 case 0x106b3600: /* Macbook 3.1 */
9669 board_config = ALC889A_MB31;
9673 "hda_codec: Unknown model for %s, trying "
9674 "auto-probe from BIOS...\n", codec->chip_name);
9675 board_config = ALC883_AUTO;
9679 if (board_config == ALC883_AUTO) {
9680 /* automatic parse from the BIOS config */
9681 err = alc883_parse_auto_config(codec);
9687 "hda_codec: Cannot set up configuration "
9688 "from BIOS. Using base mode...\n");
9689 board_config = ALC883_3ST_2ch_DIG;
9693 err = snd_hda_attach_beep_device(codec, 0x1);
9699 if (board_config != ALC883_AUTO)
9700 setup_preset(spec, &alc883_presets[board_config]);
9702 switch (codec->vendor_id) {
9704 if (!spec->num_adc_nids) {
9705 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9706 spec->adc_nids = alc883_adc_nids;
9708 if (!spec->capsrc_nids)
9709 spec->capsrc_nids = alc883_capsrc_nids;
9710 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9711 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
9714 if (!spec->num_adc_nids) {
9715 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9716 spec->adc_nids = alc889_adc_nids;
9718 if (!spec->capsrc_nids)
9719 spec->capsrc_nids = alc889_capsrc_nids;
9720 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9724 if (!spec->num_adc_nids) {
9725 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9726 spec->adc_nids = alc883_adc_nids;
9728 if (!spec->capsrc_nids)
9729 spec->capsrc_nids = alc883_capsrc_nids;
9730 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9734 spec->stream_analog_playback = &alc883_pcm_analog_playback;
9735 spec->stream_analog_capture = &alc883_pcm_analog_capture;
9736 spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture;
9738 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9739 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9741 if (!spec->cap_mixer)
9742 set_capture_mixer(spec);
9743 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9745 spec->vmaster_nid = 0x0c;
9747 codec->patch_ops = alc_patch_ops;
9748 if (board_config == ALC883_AUTO)
9749 spec->init_hook = alc883_auto_init;
9751 #ifdef CONFIG_SND_HDA_POWER_SAVE
9752 if (!spec->loopback.amplist)
9753 spec->loopback.amplist = alc883_loopbacks;
9755 codec->proc_widget_hook = print_realtek_coef;
9764 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
9765 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
9767 #define alc262_dac_nids alc260_dac_nids
9768 #define alc262_adc_nids alc882_adc_nids
9769 #define alc262_adc_nids_alt alc882_adc_nids_alt
9770 #define alc262_capsrc_nids alc882_capsrc_nids
9771 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
9773 #define alc262_modes alc260_modes
9774 #define alc262_capture_source alc882_capture_source
9776 static hda_nid_t alc262_dmic_adc_nids[1] = {
9781 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
9783 static struct snd_kcontrol_new alc262_base_mixer[] = {
9784 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9785 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9786 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9787 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9788 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9789 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9790 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9791 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9793 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9794 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9795 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9796 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
9797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9798 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
9799 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
9803 /* update HP, line and mono-out pins according to the master switch */
9804 static void alc262_hp_master_update(struct hda_codec *codec)
9806 struct alc_spec *spec = codec->spec;
9807 int val = spec->master_sw;
9810 snd_hda_codec_write_cache(codec, 0x1b, 0,
9811 AC_VERB_SET_PIN_WIDGET_CONTROL,
9813 snd_hda_codec_write_cache(codec, 0x15, 0,
9814 AC_VERB_SET_PIN_WIDGET_CONTROL,
9816 /* mono (speaker) depending on the HP jack sense */
9817 val = val && !spec->jack_present;
9818 snd_hda_codec_write_cache(codec, 0x16, 0,
9819 AC_VERB_SET_PIN_WIDGET_CONTROL,
9823 static void alc262_hp_bpc_automute(struct hda_codec *codec)
9825 struct alc_spec *spec = codec->spec;
9826 unsigned int presence;
9827 presence = snd_hda_codec_read(codec, 0x1b, 0,
9828 AC_VERB_GET_PIN_SENSE, 0);
9829 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9830 alc262_hp_master_update(codec);
9833 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
9835 if ((res >> 26) != ALC880_HP_EVENT)
9837 alc262_hp_bpc_automute(codec);
9840 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
9842 struct alc_spec *spec = codec->spec;
9843 unsigned int presence;
9844 presence = snd_hda_codec_read(codec, 0x15, 0,
9845 AC_VERB_GET_PIN_SENSE, 0);
9846 spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE);
9847 alc262_hp_master_update(codec);
9850 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9853 if ((res >> 26) != ALC880_HP_EVENT)
9855 alc262_hp_wildwest_automute(codec);
9858 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
9860 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9861 struct snd_ctl_elem_value *ucontrol)
9863 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9864 struct alc_spec *spec = codec->spec;
9865 int val = !!*ucontrol->value.integer.value;
9867 if (val == spec->master_sw)
9869 spec->master_sw = val;
9870 alc262_hp_master_update(codec);
9874 #define ALC262_HP_MASTER_SWITCH \
9876 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9877 .name = "Master Playback Switch", \
9878 .info = snd_ctl_boolean_mono_info, \
9879 .get = alc262_hp_master_sw_get, \
9880 .put = alc262_hp_master_sw_put, \
9883 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9884 ALC262_HP_MASTER_SWITCH,
9885 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9886 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9887 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9888 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9890 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9892 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9894 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9895 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
9896 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
9897 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9898 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9899 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9900 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9901 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9902 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
9903 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
9907 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9908 ALC262_HP_MASTER_SWITCH,
9909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9910 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9911 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9912 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9913 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
9915 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
9917 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
9918 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
9919 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
9920 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9921 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9927 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9928 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9929 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9930 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
9934 /* mute/unmute internal speaker according to the hp jack and mute state */
9935 static void alc262_hp_t5735_init_hook(struct hda_codec *codec)
9937 struct alc_spec *spec = codec->spec;
9939 spec->autocfg.hp_pins[0] = 0x15;
9940 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
9941 alc_automute_amp(codec);
9944 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9945 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9946 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9947 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9948 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9950 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9951 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9955 static struct hda_verb alc262_hp_t5735_verbs[] = {
9956 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9957 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9959 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9963 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
9964 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9965 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9966 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9967 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
9968 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
9969 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
9973 static struct hda_verb alc262_hp_rp5700_verbs[] = {
9974 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9975 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9976 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9978 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
9979 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9980 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
9982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
9987 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
9994 /* bind hp and internal speaker mute (with plug check) as master switch */
9995 static void alc262_hippo_master_update(struct hda_codec *codec)
9997 struct alc_spec *spec = codec->spec;
9998 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
9999 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10000 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10004 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10005 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10006 HDA_AMP_MUTE, mute);
10007 /* mute internal speaker per jack sense */
10008 if (spec->jack_present)
10009 mute = HDA_AMP_MUTE;
10011 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10012 HDA_AMP_MUTE, mute);
10013 if (speaker_nid && speaker_nid != line_nid)
10014 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10015 HDA_AMP_MUTE, mute);
10018 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10020 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10021 struct snd_ctl_elem_value *ucontrol)
10023 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10024 struct alc_spec *spec = codec->spec;
10025 int val = !!*ucontrol->value.integer.value;
10027 if (val == spec->master_sw)
10029 spec->master_sw = val;
10030 alc262_hippo_master_update(codec);
10034 #define ALC262_HIPPO_MASTER_SWITCH \
10036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10037 .name = "Master Playback Switch", \
10038 .info = snd_ctl_boolean_mono_info, \
10039 .get = alc262_hippo_master_sw_get, \
10040 .put = alc262_hippo_master_sw_put, \
10043 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10044 ALC262_HIPPO_MASTER_SWITCH,
10045 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10046 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10047 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10048 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10049 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10050 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10051 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10052 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10053 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10054 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10055 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10056 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10060 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10061 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10062 ALC262_HIPPO_MASTER_SWITCH,
10063 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10064 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10065 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10066 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10067 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10069 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10070 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10071 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10072 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10076 /* mute/unmute internal speaker according to the hp jack and mute state */
10077 static void alc262_hippo_automute(struct hda_codec *codec)
10079 struct alc_spec *spec = codec->spec;
10080 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10081 unsigned int present;
10083 /* need to execute and sync at first */
10084 snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0);
10085 present = snd_hda_codec_read(codec, hp_nid, 0,
10086 AC_VERB_GET_PIN_SENSE, 0);
10087 spec->jack_present = (present & 0x80000000) != 0;
10088 alc262_hippo_master_update(codec);
10091 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10093 if ((res >> 26) != ALC880_HP_EVENT)
10095 alc262_hippo_automute(codec);
10098 static void alc262_hippo_init_hook(struct hda_codec *codec)
10100 struct alc_spec *spec = codec->spec;
10102 spec->autocfg.hp_pins[0] = 0x15;
10103 spec->autocfg.speaker_pins[0] = 0x14;
10104 alc262_hippo_automute(codec);
10107 static void alc262_hippo1_init_hook(struct hda_codec *codec)
10109 struct alc_spec *spec = codec->spec;
10111 spec->autocfg.hp_pins[0] = 0x1b;
10112 spec->autocfg.speaker_pins[0] = 0x14;
10113 alc262_hippo_automute(codec);
10117 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10118 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10119 ALC262_HIPPO_MASTER_SWITCH,
10120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10122 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10123 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10127 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10128 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10129 ALC262_HIPPO_MASTER_SWITCH,
10130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10133 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10134 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10138 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10139 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10140 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10141 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10142 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10147 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10150 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10154 static struct hda_verb alc262_tyan_verbs[] = {
10155 /* Headphone automute */
10156 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10158 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10160 /* P11 AUX_IN, white 4-pin connector */
10161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10162 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10163 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10164 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10169 /* unsolicited event for HP jack sensing */
10170 static void alc262_tyan_init_hook(struct hda_codec *codec)
10172 struct alc_spec *spec = codec->spec;
10174 spec->autocfg.hp_pins[0] = 0x1b;
10175 spec->autocfg.speaker_pins[0] = 0x15;
10176 alc_automute_amp(codec);
10180 #define alc262_capture_mixer alc882_capture_mixer
10181 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10184 * generic initialization of ADC, input mixers and output mixers
10186 static struct hda_verb alc262_init_verbs[] = {
10188 * Unmute ADC0-2 and set the default input to mic-in
10190 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10191 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10192 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10193 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10194 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10195 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10197 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10199 * Note: PASD motherboards uses the Line In 2 as the input for
10200 * front panel mic (mic 2)
10202 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10203 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10204 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10205 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10206 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10207 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10210 * Set up output mixers (0x0c - 0x0e)
10212 /* set vol=0 to output mixers */
10213 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10214 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10215 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10216 /* set up input amps for analog loopback */
10217 /* Amp Indices: DAC = 0, mixer = 1 */
10218 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10219 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10220 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10221 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10222 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10223 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10225 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10227 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10229 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10230 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10232 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10233 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10234 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10235 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10236 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10238 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10239 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10241 /* FIXME: use matrix-type input source selection */
10242 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10243 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10244 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10245 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10246 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10247 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10251 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10252 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10262 static struct hda_verb alc262_eapd_verbs[] = {
10263 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10264 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10268 static struct hda_verb alc262_hippo_unsol_verbs[] = {
10269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10270 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10274 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10275 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10276 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10277 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10279 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10284 static struct hda_verb alc262_sony_unsol_verbs[] = {
10285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10286 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10290 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10294 static struct hda_input_mux alc262_dmic_capture_source = {
10297 { "Int DMic", 0x9 },
10302 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10303 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10304 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10305 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10311 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10312 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10314 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10315 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10316 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10318 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10319 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10323 static void alc262_dmic_automute(struct hda_codec *codec)
10325 unsigned int present;
10327 present = snd_hda_codec_read(codec, 0x18, 0,
10328 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10329 snd_hda_codec_write(codec, 0x22, 0,
10330 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09);
10334 /* unsolicited event for HP jack sensing */
10335 static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec,
10338 if ((res >> 26) == ALC880_MIC_EVENT)
10339 alc262_dmic_automute(codec);
10341 alc_sku_unsol_event(codec, res);
10344 static void alc262_toshiba_s06_init_hook(struct hda_codec *codec)
10346 struct alc_spec *spec = codec->spec;
10348 spec->autocfg.hp_pins[0] = 0x15;
10349 spec->autocfg.speaker_pins[0] = 0x14;
10350 alc_automute_pin(codec);
10351 alc262_dmic_automute(codec);
10357 * 0x16 = internal speaker
10358 * 0x18 = external mic
10361 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10362 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10363 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10365 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10366 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10367 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10369 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10374 static struct hda_verb alc262_nec_verbs[] = {
10375 /* Unmute Speaker */
10376 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10379 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10382 /* External mic to headphone */
10383 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10384 /* External mic to speaker */
10385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10391 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10392 * 0x1b = port replicator headphone out
10395 #define ALC_HP_EVENT 0x37
10397 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10398 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10400 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10401 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10405 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10406 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10407 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10411 static struct hda_input_mux alc262_fujitsu_capture_source = {
10415 { "Int Mic", 0x1 },
10420 static struct hda_input_mux alc262_HP_capture_source = {
10424 { "Front Mic", 0x1 },
10431 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10435 { "Front Mic", 0x2 },
10441 /* mute/unmute internal speaker according to the hp jacks and mute state */
10442 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10444 struct alc_spec *spec = codec->spec;
10447 if (force || !spec->sense_updated) {
10448 unsigned int present;
10449 /* need to execute and sync at first */
10450 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
10451 /* check laptop HP jack */
10452 present = snd_hda_codec_read(codec, 0x14, 0,
10453 AC_VERB_GET_PIN_SENSE, 0);
10454 /* need to execute and sync at first */
10455 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10456 /* check docking HP jack */
10457 present |= snd_hda_codec_read(codec, 0x1b, 0,
10458 AC_VERB_GET_PIN_SENSE, 0);
10459 if (present & AC_PINSENSE_PRESENCE)
10460 spec->jack_present = 1;
10462 spec->jack_present = 0;
10463 spec->sense_updated = 1;
10465 /* unmute internal speaker only if both HPs are unplugged and
10466 * master switch is on
10468 if (spec->jack_present)
10469 mute = HDA_AMP_MUTE;
10471 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10472 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10473 HDA_AMP_MUTE, mute);
10476 /* unsolicited event for HP jack sensing */
10477 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10480 if ((res >> 26) != ALC_HP_EVENT)
10482 alc262_fujitsu_automute(codec, 1);
10485 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10487 alc262_fujitsu_automute(codec, 1);
10490 /* bind volumes of both NID 0x0c and 0x0d */
10491 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10492 .ops = &snd_hda_bind_vol,
10494 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10495 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10500 /* mute/unmute internal speaker according to the hp jack and mute state */
10501 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10503 struct alc_spec *spec = codec->spec;
10506 if (force || !spec->sense_updated) {
10507 unsigned int present_int_hp;
10508 /* need to execute and sync at first */
10509 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
10510 present_int_hp = snd_hda_codec_read(codec, 0x1b, 0,
10511 AC_VERB_GET_PIN_SENSE, 0);
10512 spec->jack_present = (present_int_hp & 0x80000000) != 0;
10513 spec->sense_updated = 1;
10515 if (spec->jack_present) {
10516 /* mute internal speaker */
10517 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10518 HDA_AMP_MUTE, HDA_AMP_MUTE);
10519 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10520 HDA_AMP_MUTE, HDA_AMP_MUTE);
10522 /* unmute internal speaker if necessary */
10523 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10524 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10525 HDA_AMP_MUTE, mute);
10526 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10527 HDA_AMP_MUTE, mute);
10531 /* unsolicited event for HP jack sensing */
10532 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10535 if ((res >> 26) != ALC_HP_EVENT)
10537 alc262_lenovo_3000_automute(codec, 1);
10540 /* bind hp and internal speaker mute (with plug check) */
10541 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10542 struct snd_ctl_elem_value *ucontrol)
10544 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10545 long *valp = ucontrol->value.integer.value;
10548 change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10550 valp ? 0 : HDA_AMP_MUTE);
10551 change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10553 valp ? 0 : HDA_AMP_MUTE);
10556 alc262_fujitsu_automute(codec, 0);
10560 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10561 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10563 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10564 .name = "Master Playback Switch",
10565 .info = snd_hda_mixer_amp_switch_info,
10566 .get = snd_hda_mixer_amp_switch_get,
10567 .put = alc262_fujitsu_master_sw_put,
10568 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10570 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10571 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10572 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10573 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10574 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10575 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10576 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10577 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10581 /* bind hp and internal speaker mute (with plug check) */
10582 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10583 struct snd_ctl_elem_value *ucontrol)
10585 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10586 long *valp = ucontrol->value.integer.value;
10589 change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
10591 valp ? 0 : HDA_AMP_MUTE);
10594 alc262_lenovo_3000_automute(codec, 0);
10598 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10599 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10602 .name = "Master Playback Switch",
10603 .info = snd_hda_mixer_amp_switch_info,
10604 .get = snd_hda_mixer_amp_switch_get,
10605 .put = alc262_lenovo_3000_master_sw_put,
10606 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10608 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10609 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10611 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10612 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10613 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10614 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10615 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10619 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10620 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10621 ALC262_HIPPO_MASTER_SWITCH,
10622 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10623 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10624 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10627 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10631 /* additional init verbs for Benq laptops */
10632 static struct hda_verb alc262_EAPD_verbs[] = {
10633 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10634 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10638 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10640 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10642 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10643 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
10647 /* Samsung Q1 Ultra Vista model setup */
10648 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
10649 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10650 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10651 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10652 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10653 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
10654 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
10658 static struct hda_verb alc262_ultra_verbs[] = {
10660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10664 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10667 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10671 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10672 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10673 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
10676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10677 /* ADC, choose mic */
10678 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10679 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10680 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10681 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10682 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10683 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10684 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10685 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10686 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
10687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
10691 /* mute/unmute internal speaker according to the hp jack and mute state */
10692 static void alc262_ultra_automute(struct hda_codec *codec)
10694 struct alc_spec *spec = codec->spec;
10698 /* auto-mute only when HP is used as HP */
10699 if (!spec->cur_mux[0]) {
10700 unsigned int present;
10701 /* need to execute and sync at first */
10702 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
10703 present = snd_hda_codec_read(codec, 0x15, 0,
10704 AC_VERB_GET_PIN_SENSE, 0);
10705 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
10706 if (spec->jack_present)
10707 mute = HDA_AMP_MUTE;
10709 /* mute/unmute internal speaker */
10710 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10711 HDA_AMP_MUTE, mute);
10712 /* mute/unmute HP */
10713 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10714 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
10717 /* unsolicited event for HP jack sensing */
10718 static void alc262_ultra_unsol_event(struct hda_codec *codec,
10721 if ((res >> 26) != ALC880_HP_EVENT)
10723 alc262_ultra_automute(codec);
10726 static struct hda_input_mux alc262_ultra_capture_source = {
10730 { "Headphone", 0x7 },
10734 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
10735 struct snd_ctl_elem_value *ucontrol)
10737 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10738 struct alc_spec *spec = codec->spec;
10741 ret = alc_mux_enum_put(kcontrol, ucontrol);
10744 /* reprogram the HP pin as mic or HP according to the input source */
10745 snd_hda_codec_write_cache(codec, 0x15, 0,
10746 AC_VERB_SET_PIN_WIDGET_CONTROL,
10747 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
10748 alc262_ultra_automute(codec); /* mute/unmute HP */
10752 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
10753 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
10754 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
10756 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10757 .name = "Capture Source",
10758 .info = alc_mux_enum_info,
10759 .get = alc_mux_enum_get,
10760 .put = alc262_ultra_mux_enum_put,
10765 /* add playback controls from the parsed DAC table */
10766 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
10767 const struct auto_pin_cfg *cfg)
10772 spec->multiout.num_dacs = 1; /* only use one dac */
10773 spec->multiout.dac_nids = spec->private_dac_nids;
10774 spec->multiout.dac_nids[0] = 2;
10776 nid = cfg->line_out_pins[0];
10778 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10779 "Front Playback Volume",
10780 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT));
10783 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10784 "Front Playback Switch",
10785 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
10790 nid = cfg->speaker_pins[0];
10793 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10794 "Speaker Playback Volume",
10795 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10799 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10800 "Speaker Playback Switch",
10801 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10806 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10807 "Speaker Playback Switch",
10808 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10814 nid = cfg->hp_pins[0];
10816 /* spec->multiout.hp_nid = 2; */
10818 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10819 "Headphone Playback Volume",
10820 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
10824 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10825 "Headphone Playback Switch",
10826 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
10831 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
10832 "Headphone Playback Switch",
10833 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
10842 /* identical with ALC880 */
10843 #define alc262_auto_create_analog_input_ctls \
10844 alc880_auto_create_analog_input_ctls
10847 * generic initialization of ADC, input mixers and output mixers
10849 static struct hda_verb alc262_volume_init_verbs[] = {
10851 * Unmute ADC0-2 and set the default input to mic-in
10853 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10855 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10856 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10857 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10858 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10860 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10862 * Note: PASD motherboards uses the Line In 2 as the input for
10863 * front panel mic (mic 2)
10865 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10866 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10867 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10868 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10869 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10870 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10873 * Set up output mixers (0x0c - 0x0f)
10875 /* set vol=0 to output mixers */
10876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10880 /* set up input amps for analog loopback */
10881 /* Amp Indices: DAC = 0, mixer = 1 */
10882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10883 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10884 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10885 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10886 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10887 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10889 /* FIXME: use matrix-type input source selection */
10890 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10891 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10892 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10893 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10894 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10895 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10897 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10898 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10899 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10900 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10902 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10903 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10904 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10905 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10910 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
10912 * Unmute ADC0-2 and set the default input to mic-in
10914 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10915 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10916 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10917 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10918 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10919 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10921 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10923 * Note: PASD motherboards uses the Line In 2 as the input for
10924 * front panel mic (mic 2)
10926 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10927 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
10933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
10936 * Set up output mixers (0x0c - 0x0e)
10938 /* set vol=0 to output mixers */
10939 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10940 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10941 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10943 /* set up input amps for analog loopback */
10944 /* Amp Indices: DAC = 0, mixer = 1 */
10945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10952 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10954 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
10956 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
10959 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10960 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10962 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10963 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10964 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10965 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10966 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10968 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10969 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10970 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10971 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10972 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10973 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
10976 /* FIXME: use matrix-type input source selection */
10977 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
10978 /* Input mixer1: only unmute Mic */
10979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10980 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10981 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10982 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10983 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10984 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10985 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10986 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10987 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10989 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
10991 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10992 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10993 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10994 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
10995 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
10996 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
10997 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
10999 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11000 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11006 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11007 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11009 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11014 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11016 * Unmute ADC0-2 and set the default input to mic-in
11018 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11019 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11020 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11021 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11022 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11023 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11025 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11027 * Note: PASD motherboards uses the Line In 2 as the input for front
11028 * panel mic (mic 2)
11030 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11032 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11033 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11040 * Set up output mixers (0x0c - 0x0e)
11042 /* set vol=0 to output mixers */
11043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11044 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11045 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11047 /* set up input amps for analog loopback */
11048 /* Amp Indices: DAC = 0, mixer = 1 */
11049 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11051 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11053 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11057 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11058 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11059 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11060 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11061 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11063 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11065 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11068 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11071 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11072 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11073 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11074 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11075 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11076 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11078 /* FIXME: use matrix-type input source selection */
11079 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11080 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11085 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11086 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11087 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11089 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11090 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11091 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11092 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11093 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11094 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11097 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11098 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11099 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11100 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11101 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11102 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11105 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11110 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11112 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11113 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11114 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11116 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11117 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11118 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11119 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11121 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11122 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11123 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11128 #ifdef CONFIG_SND_HDA_POWER_SAVE
11129 #define alc262_loopbacks alc880_loopbacks
11132 /* pcm configuration: identiacal with ALC880 */
11133 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11134 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11135 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11136 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11139 * BIOS auto configuration
11141 static int alc262_parse_auto_config(struct hda_codec *codec)
11143 struct alc_spec *spec = codec->spec;
11145 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11147 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11151 if (!spec->autocfg.line_outs) {
11152 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11153 spec->multiout.max_channels = 2;
11154 spec->no_analog = 1;
11157 return 0; /* can't find valid BIOS pin config */
11159 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11162 err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg);
11166 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11169 if (spec->autocfg.dig_outs) {
11170 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11171 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11173 if (spec->autocfg.dig_in_pin)
11174 spec->dig_in_nid = ALC262_DIGIN_NID;
11176 if (spec->kctls.list)
11177 add_mixer(spec, spec->kctls.list);
11179 add_verb(spec, alc262_volume_init_verbs);
11180 spec->num_mux_defs = 1;
11181 spec->input_mux = &spec->private_imux[0];
11183 err = alc_auto_add_mic_boost(codec);
11187 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11192 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11193 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11194 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11195 #define alc262_auto_init_input_src alc882_auto_init_input_src
11198 /* init callback for auto-configuration model -- overriding the default init */
11199 static void alc262_auto_init(struct hda_codec *codec)
11201 struct alc_spec *spec = codec->spec;
11202 alc262_auto_init_multi_out(codec);
11203 alc262_auto_init_hp_out(codec);
11204 alc262_auto_init_analog_input(codec);
11205 alc262_auto_init_input_src(codec);
11206 if (spec->unsol_event)
11207 alc_inithook(codec);
11211 * configuration and preset
11213 static const char *alc262_models[ALC262_MODEL_LAST] = {
11214 [ALC262_BASIC] = "basic",
11215 [ALC262_HIPPO] = "hippo",
11216 [ALC262_HIPPO_1] = "hippo_1",
11217 [ALC262_FUJITSU] = "fujitsu",
11218 [ALC262_HP_BPC] = "hp-bpc",
11219 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11220 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11221 [ALC262_HP_RP5700] = "hp-rp5700",
11222 [ALC262_BENQ_ED8] = "benq",
11223 [ALC262_BENQ_T31] = "benq-t31",
11224 [ALC262_SONY_ASSAMD] = "sony-assamd",
11225 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11226 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11227 [ALC262_ULTRA] = "ultra",
11228 [ALC262_LENOVO_3000] = "lenovo-3000",
11229 [ALC262_NEC] = "nec",
11230 [ALC262_TYAN] = "tyan",
11231 [ALC262_AUTO] = "auto",
11234 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11235 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11236 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11237 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11239 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11241 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11243 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11244 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11245 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11246 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11247 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11248 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11249 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11250 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11251 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11252 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11253 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11254 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11255 ALC262_HP_TC_T5735),
11256 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11257 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11258 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11259 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11260 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11261 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11262 ALC262_SONY_ASSAMD),
11263 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11264 ALC262_TOSHIBA_RX1),
11265 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11266 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11267 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11268 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11269 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11271 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11272 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11273 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11274 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11275 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11279 static struct alc_config_preset alc262_presets[] = {
11281 .mixers = { alc262_base_mixer },
11282 .init_verbs = { alc262_init_verbs },
11283 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11284 .dac_nids = alc262_dac_nids,
11286 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11287 .channel_mode = alc262_modes,
11288 .input_mux = &alc262_capture_source,
11291 .mixers = { alc262_hippo_mixer },
11292 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs},
11293 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11294 .dac_nids = alc262_dac_nids,
11296 .dig_out_nid = ALC262_DIGOUT_NID,
11297 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11298 .channel_mode = alc262_modes,
11299 .input_mux = &alc262_capture_source,
11300 .unsol_event = alc262_hippo_unsol_event,
11301 .init_hook = alc262_hippo_init_hook,
11303 [ALC262_HIPPO_1] = {
11304 .mixers = { alc262_hippo1_mixer },
11305 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11306 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11307 .dac_nids = alc262_dac_nids,
11309 .dig_out_nid = ALC262_DIGOUT_NID,
11310 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11311 .channel_mode = alc262_modes,
11312 .input_mux = &alc262_capture_source,
11313 .unsol_event = alc262_hippo_unsol_event,
11314 .init_hook = alc262_hippo1_init_hook,
11316 [ALC262_FUJITSU] = {
11317 .mixers = { alc262_fujitsu_mixer },
11318 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11319 alc262_fujitsu_unsol_verbs },
11320 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11321 .dac_nids = alc262_dac_nids,
11323 .dig_out_nid = ALC262_DIGOUT_NID,
11324 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11325 .channel_mode = alc262_modes,
11326 .input_mux = &alc262_fujitsu_capture_source,
11327 .unsol_event = alc262_fujitsu_unsol_event,
11328 .init_hook = alc262_fujitsu_init_hook,
11330 [ALC262_HP_BPC] = {
11331 .mixers = { alc262_HP_BPC_mixer },
11332 .init_verbs = { alc262_HP_BPC_init_verbs },
11333 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11334 .dac_nids = alc262_dac_nids,
11336 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11337 .channel_mode = alc262_modes,
11338 .input_mux = &alc262_HP_capture_source,
11339 .unsol_event = alc262_hp_bpc_unsol_event,
11340 .init_hook = alc262_hp_bpc_automute,
11342 [ALC262_HP_BPC_D7000_WF] = {
11343 .mixers = { alc262_HP_BPC_WildWest_mixer },
11344 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11345 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11346 .dac_nids = alc262_dac_nids,
11348 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11349 .channel_mode = alc262_modes,
11350 .input_mux = &alc262_HP_D7000_capture_source,
11351 .unsol_event = alc262_hp_wildwest_unsol_event,
11352 .init_hook = alc262_hp_wildwest_automute,
11354 [ALC262_HP_BPC_D7000_WL] = {
11355 .mixers = { alc262_HP_BPC_WildWest_mixer,
11356 alc262_HP_BPC_WildWest_option_mixer },
11357 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11358 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11359 .dac_nids = alc262_dac_nids,
11361 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11362 .channel_mode = alc262_modes,
11363 .input_mux = &alc262_HP_D7000_capture_source,
11364 .unsol_event = alc262_hp_wildwest_unsol_event,
11365 .init_hook = alc262_hp_wildwest_automute,
11367 [ALC262_HP_TC_T5735] = {
11368 .mixers = { alc262_hp_t5735_mixer },
11369 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11370 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11371 .dac_nids = alc262_dac_nids,
11373 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11374 .channel_mode = alc262_modes,
11375 .input_mux = &alc262_capture_source,
11376 .unsol_event = alc_automute_amp_unsol_event,
11377 .init_hook = alc262_hp_t5735_init_hook,
11379 [ALC262_HP_RP5700] = {
11380 .mixers = { alc262_hp_rp5700_mixer },
11381 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11382 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11383 .dac_nids = alc262_dac_nids,
11384 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11385 .channel_mode = alc262_modes,
11386 .input_mux = &alc262_hp_rp5700_capture_source,
11388 [ALC262_BENQ_ED8] = {
11389 .mixers = { alc262_base_mixer },
11390 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11391 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11392 .dac_nids = alc262_dac_nids,
11394 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11395 .channel_mode = alc262_modes,
11396 .input_mux = &alc262_capture_source,
11398 [ALC262_SONY_ASSAMD] = {
11399 .mixers = { alc262_sony_mixer },
11400 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11401 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11402 .dac_nids = alc262_dac_nids,
11404 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11405 .channel_mode = alc262_modes,
11406 .input_mux = &alc262_capture_source,
11407 .unsol_event = alc262_hippo_unsol_event,
11408 .init_hook = alc262_hippo_init_hook,
11410 [ALC262_BENQ_T31] = {
11411 .mixers = { alc262_benq_t31_mixer },
11412 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs },
11413 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11414 .dac_nids = alc262_dac_nids,
11416 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11417 .channel_mode = alc262_modes,
11418 .input_mux = &alc262_capture_source,
11419 .unsol_event = alc262_hippo_unsol_event,
11420 .init_hook = alc262_hippo_init_hook,
11423 .mixers = { alc262_ultra_mixer },
11424 .cap_mixer = alc262_ultra_capture_mixer,
11425 .init_verbs = { alc262_ultra_verbs },
11426 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11427 .dac_nids = alc262_dac_nids,
11428 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11429 .channel_mode = alc262_modes,
11430 .input_mux = &alc262_ultra_capture_source,
11431 .adc_nids = alc262_adc_nids, /* ADC0 */
11432 .capsrc_nids = alc262_capsrc_nids,
11433 .num_adc_nids = 1, /* single ADC */
11434 .unsol_event = alc262_ultra_unsol_event,
11435 .init_hook = alc262_ultra_automute,
11437 [ALC262_LENOVO_3000] = {
11438 .mixers = { alc262_lenovo_3000_mixer },
11439 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11440 alc262_lenovo_3000_unsol_verbs },
11441 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11442 .dac_nids = alc262_dac_nids,
11444 .dig_out_nid = ALC262_DIGOUT_NID,
11445 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11446 .channel_mode = alc262_modes,
11447 .input_mux = &alc262_fujitsu_capture_source,
11448 .unsol_event = alc262_lenovo_3000_unsol_event,
11451 .mixers = { alc262_nec_mixer },
11452 .init_verbs = { alc262_nec_verbs },
11453 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11454 .dac_nids = alc262_dac_nids,
11456 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11457 .channel_mode = alc262_modes,
11458 .input_mux = &alc262_capture_source,
11460 [ALC262_TOSHIBA_S06] = {
11461 .mixers = { alc262_toshiba_s06_mixer },
11462 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11463 alc262_eapd_verbs },
11464 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11465 .capsrc_nids = alc262_dmic_capsrc_nids,
11466 .dac_nids = alc262_dac_nids,
11467 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11468 .dig_out_nid = ALC262_DIGOUT_NID,
11469 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11470 .channel_mode = alc262_modes,
11471 .input_mux = &alc262_dmic_capture_source,
11472 .unsol_event = alc262_toshiba_s06_unsol_event,
11473 .init_hook = alc262_toshiba_s06_init_hook,
11475 [ALC262_TOSHIBA_RX1] = {
11476 .mixers = { alc262_toshiba_rx1_mixer },
11477 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11478 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11479 .dac_nids = alc262_dac_nids,
11481 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11482 .channel_mode = alc262_modes,
11483 .input_mux = &alc262_capture_source,
11484 .unsol_event = alc262_hippo_unsol_event,
11485 .init_hook = alc262_hippo_init_hook,
11488 .mixers = { alc262_tyan_mixer },
11489 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11490 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11491 .dac_nids = alc262_dac_nids,
11493 .dig_out_nid = ALC262_DIGOUT_NID,
11494 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11495 .channel_mode = alc262_modes,
11496 .input_mux = &alc262_capture_source,
11497 .unsol_event = alc_automute_amp_unsol_event,
11498 .init_hook = alc262_tyan_init_hook,
11502 static int patch_alc262(struct hda_codec *codec)
11504 struct alc_spec *spec;
11508 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11512 codec->spec = spec;
11514 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11519 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11520 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11521 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11522 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11526 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11528 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11532 if (board_config < 0) {
11533 printk(KERN_INFO "hda_codec: Unknown model for %s, "
11534 "trying auto-probe from BIOS...\n", codec->chip_name);
11535 board_config = ALC262_AUTO;
11538 if (board_config == ALC262_AUTO) {
11539 /* automatic parse from the BIOS config */
11540 err = alc262_parse_auto_config(codec);
11546 "hda_codec: Cannot set up configuration "
11547 "from BIOS. Using base mode...\n");
11548 board_config = ALC262_BASIC;
11552 if (!spec->no_analog) {
11553 err = snd_hda_attach_beep_device(codec, 0x1);
11560 if (board_config != ALC262_AUTO)
11561 setup_preset(spec, &alc262_presets[board_config]);
11563 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11564 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11566 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11567 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11569 spec->capture_style = CAPT_MIX;
11570 if (!spec->adc_nids && spec->input_mux) {
11571 /* check whether NID 0x07 is valid */
11572 unsigned int wcap = get_wcaps(codec, 0x07);
11575 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
11576 if (wcap != AC_WID_AUD_IN) {
11577 spec->adc_nids = alc262_adc_nids_alt;
11578 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt);
11579 spec->capsrc_nids = alc262_capsrc_nids_alt;
11581 spec->adc_nids = alc262_adc_nids;
11582 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids);
11583 spec->capsrc_nids = alc262_capsrc_nids;
11586 if (!spec->cap_mixer && !spec->no_analog)
11587 set_capture_mixer(spec);
11588 if (!spec->no_analog)
11589 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11591 spec->vmaster_nid = 0x0c;
11593 codec->patch_ops = alc_patch_ops;
11594 if (board_config == ALC262_AUTO)
11595 spec->init_hook = alc262_auto_init;
11596 #ifdef CONFIG_SND_HDA_POWER_SAVE
11597 if (!spec->loopback.amplist)
11598 spec->loopback.amplist = alc262_loopbacks;
11600 codec->proc_widget_hook = print_realtek_coef;
11606 * ALC268 channel source setting (2 channel)
11608 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
11609 #define alc268_modes alc260_modes
11611 static hda_nid_t alc268_dac_nids[2] = {
11616 static hda_nid_t alc268_adc_nids[2] = {
11621 static hda_nid_t alc268_adc_nids_alt[1] = {
11626 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
11628 static struct snd_kcontrol_new alc268_base_mixer[] = {
11629 /* output mixer control */
11630 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11631 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11632 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11633 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11634 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11635 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11636 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11640 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
11641 /* output mixer control */
11642 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11643 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11644 ALC262_HIPPO_MASTER_SWITCH,
11645 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11646 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11647 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11651 /* bind Beep switches of both NID 0x0f and 0x10 */
11652 static struct hda_bind_ctls alc268_bind_beep_sw = {
11653 .ops = &snd_hda_bind_sw,
11655 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
11656 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
11661 static struct snd_kcontrol_new alc268_beep_mixer[] = {
11662 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
11663 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
11667 static struct hda_verb alc268_eapd_verbs[] = {
11668 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11669 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11673 /* Toshiba specific */
11674 static struct hda_verb alc268_toshiba_verbs[] = {
11675 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11679 static struct hda_input_mux alc268_acer_lc_capture_source = {
11687 /* Acer specific */
11688 /* bind volumes of both NID 0x02 and 0x03 */
11689 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
11690 .ops = &snd_hda_bind_vol,
11692 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
11693 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
11698 /* mute/unmute internal speaker according to the hp jack and mute state */
11699 static void alc268_acer_automute(struct hda_codec *codec, int force)
11701 struct alc_spec *spec = codec->spec;
11704 if (force || !spec->sense_updated) {
11705 unsigned int present;
11706 present = snd_hda_codec_read(codec, 0x14, 0,
11707 AC_VERB_GET_PIN_SENSE, 0);
11708 spec->jack_present = (present & 0x80000000) != 0;
11709 spec->sense_updated = 1;
11711 if (spec->jack_present)
11712 mute = HDA_AMP_MUTE; /* mute internal speaker */
11713 else /* unmute internal speaker if necessary */
11714 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11715 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11716 HDA_AMP_MUTE, mute);
11720 /* bind hp and internal speaker mute (with plug check) */
11721 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
11722 struct snd_ctl_elem_value *ucontrol)
11724 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11725 long *valp = ucontrol->value.integer.value;
11728 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11730 valp[0] ? 0 : HDA_AMP_MUTE);
11731 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11733 valp[1] ? 0 : HDA_AMP_MUTE);
11735 alc268_acer_automute(codec, 0);
11739 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
11740 /* output mixer control */
11741 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11744 .name = "Master Playback Switch",
11745 .info = snd_hda_mixer_amp_switch_info,
11746 .get = snd_hda_mixer_amp_switch_get,
11747 .put = alc268_acer_master_sw_put,
11748 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11750 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
11754 static struct snd_kcontrol_new alc268_acer_mixer[] = {
11755 /* output mixer control */
11756 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11758 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11759 .name = "Master Playback Switch",
11760 .info = snd_hda_mixer_amp_switch_info,
11761 .get = snd_hda_mixer_amp_switch_get,
11762 .put = alc268_acer_master_sw_put,
11763 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11765 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11766 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11767 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11771 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
11772 /* output mixer control */
11773 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
11775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11776 .name = "Master Playback Switch",
11777 .info = snd_hda_mixer_amp_switch_info,
11778 .get = snd_hda_mixer_amp_switch_get,
11779 .put = alc268_acer_master_sw_put,
11780 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11782 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11783 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
11787 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
11788 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11790 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11791 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11792 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
11793 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
11797 static struct hda_verb alc268_acer_verbs[] = {
11798 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
11799 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11802 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11803 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11804 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11808 /* unsolicited event for HP jack sensing */
11809 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
11810 #define alc268_toshiba_init_hook alc262_hippo_init_hook
11812 static void alc268_acer_unsol_event(struct hda_codec *codec,
11815 if ((res >> 26) != ALC880_HP_EVENT)
11817 alc268_acer_automute(codec, 1);
11820 static void alc268_acer_init_hook(struct hda_codec *codec)
11822 alc268_acer_automute(codec, 1);
11825 /* toggle speaker-output according to the hp-jack state */
11826 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
11828 unsigned int present;
11829 unsigned char bits;
11831 present = snd_hda_codec_read(codec, 0x15, 0,
11832 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11833 bits = present ? AMP_IN_MUTE(0) : 0;
11834 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
11835 AMP_IN_MUTE(0), bits);
11836 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
11837 AMP_IN_MUTE(0), bits);
11841 static void alc268_acer_mic_automute(struct hda_codec *codec)
11843 unsigned int present;
11845 present = snd_hda_codec_read(codec, 0x18, 0,
11846 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11847 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL,
11848 present ? 0x0 : 0x6);
11851 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
11854 if ((res >> 26) == ALC880_HP_EVENT)
11855 alc268_aspire_one_speaker_automute(codec);
11856 if ((res >> 26) == ALC880_MIC_EVENT)
11857 alc268_acer_mic_automute(codec);
11860 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
11862 alc268_aspire_one_speaker_automute(codec);
11863 alc268_acer_mic_automute(codec);
11866 static struct snd_kcontrol_new alc268_dell_mixer[] = {
11867 /* output mixer control */
11868 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
11869 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11870 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
11871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11872 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11873 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
11877 static struct hda_verb alc268_dell_verbs[] = {
11878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11879 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11880 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11884 /* mute/unmute internal speaker according to the hp jack and mute state */
11885 static void alc268_dell_init_hook(struct hda_codec *codec)
11887 struct alc_spec *spec = codec->spec;
11889 spec->autocfg.hp_pins[0] = 0x15;
11890 spec->autocfg.speaker_pins[0] = 0x14;
11891 alc_automute_pin(codec);
11894 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
11895 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
11896 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11897 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
11898 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11899 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11900 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
11901 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
11902 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11906 static struct hda_verb alc267_quanta_il1_verbs[] = {
11907 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11908 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
11912 static void alc267_quanta_il1_mic_automute(struct hda_codec *codec)
11914 unsigned int present;
11916 present = snd_hda_codec_read(codec, 0x18, 0,
11917 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11918 snd_hda_codec_write(codec, 0x23, 0,
11919 AC_VERB_SET_CONNECT_SEL,
11920 present ? 0x00 : 0x01);
11923 static void alc267_quanta_il1_init_hook(struct hda_codec *codec)
11925 struct alc_spec *spec = codec->spec;
11927 spec->autocfg.hp_pins[0] = 0x15;
11928 spec->autocfg.speaker_pins[0] = 0x14;
11929 alc_automute_pin(codec);
11930 alc267_quanta_il1_mic_automute(codec);
11933 static void alc267_quanta_il1_unsol_event(struct hda_codec *codec,
11936 switch (res >> 26) {
11937 case ALC880_MIC_EVENT:
11938 alc267_quanta_il1_mic_automute(codec);
11941 alc_sku_unsol_event(codec, res);
11947 * generic initialization of ADC, input mixers and output mixers
11949 static struct hda_verb alc268_base_init_verbs[] = {
11950 /* Unmute DAC0-1 and set vol = 0 */
11951 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11952 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11955 * Set up output mixers (0x0c - 0x0e)
11957 /* set vol=0 to output mixers */
11958 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11959 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
11961 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11962 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11964 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11965 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11967 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11968 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11969 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11970 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11971 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11973 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11974 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11975 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11976 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11977 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11979 /* set PCBEEP vol = 0, mute connections */
11980 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11981 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11982 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11984 /* Unmute Selector 23h,24h and set the default input to mic-in */
11986 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
11987 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11988 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
11989 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11995 * generic initialization of ADC, input mixers and output mixers
11997 static struct hda_verb alc268_volume_init_verbs[] = {
11998 /* set output DAC */
11999 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12000 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12002 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12003 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12004 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12006 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12008 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12009 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12010 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12012 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12013 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12015 /* set PCBEEP vol = 0, mute connections */
12016 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12017 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12018 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12023 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12024 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12025 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12028 /* The multiple "Capture Source" controls confuse alsamixer
12029 * So call somewhat different..
12031 /* .name = "Capture Source", */
12032 .name = "Input Source",
12034 .info = alc_mux_enum_info,
12035 .get = alc_mux_enum_get,
12036 .put = alc_mux_enum_put,
12041 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12042 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12043 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12045 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12047 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12048 /* The multiple "Capture Source" controls confuse alsamixer
12049 * So call somewhat different..
12051 /* .name = "Capture Source", */
12052 .name = "Input Source",
12054 .info = alc_mux_enum_info,
12055 .get = alc_mux_enum_get,
12056 .put = alc_mux_enum_put,
12061 static struct hda_input_mux alc268_capture_source = {
12065 { "Front Mic", 0x1 },
12071 static struct hda_input_mux alc268_acer_capture_source = {
12075 { "Internal Mic", 0x1 },
12080 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12084 { "Internal Mic", 0x6 },
12089 #ifdef CONFIG_SND_DEBUG
12090 static struct snd_kcontrol_new alc268_test_mixer[] = {
12091 /* Volume widgets */
12092 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12093 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12094 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12095 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12096 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12097 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12098 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12099 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12100 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12101 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12102 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12103 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12104 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12105 /* The below appears problematic on some hardwares */
12106 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12107 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12108 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12109 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12110 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12112 /* Modes for retasking pin widgets */
12113 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12114 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12115 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12116 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12118 /* Controls for GPIO pins, assuming they are configured as outputs */
12119 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12120 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12121 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12122 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12124 /* Switches to allow the digital SPDIF output pin to be enabled.
12125 * The ALC268 does not have an SPDIF input.
12127 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12129 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12130 * this output to turn on an external amplifier.
12132 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12133 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12139 /* create input playback/capture controls for the given pin */
12140 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12141 const char *ctlname, int idx)
12146 sprintf(name, "%s Playback Volume", ctlname);
12148 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12149 HDA_COMPOSE_AMP_VAL(0x02, 3, idx,
12153 } else if (nid == 0x15) {
12154 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
12155 HDA_COMPOSE_AMP_VAL(0x03, 3, idx,
12161 sprintf(name, "%s Playback Switch", ctlname);
12162 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
12163 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12169 /* add playback controls from the parsed DAC table */
12170 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12171 const struct auto_pin_cfg *cfg)
12176 spec->multiout.num_dacs = 2; /* only use one dac */
12177 spec->multiout.dac_nids = spec->private_dac_nids;
12178 spec->multiout.dac_nids[0] = 2;
12179 spec->multiout.dac_nids[1] = 3;
12181 nid = cfg->line_out_pins[0];
12183 alc268_new_analog_output(spec, nid, "Front", 0);
12185 nid = cfg->speaker_pins[0];
12187 err = add_control(spec, ALC_CTL_WIDGET_VOL,
12188 "Speaker Playback Volume",
12189 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12193 nid = cfg->hp_pins[0];
12195 alc268_new_analog_output(spec, nid, "Headphone", 0);
12197 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12199 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
12200 "Mono Playback Switch",
12201 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT));
12208 /* create playback/capture controls for input pins */
12209 static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12210 const struct auto_pin_cfg *cfg)
12212 struct hda_input_mux *imux = &spec->private_imux[0];
12215 for (i = 0; i < AUTO_PIN_LAST; i++) {
12216 switch(cfg->input_pins[i]) {
12218 idx1 = 0; /* Mic 1 */
12221 idx1 = 1; /* Mic 2 */
12224 idx1 = 2; /* Line In */
12231 idx1 = 6; /* digital mics */
12236 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
12237 imux->items[imux->num_items].index = idx1;
12243 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12245 struct alc_spec *spec = codec->spec;
12246 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12247 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12248 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12249 unsigned int dac_vol1, dac_vol2;
12252 snd_hda_codec_write(codec, speaker_nid, 0,
12253 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12254 snd_hda_codec_write(codec, 0x0f, 0,
12255 AC_VERB_SET_AMP_GAIN_MUTE,
12257 snd_hda_codec_write(codec, 0x10, 0,
12258 AC_VERB_SET_AMP_GAIN_MUTE,
12261 snd_hda_codec_write(codec, 0x0f, 0,
12262 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12263 snd_hda_codec_write(codec, 0x10, 0,
12264 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12267 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12268 if (line_nid == 0x14)
12269 dac_vol2 = AMP_OUT_ZERO;
12270 else if (line_nid == 0x15)
12271 dac_vol1 = AMP_OUT_ZERO;
12272 if (hp_nid == 0x14)
12273 dac_vol2 = AMP_OUT_ZERO;
12274 else if (hp_nid == 0x15)
12275 dac_vol1 = AMP_OUT_ZERO;
12276 if (line_nid != 0x16 || hp_nid != 0x16 ||
12277 spec->autocfg.line_out_pins[1] != 0x16 ||
12278 spec->autocfg.line_out_pins[2] != 0x16)
12279 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12281 snd_hda_codec_write(codec, 0x02, 0,
12282 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12283 snd_hda_codec_write(codec, 0x03, 0,
12284 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12287 /* pcm configuration: identiacal with ALC880 */
12288 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12289 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12290 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12291 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12294 * BIOS auto configuration
12296 static int alc268_parse_auto_config(struct hda_codec *codec)
12298 struct alc_spec *spec = codec->spec;
12300 static hda_nid_t alc268_ignore[] = { 0 };
12302 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12306 if (!spec->autocfg.line_outs) {
12307 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12308 spec->multiout.max_channels = 2;
12309 spec->no_analog = 1;
12312 return 0; /* can't find valid BIOS pin config */
12314 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12317 err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg);
12321 spec->multiout.max_channels = 2;
12324 /* digital only support output */
12325 if (spec->autocfg.dig_outs) {
12326 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12327 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12329 if (spec->kctls.list)
12330 add_mixer(spec, spec->kctls.list);
12332 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12333 add_mixer(spec, alc268_beep_mixer);
12335 add_verb(spec, alc268_volume_init_verbs);
12336 spec->num_mux_defs = 1;
12337 spec->input_mux = &spec->private_imux[0];
12339 err = alc_auto_add_mic_boost(codec);
12346 #define alc268_auto_init_multi_out alc882_auto_init_multi_out
12347 #define alc268_auto_init_hp_out alc882_auto_init_hp_out
12348 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12350 /* init callback for auto-configuration model -- overriding the default init */
12351 static void alc268_auto_init(struct hda_codec *codec)
12353 struct alc_spec *spec = codec->spec;
12354 alc268_auto_init_multi_out(codec);
12355 alc268_auto_init_hp_out(codec);
12356 alc268_auto_init_mono_speaker_out(codec);
12357 alc268_auto_init_analog_input(codec);
12358 if (spec->unsol_event)
12359 alc_inithook(codec);
12363 * configuration and preset
12365 static const char *alc268_models[ALC268_MODEL_LAST] = {
12366 [ALC267_QUANTA_IL1] = "quanta-il1",
12367 [ALC268_3ST] = "3stack",
12368 [ALC268_TOSHIBA] = "toshiba",
12369 [ALC268_ACER] = "acer",
12370 [ALC268_ACER_DMIC] = "acer-dmic",
12371 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12372 [ALC268_DELL] = "dell",
12373 [ALC268_ZEPTO] = "zepto",
12374 #ifdef CONFIG_SND_DEBUG
12375 [ALC268_TEST] = "test",
12377 [ALC268_AUTO] = "auto",
12380 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12381 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12382 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12383 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12384 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12385 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12386 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12387 ALC268_ACER_ASPIRE_ONE),
12388 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12389 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),
12390 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12392 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12393 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12394 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12396 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12397 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12398 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12399 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12403 static struct alc_config_preset alc268_presets[] = {
12404 [ALC267_QUANTA_IL1] = {
12405 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer },
12406 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12407 alc267_quanta_il1_verbs },
12408 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12409 .dac_nids = alc268_dac_nids,
12410 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12411 .adc_nids = alc268_adc_nids_alt,
12413 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12414 .channel_mode = alc268_modes,
12415 .input_mux = &alc268_capture_source,
12416 .unsol_event = alc267_quanta_il1_unsol_event,
12417 .init_hook = alc267_quanta_il1_init_hook,
12420 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12421 alc268_beep_mixer },
12422 .init_verbs = { alc268_base_init_verbs },
12423 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12424 .dac_nids = alc268_dac_nids,
12425 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12426 .adc_nids = alc268_adc_nids_alt,
12427 .capsrc_nids = alc268_capsrc_nids,
12429 .dig_out_nid = ALC268_DIGOUT_NID,
12430 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12431 .channel_mode = alc268_modes,
12432 .input_mux = &alc268_capture_source,
12434 [ALC268_TOSHIBA] = {
12435 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12436 alc268_beep_mixer },
12437 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12438 alc268_toshiba_verbs },
12439 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12440 .dac_nids = alc268_dac_nids,
12441 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12442 .adc_nids = alc268_adc_nids_alt,
12443 .capsrc_nids = alc268_capsrc_nids,
12445 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12446 .channel_mode = alc268_modes,
12447 .input_mux = &alc268_capture_source,
12448 .unsol_event = alc268_toshiba_unsol_event,
12449 .init_hook = alc268_toshiba_init_hook,
12452 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12453 alc268_beep_mixer },
12454 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12455 alc268_acer_verbs },
12456 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12457 .dac_nids = alc268_dac_nids,
12458 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12459 .adc_nids = alc268_adc_nids_alt,
12460 .capsrc_nids = alc268_capsrc_nids,
12462 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12463 .channel_mode = alc268_modes,
12464 .input_mux = &alc268_acer_capture_source,
12465 .unsol_event = alc268_acer_unsol_event,
12466 .init_hook = alc268_acer_init_hook,
12468 [ALC268_ACER_DMIC] = {
12469 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12470 alc268_beep_mixer },
12471 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12472 alc268_acer_verbs },
12473 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12474 .dac_nids = alc268_dac_nids,
12475 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12476 .adc_nids = alc268_adc_nids_alt,
12477 .capsrc_nids = alc268_capsrc_nids,
12479 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12480 .channel_mode = alc268_modes,
12481 .input_mux = &alc268_acer_dmic_capture_source,
12482 .unsol_event = alc268_acer_unsol_event,
12483 .init_hook = alc268_acer_init_hook,
12485 [ALC268_ACER_ASPIRE_ONE] = {
12486 .mixers = { alc268_acer_aspire_one_mixer,
12488 alc268_capture_alt_mixer },
12489 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12490 alc268_acer_aspire_one_verbs },
12491 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12492 .dac_nids = alc268_dac_nids,
12493 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12494 .adc_nids = alc268_adc_nids_alt,
12495 .capsrc_nids = alc268_capsrc_nids,
12497 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12498 .channel_mode = alc268_modes,
12499 .input_mux = &alc268_acer_lc_capture_source,
12500 .unsol_event = alc268_acer_lc_unsol_event,
12501 .init_hook = alc268_acer_lc_init_hook,
12504 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
12505 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12506 alc268_dell_verbs },
12507 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12508 .dac_nids = alc268_dac_nids,
12510 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12511 .channel_mode = alc268_modes,
12512 .unsol_event = alc_sku_unsol_event,
12513 .init_hook = alc268_dell_init_hook,
12514 .input_mux = &alc268_capture_source,
12517 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12518 alc268_beep_mixer },
12519 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12520 alc268_toshiba_verbs },
12521 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12522 .dac_nids = alc268_dac_nids,
12523 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12524 .adc_nids = alc268_adc_nids_alt,
12525 .capsrc_nids = alc268_capsrc_nids,
12527 .dig_out_nid = ALC268_DIGOUT_NID,
12528 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12529 .channel_mode = alc268_modes,
12530 .input_mux = &alc268_capture_source,
12531 .unsol_event = alc268_toshiba_unsol_event,
12532 .init_hook = alc268_toshiba_init_hook
12534 #ifdef CONFIG_SND_DEBUG
12536 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12537 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12538 alc268_volume_init_verbs },
12539 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12540 .dac_nids = alc268_dac_nids,
12541 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12542 .adc_nids = alc268_adc_nids_alt,
12543 .capsrc_nids = alc268_capsrc_nids,
12545 .dig_out_nid = ALC268_DIGOUT_NID,
12546 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12547 .channel_mode = alc268_modes,
12548 .input_mux = &alc268_capture_source,
12553 static int patch_alc268(struct hda_codec *codec)
12555 struct alc_spec *spec;
12557 int i, has_beep, err;
12559 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12563 codec->spec = spec;
12565 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12569 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12570 printk(KERN_INFO "hda_codec: Unknown model for %s, "
12571 "trying auto-probe from BIOS...\n", codec->chip_name);
12572 board_config = ALC268_AUTO;
12575 if (board_config == ALC268_AUTO) {
12576 /* automatic parse from the BIOS config */
12577 err = alc268_parse_auto_config(codec);
12583 "hda_codec: Cannot set up configuration "
12584 "from BIOS. Using base mode...\n");
12585 board_config = ALC268_3ST;
12589 if (board_config != ALC268_AUTO)
12590 setup_preset(spec, &alc268_presets[board_config]);
12592 spec->stream_analog_playback = &alc268_pcm_analog_playback;
12593 spec->stream_analog_capture = &alc268_pcm_analog_capture;
12594 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
12596 spec->stream_digital_playback = &alc268_pcm_digital_playback;
12599 for (i = 0; i < spec->num_mixers; i++) {
12600 if (spec->mixers[i] == alc268_beep_mixer) {
12607 err = snd_hda_attach_beep_device(codec, 0x1);
12612 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
12613 /* override the amp caps for beep generator */
12614 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
12615 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
12616 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
12617 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
12618 (0 << AC_AMPCAP_MUTE_SHIFT));
12621 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
12622 /* check whether NID 0x07 is valid */
12623 unsigned int wcap = get_wcaps(codec, 0x07);
12627 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
12628 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12629 spec->adc_nids = alc268_adc_nids_alt;
12630 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12631 add_mixer(spec, alc268_capture_alt_mixer);
12633 spec->adc_nids = alc268_adc_nids;
12634 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12635 add_mixer(spec, alc268_capture_mixer);
12637 spec->capsrc_nids = alc268_capsrc_nids;
12638 /* set default input source */
12639 for (i = 0; i < spec->num_adc_nids; i++)
12640 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12641 0, AC_VERB_SET_CONNECT_SEL,
12642 spec->input_mux->items[0].index);
12645 spec->vmaster_nid = 0x02;
12647 codec->patch_ops = alc_patch_ops;
12648 if (board_config == ALC268_AUTO)
12649 spec->init_hook = alc268_auto_init;
12651 codec->proc_widget_hook = print_realtek_coef;
12657 * ALC269 channel source setting (2 channel)
12659 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
12661 #define alc269_dac_nids alc260_dac_nids
12663 static hda_nid_t alc269_adc_nids[1] = {
12668 static hda_nid_t alc269_capsrc_nids[1] = {
12672 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
12676 static struct hda_input_mux alc269_eeepc_dmic_capture_source = {
12684 static struct hda_input_mux alc269_eeepc_amic_capture_source = {
12692 #define alc269_modes alc260_modes
12693 #define alc269_capture_source alc880_lg_lw_capture_source
12695 static struct snd_kcontrol_new alc269_base_mixer[] = {
12696 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12697 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12698 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
12699 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
12700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12702 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12703 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12705 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12706 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12707 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
12711 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
12712 /* output mixer control */
12713 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12716 .name = "Master Playback Switch",
12717 .info = snd_hda_mixer_amp_switch_info,
12718 .get = snd_hda_mixer_amp_switch_get,
12719 .put = alc268_acer_master_sw_put,
12720 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12722 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12723 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12724 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12725 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12726 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12727 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12731 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
12732 /* output mixer control */
12733 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12736 .name = "Master Playback Switch",
12737 .info = snd_hda_mixer_amp_switch_info,
12738 .get = snd_hda_mixer_amp_switch_get,
12739 .put = alc268_acer_master_sw_put,
12740 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12742 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
12743 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
12744 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12745 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
12746 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
12747 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12748 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
12749 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
12750 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
12754 /* bind volumes of both NID 0x0c and 0x0d */
12755 static struct hda_bind_ctls alc269_epc_bind_vol = {
12756 .ops = &snd_hda_bind_vol,
12758 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12759 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12764 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
12765 HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12766 HDA_BIND_VOL("LineOut Playback Volume", &alc269_epc_bind_vol),
12767 HDA_CODEC_MUTE("LineOut Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12771 /* capture mixer elements */
12772 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
12773 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
12774 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
12775 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12780 static struct snd_kcontrol_new alc269_fujitsu_mixer[] = {
12781 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12782 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12783 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol),
12787 static struct hda_verb alc269_quanta_fl1_verbs[] = {
12788 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12789 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12791 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12792 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12793 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12797 static struct hda_verb alc269_lifebook_verbs[] = {
12798 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12799 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
12800 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12802 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12803 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12805 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12806 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12807 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12811 /* toggle speaker-output according to the hp-jack state */
12812 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
12814 unsigned int present;
12815 unsigned char bits;
12817 present = snd_hda_codec_read(codec, 0x15, 0,
12818 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12819 bits = present ? AMP_IN_MUTE(0) : 0;
12820 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12821 AMP_IN_MUTE(0), bits);
12822 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12823 AMP_IN_MUTE(0), bits);
12825 snd_hda_codec_write(codec, 0x20, 0,
12826 AC_VERB_SET_COEF_INDEX, 0x0c);
12827 snd_hda_codec_write(codec, 0x20, 0,
12828 AC_VERB_SET_PROC_COEF, 0x680);
12830 snd_hda_codec_write(codec, 0x20, 0,
12831 AC_VERB_SET_COEF_INDEX, 0x0c);
12832 snd_hda_codec_write(codec, 0x20, 0,
12833 AC_VERB_SET_PROC_COEF, 0x480);
12836 /* toggle speaker-output according to the hp-jacks state */
12837 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
12839 unsigned int present;
12840 unsigned char bits;
12842 /* Check laptop headphone socket */
12843 present = snd_hda_codec_read(codec, 0x15, 0,
12844 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12846 /* Check port replicator headphone socket */
12847 present |= snd_hda_codec_read(codec, 0x1a, 0,
12848 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12850 bits = present ? AMP_IN_MUTE(0) : 0;
12851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12852 AMP_IN_MUTE(0), bits);
12853 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12854 AMP_IN_MUTE(0), bits);
12856 snd_hda_codec_write(codec, 0x20, 0,
12857 AC_VERB_SET_COEF_INDEX, 0x0c);
12858 snd_hda_codec_write(codec, 0x20, 0,
12859 AC_VERB_SET_PROC_COEF, 0x680);
12861 snd_hda_codec_write(codec, 0x20, 0,
12862 AC_VERB_SET_COEF_INDEX, 0x0c);
12863 snd_hda_codec_write(codec, 0x20, 0,
12864 AC_VERB_SET_PROC_COEF, 0x480);
12867 static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec)
12869 unsigned int present;
12871 present = snd_hda_codec_read(codec, 0x18, 0,
12872 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12873 snd_hda_codec_write(codec, 0x23, 0,
12874 AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1);
12877 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
12879 unsigned int present_laptop;
12880 unsigned int present_dock;
12882 present_laptop = snd_hda_codec_read(codec, 0x18, 0,
12883 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12885 present_dock = snd_hda_codec_read(codec, 0x1b, 0,
12886 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12888 /* Laptop mic port overrides dock mic port, design decision */
12890 snd_hda_codec_write(codec, 0x23, 0,
12891 AC_VERB_SET_CONNECT_SEL, 0x3);
12892 if (present_laptop)
12893 snd_hda_codec_write(codec, 0x23, 0,
12894 AC_VERB_SET_CONNECT_SEL, 0x0);
12895 if (!present_dock && !present_laptop)
12896 snd_hda_codec_write(codec, 0x23, 0,
12897 AC_VERB_SET_CONNECT_SEL, 0x1);
12900 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
12903 if ((res >> 26) == ALC880_HP_EVENT)
12904 alc269_quanta_fl1_speaker_automute(codec);
12905 if ((res >> 26) == ALC880_MIC_EVENT)
12906 alc269_quanta_fl1_mic_automute(codec);
12909 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
12912 if ((res >> 26) == ALC880_HP_EVENT)
12913 alc269_lifebook_speaker_automute(codec);
12914 if ((res >> 26) == ALC880_MIC_EVENT)
12915 alc269_lifebook_mic_autoswitch(codec);
12918 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
12920 alc269_quanta_fl1_speaker_automute(codec);
12921 alc269_quanta_fl1_mic_automute(codec);
12924 static void alc269_lifebook_init_hook(struct hda_codec *codec)
12926 alc269_lifebook_speaker_automute(codec);
12927 alc269_lifebook_mic_autoswitch(codec);
12930 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
12931 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12932 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
12933 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12934 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
12935 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12936 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12937 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12941 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
12942 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12943 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
12944 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
12945 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
12946 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12947 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12951 /* toggle speaker-output according to the hp-jack state */
12952 static void alc269_speaker_automute(struct hda_codec *codec)
12954 unsigned int present;
12955 unsigned char bits;
12957 present = snd_hda_codec_read(codec, 0x15, 0,
12958 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12959 bits = present ? AMP_IN_MUTE(0) : 0;
12960 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
12961 AMP_IN_MUTE(0), bits);
12962 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
12963 AMP_IN_MUTE(0), bits);
12966 static void alc269_eeepc_dmic_automute(struct hda_codec *codec)
12968 unsigned int present;
12970 present = snd_hda_codec_read(codec, 0x18, 0,
12971 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12972 snd_hda_codec_write(codec, 0x23, 0,
12973 AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5));
12976 static void alc269_eeepc_amic_automute(struct hda_codec *codec)
12978 unsigned int present;
12980 present = snd_hda_codec_read(codec, 0x18, 0,
12981 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
12982 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12983 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
12984 snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE,
12985 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
12988 /* unsolicited event for HP jack sensing */
12989 static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec,
12992 if ((res >> 26) == ALC880_HP_EVENT)
12993 alc269_speaker_automute(codec);
12995 if ((res >> 26) == ALC880_MIC_EVENT)
12996 alc269_eeepc_dmic_automute(codec);
12999 static void alc269_eeepc_dmic_inithook(struct hda_codec *codec)
13001 alc269_speaker_automute(codec);
13002 alc269_eeepc_dmic_automute(codec);
13005 /* unsolicited event for HP jack sensing */
13006 static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec,
13009 if ((res >> 26) == ALC880_HP_EVENT)
13010 alc269_speaker_automute(codec);
13012 if ((res >> 26) == ALC880_MIC_EVENT)
13013 alc269_eeepc_amic_automute(codec);
13016 static void alc269_eeepc_amic_inithook(struct hda_codec *codec)
13018 alc269_speaker_automute(codec);
13019 alc269_eeepc_amic_automute(codec);
13023 * generic initialization of ADC, input mixers and output mixers
13025 static struct hda_verb alc269_init_verbs[] = {
13027 * Unmute ADC0 and set the default input to mic-in
13029 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13031 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13032 * analog-loopback mixer widget
13033 * Note: PASD motherboards uses the Line In 2 as the input for
13034 * front panel mic (mic 2)
13036 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13039 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13044 * Set up output mixers (0x0c - 0x0e)
13046 /* set vol=0 to output mixers */
13047 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13048 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13050 /* set up input amps for analog loopback */
13051 /* Amp Indices: DAC = 0, mixer = 1 */
13052 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13053 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13054 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13055 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13056 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13057 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13060 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13061 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13062 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13064 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13065 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13067 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13070 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13071 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13072 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13075 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13076 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13078 /* FIXME: use matrix-type input source selection */
13079 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13080 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13081 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13082 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13083 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13084 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13087 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13088 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13092 /* add playback controls from the parsed DAC table */
13093 static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
13094 const struct auto_pin_cfg *cfg)
13099 spec->multiout.num_dacs = 1; /* only use one dac */
13100 spec->multiout.dac_nids = spec->private_dac_nids;
13101 spec->multiout.dac_nids[0] = 2;
13103 nid = cfg->line_out_pins[0];
13105 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13106 "Front Playback Volume",
13107 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
13110 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13111 "Front Playback Switch",
13112 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
13117 nid = cfg->speaker_pins[0];
13119 if (!cfg->line_out_pins[0]) {
13120 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13121 "Speaker Playback Volume",
13122 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13128 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13129 "Speaker Playback Switch",
13130 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13135 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13136 "Speaker Playback Switch",
13137 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13143 nid = cfg->hp_pins[0];
13145 /* spec->multiout.hp_nid = 2; */
13146 if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
13147 err = add_control(spec, ALC_CTL_WIDGET_VOL,
13148 "Headphone Playback Volume",
13149 HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
13155 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13156 "Headphone Playback Switch",
13157 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
13162 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
13163 "Headphone Playback Switch",
13164 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
13173 static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
13174 const struct auto_pin_cfg *cfg)
13178 err = alc880_auto_create_analog_input_ctls(spec, cfg);
13181 /* digital-mic input pin is excluded in alc880_auto_create..()
13182 * because it's under 0x18
13184 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
13185 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
13186 struct hda_input_mux *imux = &spec->private_imux[0];
13187 imux->items[imux->num_items].label = "Int Mic";
13188 imux->items[imux->num_items].index = 0x05;
13194 #ifdef CONFIG_SND_HDA_POWER_SAVE
13195 #define alc269_loopbacks alc880_loopbacks
13198 /* pcm configuration: identiacal with ALC880 */
13199 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13200 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13201 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13202 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13204 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13208 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13209 /* NID is set in alc_build_pcms */
13211 .open = alc880_playback_pcm_open,
13212 .prepare = alc880_playback_pcm_prepare,
13213 .cleanup = alc880_playback_pcm_cleanup
13217 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13221 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13222 /* NID is set in alc_build_pcms */
13226 * BIOS auto configuration
13228 static int alc269_parse_auto_config(struct hda_codec *codec)
13230 struct alc_spec *spec = codec->spec;
13232 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13234 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13239 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13242 err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg);
13246 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13248 if (spec->autocfg.dig_outs)
13249 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13251 if (spec->kctls.list)
13252 add_mixer(spec, spec->kctls.list);
13254 add_verb(spec, alc269_init_verbs);
13255 spec->num_mux_defs = 1;
13256 spec->input_mux = &spec->private_imux[0];
13257 /* set default input source */
13258 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13259 0, AC_VERB_SET_CONNECT_SEL,
13260 spec->input_mux->items[0].index);
13262 err = alc_auto_add_mic_boost(codec);
13266 if (!spec->cap_mixer && !spec->no_analog)
13267 set_capture_mixer(spec);
13272 #define alc269_auto_init_multi_out alc882_auto_init_multi_out
13273 #define alc269_auto_init_hp_out alc882_auto_init_hp_out
13274 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13277 /* init callback for auto-configuration model -- overriding the default init */
13278 static void alc269_auto_init(struct hda_codec *codec)
13280 struct alc_spec *spec = codec->spec;
13281 alc269_auto_init_multi_out(codec);
13282 alc269_auto_init_hp_out(codec);
13283 alc269_auto_init_analog_input(codec);
13284 if (spec->unsol_event)
13285 alc_inithook(codec);
13289 * configuration and preset
13291 static const char *alc269_models[ALC269_MODEL_LAST] = {
13292 [ALC269_BASIC] = "basic",
13293 [ALC269_QUANTA_FL1] = "quanta",
13294 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13295 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13296 [ALC269_FUJITSU] = "fujitsu",
13297 [ALC269_LIFEBOOK] = "lifebook"
13300 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13301 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13302 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13303 ALC269_ASUS_EEEPC_P703),
13304 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13305 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13306 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13307 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13308 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13309 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13310 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13311 ALC269_ASUS_EEEPC_P901),
13312 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13313 ALC269_ASUS_EEEPC_P901),
13314 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13315 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13316 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13320 static struct alc_config_preset alc269_presets[] = {
13322 .mixers = { alc269_base_mixer },
13323 .init_verbs = { alc269_init_verbs },
13324 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13325 .dac_nids = alc269_dac_nids,
13327 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13328 .channel_mode = alc269_modes,
13329 .input_mux = &alc269_capture_source,
13331 [ALC269_QUANTA_FL1] = {
13332 .mixers = { alc269_quanta_fl1_mixer },
13333 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13334 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13335 .dac_nids = alc269_dac_nids,
13337 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13338 .channel_mode = alc269_modes,
13339 .input_mux = &alc269_capture_source,
13340 .unsol_event = alc269_quanta_fl1_unsol_event,
13341 .init_hook = alc269_quanta_fl1_init_hook,
13343 [ALC269_ASUS_EEEPC_P703] = {
13344 .mixers = { alc269_eeepc_mixer },
13345 .cap_mixer = alc269_epc_capture_mixer,
13346 .init_verbs = { alc269_init_verbs,
13347 alc269_eeepc_amic_init_verbs },
13348 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13349 .dac_nids = alc269_dac_nids,
13351 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13352 .channel_mode = alc269_modes,
13353 .input_mux = &alc269_eeepc_amic_capture_source,
13354 .unsol_event = alc269_eeepc_amic_unsol_event,
13355 .init_hook = alc269_eeepc_amic_inithook,
13357 [ALC269_ASUS_EEEPC_P901] = {
13358 .mixers = { alc269_eeepc_mixer },
13359 .cap_mixer = alc269_epc_capture_mixer,
13360 .init_verbs = { alc269_init_verbs,
13361 alc269_eeepc_dmic_init_verbs },
13362 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13363 .dac_nids = alc269_dac_nids,
13365 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13366 .channel_mode = alc269_modes,
13367 .input_mux = &alc269_eeepc_dmic_capture_source,
13368 .unsol_event = alc269_eeepc_dmic_unsol_event,
13369 .init_hook = alc269_eeepc_dmic_inithook,
13371 [ALC269_FUJITSU] = {
13372 .mixers = { alc269_fujitsu_mixer },
13373 .cap_mixer = alc269_epc_capture_mixer,
13374 .init_verbs = { alc269_init_verbs,
13375 alc269_eeepc_dmic_init_verbs },
13376 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13377 .dac_nids = alc269_dac_nids,
13379 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13380 .channel_mode = alc269_modes,
13381 .input_mux = &alc269_eeepc_dmic_capture_source,
13382 .unsol_event = alc269_eeepc_dmic_unsol_event,
13383 .init_hook = alc269_eeepc_dmic_inithook,
13385 [ALC269_LIFEBOOK] = {
13386 .mixers = { alc269_lifebook_mixer },
13387 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13388 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13389 .dac_nids = alc269_dac_nids,
13391 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13392 .channel_mode = alc269_modes,
13393 .input_mux = &alc269_capture_source,
13394 .unsol_event = alc269_lifebook_unsol_event,
13395 .init_hook = alc269_lifebook_init_hook,
13399 static int patch_alc269(struct hda_codec *codec)
13401 struct alc_spec *spec;
13405 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13409 codec->spec = spec;
13411 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13413 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13417 if (board_config < 0) {
13418 printk(KERN_INFO "hda_codec: Unknown model for %s, "
13419 "trying auto-probe from BIOS...\n", codec->chip_name);
13420 board_config = ALC269_AUTO;
13423 if (board_config == ALC269_AUTO) {
13424 /* automatic parse from the BIOS config */
13425 err = alc269_parse_auto_config(codec);
13431 "hda_codec: Cannot set up configuration "
13432 "from BIOS. Using base mode...\n");
13433 board_config = ALC269_BASIC;
13437 err = snd_hda_attach_beep_device(codec, 0x1);
13443 if (board_config != ALC269_AUTO)
13444 setup_preset(spec, &alc269_presets[board_config]);
13446 if (codec->subsystem_id == 0x17aa3bf8) {
13447 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13448 * fix the sample rate of analog I/O to 44.1kHz
13450 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13451 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13453 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13454 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13456 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13457 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13459 spec->adc_nids = alc269_adc_nids;
13460 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13461 spec->capsrc_nids = alc269_capsrc_nids;
13462 if (!spec->cap_mixer)
13463 set_capture_mixer(spec);
13464 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13466 codec->patch_ops = alc_patch_ops;
13467 if (board_config == ALC269_AUTO)
13468 spec->init_hook = alc269_auto_init;
13469 #ifdef CONFIG_SND_HDA_POWER_SAVE
13470 if (!spec->loopback.amplist)
13471 spec->loopback.amplist = alc269_loopbacks;
13473 codec->proc_widget_hook = print_realtek_coef;
13479 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13483 * set the path ways for 2 channel output
13484 * need to set the codec line out and mic 1 pin widgets to inputs
13486 static struct hda_verb alc861_threestack_ch2_init[] = {
13487 /* set pin widget 1Ah (line in) for input */
13488 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13489 /* set pin widget 18h (mic1/2) for input, for mic also enable
13492 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13494 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13496 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13497 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13503 * need to set the codec line out and mic 1 pin widgets to outputs
13505 static struct hda_verb alc861_threestack_ch6_init[] = {
13506 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13507 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13508 /* set pin widget 18h (mic1) for output (CLFE)*/
13509 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13511 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13512 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13514 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13516 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13517 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13522 static struct hda_channel_mode alc861_threestack_modes[2] = {
13523 { 2, alc861_threestack_ch2_init },
13524 { 6, alc861_threestack_ch6_init },
13526 /* Set mic1 as input and unmute the mixer */
13527 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13528 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13529 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13532 /* Set mic1 as output and mute mixer */
13533 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13534 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13535 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13539 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13540 { 2, alc861_uniwill_m31_ch2_init },
13541 { 4, alc861_uniwill_m31_ch4_init },
13544 /* Set mic1 and line-in as input and unmute the mixer */
13545 static struct hda_verb alc861_asus_ch2_init[] = {
13546 /* set pin widget 1Ah (line in) for input */
13547 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13548 /* set pin widget 18h (mic1/2) for input, for mic also enable
13551 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13553 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13555 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13556 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13560 /* Set mic1 nad line-in as output and mute mixer */
13561 static struct hda_verb alc861_asus_ch6_init[] = {
13562 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13563 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13564 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13565 /* set pin widget 18h (mic1) for output (CLFE)*/
13566 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13567 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13568 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13569 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13571 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13573 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13574 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13579 static struct hda_channel_mode alc861_asus_modes[2] = {
13580 { 2, alc861_asus_ch2_init },
13581 { 6, alc861_asus_ch6_init },
13586 static struct snd_kcontrol_new alc861_base_mixer[] = {
13587 /* output mixer control */
13588 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13589 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13590 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13591 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13592 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13594 /*Input mixer control */
13595 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13596 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13597 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13598 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13599 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13600 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13602 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13603 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13604 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13609 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13610 /* output mixer control */
13611 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13612 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13613 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13614 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13615 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13617 /* Input mixer control */
13618 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13619 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13620 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13621 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13622 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13623 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13624 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13625 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13626 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13627 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13630 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13631 .name = "Channel Mode",
13632 .info = alc_ch_mode_info,
13633 .get = alc_ch_mode_get,
13634 .put = alc_ch_mode_put,
13635 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13640 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13641 /* output mixer control */
13642 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13643 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13644 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13649 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13650 /* output mixer control */
13651 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13652 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13653 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13654 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13655 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13657 /* Input mixer control */
13658 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13659 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13660 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13661 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13662 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13663 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13665 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13666 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13667 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13670 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13671 .name = "Channel Mode",
13672 .info = alc_ch_mode_info,
13673 .get = alc_ch_mode_get,
13674 .put = alc_ch_mode_put,
13675 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13680 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13681 /* output mixer control */
13682 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13683 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13684 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13685 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13686 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13688 /* Input mixer control */
13689 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13690 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13691 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13692 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13693 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13694 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13696 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13697 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13698 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13701 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13702 .name = "Channel Mode",
13703 .info = alc_ch_mode_info,
13704 .get = alc_ch_mode_get,
13705 .put = alc_ch_mode_put,
13706 .private_value = ARRAY_SIZE(alc861_asus_modes),
13711 /* additional mixer */
13712 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
13713 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13714 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13719 * generic initialization of ADC, input mixers and output mixers
13721 static struct hda_verb alc861_base_init_verbs[] = {
13723 * Unmute ADC0 and set the default input to mic-in
13725 /* port-A for surround (rear panel) */
13726 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13727 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
13728 /* port-B for mic-in (rear panel) with vref */
13729 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13730 /* port-C for line-in (rear panel) */
13731 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13732 /* port-D for Front */
13733 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13734 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13735 /* port-E for HP out (front panel) */
13736 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13737 /* route front PCM to HP */
13738 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13739 /* port-F for mic-in (front panel) with vref */
13740 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13741 /* port-G for CLFE (rear panel) */
13742 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13743 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13744 /* port-H for side (rear panel) */
13745 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13746 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
13748 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13749 /* route front mic to ADC1*/
13750 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13751 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13753 /* Unmute DAC0~3 & spdif out*/
13754 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13755 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13756 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13757 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13760 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13761 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13762 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13763 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13764 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13766 /* Unmute Stereo Mixer 15 */
13767 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13768 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13772 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13773 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13774 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13775 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13777 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13779 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13780 /* hp used DAC 3 (Front) */
13781 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13782 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13787 static struct hda_verb alc861_threestack_init_verbs[] = {
13789 * Unmute ADC0 and set the default input to mic-in
13791 /* port-A for surround (rear panel) */
13792 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13793 /* port-B for mic-in (rear panel) with vref */
13794 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13795 /* port-C for line-in (rear panel) */
13796 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13797 /* port-D for Front */
13798 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13799 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13800 /* port-E for HP out (front panel) */
13801 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
13802 /* route front PCM to HP */
13803 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13804 /* port-F for mic-in (front panel) with vref */
13805 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13806 /* port-G for CLFE (rear panel) */
13807 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13808 /* port-H for side (rear panel) */
13809 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13811 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13812 /* route front mic to ADC1*/
13813 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13814 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13815 /* Unmute DAC0~3 & spdif out*/
13816 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13817 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13818 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13819 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13820 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13822 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13823 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13824 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13825 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13826 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13828 /* Unmute Stereo Mixer 15 */
13829 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13830 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13831 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13835 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13836 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13837 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13838 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13839 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13840 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13842 /* hp used DAC 3 (Front) */
13843 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13844 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13848 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
13850 * Unmute ADC0 and set the default input to mic-in
13852 /* port-A for surround (rear panel) */
13853 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13854 /* port-B for mic-in (rear panel) with vref */
13855 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13856 /* port-C for line-in (rear panel) */
13857 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13858 /* port-D for Front */
13859 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13860 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13861 /* port-E for HP out (front panel) */
13862 /* this has to be set to VREF80 */
13863 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13864 /* route front PCM to HP */
13865 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13866 /* port-F for mic-in (front panel) with vref */
13867 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13868 /* port-G for CLFE (rear panel) */
13869 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13870 /* port-H for side (rear panel) */
13871 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
13873 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13874 /* route front mic to ADC1*/
13875 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13876 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13877 /* Unmute DAC0~3 & spdif out*/
13878 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13879 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13880 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13881 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13882 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13884 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13885 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13886 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13887 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13888 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13890 /* Unmute Stereo Mixer 15 */
13891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13892 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13893 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13894 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13896 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13897 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13898 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13899 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13900 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13901 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13902 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13903 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13904 /* hp used DAC 3 (Front) */
13905 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13906 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13910 static struct hda_verb alc861_asus_init_verbs[] = {
13912 * Unmute ADC0 and set the default input to mic-in
13914 /* port-A for surround (rear panel)
13915 * according to codec#0 this is the HP jack
13917 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
13918 /* route front PCM to HP */
13919 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
13920 /* port-B for mic-in (rear panel) with vref */
13921 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13922 /* port-C for line-in (rear panel) */
13923 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13924 /* port-D for Front */
13925 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13926 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
13927 /* port-E for HP out (front panel) */
13928 /* this has to be set to VREF80 */
13929 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13930 /* route front PCM to HP */
13931 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
13932 /* port-F for mic-in (front panel) with vref */
13933 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13934 /* port-G for CLFE (rear panel) */
13935 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13936 /* port-H for side (rear panel) */
13937 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13939 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13940 /* route front mic to ADC1*/
13941 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
13942 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13943 /* Unmute DAC0~3 & spdif out*/
13944 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13945 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13946 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13947 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13948 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13949 /* Unmute Mixer 14 (mic) 1c (Line in)*/
13950 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13951 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13952 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13953 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13955 /* Unmute Stereo Mixer 15 */
13956 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13957 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13958 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13959 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
13961 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13962 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13963 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13964 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13965 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13966 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13967 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13968 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13969 /* hp used DAC 3 (Front) */
13970 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
13971 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
13975 /* additional init verbs for ASUS laptops */
13976 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
13977 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
13978 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
13983 * generic initialization of ADC, input mixers and output mixers
13985 static struct hda_verb alc861_auto_init_verbs[] = {
13987 * Unmute ADC0 and set the default input to mic-in
13989 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
13990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13992 /* Unmute DAC0~3 & spdif out*/
13993 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13994 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13995 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13996 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13997 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13999 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14000 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14001 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14002 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14003 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14005 /* Unmute Stereo Mixer 15 */
14006 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14007 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14008 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14009 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14011 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14012 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14014 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14016 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14017 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14018 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14020 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14021 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14022 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14023 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14024 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14025 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14026 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14027 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14029 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14034 static struct hda_verb alc861_toshiba_init_verbs[] = {
14035 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14040 /* toggle speaker-output according to the hp-jack state */
14041 static void alc861_toshiba_automute(struct hda_codec *codec)
14043 unsigned int present;
14045 present = snd_hda_codec_read(codec, 0x0f, 0,
14046 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14047 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14048 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14049 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14050 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14053 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14056 if ((res >> 26) == ALC880_HP_EVENT)
14057 alc861_toshiba_automute(codec);
14060 /* pcm configuration: identiacal with ALC880 */
14061 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14062 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14063 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14064 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14067 #define ALC861_DIGOUT_NID 0x07
14069 static struct hda_channel_mode alc861_8ch_modes[1] = {
14073 static hda_nid_t alc861_dac_nids[4] = {
14074 /* front, surround, clfe, side */
14075 0x03, 0x06, 0x05, 0x04
14078 static hda_nid_t alc660_dac_nids[3] = {
14079 /* front, clfe, surround */
14083 static hda_nid_t alc861_adc_nids[1] = {
14088 static struct hda_input_mux alc861_capture_source = {
14092 { "Front Mic", 0x3 },
14099 /* fill in the dac_nids table from the parsed pin configuration */
14100 static int alc861_auto_fill_dac_nids(struct alc_spec *spec,
14101 const struct auto_pin_cfg *cfg)
14106 spec->multiout.dac_nids = spec->private_dac_nids;
14107 for (i = 0; i < cfg->line_outs; i++) {
14108 nid = cfg->line_out_pins[i];
14110 if (i >= ARRAY_SIZE(alc861_dac_nids))
14112 spec->multiout.dac_nids[i] = alc861_dac_nids[i];
14115 spec->multiout.num_dacs = cfg->line_outs;
14119 /* add playback controls from the parsed DAC table */
14120 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec,
14121 const struct auto_pin_cfg *cfg)
14124 static const char *chname[4] = {
14125 "Front", "Surround", NULL /*CLFE*/, "Side"
14130 for (i = 0; i < cfg->line_outs; i++) {
14131 nid = spec->multiout.dac_nids[i];
14136 err = add_control(spec, ALC_CTL_BIND_MUTE,
14137 "Center Playback Switch",
14138 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
14142 err = add_control(spec, ALC_CTL_BIND_MUTE,
14143 "LFE Playback Switch",
14144 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
14149 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1;
14151 if (nid == alc861_dac_nids[idx])
14153 sprintf(name, "%s Playback Switch", chname[idx]);
14154 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
14155 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
14164 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
14172 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14174 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
14175 "Headphone Playback Switch",
14176 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
14179 spec->multiout.hp_nid = nid;
14184 /* create playback/capture controls for input pins */
14185 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
14186 const struct auto_pin_cfg *cfg)
14188 struct hda_input_mux *imux = &spec->private_imux[0];
14189 int i, err, idx, idx1;
14191 for (i = 0; i < AUTO_PIN_LAST; i++) {
14192 switch (cfg->input_pins[i]) {
14195 idx = 2; /* Line In */
14199 idx = 2; /* Line In */
14203 idx = 1; /* Mic In */
14207 idx = 1; /* Mic In */
14217 err = new_analog_input(spec, cfg->input_pins[i],
14218 auto_pin_cfg_labels[i], idx, 0x15);
14222 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];
14223 imux->items[imux->num_items].index = idx1;
14229 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14231 int pin_type, int dac_idx)
14233 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14235 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14239 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14241 struct alc_spec *spec = codec->spec;
14244 for (i = 0; i < spec->autocfg.line_outs; i++) {
14245 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14246 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14248 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14249 spec->multiout.dac_nids[i]);
14253 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14255 struct alc_spec *spec = codec->spec;
14258 pin = spec->autocfg.hp_pins[0];
14259 if (pin) /* connect to front */
14260 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP,
14261 spec->multiout.dac_nids[0]);
14262 pin = spec->autocfg.speaker_pins[0];
14264 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
14267 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14269 struct alc_spec *spec = codec->spec;
14272 for (i = 0; i < AUTO_PIN_LAST; i++) {
14273 hda_nid_t nid = spec->autocfg.input_pins[i];
14274 if (nid >= 0x0c && nid <= 0x11)
14275 alc_set_input_pin(codec, nid, i);
14279 /* parse the BIOS configuration and set up the alc_spec */
14280 /* return 1 if successful, 0 if the proper config is not found,
14281 * or a negative error code
14283 static int alc861_parse_auto_config(struct hda_codec *codec)
14285 struct alc_spec *spec = codec->spec;
14287 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14289 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14293 if (!spec->autocfg.line_outs)
14294 return 0; /* can't find valid BIOS pin config */
14296 err = alc861_auto_fill_dac_nids(spec, &spec->autocfg);
14299 err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg);
14302 err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]);
14305 err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg);
14309 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14311 if (spec->autocfg.dig_outs)
14312 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14314 if (spec->kctls.list)
14315 add_mixer(spec, spec->kctls.list);
14317 add_verb(spec, alc861_auto_init_verbs);
14319 spec->num_mux_defs = 1;
14320 spec->input_mux = &spec->private_imux[0];
14322 spec->adc_nids = alc861_adc_nids;
14323 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14324 set_capture_mixer(spec);
14326 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14331 /* additional initialization for auto-configuration model */
14332 static void alc861_auto_init(struct hda_codec *codec)
14334 struct alc_spec *spec = codec->spec;
14335 alc861_auto_init_multi_out(codec);
14336 alc861_auto_init_hp_out(codec);
14337 alc861_auto_init_analog_input(codec);
14338 if (spec->unsol_event)
14339 alc_inithook(codec);
14342 #ifdef CONFIG_SND_HDA_POWER_SAVE
14343 static struct hda_amp_list alc861_loopbacks[] = {
14344 { 0x15, HDA_INPUT, 0 },
14345 { 0x15, HDA_INPUT, 1 },
14346 { 0x15, HDA_INPUT, 2 },
14347 { 0x15, HDA_INPUT, 3 },
14354 * configuration and preset
14356 static const char *alc861_models[ALC861_MODEL_LAST] = {
14357 [ALC861_3ST] = "3stack",
14358 [ALC660_3ST] = "3stack-660",
14359 [ALC861_3ST_DIG] = "3stack-dig",
14360 [ALC861_6ST_DIG] = "6stack-dig",
14361 [ALC861_UNIWILL_M31] = "uniwill-m31",
14362 [ALC861_TOSHIBA] = "toshiba",
14363 [ALC861_ASUS] = "asus",
14364 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14365 [ALC861_AUTO] = "auto",
14368 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14369 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14370 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14371 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14372 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14373 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14374 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14375 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14376 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14377 * Any other models that need this preset?
14379 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14380 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14381 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14382 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14383 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14384 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14385 /* FIXME: the below seems conflict */
14386 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14387 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14388 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14392 static struct alc_config_preset alc861_presets[] = {
14394 .mixers = { alc861_3ST_mixer },
14395 .init_verbs = { alc861_threestack_init_verbs },
14396 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14397 .dac_nids = alc861_dac_nids,
14398 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14399 .channel_mode = alc861_threestack_modes,
14401 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14402 .adc_nids = alc861_adc_nids,
14403 .input_mux = &alc861_capture_source,
14405 [ALC861_3ST_DIG] = {
14406 .mixers = { alc861_base_mixer },
14407 .init_verbs = { alc861_threestack_init_verbs },
14408 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14409 .dac_nids = alc861_dac_nids,
14410 .dig_out_nid = ALC861_DIGOUT_NID,
14411 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14412 .channel_mode = alc861_threestack_modes,
14414 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14415 .adc_nids = alc861_adc_nids,
14416 .input_mux = &alc861_capture_source,
14418 [ALC861_6ST_DIG] = {
14419 .mixers = { alc861_base_mixer },
14420 .init_verbs = { alc861_base_init_verbs },
14421 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14422 .dac_nids = alc861_dac_nids,
14423 .dig_out_nid = ALC861_DIGOUT_NID,
14424 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14425 .channel_mode = alc861_8ch_modes,
14426 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14427 .adc_nids = alc861_adc_nids,
14428 .input_mux = &alc861_capture_source,
14431 .mixers = { alc861_3ST_mixer },
14432 .init_verbs = { alc861_threestack_init_verbs },
14433 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14434 .dac_nids = alc660_dac_nids,
14435 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14436 .channel_mode = alc861_threestack_modes,
14438 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14439 .adc_nids = alc861_adc_nids,
14440 .input_mux = &alc861_capture_source,
14442 [ALC861_UNIWILL_M31] = {
14443 .mixers = { alc861_uniwill_m31_mixer },
14444 .init_verbs = { alc861_uniwill_m31_init_verbs },
14445 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14446 .dac_nids = alc861_dac_nids,
14447 .dig_out_nid = ALC861_DIGOUT_NID,
14448 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14449 .channel_mode = alc861_uniwill_m31_modes,
14451 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14452 .adc_nids = alc861_adc_nids,
14453 .input_mux = &alc861_capture_source,
14455 [ALC861_TOSHIBA] = {
14456 .mixers = { alc861_toshiba_mixer },
14457 .init_verbs = { alc861_base_init_verbs,
14458 alc861_toshiba_init_verbs },
14459 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14460 .dac_nids = alc861_dac_nids,
14461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14462 .channel_mode = alc883_3ST_2ch_modes,
14463 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14464 .adc_nids = alc861_adc_nids,
14465 .input_mux = &alc861_capture_source,
14466 .unsol_event = alc861_toshiba_unsol_event,
14467 .init_hook = alc861_toshiba_automute,
14470 .mixers = { alc861_asus_mixer },
14471 .init_verbs = { alc861_asus_init_verbs },
14472 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14473 .dac_nids = alc861_dac_nids,
14474 .dig_out_nid = ALC861_DIGOUT_NID,
14475 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14476 .channel_mode = alc861_asus_modes,
14479 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14480 .adc_nids = alc861_adc_nids,
14481 .input_mux = &alc861_capture_source,
14483 [ALC861_ASUS_LAPTOP] = {
14484 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14485 .init_verbs = { alc861_asus_init_verbs,
14486 alc861_asus_laptop_init_verbs },
14487 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14488 .dac_nids = alc861_dac_nids,
14489 .dig_out_nid = ALC861_DIGOUT_NID,
14490 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14491 .channel_mode = alc883_3ST_2ch_modes,
14493 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14494 .adc_nids = alc861_adc_nids,
14495 .input_mux = &alc861_capture_source,
14500 static int patch_alc861(struct hda_codec *codec)
14502 struct alc_spec *spec;
14506 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14510 codec->spec = spec;
14512 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14516 if (board_config < 0) {
14517 printk(KERN_INFO "hda_codec: Unknown model for %s, "
14518 "trying auto-probe from BIOS...\n", codec->chip_name);
14519 board_config = ALC861_AUTO;
14522 if (board_config == ALC861_AUTO) {
14523 /* automatic parse from the BIOS config */
14524 err = alc861_parse_auto_config(codec);
14530 "hda_codec: Cannot set up configuration "
14531 "from BIOS. Using base mode...\n");
14532 board_config = ALC861_3ST_DIG;
14536 err = snd_hda_attach_beep_device(codec, 0x23);
14542 if (board_config != ALC861_AUTO)
14543 setup_preset(spec, &alc861_presets[board_config]);
14545 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14546 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14548 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14549 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14551 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14553 spec->vmaster_nid = 0x03;
14555 codec->patch_ops = alc_patch_ops;
14556 if (board_config == ALC861_AUTO)
14557 spec->init_hook = alc861_auto_init;
14558 #ifdef CONFIG_SND_HDA_POWER_SAVE
14559 if (!spec->loopback.amplist)
14560 spec->loopback.amplist = alc861_loopbacks;
14562 codec->proc_widget_hook = print_realtek_coef;
14568 * ALC861-VD support
14572 * In addition, an independent DAC
14574 #define ALC861VD_DIGOUT_NID 0x06
14576 static hda_nid_t alc861vd_dac_nids[4] = {
14577 /* front, surr, clfe, side surr */
14578 0x02, 0x03, 0x04, 0x05
14581 /* dac_nids for ALC660vd are in a different order - according to
14582 * Realtek's driver.
14583 * This should probably tesult in a different mixer for 6stack models
14584 * of ALC660vd codecs, but for now there is only 3stack mixer
14585 * - and it is the same as in 861vd.
14586 * adc_nids in ALC660vd are (is) the same as in 861vd
14588 static hda_nid_t alc660vd_dac_nids[3] = {
14589 /* front, rear, clfe, rear_surr */
14593 static hda_nid_t alc861vd_adc_nids[1] = {
14598 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14601 /* FIXME: should be a matrix-type input source selection */
14602 static struct hda_input_mux alc861vd_capture_source = {
14606 { "Front Mic", 0x1 },
14612 static struct hda_input_mux alc861vd_dallas_capture_source = {
14615 { "Ext Mic", 0x0 },
14616 { "Int Mic", 0x1 },
14620 static struct hda_input_mux alc861vd_hp_capture_source = {
14623 { "Front Mic", 0x0 },
14624 { "ATAPI Mic", 0x1 },
14631 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14638 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14639 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14640 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14641 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14642 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14649 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14650 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14651 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14652 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14653 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14657 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14658 { 6, alc861vd_6stack_ch6_init },
14659 { 8, alc861vd_6stack_ch8_init },
14662 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14665 .name = "Channel Mode",
14666 .info = alc_ch_mode_info,
14667 .get = alc_ch_mode_get,
14668 .put = alc_ch_mode_put,
14673 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
14674 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
14676 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
14677 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14678 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14680 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14681 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
14683 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
14685 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
14687 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
14688 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
14690 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
14691 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
14693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14695 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14696 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14697 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14699 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14700 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14701 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14703 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14704 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14706 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14707 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14712 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
14713 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14714 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14716 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14718 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14719 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14720 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14722 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14723 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14724 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14726 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14727 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14729 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14730 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14735 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
14736 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14737 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
14738 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14740 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
14742 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14743 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14744 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14746 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14747 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14748 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14750 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
14751 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
14756 /* Pin assignment: Speaker=0x14, HP = 0x15,
14757 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
14759 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
14760 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14761 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
14762 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14763 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14764 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
14765 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14766 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14767 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
14768 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14769 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14773 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
14774 * Front Mic=0x18, ATAPI Mic = 0x19,
14776 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
14777 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14778 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
14779 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14780 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
14781 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14782 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14783 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
14784 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
14790 * generic initialization of ADC, input mixers and output mixers
14792 static struct hda_verb alc861vd_volume_init_verbs[] = {
14794 * Unmute ADC0 and set the default input to mic-in
14796 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
14797 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14799 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
14800 * the analog-loopback mixer widget
14802 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
14803 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14804 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14805 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14806 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14807 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
14809 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
14810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14812 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14813 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
14816 * Set up output mixers (0x02 - 0x05)
14818 /* set vol=0 to output mixers */
14819 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14820 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14821 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14822 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14824 /* set up input amps for analog loopback */
14825 /* Amp Indices: DAC = 0, mixer = 1 */
14826 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14827 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14828 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14829 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14830 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14831 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14839 * 3-stack pin configuration:
14840 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
14842 static struct hda_verb alc861vd_3stack_init_verbs[] = {
14844 * Set pin mode and muting
14846 /* set front pin widgets 0x14 for output */
14847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14848 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14849 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14851 /* Mic (rear) pin: input vref at 80% */
14852 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14853 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14854 /* Front Mic pin: input vref at 80% */
14855 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14856 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14857 /* Line In pin: input */
14858 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14859 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14860 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14861 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14862 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14864 /* CD pin widget for input */
14865 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14871 * 6-stack pin configuration:
14873 static struct hda_verb alc861vd_6stack_init_verbs[] = {
14875 * Set pin mode and muting
14877 /* set front pin widgets 0x14 for output */
14878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14880 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
14882 /* Rear Pin: output 1 (0x0d) */
14883 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14884 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14885 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14886 /* CLFE Pin: output 2 (0x0e) */
14887 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14888 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14889 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
14890 /* Side Pin: output 3 (0x0f) */
14891 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14892 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14893 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
14895 /* Mic (rear) pin: input vref at 80% */
14896 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14897 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14898 /* Front Mic pin: input vref at 80% */
14899 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14900 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14901 /* Line In pin: input */
14902 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14903 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14904 /* Line-2 In: Headphone output (output 0 - 0x0c) */
14905 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14906 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14907 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
14908 /* CD pin widget for input */
14909 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14914 static struct hda_verb alc861vd_eapd_verbs[] = {
14915 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14919 static struct hda_verb alc660vd_eapd_verbs[] = {
14920 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14921 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
14925 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
14926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
14929 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14930 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14934 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
14936 unsigned int present;
14937 unsigned char bits;
14939 present = snd_hda_codec_read(codec, 0x18, 0,
14940 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
14941 bits = present ? HDA_AMP_MUTE : 0;
14942 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
14943 HDA_AMP_MUTE, bits);
14946 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
14948 struct alc_spec *spec = codec->spec;
14950 spec->autocfg.hp_pins[0] = 0x1b;
14951 spec->autocfg.speaker_pins[0] = 0x14;
14952 alc_automute_amp(codec);
14953 alc861vd_lenovo_mic_automute(codec);
14956 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
14959 switch (res >> 26) {
14960 case ALC880_MIC_EVENT:
14961 alc861vd_lenovo_mic_automute(codec);
14964 alc_automute_amp_unsol_event(codec, res);
14969 static struct hda_verb alc861vd_dallas_verbs[] = {
14970 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14971 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14972 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14973 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14975 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14976 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14977 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14978 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14979 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14980 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14981 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14982 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14988 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14989 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14990 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14991 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14993 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14994 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14995 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
14996 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14997 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15000 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15002 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15003 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15004 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15005 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15007 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15008 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15009 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15014 /* toggle speaker-output according to the hp-jack state */
15015 static void alc861vd_dallas_init_hook(struct hda_codec *codec)
15017 struct alc_spec *spec = codec->spec;
15019 spec->autocfg.hp_pins[0] = 0x15;
15020 spec->autocfg.speaker_pins[0] = 0x14;
15021 alc_automute_amp(codec);
15024 #ifdef CONFIG_SND_HDA_POWER_SAVE
15025 #define alc861vd_loopbacks alc880_loopbacks
15028 /* pcm configuration: identiacal with ALC880 */
15029 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15030 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15031 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15032 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15035 * configuration and preset
15037 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15038 [ALC660VD_3ST] = "3stack-660",
15039 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15040 [ALC660VD_ASUS_V1S] = "asus-v1s",
15041 [ALC861VD_3ST] = "3stack",
15042 [ALC861VD_3ST_DIG] = "3stack-digout",
15043 [ALC861VD_6ST_DIG] = "6stack-digout",
15044 [ALC861VD_LENOVO] = "lenovo",
15045 [ALC861VD_DALLAS] = "dallas",
15046 [ALC861VD_HP] = "hp",
15047 [ALC861VD_AUTO] = "auto",
15050 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15051 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15052 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15053 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15054 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),
15055 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15056 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15057 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15058 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15059 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15060 SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS),
15061 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15062 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15063 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15064 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15065 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15069 static struct alc_config_preset alc861vd_presets[] = {
15071 .mixers = { alc861vd_3st_mixer },
15072 .init_verbs = { alc861vd_volume_init_verbs,
15073 alc861vd_3stack_init_verbs },
15074 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15075 .dac_nids = alc660vd_dac_nids,
15076 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15077 .channel_mode = alc861vd_3stack_2ch_modes,
15078 .input_mux = &alc861vd_capture_source,
15080 [ALC660VD_3ST_DIG] = {
15081 .mixers = { alc861vd_3st_mixer },
15082 .init_verbs = { alc861vd_volume_init_verbs,
15083 alc861vd_3stack_init_verbs },
15084 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15085 .dac_nids = alc660vd_dac_nids,
15086 .dig_out_nid = ALC861VD_DIGOUT_NID,
15087 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15088 .channel_mode = alc861vd_3stack_2ch_modes,
15089 .input_mux = &alc861vd_capture_source,
15092 .mixers = { alc861vd_3st_mixer },
15093 .init_verbs = { alc861vd_volume_init_verbs,
15094 alc861vd_3stack_init_verbs },
15095 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15096 .dac_nids = alc861vd_dac_nids,
15097 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15098 .channel_mode = alc861vd_3stack_2ch_modes,
15099 .input_mux = &alc861vd_capture_source,
15101 [ALC861VD_3ST_DIG] = {
15102 .mixers = { alc861vd_3st_mixer },
15103 .init_verbs = { alc861vd_volume_init_verbs,
15104 alc861vd_3stack_init_verbs },
15105 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15106 .dac_nids = alc861vd_dac_nids,
15107 .dig_out_nid = ALC861VD_DIGOUT_NID,
15108 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15109 .channel_mode = alc861vd_3stack_2ch_modes,
15110 .input_mux = &alc861vd_capture_source,
15112 [ALC861VD_6ST_DIG] = {
15113 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15114 .init_verbs = { alc861vd_volume_init_verbs,
15115 alc861vd_6stack_init_verbs },
15116 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15117 .dac_nids = alc861vd_dac_nids,
15118 .dig_out_nid = ALC861VD_DIGOUT_NID,
15119 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15120 .channel_mode = alc861vd_6stack_modes,
15121 .input_mux = &alc861vd_capture_source,
15123 [ALC861VD_LENOVO] = {
15124 .mixers = { alc861vd_lenovo_mixer },
15125 .init_verbs = { alc861vd_volume_init_verbs,
15126 alc861vd_3stack_init_verbs,
15127 alc861vd_eapd_verbs,
15128 alc861vd_lenovo_unsol_verbs },
15129 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15130 .dac_nids = alc660vd_dac_nids,
15131 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15132 .channel_mode = alc861vd_3stack_2ch_modes,
15133 .input_mux = &alc861vd_capture_source,
15134 .unsol_event = alc861vd_lenovo_unsol_event,
15135 .init_hook = alc861vd_lenovo_init_hook,
15137 [ALC861VD_DALLAS] = {
15138 .mixers = { alc861vd_dallas_mixer },
15139 .init_verbs = { alc861vd_dallas_verbs },
15140 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15141 .dac_nids = alc861vd_dac_nids,
15142 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15143 .channel_mode = alc861vd_3stack_2ch_modes,
15144 .input_mux = &alc861vd_dallas_capture_source,
15145 .unsol_event = alc_automute_amp_unsol_event,
15146 .init_hook = alc861vd_dallas_init_hook,
15149 .mixers = { alc861vd_hp_mixer },
15150 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15151 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15152 .dac_nids = alc861vd_dac_nids,
15153 .dig_out_nid = ALC861VD_DIGOUT_NID,
15154 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15155 .channel_mode = alc861vd_3stack_2ch_modes,
15156 .input_mux = &alc861vd_hp_capture_source,
15157 .unsol_event = alc_automute_amp_unsol_event,
15158 .init_hook = alc861vd_dallas_init_hook,
15160 [ALC660VD_ASUS_V1S] = {
15161 .mixers = { alc861vd_lenovo_mixer },
15162 .init_verbs = { alc861vd_volume_init_verbs,
15163 alc861vd_3stack_init_verbs,
15164 alc861vd_eapd_verbs,
15165 alc861vd_lenovo_unsol_verbs },
15166 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15167 .dac_nids = alc660vd_dac_nids,
15168 .dig_out_nid = ALC861VD_DIGOUT_NID,
15169 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15170 .channel_mode = alc861vd_3stack_2ch_modes,
15171 .input_mux = &alc861vd_capture_source,
15172 .unsol_event = alc861vd_lenovo_unsol_event,
15173 .init_hook = alc861vd_lenovo_init_hook,
15178 * BIOS auto configuration
15180 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15181 hda_nid_t nid, int pin_type, int dac_idx)
15183 alc_set_pin_output(codec, nid, pin_type);
15186 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15188 struct alc_spec *spec = codec->spec;
15191 for (i = 0; i <= HDA_SIDE; i++) {
15192 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15193 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15195 alc861vd_auto_set_output_and_unmute(codec, nid,
15201 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15203 struct alc_spec *spec = codec->spec;
15206 pin = spec->autocfg.hp_pins[0];
15207 if (pin) /* connect to front and use dac 0 */
15208 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15209 pin = spec->autocfg.speaker_pins[0];
15211 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15214 #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid)
15215 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15217 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15219 struct alc_spec *spec = codec->spec;
15222 for (i = 0; i < AUTO_PIN_LAST; i++) {
15223 hda_nid_t nid = spec->autocfg.input_pins[i];
15224 if (alc861vd_is_input_pin(nid)) {
15225 alc_set_input_pin(codec, nid, i);
15226 if (nid != ALC861VD_PIN_CD_NID &&
15227 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15228 snd_hda_codec_write(codec, nid, 0,
15229 AC_VERB_SET_AMP_GAIN_MUTE,
15235 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15237 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15238 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15240 /* add playback controls from the parsed DAC table */
15241 /* Based on ALC880 version. But ALC861VD has separate,
15242 * different NIDs for mute/unmute switch and volume control */
15243 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15244 const struct auto_pin_cfg *cfg)
15247 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15248 hda_nid_t nid_v, nid_s;
15251 for (i = 0; i < cfg->line_outs; i++) {
15252 if (!spec->multiout.dac_nids[i])
15254 nid_v = alc861vd_idx_to_mixer_vol(
15256 spec->multiout.dac_nids[i]));
15257 nid_s = alc861vd_idx_to_mixer_switch(
15259 spec->multiout.dac_nids[i]));
15263 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15264 "Center Playback Volume",
15265 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15269 err = add_control(spec, ALC_CTL_WIDGET_VOL,
15270 "LFE Playback Volume",
15271 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15275 err = add_control(spec, ALC_CTL_BIND_MUTE,
15276 "Center Playback Switch",
15277 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15281 err = add_control(spec, ALC_CTL_BIND_MUTE,
15282 "LFE Playback Switch",
15283 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15288 sprintf(name, "%s Playback Volume", chname[i]);
15289 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15290 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15294 sprintf(name, "%s Playback Switch", chname[i]);
15295 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15296 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15305 /* add playback controls for speaker and HP outputs */
15306 /* Based on ALC880 version. But ALC861VD has separate,
15307 * different NIDs for mute/unmute switch and volume control */
15308 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15309 hda_nid_t pin, const char *pfx)
15311 hda_nid_t nid_v, nid_s;
15318 if (alc880_is_fixed_pin(pin)) {
15319 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15320 /* specify the DAC as the extra output */
15321 if (!spec->multiout.hp_nid)
15322 spec->multiout.hp_nid = nid_v;
15324 spec->multiout.extra_out_nid[0] = nid_v;
15325 /* control HP volume/switch on the output mixer amp */
15326 nid_v = alc861vd_idx_to_mixer_vol(
15327 alc880_fixed_pin_idx(pin));
15328 nid_s = alc861vd_idx_to_mixer_switch(
15329 alc880_fixed_pin_idx(pin));
15331 sprintf(name, "%s Playback Volume", pfx);
15332 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
15333 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15336 sprintf(name, "%s Playback Switch", pfx);
15337 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
15338 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15341 } else if (alc880_is_multi_pin(pin)) {
15342 /* set manual connection */
15343 /* we have only a switch on HP-out PIN */
15344 sprintf(name, "%s Playback Switch", pfx);
15345 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
15346 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15353 /* parse the BIOS configuration and set up the alc_spec
15354 * return 1 if successful, 0 if the proper config is not found,
15355 * or a negative error code
15356 * Based on ALC880 version - had to change it to override
15357 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15358 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15360 struct alc_spec *spec = codec->spec;
15362 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15364 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15368 if (!spec->autocfg.line_outs)
15369 return 0; /* can't find valid BIOS pin config */
15371 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15374 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15377 err = alc861vd_auto_create_extra_out(spec,
15378 spec->autocfg.speaker_pins[0],
15382 err = alc861vd_auto_create_extra_out(spec,
15383 spec->autocfg.hp_pins[0],
15387 err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg);
15391 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15393 if (spec->autocfg.dig_outs)
15394 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15396 if (spec->kctls.list)
15397 add_mixer(spec, spec->kctls.list);
15399 add_verb(spec, alc861vd_volume_init_verbs);
15401 spec->num_mux_defs = 1;
15402 spec->input_mux = &spec->private_imux[0];
15404 err = alc_auto_add_mic_boost(codec);
15408 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15413 /* additional initialization for auto-configuration model */
15414 static void alc861vd_auto_init(struct hda_codec *codec)
15416 struct alc_spec *spec = codec->spec;
15417 alc861vd_auto_init_multi_out(codec);
15418 alc861vd_auto_init_hp_out(codec);
15419 alc861vd_auto_init_analog_input(codec);
15420 alc861vd_auto_init_input_src(codec);
15421 if (spec->unsol_event)
15422 alc_inithook(codec);
15425 static int patch_alc861vd(struct hda_codec *codec)
15427 struct alc_spec *spec;
15428 int err, board_config;
15430 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15434 codec->spec = spec;
15436 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15440 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15441 printk(KERN_INFO "hda_codec: Unknown model for %s, "
15442 "trying auto-probe from BIOS...\n", codec->chip_name);
15443 board_config = ALC861VD_AUTO;
15446 if (board_config == ALC861VD_AUTO) {
15447 /* automatic parse from the BIOS config */
15448 err = alc861vd_parse_auto_config(codec);
15454 "hda_codec: Cannot set up configuration "
15455 "from BIOS. Using base mode...\n");
15456 board_config = ALC861VD_3ST;
15460 err = snd_hda_attach_beep_device(codec, 0x23);
15466 if (board_config != ALC861VD_AUTO)
15467 setup_preset(spec, &alc861vd_presets[board_config]);
15469 if (codec->vendor_id == 0x10ec0660) {
15470 /* always turn on EAPD */
15471 add_verb(spec, alc660vd_eapd_verbs);
15474 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15475 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15477 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15478 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15480 spec->adc_nids = alc861vd_adc_nids;
15481 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15482 spec->capsrc_nids = alc861vd_capsrc_nids;
15483 spec->capture_style = CAPT_MIX;
15485 set_capture_mixer(spec);
15486 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15488 spec->vmaster_nid = 0x02;
15490 codec->patch_ops = alc_patch_ops;
15492 if (board_config == ALC861VD_AUTO)
15493 spec->init_hook = alc861vd_auto_init;
15494 #ifdef CONFIG_SND_HDA_POWER_SAVE
15495 if (!spec->loopback.amplist)
15496 spec->loopback.amplist = alc861vd_loopbacks;
15498 codec->proc_widget_hook = print_realtek_coef;
15506 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15507 * configuration. Each pin widget can choose any input DACs and a mixer.
15508 * Each ADC is connected from a mixer of all inputs. This makes possible
15509 * 6-channel independent captures.
15511 * In addition, an independent DAC for the multi-playback (not used in this
15514 #define ALC662_DIGOUT_NID 0x06
15515 #define ALC662_DIGIN_NID 0x0a
15517 static hda_nid_t alc662_dac_nids[4] = {
15518 /* front, rear, clfe, rear_surr */
15522 static hda_nid_t alc272_dac_nids[2] = {
15526 static hda_nid_t alc662_adc_nids[1] = {
15531 static hda_nid_t alc272_adc_nids[1] = {
15536 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 };
15537 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15541 /* FIXME: should be a matrix-type input source selection */
15542 static struct hda_input_mux alc662_capture_source = {
15546 { "Front Mic", 0x1 },
15552 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15560 static struct hda_input_mux alc662_eeepc_capture_source = {
15568 static struct hda_input_mux alc663_capture_source = {
15572 { "Front Mic", 0x1 },
15577 static struct hda_input_mux alc663_m51va_capture_source = {
15580 { "Ext-Mic", 0x0 },
15585 #if 1 /* set to 0 for testing other input sources below */
15586 static struct hda_input_mux alc272_nc10_capture_source = {
15589 { "Autoselect Mic", 0x0 },
15590 { "Internal Mic", 0x1 },
15594 static struct hda_input_mux alc272_nc10_capture_source = {
15597 { "Autoselect Mic", 0x0 },
15598 { "Internal Mic", 0x1 },
15599 { "In-0x02", 0x2 },
15600 { "In-0x03", 0x3 },
15601 { "In-0x04", 0x4 },
15602 { "In-0x05", 0x5 },
15603 { "In-0x06", 0x6 },
15604 { "In-0x07", 0x7 },
15605 { "In-0x08", 0x8 },
15606 { "In-0x09", 0x9 },
15607 { "In-0x0a", 0x0a },
15608 { "In-0x0b", 0x0b },
15609 { "In-0x0c", 0x0c },
15610 { "In-0x0d", 0x0d },
15611 { "In-0x0e", 0x0e },
15612 { "In-0x0f", 0x0f },
15620 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15627 static struct hda_verb alc662_3ST_ch2_init[] = {
15628 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15629 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15630 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15631 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15638 static struct hda_verb alc662_3ST_ch6_init[] = {
15639 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15640 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15641 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15642 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15643 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15644 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15648 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15649 { 2, alc662_3ST_ch2_init },
15650 { 6, alc662_3ST_ch6_init },
15656 static struct hda_verb alc662_sixstack_ch6_init[] = {
15657 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15658 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15659 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15666 static struct hda_verb alc662_sixstack_ch8_init[] = {
15667 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15668 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15669 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15673 static struct hda_channel_mode alc662_5stack_modes[2] = {
15674 { 2, alc662_sixstack_ch6_init },
15675 { 6, alc662_sixstack_ch8_init },
15678 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15679 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15682 static struct snd_kcontrol_new alc662_base_mixer[] = {
15683 /* output mixer control */
15684 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
15685 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15686 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
15687 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15688 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15689 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15690 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15691 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15692 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15694 /*Input mixer control */
15695 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
15696 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
15697 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
15698 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
15699 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
15700 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
15701 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
15702 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
15706 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
15707 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15708 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15709 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15710 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15711 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15712 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15713 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15714 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15715 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15716 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15717 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15721 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
15722 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15723 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
15724 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15725 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
15726 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15727 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15728 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
15729 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
15730 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15731 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15732 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15733 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15734 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15735 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15736 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15737 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15738 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15742 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
15743 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15744 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
15745 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15746 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
15747 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15748 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15749 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15750 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15751 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15755 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
15756 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15757 ALC262_HIPPO_MASTER_SWITCH,
15759 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
15760 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15761 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15763 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
15764 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15765 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15769 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
15770 ALC262_HIPPO_MASTER_SWITCH,
15771 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15772 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15773 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
15774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
15775 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
15776 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15777 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15778 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15779 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15783 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
15784 .ops = &snd_hda_bind_vol,
15786 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15787 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
15792 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
15793 .ops = &snd_hda_bind_sw,
15795 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15796 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15801 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
15802 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15803 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
15804 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15805 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15809 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
15810 .ops = &snd_hda_bind_sw,
15812 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15813 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15814 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
15819 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
15820 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15821 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
15822 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15823 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15824 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15825 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15830 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
15831 .ops = &snd_hda_bind_sw,
15833 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15834 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
15835 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
15840 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
15841 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15842 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
15843 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15844 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15845 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15846 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15850 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
15851 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15852 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15853 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15854 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15855 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15856 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15857 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15861 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
15862 .ops = &snd_hda_bind_vol,
15864 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
15865 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
15870 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
15871 .ops = &snd_hda_bind_sw,
15873 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
15874 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
15879 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
15880 HDA_BIND_VOL("Master Playback Volume",
15881 &alc663_asus_two_bind_master_vol),
15882 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15883 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15884 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15885 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15886 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15890 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
15891 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
15892 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
15893 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15894 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15895 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15896 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15900 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
15901 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15902 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15903 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15904 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15905 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15907 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15908 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15909 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15910 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15914 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
15915 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15916 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15917 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
15919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15921 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15922 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15923 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15924 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15928 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
15930 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15931 .name = "Channel Mode",
15932 .info = alc_ch_mode_info,
15933 .get = alc_ch_mode_get,
15934 .put = alc_ch_mode_put,
15939 static struct hda_verb alc662_init_verbs[] = {
15940 /* ADC: mute amp left and right */
15941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15942 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15943 /* Front mixer: unmute input/output amp left and right (volume = 0) */
15945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15946 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15947 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15948 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15952 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15954 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15956 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15958 /* Front Pin: output 0 (0x0c) */
15959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15960 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15962 /* Rear Pin: output 1 (0x0d) */
15963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15966 /* CLFE Pin: output 2 (0x0e) */
15967 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15968 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15970 /* Mic (rear) pin: input vref at 80% */
15971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15973 /* Front Mic pin: input vref at 80% */
15974 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15975 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15976 /* Line In pin: input */
15977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15979 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15980 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15981 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15982 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15983 /* CD pin widget for input */
15984 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15986 /* FIXME: use matrix-type input source selection */
15987 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
15989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15990 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15992 /* always trun on EAPD */
15993 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15994 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15999 static struct hda_verb alc662_sue_init_verbs[] = {
16000 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16001 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16005 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16006 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16007 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16011 /* Set Unsolicited Event*/
16012 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16013 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16014 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16019 * generic initialization of ADC, input mixers and output mixers
16021 static struct hda_verb alc662_auto_init_verbs[] = {
16023 * Unmute ADC and set the default input to mic-in
16025 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16026 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16028 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16030 * Note: PASD motherboards uses the Line In 2 as the input for front
16031 * panel mic (mic 2)
16033 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16034 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16035 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16037 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16038 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16041 * Set up output mixers (0x0c - 0x0f)
16043 /* set vol=0 to output mixers */
16044 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16045 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16046 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16048 /* set up input amps for analog loopback */
16049 /* Amp Indices: DAC = 0, mixer = 1 */
16050 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16051 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16052 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16053 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16054 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16055 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16058 /* FIXME: use matrix-type input source selection */
16059 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16061 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16062 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16066 /* additional verbs for ALC663 */
16067 static struct hda_verb alc663_auto_init_verbs[] = {
16068 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16069 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16073 static struct hda_verb alc663_m51va_init_verbs[] = {
16074 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16075 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16076 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16077 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16078 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16079 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16080 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16081 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16082 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16086 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16087 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16088 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16089 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16090 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16091 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16092 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16093 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16097 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16098 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16099 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16100 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16101 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16104 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16105 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16109 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16110 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16111 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16112 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16113 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16114 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16115 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16116 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16120 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16121 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16122 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16123 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16124 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16125 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16127 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16128 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16129 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16130 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16131 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16132 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16136 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16137 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16138 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16139 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16140 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16144 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16145 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16146 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16147 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16148 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16152 static struct hda_verb alc663_g71v_init_verbs[] = {
16153 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16154 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16155 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16157 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16158 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16159 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16161 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16162 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16163 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16167 static struct hda_verb alc663_g50v_init_verbs[] = {
16168 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16169 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16170 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16172 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16173 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16177 static struct hda_verb alc662_ecs_init_verbs[] = {
16178 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16180 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16181 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16185 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16186 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16187 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16188 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16189 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16190 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16191 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16192 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16193 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16194 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16195 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16196 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16200 static struct hda_verb alc272_dell_init_verbs[] = {
16201 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16202 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16203 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16204 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16205 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16206 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16207 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16208 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16209 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16210 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16211 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16215 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16216 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16217 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16221 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16222 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16223 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16227 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16229 unsigned int present;
16230 unsigned char bits;
16232 present = snd_hda_codec_read(codec, 0x14, 0,
16233 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16234 bits = present ? HDA_AMP_MUTE : 0;
16235 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16236 HDA_AMP_MUTE, bits);
16239 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16241 unsigned int present;
16242 unsigned char bits;
16244 present = snd_hda_codec_read(codec, 0x1b, 0,
16245 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16246 bits = present ? HDA_AMP_MUTE : 0;
16247 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16248 HDA_AMP_MUTE, bits);
16249 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16250 HDA_AMP_MUTE, bits);
16253 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16256 if ((res >> 26) == ALC880_HP_EVENT)
16257 alc662_lenovo_101e_all_automute(codec);
16258 if ((res >> 26) == ALC880_FRONT_EVENT)
16259 alc662_lenovo_101e_ispeaker_automute(codec);
16262 static void alc662_eeepc_mic_automute(struct hda_codec *codec)
16264 unsigned int present;
16266 present = snd_hda_codec_read(codec, 0x18, 0,
16267 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
16268 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16269 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16270 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16271 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16272 snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16273 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16274 snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16275 0x7000 | (0x01 << 8) | (present ? 0x80 : 0));
16278 /* unsolicited event for HP jack sensing */
16279 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16282 if ((res >> 26) == ALC880_MIC_EVENT)
16283 alc662_eeepc_mic_automute(codec);
16285 alc262_hippo_unsol_event(codec, res);
16288 static void alc662_eeepc_inithook(struct hda_codec *codec)
16290 alc262_hippo1_init_hook(codec);
16291 alc662_eeepc_mic_automute(codec);
16294 static void alc662_eeepc_ep20_inithook(struct hda_codec *codec)
16296 struct alc_spec *spec = codec->spec;
16298 spec->autocfg.hp_pins[0] = 0x14;
16299 spec->autocfg.speaker_pins[0] = 0x1b;
16300 alc262_hippo_master_update(codec);
16303 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16305 unsigned int present;
16306 unsigned char bits;
16308 present = snd_hda_codec_read(codec, 0x21, 0,
16309 AC_VERB_GET_PIN_SENSE, 0)
16310 & AC_PINSENSE_PRESENCE;
16311 bits = present ? HDA_AMP_MUTE : 0;
16312 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16313 AMP_IN_MUTE(0), bits);
16314 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16315 AMP_IN_MUTE(0), bits);
16318 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16320 unsigned int present;
16321 unsigned char bits;
16323 present = snd_hda_codec_read(codec, 0x21, 0,
16324 AC_VERB_GET_PIN_SENSE, 0)
16325 & AC_PINSENSE_PRESENCE;
16326 bits = present ? HDA_AMP_MUTE : 0;
16327 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16328 AMP_IN_MUTE(0), bits);
16329 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16330 AMP_IN_MUTE(0), bits);
16331 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16332 AMP_IN_MUTE(0), bits);
16333 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16334 AMP_IN_MUTE(0), bits);
16337 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16339 unsigned int present;
16340 unsigned char bits;
16342 present = snd_hda_codec_read(codec, 0x15, 0,
16343 AC_VERB_GET_PIN_SENSE, 0)
16344 & AC_PINSENSE_PRESENCE;
16345 bits = present ? HDA_AMP_MUTE : 0;
16346 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16347 AMP_IN_MUTE(0), bits);
16348 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16349 AMP_IN_MUTE(0), bits);
16350 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16351 AMP_IN_MUTE(0), bits);
16352 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16353 AMP_IN_MUTE(0), bits);
16356 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16358 unsigned int present;
16359 unsigned char bits;
16361 present = snd_hda_codec_read(codec, 0x1b, 0,
16362 AC_VERB_GET_PIN_SENSE, 0)
16363 & AC_PINSENSE_PRESENCE;
16364 bits = present ? 0 : PIN_OUT;
16365 snd_hda_codec_write(codec, 0x14, 0,
16366 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16369 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16371 unsigned int present1, present2;
16373 present1 = snd_hda_codec_read(codec, 0x21, 0,
16374 AC_VERB_GET_PIN_SENSE, 0)
16375 & AC_PINSENSE_PRESENCE;
16376 present2 = snd_hda_codec_read(codec, 0x15, 0,
16377 AC_VERB_GET_PIN_SENSE, 0)
16378 & AC_PINSENSE_PRESENCE;
16380 if (present1 || present2) {
16381 snd_hda_codec_write_cache(codec, 0x14, 0,
16382 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16384 snd_hda_codec_write_cache(codec, 0x14, 0,
16385 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16389 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16391 unsigned int present1, present2;
16393 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16394 AC_VERB_GET_PIN_SENSE, 0)
16395 & AC_PINSENSE_PRESENCE;
16396 present2 = snd_hda_codec_read(codec, 0x15, 0,
16397 AC_VERB_GET_PIN_SENSE, 0)
16398 & AC_PINSENSE_PRESENCE;
16400 if (present1 || present2) {
16401 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16402 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16403 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16404 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16407 AMP_IN_MUTE(0), 0);
16408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16409 AMP_IN_MUTE(0), 0);
16413 static void alc663_m51va_mic_automute(struct hda_codec *codec)
16415 unsigned int present;
16417 present = snd_hda_codec_read(codec, 0x18, 0,
16418 AC_VERB_GET_PIN_SENSE, 0)
16419 & AC_PINSENSE_PRESENCE;
16420 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16421 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16422 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16423 0x7000 | (0x00 << 8) | (present ? 0 : 0x80));
16424 snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16425 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16426 snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE,
16427 0x7000 | (0x09 << 8) | (present ? 0x80 : 0));
16430 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16433 switch (res >> 26) {
16434 case ALC880_HP_EVENT:
16435 alc663_m51va_speaker_automute(codec);
16437 case ALC880_MIC_EVENT:
16438 alc663_m51va_mic_automute(codec);
16443 static void alc663_m51va_inithook(struct hda_codec *codec)
16445 alc663_m51va_speaker_automute(codec);
16446 alc663_m51va_mic_automute(codec);
16449 /* ***************** Mode1 ******************************/
16450 static void alc663_mode1_unsol_event(struct hda_codec *codec,
16453 switch (res >> 26) {
16454 case ALC880_HP_EVENT:
16455 alc663_m51va_speaker_automute(codec);
16457 case ALC880_MIC_EVENT:
16458 alc662_eeepc_mic_automute(codec);
16463 static void alc663_mode1_inithook(struct hda_codec *codec)
16465 alc663_m51va_speaker_automute(codec);
16466 alc662_eeepc_mic_automute(codec);
16468 /* ***************** Mode2 ******************************/
16469 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16472 switch (res >> 26) {
16473 case ALC880_HP_EVENT:
16474 alc662_f5z_speaker_automute(codec);
16476 case ALC880_MIC_EVENT:
16477 alc662_eeepc_mic_automute(codec);
16482 static void alc662_mode2_inithook(struct hda_codec *codec)
16484 alc662_f5z_speaker_automute(codec);
16485 alc662_eeepc_mic_automute(codec);
16487 /* ***************** Mode3 ******************************/
16488 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16491 switch (res >> 26) {
16492 case ALC880_HP_EVENT:
16493 alc663_two_hp_m1_speaker_automute(codec);
16495 case ALC880_MIC_EVENT:
16496 alc662_eeepc_mic_automute(codec);
16501 static void alc663_mode3_inithook(struct hda_codec *codec)
16503 alc663_two_hp_m1_speaker_automute(codec);
16504 alc662_eeepc_mic_automute(codec);
16506 /* ***************** Mode4 ******************************/
16507 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16510 switch (res >> 26) {
16511 case ALC880_HP_EVENT:
16512 alc663_21jd_two_speaker_automute(codec);
16514 case ALC880_MIC_EVENT:
16515 alc662_eeepc_mic_automute(codec);
16520 static void alc663_mode4_inithook(struct hda_codec *codec)
16522 alc663_21jd_two_speaker_automute(codec);
16523 alc662_eeepc_mic_automute(codec);
16525 /* ***************** Mode5 ******************************/
16526 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16529 switch (res >> 26) {
16530 case ALC880_HP_EVENT:
16531 alc663_15jd_two_speaker_automute(codec);
16533 case ALC880_MIC_EVENT:
16534 alc662_eeepc_mic_automute(codec);
16539 static void alc663_mode5_inithook(struct hda_codec *codec)
16541 alc663_15jd_two_speaker_automute(codec);
16542 alc662_eeepc_mic_automute(codec);
16544 /* ***************** Mode6 ******************************/
16545 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16548 switch (res >> 26) {
16549 case ALC880_HP_EVENT:
16550 alc663_two_hp_m2_speaker_automute(codec);
16552 case ALC880_MIC_EVENT:
16553 alc662_eeepc_mic_automute(codec);
16558 static void alc663_mode6_inithook(struct hda_codec *codec)
16560 alc663_two_hp_m2_speaker_automute(codec);
16561 alc662_eeepc_mic_automute(codec);
16564 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16566 unsigned int present;
16567 unsigned char bits;
16569 present = snd_hda_codec_read(codec, 0x21, 0,
16570 AC_VERB_GET_PIN_SENSE, 0)
16571 & AC_PINSENSE_PRESENCE;
16572 bits = present ? HDA_AMP_MUTE : 0;
16573 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16574 HDA_AMP_MUTE, bits);
16575 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16576 HDA_AMP_MUTE, bits);
16579 static void alc663_g71v_front_automute(struct hda_codec *codec)
16581 unsigned int present;
16582 unsigned char bits;
16584 present = snd_hda_codec_read(codec, 0x15, 0,
16585 AC_VERB_GET_PIN_SENSE, 0)
16586 & AC_PINSENSE_PRESENCE;
16587 bits = present ? HDA_AMP_MUTE : 0;
16588 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16589 HDA_AMP_MUTE, bits);
16592 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16595 switch (res >> 26) {
16596 case ALC880_HP_EVENT:
16597 alc663_g71v_hp_automute(codec);
16599 case ALC880_FRONT_EVENT:
16600 alc663_g71v_front_automute(codec);
16602 case ALC880_MIC_EVENT:
16603 alc662_eeepc_mic_automute(codec);
16608 static void alc663_g71v_inithook(struct hda_codec *codec)
16610 alc663_g71v_front_automute(codec);
16611 alc663_g71v_hp_automute(codec);
16612 alc662_eeepc_mic_automute(codec);
16615 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16618 switch (res >> 26) {
16619 case ALC880_HP_EVENT:
16620 alc663_m51va_speaker_automute(codec);
16622 case ALC880_MIC_EVENT:
16623 alc662_eeepc_mic_automute(codec);
16628 static void alc663_g50v_inithook(struct hda_codec *codec)
16630 alc663_m51va_speaker_automute(codec);
16631 alc662_eeepc_mic_automute(codec);
16634 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16635 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16636 ALC262_HIPPO_MASTER_SWITCH,
16638 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16639 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16640 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16642 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16643 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16644 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16648 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16649 /* Master Playback automatically created from Speaker and Headphone */
16650 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16651 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16652 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16653 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16655 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16656 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16657 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16659 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16660 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16661 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16665 #ifdef CONFIG_SND_HDA_POWER_SAVE
16666 #define alc662_loopbacks alc880_loopbacks
16670 /* pcm configuration: identiacal with ALC880 */
16671 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16672 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16673 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16674 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16677 * configuration and preset
16679 static const char *alc662_models[ALC662_MODEL_LAST] = {
16680 [ALC662_3ST_2ch_DIG] = "3stack-dig",
16681 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
16682 [ALC662_3ST_6ch] = "3stack-6ch",
16683 [ALC662_5ST_DIG] = "6stack-dig",
16684 [ALC662_LENOVO_101E] = "lenovo-101e",
16685 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
16686 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
16687 [ALC662_ECS] = "ecs",
16688 [ALC663_ASUS_M51VA] = "m51va",
16689 [ALC663_ASUS_G71V] = "g71v",
16690 [ALC663_ASUS_H13] = "h13",
16691 [ALC663_ASUS_G50V] = "g50v",
16692 [ALC663_ASUS_MODE1] = "asus-mode1",
16693 [ALC662_ASUS_MODE2] = "asus-mode2",
16694 [ALC663_ASUS_MODE3] = "asus-mode3",
16695 [ALC663_ASUS_MODE4] = "asus-mode4",
16696 [ALC663_ASUS_MODE5] = "asus-mode5",
16697 [ALC663_ASUS_MODE6] = "asus-mode6",
16698 [ALC272_DELL] = "dell",
16699 [ALC272_DELL_ZM1] = "dell-zm1",
16700 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
16701 [ALC662_AUTO] = "auto",
16704 static struct snd_pci_quirk alc662_cfg_tbl[] = {
16705 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
16706 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
16707 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
16708 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
16709 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
16710 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
16711 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
16712 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
16713 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
16714 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
16715 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
16716 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
16717 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
16718 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
16719 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
16720 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
16721 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
16722 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
16723 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
16724 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
16725 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
16726 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
16727 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
16728 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
16729 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
16730 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
16731 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
16732 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
16733 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
16734 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
16735 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
16736 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
16737 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
16738 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
16739 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
16740 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
16741 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
16742 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
16743 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
16744 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
16745 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
16746 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
16747 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
16748 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
16749 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
16750 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
16751 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
16752 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
16753 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
16754 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
16755 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
16756 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
16757 ALC662_3ST_6ch_DIG),
16758 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
16759 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
16760 ALC662_3ST_6ch_DIG),
16761 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
16762 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
16763 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
16764 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
16765 ALC662_3ST_6ch_DIG),
16766 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
16771 static struct alc_config_preset alc662_presets[] = {
16772 [ALC662_3ST_2ch_DIG] = {
16773 .mixers = { alc662_3ST_2ch_mixer },
16774 .init_verbs = { alc662_init_verbs },
16775 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16776 .dac_nids = alc662_dac_nids,
16777 .dig_out_nid = ALC662_DIGOUT_NID,
16778 .dig_in_nid = ALC662_DIGIN_NID,
16779 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16780 .channel_mode = alc662_3ST_2ch_modes,
16781 .input_mux = &alc662_capture_source,
16783 [ALC662_3ST_6ch_DIG] = {
16784 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16785 .init_verbs = { alc662_init_verbs },
16786 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16787 .dac_nids = alc662_dac_nids,
16788 .dig_out_nid = ALC662_DIGOUT_NID,
16789 .dig_in_nid = ALC662_DIGIN_NID,
16790 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16791 .channel_mode = alc662_3ST_6ch_modes,
16793 .input_mux = &alc662_capture_source,
16795 [ALC662_3ST_6ch] = {
16796 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
16797 .init_verbs = { alc662_init_verbs },
16798 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16799 .dac_nids = alc662_dac_nids,
16800 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16801 .channel_mode = alc662_3ST_6ch_modes,
16803 .input_mux = &alc662_capture_source,
16805 [ALC662_5ST_DIG] = {
16806 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
16807 .init_verbs = { alc662_init_verbs },
16808 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16809 .dac_nids = alc662_dac_nids,
16810 .dig_out_nid = ALC662_DIGOUT_NID,
16811 .dig_in_nid = ALC662_DIGIN_NID,
16812 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
16813 .channel_mode = alc662_5stack_modes,
16814 .input_mux = &alc662_capture_source,
16816 [ALC662_LENOVO_101E] = {
16817 .mixers = { alc662_lenovo_101e_mixer },
16818 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
16819 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16820 .dac_nids = alc662_dac_nids,
16821 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16822 .channel_mode = alc662_3ST_2ch_modes,
16823 .input_mux = &alc662_lenovo_101e_capture_source,
16824 .unsol_event = alc662_lenovo_101e_unsol_event,
16825 .init_hook = alc662_lenovo_101e_all_automute,
16827 [ALC662_ASUS_EEEPC_P701] = {
16828 .mixers = { alc662_eeepc_p701_mixer },
16829 .init_verbs = { alc662_init_verbs,
16830 alc662_eeepc_sue_init_verbs },
16831 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16832 .dac_nids = alc662_dac_nids,
16833 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16834 .channel_mode = alc662_3ST_2ch_modes,
16835 .input_mux = &alc662_eeepc_capture_source,
16836 .unsol_event = alc662_eeepc_unsol_event,
16837 .init_hook = alc662_eeepc_inithook,
16839 [ALC662_ASUS_EEEPC_EP20] = {
16840 .mixers = { alc662_eeepc_ep20_mixer,
16841 alc662_chmode_mixer },
16842 .init_verbs = { alc662_init_verbs,
16843 alc662_eeepc_ep20_sue_init_verbs },
16844 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16845 .dac_nids = alc662_dac_nids,
16846 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16847 .channel_mode = alc662_3ST_6ch_modes,
16848 .input_mux = &alc662_lenovo_101e_capture_source,
16849 .unsol_event = alc662_eeepc_unsol_event,
16850 .init_hook = alc662_eeepc_ep20_inithook,
16853 .mixers = { alc662_ecs_mixer },
16854 .init_verbs = { alc662_init_verbs,
16855 alc662_ecs_init_verbs },
16856 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16857 .dac_nids = alc662_dac_nids,
16858 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16859 .channel_mode = alc662_3ST_2ch_modes,
16860 .input_mux = &alc662_eeepc_capture_source,
16861 .unsol_event = alc662_eeepc_unsol_event,
16862 .init_hook = alc662_eeepc_inithook,
16864 [ALC663_ASUS_M51VA] = {
16865 .mixers = { alc663_m51va_mixer },
16866 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16868 .dac_nids = alc662_dac_nids,
16869 .dig_out_nid = ALC662_DIGOUT_NID,
16870 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16871 .channel_mode = alc662_3ST_2ch_modes,
16872 .input_mux = &alc663_m51va_capture_source,
16873 .unsol_event = alc663_m51va_unsol_event,
16874 .init_hook = alc663_m51va_inithook,
16876 [ALC663_ASUS_G71V] = {
16877 .mixers = { alc663_g71v_mixer },
16878 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
16879 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16880 .dac_nids = alc662_dac_nids,
16881 .dig_out_nid = ALC662_DIGOUT_NID,
16882 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16883 .channel_mode = alc662_3ST_2ch_modes,
16884 .input_mux = &alc662_eeepc_capture_source,
16885 .unsol_event = alc663_g71v_unsol_event,
16886 .init_hook = alc663_g71v_inithook,
16888 [ALC663_ASUS_H13] = {
16889 .mixers = { alc663_m51va_mixer },
16890 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
16891 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16892 .dac_nids = alc662_dac_nids,
16893 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16894 .channel_mode = alc662_3ST_2ch_modes,
16895 .input_mux = &alc663_m51va_capture_source,
16896 .unsol_event = alc663_m51va_unsol_event,
16897 .init_hook = alc663_m51va_inithook,
16899 [ALC663_ASUS_G50V] = {
16900 .mixers = { alc663_g50v_mixer },
16901 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
16902 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16903 .dac_nids = alc662_dac_nids,
16904 .dig_out_nid = ALC662_DIGOUT_NID,
16905 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
16906 .channel_mode = alc662_3ST_6ch_modes,
16907 .input_mux = &alc663_capture_source,
16908 .unsol_event = alc663_g50v_unsol_event,
16909 .init_hook = alc663_g50v_inithook,
16911 [ALC663_ASUS_MODE1] = {
16912 .mixers = { alc663_m51va_mixer },
16913 .cap_mixer = alc662_auto_capture_mixer,
16914 .init_verbs = { alc662_init_verbs,
16915 alc663_21jd_amic_init_verbs },
16916 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16918 .dac_nids = alc662_dac_nids,
16919 .dig_out_nid = ALC662_DIGOUT_NID,
16920 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16921 .channel_mode = alc662_3ST_2ch_modes,
16922 .input_mux = &alc662_eeepc_capture_source,
16923 .unsol_event = alc663_mode1_unsol_event,
16924 .init_hook = alc663_mode1_inithook,
16926 [ALC662_ASUS_MODE2] = {
16927 .mixers = { alc662_1bjd_mixer },
16928 .cap_mixer = alc662_auto_capture_mixer,
16929 .init_verbs = { alc662_init_verbs,
16930 alc662_1bjd_amic_init_verbs },
16931 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16932 .dac_nids = alc662_dac_nids,
16933 .dig_out_nid = ALC662_DIGOUT_NID,
16934 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16935 .channel_mode = alc662_3ST_2ch_modes,
16936 .input_mux = &alc662_eeepc_capture_source,
16937 .unsol_event = alc662_mode2_unsol_event,
16938 .init_hook = alc662_mode2_inithook,
16940 [ALC663_ASUS_MODE3] = {
16941 .mixers = { alc663_two_hp_m1_mixer },
16942 .cap_mixer = alc662_auto_capture_mixer,
16943 .init_verbs = { alc662_init_verbs,
16944 alc663_two_hp_amic_m1_init_verbs },
16945 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16947 .dac_nids = alc662_dac_nids,
16948 .dig_out_nid = ALC662_DIGOUT_NID,
16949 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16950 .channel_mode = alc662_3ST_2ch_modes,
16951 .input_mux = &alc662_eeepc_capture_source,
16952 .unsol_event = alc663_mode3_unsol_event,
16953 .init_hook = alc663_mode3_inithook,
16955 [ALC663_ASUS_MODE4] = {
16956 .mixers = { alc663_asus_21jd_clfe_mixer },
16957 .cap_mixer = alc662_auto_capture_mixer,
16958 .init_verbs = { alc662_init_verbs,
16959 alc663_21jd_amic_init_verbs},
16960 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16962 .dac_nids = alc662_dac_nids,
16963 .dig_out_nid = ALC662_DIGOUT_NID,
16964 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16965 .channel_mode = alc662_3ST_2ch_modes,
16966 .input_mux = &alc662_eeepc_capture_source,
16967 .unsol_event = alc663_mode4_unsol_event,
16968 .init_hook = alc663_mode4_inithook,
16970 [ALC663_ASUS_MODE5] = {
16971 .mixers = { alc663_asus_15jd_clfe_mixer },
16972 .cap_mixer = alc662_auto_capture_mixer,
16973 .init_verbs = { alc662_init_verbs,
16974 alc663_15jd_amic_init_verbs },
16975 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16977 .dac_nids = alc662_dac_nids,
16978 .dig_out_nid = ALC662_DIGOUT_NID,
16979 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16980 .channel_mode = alc662_3ST_2ch_modes,
16981 .input_mux = &alc662_eeepc_capture_source,
16982 .unsol_event = alc663_mode5_unsol_event,
16983 .init_hook = alc663_mode5_inithook,
16985 [ALC663_ASUS_MODE6] = {
16986 .mixers = { alc663_two_hp_m2_mixer },
16987 .cap_mixer = alc662_auto_capture_mixer,
16988 .init_verbs = { alc662_init_verbs,
16989 alc663_two_hp_amic_m2_init_verbs },
16990 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
16992 .dac_nids = alc662_dac_nids,
16993 .dig_out_nid = ALC662_DIGOUT_NID,
16994 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
16995 .channel_mode = alc662_3ST_2ch_modes,
16996 .input_mux = &alc662_eeepc_capture_source,
16997 .unsol_event = alc663_mode6_unsol_event,
16998 .init_hook = alc663_mode6_inithook,
17001 .mixers = { alc663_m51va_mixer },
17002 .cap_mixer = alc272_auto_capture_mixer,
17003 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17004 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17005 .dac_nids = alc662_dac_nids,
17006 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17007 .adc_nids = alc272_adc_nids,
17008 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17009 .capsrc_nids = alc272_capsrc_nids,
17010 .channel_mode = alc662_3ST_2ch_modes,
17011 .input_mux = &alc663_m51va_capture_source,
17012 .unsol_event = alc663_m51va_unsol_event,
17013 .init_hook = alc663_m51va_inithook,
17015 [ALC272_DELL_ZM1] = {
17016 .mixers = { alc663_m51va_mixer },
17017 .cap_mixer = alc662_auto_capture_mixer,
17018 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17019 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17020 .dac_nids = alc662_dac_nids,
17021 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17022 .adc_nids = alc662_adc_nids,
17023 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
17024 .capsrc_nids = alc662_capsrc_nids,
17025 .channel_mode = alc662_3ST_2ch_modes,
17026 .input_mux = &alc663_m51va_capture_source,
17027 .unsol_event = alc663_m51va_unsol_event,
17028 .init_hook = alc663_m51va_inithook,
17030 [ALC272_SAMSUNG_NC10] = {
17031 .mixers = { alc272_nc10_mixer },
17032 .init_verbs = { alc662_init_verbs,
17033 alc663_21jd_amic_init_verbs },
17034 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17035 .dac_nids = alc272_dac_nids,
17036 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17037 .channel_mode = alc662_3ST_2ch_modes,
17038 .input_mux = &alc272_nc10_capture_source,
17039 .unsol_event = alc663_mode4_unsol_event,
17040 .init_hook = alc663_mode4_inithook,
17046 * BIOS auto configuration
17049 /* add playback controls from the parsed DAC table */
17050 static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec,
17051 const struct auto_pin_cfg *cfg)
17054 static const char *chname[4] = {
17055 "Front", "Surround", NULL /*CLFE*/, "Side"
17060 for (i = 0; i < cfg->line_outs; i++) {
17061 if (!spec->multiout.dac_nids[i])
17063 nid = alc880_idx_to_dac(i);
17066 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17067 "Center Playback Volume",
17068 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
17072 err = add_control(spec, ALC_CTL_WIDGET_VOL,
17073 "LFE Playback Volume",
17074 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
17078 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17079 "Center Playback Switch",
17080 HDA_COMPOSE_AMP_VAL(0x0e, 1, 0,
17084 err = add_control(spec, ALC_CTL_WIDGET_MUTE,
17085 "LFE Playback Switch",
17086 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0,
17091 sprintf(name, "%s Playback Volume", chname[i]);
17092 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17093 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
17097 sprintf(name, "%s Playback Switch", chname[i]);
17098 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17099 HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i),
17108 /* add playback controls for speaker and HP outputs */
17109 static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
17120 /* ALC663 has a mono output pin on 0x17 */
17121 sprintf(name, "%s Playback Switch", pfx);
17122 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17123 HDA_COMPOSE_AMP_VAL(pin, 2, 0, HDA_OUTPUT));
17127 if (alc880_is_fixed_pin(pin)) {
17128 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17129 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */
17130 /* specify the DAC as the extra output */
17131 if (!spec->multiout.hp_nid)
17132 spec->multiout.hp_nid = nid;
17134 spec->multiout.extra_out_nid[0] = nid;
17135 /* control HP volume/switch on the output mixer amp */
17136 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17137 sprintf(name, "%s Playback Volume", pfx);
17138 err = add_control(spec, ALC_CTL_WIDGET_VOL, name,
17139 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
17142 sprintf(name, "%s Playback Switch", pfx);
17143 err = add_control(spec, ALC_CTL_BIND_MUTE, name,
17144 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
17147 } else if (alc880_is_multi_pin(pin)) {
17148 /* set manual connection */
17149 /* we have only a switch on HP-out PIN */
17150 sprintf(name, "%s Playback Switch", pfx);
17151 err = add_control(spec, ALC_CTL_WIDGET_MUTE, name,
17152 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17159 /* return the index of the src widget from the connection list of the nid.
17160 * return -1 if not found
17162 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
17165 hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
17168 conns = snd_hda_get_connections(codec, nid, conn_list,
17169 ARRAY_SIZE(conn_list));
17172 for (i = 0; i < conns; i++)
17173 if (conn_list[i] == src)
17178 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
17180 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
17181 return (pincap & AC_PINCAP_IN) != 0;
17184 /* create playback/capture controls for input pins */
17185 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec,
17186 const struct auto_pin_cfg *cfg)
17188 struct alc_spec *spec = codec->spec;
17189 struct hda_input_mux *imux = &spec->private_imux[0];
17192 for (i = 0; i < AUTO_PIN_LAST; i++) {
17193 if (alc662_is_input_pin(codec, cfg->input_pins[i])) {
17194 idx = alc662_input_pin_idx(codec, 0x0b,
17195 cfg->input_pins[i]);
17197 err = new_analog_input(spec, cfg->input_pins[i],
17198 auto_pin_cfg_labels[i],
17203 idx = alc662_input_pin_idx(codec, 0x22,
17204 cfg->input_pins[i]);
17206 imux->items[imux->num_items].label =
17207 auto_pin_cfg_labels[i];
17208 imux->items[imux->num_items].index = idx;
17216 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17217 hda_nid_t nid, int pin_type,
17220 alc_set_pin_output(codec, nid, pin_type);
17221 /* need the manual connection? */
17222 if (alc880_is_multi_pin(nid)) {
17223 struct alc_spec *spec = codec->spec;
17224 int idx = alc880_multi_pin_idx(nid);
17225 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
17226 AC_VERB_SET_CONNECT_SEL,
17227 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
17231 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17233 struct alc_spec *spec = codec->spec;
17236 for (i = 0; i <= HDA_SIDE; i++) {
17237 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17238 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17240 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17245 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17247 struct alc_spec *spec = codec->spec;
17250 pin = spec->autocfg.hp_pins[0];
17251 if (pin) /* connect to front */
17253 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
17254 pin = spec->autocfg.speaker_pins[0];
17256 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
17259 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17261 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17263 struct alc_spec *spec = codec->spec;
17266 for (i = 0; i < AUTO_PIN_LAST; i++) {
17267 hda_nid_t nid = spec->autocfg.input_pins[i];
17268 if (alc662_is_input_pin(codec, nid)) {
17269 alc_set_input_pin(codec, nid, i);
17270 if (nid != ALC662_PIN_CD_NID &&
17271 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17272 snd_hda_codec_write(codec, nid, 0,
17273 AC_VERB_SET_AMP_GAIN_MUTE,
17279 #define alc662_auto_init_input_src alc882_auto_init_input_src
17281 static int alc662_parse_auto_config(struct hda_codec *codec)
17283 struct alc_spec *spec = codec->spec;
17285 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17287 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17291 if (!spec->autocfg.line_outs)
17292 return 0; /* can't find valid BIOS pin config */
17294 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17297 err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg);
17300 err = alc662_auto_create_extra_out(spec,
17301 spec->autocfg.speaker_pins[0],
17305 err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
17309 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg);
17313 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17315 if (spec->autocfg.dig_outs)
17316 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17318 if (spec->kctls.list)
17319 add_mixer(spec, spec->kctls.list);
17321 spec->num_mux_defs = 1;
17322 spec->input_mux = &spec->private_imux[0];
17324 add_verb(spec, alc662_auto_init_verbs);
17325 if (codec->vendor_id == 0x10ec0663)
17326 add_verb(spec, alc663_auto_init_verbs);
17328 err = alc_auto_add_mic_boost(codec);
17332 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17337 /* additional initialization for auto-configuration model */
17338 static void alc662_auto_init(struct hda_codec *codec)
17340 struct alc_spec *spec = codec->spec;
17341 alc662_auto_init_multi_out(codec);
17342 alc662_auto_init_hp_out(codec);
17343 alc662_auto_init_analog_input(codec);
17344 alc662_auto_init_input_src(codec);
17345 if (spec->unsol_event)
17346 alc_inithook(codec);
17349 static int patch_alc662(struct hda_codec *codec)
17351 struct alc_spec *spec;
17352 int err, board_config;
17354 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17358 codec->spec = spec;
17360 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17362 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17365 if (board_config < 0) {
17366 printk(KERN_INFO "hda_codec: Unknown model for %s, "
17367 "trying auto-probe from BIOS...\n", codec->chip_name);
17368 board_config = ALC662_AUTO;
17371 if (board_config == ALC662_AUTO) {
17372 /* automatic parse from the BIOS config */
17373 err = alc662_parse_auto_config(codec);
17379 "hda_codec: Cannot set up configuration "
17380 "from BIOS. Using base mode...\n");
17381 board_config = ALC662_3ST_2ch_DIG;
17385 err = snd_hda_attach_beep_device(codec, 0x1);
17391 if (board_config != ALC662_AUTO)
17392 setup_preset(spec, &alc662_presets[board_config]);
17394 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17395 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17397 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17398 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17400 spec->adc_nids = alc662_adc_nids;
17401 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17402 spec->capsrc_nids = alc662_capsrc_nids;
17403 spec->capture_style = CAPT_MIX;
17405 if (!spec->cap_mixer)
17406 set_capture_mixer(spec);
17407 if (codec->vendor_id == 0x10ec0662)
17408 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17410 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17412 spec->vmaster_nid = 0x02;
17414 codec->patch_ops = alc_patch_ops;
17415 if (board_config == ALC662_AUTO)
17416 spec->init_hook = alc662_auto_init;
17417 #ifdef CONFIG_SND_HDA_POWER_SAVE
17418 if (!spec->loopback.amplist)
17419 spec->loopback.amplist = alc662_loopbacks;
17421 codec->proc_widget_hook = print_realtek_coef;
17429 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17430 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17431 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17432 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17433 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17434 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17435 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17436 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17437 .patch = patch_alc861 },
17438 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17439 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17440 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17441 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17442 .patch = patch_alc883 },
17443 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17444 .patch = patch_alc662 },
17445 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17446 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17447 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17448 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 },
17449 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17450 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17451 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17452 .patch = patch_alc882 }, /* should be patch_alc883() in future */
17453 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17454 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
17455 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17456 .patch = patch_alc883 },
17457 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
17458 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
17459 {} /* terminator */
17462 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17464 MODULE_LICENSE("GPL");
17465 MODULE_DESCRIPTION("Realtek HD-audio codec");
17467 static struct hda_codec_preset_list realtek_list = {
17468 .preset = snd_hda_preset_realtek,
17469 .owner = THIS_MODULE,
17472 static int __init patch_realtek_init(void)
17474 return snd_hda_add_codec_preset(&realtek_list);
17477 static void __exit patch_realtek_exit(void)
17479 snd_hda_delete_codec_preset(&realtek_list);
17482 module_init(patch_realtek_init)
17483 module_exit(patch_realtek_exit)