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,
217 ALC883_TARGA_2ch_DIG,
218 ALC883_TARGA_8ch_DIG,
221 ALC888_ACER_ASPIRE_4930G,
222 ALC888_ACER_ASPIRE_6530G,
223 ALC888_ACER_ASPIRE_8930G,
224 ALC888_ACER_ASPIRE_7730G,
228 ALC883_LENOVO_101E_2ch,
229 ALC883_LENOVO_NB0763,
230 ALC888_LENOVO_MS7195_DIG,
238 ALC883_FUJITSU_PI2515,
239 ALC888_FUJITSU_XA3530,
240 ALC883_3ST_6ch_INTEL,
253 #define GPIO_MASK 0x03
255 /* extra amp-initialization sequence types */
264 struct alc_mic_route {
266 unsigned char mux_idx;
267 unsigned char amix_idx;
270 #define MUX_IDX_UNDEF ((unsigned char)-1)
273 /* codec parameterization */
274 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
275 unsigned int num_mixers;
276 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
277 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
279 const struct hda_verb *init_verbs[10]; /* initialization verbs
283 unsigned int num_init_verbs;
285 char stream_name_analog[32]; /* analog PCM stream */
286 struct hda_pcm_stream *stream_analog_playback;
287 struct hda_pcm_stream *stream_analog_capture;
288 struct hda_pcm_stream *stream_analog_alt_playback;
289 struct hda_pcm_stream *stream_analog_alt_capture;
291 char stream_name_digital[32]; /* digital PCM stream */
292 struct hda_pcm_stream *stream_digital_playback;
293 struct hda_pcm_stream *stream_digital_capture;
296 struct hda_multi_out multiout; /* playback set-up
297 * max_channels, dacs must be set
298 * dig_out_nid and hp_nid are optional
300 hda_nid_t alt_dac_nid;
301 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
305 unsigned int num_adc_nids;
307 hda_nid_t *capsrc_nids;
308 hda_nid_t dig_in_nid; /* digital-in NID; optional */
311 unsigned int num_mux_defs;
312 const struct hda_input_mux *input_mux;
313 unsigned int cur_mux[3];
314 struct alc_mic_route ext_mic;
315 struct alc_mic_route int_mic;
318 const struct hda_channel_mode *channel_mode;
319 int num_channel_mode;
321 int const_channel_count;
322 int ext_channel_count;
324 /* PCM information */
325 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
327 /* dynamic controls, init_verbs and input_mux */
328 struct auto_pin_cfg autocfg;
329 struct snd_array kctls;
330 struct hda_input_mux private_imux[3];
331 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
332 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
333 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
336 void (*init_hook)(struct hda_codec *codec);
337 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
339 /* for pin sensing */
340 unsigned int sense_updated: 1;
341 unsigned int jack_present: 1;
342 unsigned int master_sw: 1;
343 unsigned int auto_mic:1;
346 unsigned int no_analog :1; /* digital I/O only */
349 /* for virtual master */
350 hda_nid_t vmaster_nid;
351 #ifdef CONFIG_SND_HDA_POWER_SAVE
352 struct hda_loopback_check loopback;
357 unsigned int pll_coef_idx, pll_coef_bit;
361 * configuration template - to be copied to the spec instance
363 struct alc_config_preset {
364 struct snd_kcontrol_new *mixers[5]; /* should be identical size
367 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
368 const struct hda_verb *init_verbs[5];
369 unsigned int num_dacs;
371 hda_nid_t dig_out_nid; /* optional */
372 hda_nid_t hp_nid; /* optional */
373 hda_nid_t *slave_dig_outs;
374 unsigned int num_adc_nids;
376 hda_nid_t *capsrc_nids;
377 hda_nid_t dig_in_nid;
378 unsigned int num_channel_mode;
379 const struct hda_channel_mode *channel_mode;
381 int const_channel_count;
382 unsigned int num_mux_defs;
383 const struct hda_input_mux *input_mux;
384 void (*unsol_event)(struct hda_codec *, unsigned int);
385 void (*setup)(struct hda_codec *);
386 void (*init_hook)(struct hda_codec *);
387 #ifdef CONFIG_SND_HDA_POWER_SAVE
388 struct hda_amp_list *loopbacks;
396 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
397 struct snd_ctl_elem_info *uinfo)
399 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
400 struct alc_spec *spec = codec->spec;
401 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
402 if (mux_idx >= spec->num_mux_defs)
404 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
407 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_value *ucontrol)
410 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
411 struct alc_spec *spec = codec->spec;
412 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
414 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
418 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
419 struct snd_ctl_elem_value *ucontrol)
421 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
422 struct alc_spec *spec = codec->spec;
423 const struct hda_input_mux *imux;
424 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
425 unsigned int mux_idx;
426 hda_nid_t nid = spec->capsrc_nids ?
427 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
430 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
431 imux = &spec->input_mux[mux_idx];
433 type = get_wcaps_type(get_wcaps(codec, nid));
434 if (type == AC_WID_AUD_MIX) {
435 /* Matrix-mixer style (e.g. ALC882) */
436 unsigned int *cur_val = &spec->cur_mux[adc_idx];
439 idx = ucontrol->value.enumerated.item[0];
440 if (idx >= imux->num_items)
441 idx = imux->num_items - 1;
444 for (i = 0; i < imux->num_items; i++) {
445 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
446 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
447 imux->items[i].index,
453 /* MUX style (e.g. ALC880) */
454 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
455 &spec->cur_mux[adc_idx]);
460 * channel mode setting
462 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
463 struct snd_ctl_elem_info *uinfo)
465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
466 struct alc_spec *spec = codec->spec;
467 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
468 spec->num_channel_mode);
471 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_value *ucontrol)
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
475 struct alc_spec *spec = codec->spec;
476 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
477 spec->num_channel_mode,
478 spec->ext_channel_count);
481 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
482 struct snd_ctl_elem_value *ucontrol)
484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
485 struct alc_spec *spec = codec->spec;
486 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
487 spec->num_channel_mode,
488 &spec->ext_channel_count);
489 if (err >= 0 && !spec->const_channel_count) {
490 spec->multiout.max_channels = spec->ext_channel_count;
491 if (spec->need_dac_fix)
492 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
498 * Control the mode of pin widget settings via the mixer. "pc" is used
499 * instead of "%" to avoid consequences of accidently treating the % as
500 * being part of a format specifier. Maximum allowed length of a value is
501 * 63 characters plus NULL terminator.
503 * Note: some retasking pin complexes seem to ignore requests for input
504 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
505 * are requested. Therefore order this list so that this behaviour will not
506 * cause problems when mixer clients move through the enum sequentially.
507 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
510 static char *alc_pin_mode_names[] = {
511 "Mic 50pc bias", "Mic 80pc bias",
512 "Line in", "Line out", "Headphone out",
514 static unsigned char alc_pin_mode_values[] = {
515 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
517 /* The control can present all 5 options, or it can limit the options based
518 * in the pin being assumed to be exclusively an input or an output pin. In
519 * addition, "input" pins may or may not process the mic bias option
520 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
521 * accept requests for bias as of chip versions up to March 2006) and/or
522 * wiring in the computer.
524 #define ALC_PIN_DIR_IN 0x00
525 #define ALC_PIN_DIR_OUT 0x01
526 #define ALC_PIN_DIR_INOUT 0x02
527 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
528 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
530 /* Info about the pin modes supported by the different pin direction modes.
531 * For each direction the minimum and maximum values are given.
533 static signed char alc_pin_mode_dir_info[5][2] = {
534 { 0, 2 }, /* ALC_PIN_DIR_IN */
535 { 3, 4 }, /* ALC_PIN_DIR_OUT */
536 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
537 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
538 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
540 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
541 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
542 #define alc_pin_mode_n_items(_dir) \
543 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
545 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
546 struct snd_ctl_elem_info *uinfo)
548 unsigned int item_num = uinfo->value.enumerated.item;
549 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
551 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
553 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
555 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
556 item_num = alc_pin_mode_min(dir);
557 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
561 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
562 struct snd_ctl_elem_value *ucontrol)
565 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
566 hda_nid_t nid = kcontrol->private_value & 0xffff;
567 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
568 long *valp = ucontrol->value.integer.value;
569 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
570 AC_VERB_GET_PIN_WIDGET_CONTROL,
573 /* Find enumerated value for current pinctl setting */
574 i = alc_pin_mode_min(dir);
575 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
577 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
581 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
582 struct snd_ctl_elem_value *ucontrol)
585 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
586 hda_nid_t nid = kcontrol->private_value & 0xffff;
587 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
588 long val = *ucontrol->value.integer.value;
589 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
590 AC_VERB_GET_PIN_WIDGET_CONTROL,
593 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
594 val = alc_pin_mode_min(dir);
596 change = pinctl != alc_pin_mode_values[val];
598 /* Set pin mode to that requested */
599 snd_hda_codec_write_cache(codec, nid, 0,
600 AC_VERB_SET_PIN_WIDGET_CONTROL,
601 alc_pin_mode_values[val]);
603 /* Also enable the retasking pin's input/output as required
604 * for the requested pin mode. Enum values of 2 or less are
607 * Dynamically switching the input/output buffers probably
608 * reduces noise slightly (particularly on input) so we'll
609 * do it. However, having both input and output buffers
610 * enabled simultaneously doesn't seem to be problematic if
611 * this turns out to be necessary in the future.
614 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
615 HDA_AMP_MUTE, HDA_AMP_MUTE);
616 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
619 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
620 HDA_AMP_MUTE, HDA_AMP_MUTE);
621 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
628 #define ALC_PIN_MODE(xname, nid, dir) \
629 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
630 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
631 .info = alc_pin_mode_info, \
632 .get = alc_pin_mode_get, \
633 .put = alc_pin_mode_put, \
634 .private_value = nid | (dir<<16) }
636 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
637 * together using a mask with more than one bit set. This control is
638 * currently used only by the ALC260 test model. At this stage they are not
639 * needed for any "production" models.
641 #ifdef CONFIG_SND_DEBUG
642 #define alc_gpio_data_info snd_ctl_boolean_mono_info
644 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
645 struct snd_ctl_elem_value *ucontrol)
647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
648 hda_nid_t nid = kcontrol->private_value & 0xffff;
649 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
650 long *valp = ucontrol->value.integer.value;
651 unsigned int val = snd_hda_codec_read(codec, nid, 0,
652 AC_VERB_GET_GPIO_DATA, 0x00);
654 *valp = (val & mask) != 0;
657 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
658 struct snd_ctl_elem_value *ucontrol)
661 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
662 hda_nid_t nid = kcontrol->private_value & 0xffff;
663 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
664 long val = *ucontrol->value.integer.value;
665 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
666 AC_VERB_GET_GPIO_DATA,
669 /* Set/unset the masked GPIO bit(s) as needed */
670 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
675 snd_hda_codec_write_cache(codec, nid, 0,
676 AC_VERB_SET_GPIO_DATA, gpio_data);
680 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
681 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
682 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
683 .info = alc_gpio_data_info, \
684 .get = alc_gpio_data_get, \
685 .put = alc_gpio_data_put, \
686 .private_value = nid | (mask<<16) }
687 #endif /* CONFIG_SND_DEBUG */
689 /* A switch control to allow the enabling of the digital IO pins on the
690 * ALC260. This is incredibly simplistic; the intention of this control is
691 * to provide something in the test model allowing digital outputs to be
692 * identified if present. If models are found which can utilise these
693 * outputs a more complete mixer control can be devised for those models if
696 #ifdef CONFIG_SND_DEBUG
697 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
699 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
703 hda_nid_t nid = kcontrol->private_value & 0xffff;
704 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
705 long *valp = ucontrol->value.integer.value;
706 unsigned int val = snd_hda_codec_read(codec, nid, 0,
707 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
709 *valp = (val & mask) != 0;
712 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
713 struct snd_ctl_elem_value *ucontrol)
716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
717 hda_nid_t nid = kcontrol->private_value & 0xffff;
718 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
719 long val = *ucontrol->value.integer.value;
720 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
721 AC_VERB_GET_DIGI_CONVERT_1,
724 /* Set/unset the masked control bit(s) as needed */
725 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
730 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
735 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
736 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
737 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
738 .info = alc_spdif_ctrl_info, \
739 .get = alc_spdif_ctrl_get, \
740 .put = alc_spdif_ctrl_put, \
741 .private_value = nid | (mask<<16) }
742 #endif /* CONFIG_SND_DEBUG */
744 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
745 * Again, this is only used in the ALC26x test models to help identify when
746 * the EAPD line must be asserted for features to work.
748 #ifdef CONFIG_SND_DEBUG
749 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
751 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
752 struct snd_ctl_elem_value *ucontrol)
754 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
755 hda_nid_t nid = kcontrol->private_value & 0xffff;
756 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
757 long *valp = ucontrol->value.integer.value;
758 unsigned int val = snd_hda_codec_read(codec, nid, 0,
759 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
761 *valp = (val & mask) != 0;
765 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
766 struct snd_ctl_elem_value *ucontrol)
769 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
770 hda_nid_t nid = kcontrol->private_value & 0xffff;
771 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
772 long val = *ucontrol->value.integer.value;
773 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
774 AC_VERB_GET_EAPD_BTLENABLE,
777 /* Set/unset the masked control bit(s) as needed */
778 change = (!val ? 0 : mask) != (ctrl_data & mask);
783 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
789 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
790 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
791 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
792 .info = alc_eapd_ctrl_info, \
793 .get = alc_eapd_ctrl_get, \
794 .put = alc_eapd_ctrl_put, \
795 .private_value = nid | (mask<<16) }
796 #endif /* CONFIG_SND_DEBUG */
799 * set up the input pin config (depending on the given auto-pin type)
801 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
804 unsigned int val = PIN_IN;
806 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
808 pincap = snd_hda_query_pin_caps(codec, nid);
809 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
810 if (pincap & AC_PINCAP_VREF_80)
812 else if (pincap & AC_PINCAP_VREF_50)
814 else if (pincap & AC_PINCAP_VREF_100)
816 else if (pincap & AC_PINCAP_VREF_GRD)
819 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
824 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
826 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
828 spec->mixers[spec->num_mixers++] = mix;
831 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
833 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
835 spec->init_verbs[spec->num_init_verbs++] = verb;
838 #ifdef CONFIG_PROC_FS
842 static void print_realtek_coef(struct snd_info_buffer *buffer,
843 struct hda_codec *codec, hda_nid_t nid)
849 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
850 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
851 coeff = snd_hda_codec_read(codec, nid, 0,
852 AC_VERB_GET_COEF_INDEX, 0);
853 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
856 #define print_realtek_coef NULL
860 * set up from the preset table
862 static void setup_preset(struct hda_codec *codec,
863 const struct alc_config_preset *preset)
865 struct alc_spec *spec = codec->spec;
868 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
869 add_mixer(spec, preset->mixers[i]);
870 spec->cap_mixer = preset->cap_mixer;
871 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
873 add_verb(spec, preset->init_verbs[i]);
875 spec->channel_mode = preset->channel_mode;
876 spec->num_channel_mode = preset->num_channel_mode;
877 spec->need_dac_fix = preset->need_dac_fix;
878 spec->const_channel_count = preset->const_channel_count;
880 if (preset->const_channel_count)
881 spec->multiout.max_channels = preset->const_channel_count;
883 spec->multiout.max_channels = spec->channel_mode[0].channels;
884 spec->ext_channel_count = spec->channel_mode[0].channels;
886 spec->multiout.num_dacs = preset->num_dacs;
887 spec->multiout.dac_nids = preset->dac_nids;
888 spec->multiout.dig_out_nid = preset->dig_out_nid;
889 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
890 spec->multiout.hp_nid = preset->hp_nid;
892 spec->num_mux_defs = preset->num_mux_defs;
893 if (!spec->num_mux_defs)
894 spec->num_mux_defs = 1;
895 spec->input_mux = preset->input_mux;
897 spec->num_adc_nids = preset->num_adc_nids;
898 spec->adc_nids = preset->adc_nids;
899 spec->capsrc_nids = preset->capsrc_nids;
900 spec->dig_in_nid = preset->dig_in_nid;
902 spec->unsol_event = preset->unsol_event;
903 spec->init_hook = preset->init_hook;
904 #ifdef CONFIG_SND_HDA_POWER_SAVE
905 spec->loopback.amplist = preset->loopbacks;
909 preset->setup(codec);
912 /* Enable GPIO mask and set output */
913 static struct hda_verb alc_gpio1_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
920 static struct hda_verb alc_gpio2_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
927 static struct hda_verb alc_gpio3_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
935 * Fix hardware PLL issue
936 * On some codecs, the analog PLL gating control must be off while
937 * the default value is 1.
939 static void alc_fix_pll(struct hda_codec *codec)
941 struct alc_spec *spec = codec->spec;
946 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
948 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
949 AC_VERB_GET_PROC_COEF, 0);
950 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
952 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
953 val & ~(1 << spec->pll_coef_bit));
956 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
957 unsigned int coef_idx, unsigned int coef_bit)
959 struct alc_spec *spec = codec->spec;
961 spec->pll_coef_idx = coef_idx;
962 spec->pll_coef_bit = coef_bit;
966 static void alc_automute_pin(struct hda_codec *codec)
968 struct alc_spec *spec = codec->spec;
969 unsigned int nid = spec->autocfg.hp_pins[0];
974 spec->jack_present = snd_hda_jack_detect(codec, nid);
975 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
976 nid = spec->autocfg.speaker_pins[i];
979 snd_hda_codec_write(codec, nid, 0,
980 AC_VERB_SET_PIN_WIDGET_CONTROL,
981 spec->jack_present ? 0 : PIN_OUT);
985 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
988 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
991 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
992 for (i = 0; i < nums; i++)
998 static void alc_mic_automute(struct hda_codec *codec)
1000 struct alc_spec *spec = codec->spec;
1001 struct alc_mic_route *dead, *alive;
1002 unsigned int present, type;
1005 if (!spec->auto_mic)
1007 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1009 if (snd_BUG_ON(!spec->adc_nids))
1012 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1014 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1016 alive = &spec->ext_mic;
1017 dead = &spec->int_mic;
1019 alive = &spec->int_mic;
1020 dead = &spec->ext_mic;
1023 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1024 if (type == AC_WID_AUD_MIX) {
1025 /* Matrix-mixer style (e.g. ALC882) */
1026 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1029 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1031 HDA_AMP_MUTE, HDA_AMP_MUTE);
1033 /* MUX style (e.g. ALC880) */
1034 snd_hda_codec_write_cache(codec, cap_nid, 0,
1035 AC_VERB_SET_CONNECT_SEL,
1039 /* FIXME: analog mixer */
1042 /* unsolicited event for HP jack sensing */
1043 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1045 if (codec->vendor_id == 0x10ec0880)
1050 case ALC880_HP_EVENT:
1051 alc_automute_pin(codec);
1053 case ALC880_MIC_EVENT:
1054 alc_mic_automute(codec);
1059 static void alc_inithook(struct hda_codec *codec)
1061 alc_automute_pin(codec);
1062 alc_mic_automute(codec);
1065 /* additional initialization for ALC888 variants */
1066 static void alc888_coef_init(struct hda_codec *codec)
1070 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1071 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1072 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1073 if ((tmp & 0xf0) == 0x20)
1075 snd_hda_codec_read(codec, 0x20, 0,
1076 AC_VERB_SET_PROC_COEF, 0x830);
1079 snd_hda_codec_read(codec, 0x20, 0,
1080 AC_VERB_SET_PROC_COEF, 0x3030);
1083 static void alc889_coef_init(struct hda_codec *codec)
1087 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1088 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1089 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1090 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1093 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1098 case ALC_INIT_GPIO1:
1099 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1101 case ALC_INIT_GPIO2:
1102 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1104 case ALC_INIT_GPIO3:
1105 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1107 case ALC_INIT_DEFAULT:
1108 switch (codec->vendor_id) {
1110 snd_hda_codec_write(codec, 0x0f, 0,
1111 AC_VERB_SET_EAPD_BTLENABLE, 2);
1112 snd_hda_codec_write(codec, 0x10, 0,
1113 AC_VERB_SET_EAPD_BTLENABLE, 2);
1125 snd_hda_codec_write(codec, 0x14, 0,
1126 AC_VERB_SET_EAPD_BTLENABLE, 2);
1127 snd_hda_codec_write(codec, 0x15, 0,
1128 AC_VERB_SET_EAPD_BTLENABLE, 2);
1131 switch (codec->vendor_id) {
1133 snd_hda_codec_write(codec, 0x1a, 0,
1134 AC_VERB_SET_COEF_INDEX, 7);
1135 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1136 AC_VERB_GET_PROC_COEF, 0);
1137 snd_hda_codec_write(codec, 0x1a, 0,
1138 AC_VERB_SET_COEF_INDEX, 7);
1139 snd_hda_codec_write(codec, 0x1a, 0,
1140 AC_VERB_SET_PROC_COEF,
1150 alc889_coef_init(codec);
1153 alc888_coef_init(codec);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_COEF_INDEX, 7);
1159 tmp = snd_hda_codec_read(codec, 0x20, 0,
1160 AC_VERB_GET_PROC_COEF, 0);
1161 snd_hda_codec_write(codec, 0x20, 0,
1162 AC_VERB_SET_COEF_INDEX, 7);
1163 snd_hda_codec_write(codec, 0x20, 0,
1164 AC_VERB_SET_PROC_COEF,
1172 static void alc_init_auto_hp(struct hda_codec *codec)
1174 struct alc_spec *spec = codec->spec;
1176 if (!spec->autocfg.hp_pins[0])
1179 if (!spec->autocfg.speaker_pins[0]) {
1180 if (spec->autocfg.line_out_pins[0] &&
1181 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1182 spec->autocfg.speaker_pins[0] =
1183 spec->autocfg.line_out_pins[0];
1188 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1189 spec->autocfg.hp_pins[0]);
1190 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1191 AC_VERB_SET_UNSOLICITED_ENABLE,
1192 AC_USRSP_EN | ALC880_HP_EVENT);
1193 spec->unsol_event = alc_sku_unsol_event;
1196 static void alc_init_auto_mic(struct hda_codec *codec)
1198 struct alc_spec *spec = codec->spec;
1199 struct auto_pin_cfg *cfg = &spec->autocfg;
1200 hda_nid_t fixed, ext;
1203 /* there must be only two mic inputs exclusively */
1204 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1205 if (cfg->input_pins[i])
1209 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1210 hda_nid_t nid = cfg->input_pins[i];
1211 unsigned int defcfg;
1214 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1215 switch (get_defcfg_connect(defcfg)) {
1216 case AC_JACK_PORT_FIXED:
1218 return; /* already occupied */
1221 case AC_JACK_PORT_COMPLEX:
1223 return; /* already occupied */
1227 return; /* invalid entry */
1230 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1231 return; /* no unsol support */
1232 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1234 spec->ext_mic.pin = ext;
1235 spec->int_mic.pin = fixed;
1236 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1237 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1239 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1240 AC_VERB_SET_UNSOLICITED_ENABLE,
1241 AC_USRSP_EN | ALC880_MIC_EVENT);
1242 spec->unsol_event = alc_sku_unsol_event;
1245 /* check subsystem ID and set up device-specific initialization;
1246 * return 1 if initialized, 0 if invalid SSID
1248 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1249 * 31 ~ 16 : Manufacture ID
1251 * 7 ~ 0 : Assembly ID
1252 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1254 static int alc_subsystem_id(struct hda_codec *codec,
1255 hda_nid_t porta, hda_nid_t porte,
1258 unsigned int ass, tmp, i;
1260 struct alc_spec *spec = codec->spec;
1262 ass = codec->subsystem_id & 0xffff;
1263 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1266 /* invalid SSID, check the special NID pin defcfg instead */
1268 * 31~30 : port connectivity
1271 * 19~16 : Check sum (15:1)
1276 if (codec->vendor_id == 0x10ec0260)
1278 ass = snd_hda_codec_get_pincfg(codec, nid);
1279 snd_printd("realtek: No valid SSID, "
1280 "checking pincfg 0x%08x for NID 0x%x\n",
1282 if (!(ass & 1) && !(ass & 0x100000))
1284 if ((ass >> 30) != 1) /* no physical connection */
1289 for (i = 1; i < 16; i++) {
1293 if (((ass >> 16) & 0xf) != tmp)
1296 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1297 ass & 0xffff, codec->vendor_id);
1301 * 2 : 0 --> Desktop, 1 --> Laptop
1302 * 3~5 : External Amplifier control
1305 tmp = (ass & 0x38) >> 3; /* external Amp control */
1308 spec->init_amp = ALC_INIT_GPIO1;
1311 spec->init_amp = ALC_INIT_GPIO2;
1314 spec->init_amp = ALC_INIT_GPIO3;
1317 spec->init_amp = ALC_INIT_DEFAULT;
1321 /* is laptop or Desktop and enable the function "Mute internal speaker
1322 * when the external headphone out jack is plugged"
1324 if (!(ass & 0x8000))
1327 * 10~8 : Jack location
1328 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1330 * 15 : 1 --> enable the function "Mute internal speaker
1331 * when the external headphone out jack is plugged"
1333 if (!spec->autocfg.hp_pins[0]) {
1335 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1344 for (i = 0; i < spec->autocfg.line_outs; i++)
1345 if (spec->autocfg.line_out_pins[i] == nid)
1347 spec->autocfg.hp_pins[0] = nid;
1350 alc_init_auto_hp(codec);
1351 alc_init_auto_mic(codec);
1355 static void alc_ssid_check(struct hda_codec *codec,
1356 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1358 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1359 struct alc_spec *spec = codec->spec;
1360 snd_printd("realtek: "
1361 "Enable default setup for auto mode as fallback\n");
1362 spec->init_amp = ALC_INIT_DEFAULT;
1363 alc_init_auto_hp(codec);
1364 alc_init_auto_mic(codec);
1369 * Fix-up pin default configurations and add default verbs
1378 const struct alc_pincfg *pins;
1379 const struct hda_verb *verbs;
1382 static void alc_pick_fixup(struct hda_codec *codec,
1383 const struct snd_pci_quirk *quirk,
1384 const struct alc_fixup *fix)
1386 const struct alc_pincfg *cfg;
1388 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1392 fix += quirk->value;
1395 for (; cfg->nid; cfg++)
1396 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1399 add_verb(codec->spec, fix->verbs);
1402 static int alc_read_coef_idx(struct hda_codec *codec,
1403 unsigned int coef_idx)
1406 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1408 val = snd_hda_codec_read(codec, 0x20, 0,
1409 AC_VERB_GET_PROC_COEF, 0);
1420 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1421 /* Mic-in jack as mic in */
1422 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1423 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1424 /* Line-in jack as Line in */
1425 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1426 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1427 /* Line-Out as Front */
1428 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1435 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1436 /* Mic-in jack as mic in */
1437 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1438 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1439 /* Line-in jack as Surround */
1440 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1441 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1442 /* Line-Out as Front */
1443 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1450 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1451 /* Mic-in jack as CLFE */
1452 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-in jack as Surround */
1455 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1456 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1457 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1458 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1465 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1466 /* Mic-in jack as CLFE */
1467 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-in jack as Surround */
1470 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1471 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1472 /* Line-Out as Side */
1473 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1477 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1478 { 2, alc888_4ST_ch2_intel_init },
1479 { 4, alc888_4ST_ch4_intel_init },
1480 { 6, alc888_4ST_ch6_intel_init },
1481 { 8, alc888_4ST_ch8_intel_init },
1485 * ALC888 Fujitsu Siemens Amillo xa3530
1488 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1489 /* Front Mic: set to PIN_IN (empty by default) */
1490 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1491 /* Connect Internal HP to Front */
1492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1494 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1495 /* Connect Bass HP to Front */
1496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1498 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1499 /* Connect Line-Out side jack (SPDIF) to Side */
1500 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1501 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1502 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1503 /* Connect Mic jack to CLFE */
1504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1505 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1506 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1507 /* Connect Line-in jack to Surround */
1508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1511 /* Connect HP out jack to Front */
1512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1515 /* Enable unsolicited event for HP jack and Line-out jack */
1516 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1517 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1521 static void alc_automute_amp(struct hda_codec *codec)
1523 struct alc_spec *spec = codec->spec;
1528 spec->jack_present = 0;
1529 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1530 nid = spec->autocfg.hp_pins[i];
1533 if (snd_hda_jack_detect(codec, nid)) {
1534 spec->jack_present = 1;
1539 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1540 /* Toggle internal speakers muting */
1541 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1542 nid = spec->autocfg.speaker_pins[i];
1545 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1546 HDA_AMP_MUTE, mute);
1550 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1553 if (codec->vendor_id == 0x10ec0880)
1557 if (res == ALC880_HP_EVENT)
1558 alc_automute_amp(codec);
1561 static void alc889_automute_setup(struct hda_codec *codec)
1563 struct alc_spec *spec = codec->spec;
1565 spec->autocfg.hp_pins[0] = 0x15;
1566 spec->autocfg.speaker_pins[0] = 0x14;
1567 spec->autocfg.speaker_pins[1] = 0x16;
1568 spec->autocfg.speaker_pins[2] = 0x17;
1569 spec->autocfg.speaker_pins[3] = 0x19;
1570 spec->autocfg.speaker_pins[4] = 0x1a;
1573 static void alc889_intel_init_hook(struct hda_codec *codec)
1575 alc889_coef_init(codec);
1576 alc_automute_amp(codec);
1579 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1581 struct alc_spec *spec = codec->spec;
1583 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1584 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1585 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1586 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1590 * ALC888 Acer Aspire 4930G model
1593 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1594 /* Front Mic: set to PIN_IN (empty by default) */
1595 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1596 /* Unselect Front Mic by default in input mixer 3 */
1597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1598 /* Enable unsolicited event for HP jack */
1599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1600 /* Connect Internal HP to front */
1601 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1602 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1603 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1604 /* Connect HP out to front */
1605 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1606 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1607 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1612 * ALC888 Acer Aspire 6530G model
1615 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1616 /* Bias voltage on for external mic port */
1617 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1618 /* Front Mic: set to PIN_IN (empty by default) */
1619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1620 /* Unselect Front Mic by default in input mixer 3 */
1621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1622 /* Enable unsolicited event for HP jack */
1623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1624 /* Enable speaker output */
1625 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1626 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 /* Enable headphone output */
1628 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1629 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1630 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1635 * ALC889 Acer Aspire 8930G model
1638 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1639 /* Front Mic: set to PIN_IN (empty by default) */
1640 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1641 /* Unselect Front Mic by default in input mixer 3 */
1642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1643 /* Enable unsolicited event for HP jack */
1644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1645 /* Connect Internal Front to Front */
1646 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1647 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1648 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1649 /* Connect Internal Rear to Rear */
1650 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1651 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1652 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1653 /* Connect Internal CLFE to CLFE */
1654 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1655 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1656 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1657 /* Connect HP out to Front */
1658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1659 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1660 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1661 /* Enable all DACs */
1662 /* DAC DISABLE/MUTE 1? */
1663 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1664 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1665 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1666 /* DAC DISABLE/MUTE 2? */
1667 /* some bit here disables the other DACs. Init=0x4900 */
1668 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1669 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1670 /* Enable amplifiers */
1671 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1672 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
1674 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1675 * which makes the stereo useless. However, either the mic or the ALC889
1676 * makes the signal become a difference/sum signal instead of standard
1677 * stereo, which is annoying. So instead we flip this bit which makes the
1678 * codec replicate the sum signal to both channels, turning it into a
1681 /* DMIC_CONTROL? Init value = 0x0001 */
1682 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1683 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1687 static struct hda_input_mux alc888_2_capture_sources[2] = {
1688 /* Front mic only available on one ADC */
1695 { "Front Mic", 0xb },
1708 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1709 /* Interal mic only available on one ADC */
1716 { "Input Mix", 0xa },
1726 { "Input Mix", 0xa },
1731 static struct hda_input_mux alc889_capture_sources[3] = {
1732 /* Digital mic only available on first "ADC" */
1739 { "Front Mic", 0xb },
1740 { "Input Mix", 0xa },
1749 { "Input Mix", 0xa },
1758 { "Input Mix", 0xa },
1763 static struct snd_kcontrol_new alc888_base_mixer[] = {
1764 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1766 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1767 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1770 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1772 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1774 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1775 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1776 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1778 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1780 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1781 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1785 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1787 struct alc_spec *spec = codec->spec;
1789 spec->autocfg.hp_pins[0] = 0x15;
1790 spec->autocfg.speaker_pins[0] = 0x14;
1791 spec->autocfg.speaker_pins[1] = 0x16;
1792 spec->autocfg.speaker_pins[2] = 0x17;
1795 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1797 struct alc_spec *spec = codec->spec;
1799 spec->autocfg.hp_pins[0] = 0x15;
1800 spec->autocfg.speaker_pins[0] = 0x14;
1801 spec->autocfg.speaker_pins[1] = 0x16;
1802 spec->autocfg.speaker_pins[2] = 0x17;
1805 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1807 struct alc_spec *spec = codec->spec;
1809 spec->autocfg.hp_pins[0] = 0x15;
1810 spec->autocfg.speaker_pins[0] = 0x14;
1811 spec->autocfg.speaker_pins[1] = 0x16;
1812 spec->autocfg.speaker_pins[2] = 0x1b;
1816 * ALC880 3-stack model
1818 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1819 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1820 * F-Mic = 0x1b, HP = 0x19
1823 static hda_nid_t alc880_dac_nids[4] = {
1824 /* front, rear, clfe, rear_surr */
1825 0x02, 0x05, 0x04, 0x03
1828 static hda_nid_t alc880_adc_nids[3] = {
1833 /* The datasheet says the node 0x07 is connected from inputs,
1834 * but it shows zero connection in the real implementation on some devices.
1835 * Note: this is a 915GAV bug, fixed on 915GLV
1837 static hda_nid_t alc880_adc_nids_alt[2] = {
1842 #define ALC880_DIGOUT_NID 0x06
1843 #define ALC880_DIGIN_NID 0x0a
1845 static struct hda_input_mux alc880_capture_source = {
1849 { "Front Mic", 0x3 },
1855 /* channel source setting (2/6 channel selection for 3-stack) */
1857 static struct hda_verb alc880_threestack_ch2_init[] = {
1858 /* set line-in to input, mute it */
1859 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1860 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1861 /* set mic-in to input vref 80%, mute it */
1862 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1863 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1868 static struct hda_verb alc880_threestack_ch6_init[] = {
1869 /* set line-in to output, unmute it */
1870 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1871 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1872 /* set mic-in to output, unmute it */
1873 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1874 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1878 static struct hda_channel_mode alc880_threestack_modes[2] = {
1879 { 2, alc880_threestack_ch2_init },
1880 { 6, alc880_threestack_ch6_init },
1883 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1885 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1886 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1887 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1888 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1889 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1890 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1891 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1892 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1893 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1894 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1895 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1896 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1897 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1898 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1902 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1903 .name = "Channel Mode",
1904 .info = alc_ch_mode_info,
1905 .get = alc_ch_mode_get,
1906 .put = alc_ch_mode_put,
1911 /* capture mixer elements */
1912 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1913 struct snd_ctl_elem_info *uinfo)
1915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1916 struct alc_spec *spec = codec->spec;
1919 mutex_lock(&codec->control_mutex);
1920 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1922 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1923 mutex_unlock(&codec->control_mutex);
1927 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1928 unsigned int size, unsigned int __user *tlv)
1930 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1931 struct alc_spec *spec = codec->spec;
1934 mutex_lock(&codec->control_mutex);
1935 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1937 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1938 mutex_unlock(&codec->control_mutex);
1942 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1943 struct snd_ctl_elem_value *ucontrol);
1945 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1946 struct snd_ctl_elem_value *ucontrol,
1949 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1950 struct alc_spec *spec = codec->spec;
1951 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1954 mutex_lock(&codec->control_mutex);
1955 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1957 err = func(kcontrol, ucontrol);
1958 mutex_unlock(&codec->control_mutex);
1962 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1963 struct snd_ctl_elem_value *ucontrol)
1965 return alc_cap_getput_caller(kcontrol, ucontrol,
1966 snd_hda_mixer_amp_volume_get);
1969 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1970 struct snd_ctl_elem_value *ucontrol)
1972 return alc_cap_getput_caller(kcontrol, ucontrol,
1973 snd_hda_mixer_amp_volume_put);
1976 /* capture mixer elements */
1977 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1979 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1980 struct snd_ctl_elem_value *ucontrol)
1982 return alc_cap_getput_caller(kcontrol, ucontrol,
1983 snd_hda_mixer_amp_switch_get);
1986 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
1987 struct snd_ctl_elem_value *ucontrol)
1989 return alc_cap_getput_caller(kcontrol, ucontrol,
1990 snd_hda_mixer_amp_switch_put);
1993 #define _DEFINE_CAPMIX(num) \
1995 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1996 .name = "Capture Switch", \
1997 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1999 .info = alc_cap_sw_info, \
2000 .get = alc_cap_sw_get, \
2001 .put = alc_cap_sw_put, \
2004 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2005 .name = "Capture Volume", \
2006 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2007 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2008 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2010 .info = alc_cap_vol_info, \
2011 .get = alc_cap_vol_get, \
2012 .put = alc_cap_vol_put, \
2013 .tlv = { .c = alc_cap_vol_tlv }, \
2016 #define _DEFINE_CAPSRC(num) \
2018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2019 /* .name = "Capture Source", */ \
2020 .name = "Input Source", \
2022 .info = alc_mux_enum_info, \
2023 .get = alc_mux_enum_get, \
2024 .put = alc_mux_enum_put, \
2027 #define DEFINE_CAPMIX(num) \
2028 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2029 _DEFINE_CAPMIX(num), \
2030 _DEFINE_CAPSRC(num), \
2034 #define DEFINE_CAPMIX_NOSRC(num) \
2035 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2036 _DEFINE_CAPMIX(num), \
2040 /* up to three ADCs */
2044 DEFINE_CAPMIX_NOSRC(1);
2045 DEFINE_CAPMIX_NOSRC(2);
2046 DEFINE_CAPMIX_NOSRC(3);
2049 * ALC880 5-stack model
2051 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2053 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2054 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2057 /* additional mixers to alc880_three_stack_mixer */
2058 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2059 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2060 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2064 /* channel source setting (6/8 channel selection for 5-stack) */
2066 static struct hda_verb alc880_fivestack_ch6_init[] = {
2067 /* set line-in to input, mute it */
2068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2074 static struct hda_verb alc880_fivestack_ch8_init[] = {
2075 /* set line-in to output, unmute it */
2076 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2077 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2081 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2082 { 6, alc880_fivestack_ch6_init },
2083 { 8, alc880_fivestack_ch8_init },
2088 * ALC880 6-stack model
2090 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2091 * Side = 0x05 (0x0f)
2092 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2093 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2096 static hda_nid_t alc880_6st_dac_nids[4] = {
2097 /* front, rear, clfe, rear_surr */
2098 0x02, 0x03, 0x04, 0x05
2101 static struct hda_input_mux alc880_6stack_capture_source = {
2105 { "Front Mic", 0x1 },
2111 /* fixed 8-channels */
2112 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2116 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2119 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2120 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2121 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2122 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2123 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2124 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2125 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2126 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2132 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2137 .name = "Channel Mode",
2138 .info = alc_ch_mode_info,
2139 .get = alc_ch_mode_get,
2140 .put = alc_ch_mode_put,
2149 * W810 has rear IO for:
2152 * Center/LFE (DAC 04)
2155 * The system also has a pair of internal speakers, and a headphone jack.
2156 * These are both connected to Line2 on the codec, hence to DAC 02.
2158 * There is a variable resistor to control the speaker or headphone
2159 * volume. This is a hardware-only device without a software API.
2161 * Plugging headphones in will disable the internal speakers. This is
2162 * implemented in hardware, not via the driver using jack sense. In
2163 * a similar fashion, plugging into the rear socket marked "front" will
2164 * disable both the speakers and headphones.
2166 * For input, there's a microphone jack, and an "audio in" jack.
2167 * These may not do anything useful with this driver yet, because I
2168 * haven't setup any initialization verbs for these yet...
2171 static hda_nid_t alc880_w810_dac_nids[3] = {
2172 /* front, rear/surround, clfe */
2176 /* fixed 6 channels */
2177 static struct hda_channel_mode alc880_w810_modes[1] = {
2181 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2182 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2188 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2189 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2190 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2199 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2200 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2204 static hda_nid_t alc880_z71v_dac_nids[1] = {
2207 #define ALC880_Z71V_HP_DAC 0x03
2209 /* fixed 2 channels */
2210 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2214 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2215 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2216 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2228 * ALC880 F1734 model
2230 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2231 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2234 static hda_nid_t alc880_f1734_dac_nids[1] = {
2237 #define ALC880_F1734_HP_DAC 0x02
2239 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2241 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2242 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2243 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2251 static struct hda_input_mux alc880_f1734_capture_source = {
2263 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2264 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2265 * Mic = 0x18, Line = 0x1a
2268 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2269 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2271 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2277 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2278 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2279 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2280 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2281 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2285 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2288 .name = "Channel Mode",
2289 .info = alc_ch_mode_info,
2290 .get = alc_ch_mode_get,
2291 .put = alc_ch_mode_put,
2297 * ALC880 ASUS W1V model
2299 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2300 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2301 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2304 /* additional mixers to alc880_asus_mixer */
2305 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2306 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2307 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2312 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2314 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2316 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2317 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2318 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2319 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2320 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2321 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2326 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2328 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2329 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2330 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2331 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2332 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2334 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2335 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2336 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2337 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2338 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2342 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2344 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2345 .name = "Channel Mode",
2346 .info = alc_ch_mode_info,
2347 .get = alc_ch_mode_get,
2348 .put = alc_ch_mode_put,
2353 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2354 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2355 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2356 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2357 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2359 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2360 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2361 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2363 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2367 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2368 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2369 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2371 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2378 * virtual master controls
2382 * slave controls for virtual master
2384 static const char *alc_slave_vols[] = {
2385 "Front Playback Volume",
2386 "Surround Playback Volume",
2387 "Center Playback Volume",
2388 "LFE Playback Volume",
2389 "Side Playback Volume",
2390 "Headphone Playback Volume",
2391 "Speaker Playback Volume",
2392 "Mono Playback Volume",
2393 "Line-Out Playback Volume",
2394 "PCM Playback Volume",
2398 static const char *alc_slave_sws[] = {
2399 "Front Playback Switch",
2400 "Surround Playback Switch",
2401 "Center Playback Switch",
2402 "LFE Playback Switch",
2403 "Side Playback Switch",
2404 "Headphone Playback Switch",
2405 "Speaker Playback Switch",
2406 "Mono Playback Switch",
2407 "IEC958 Playback Switch",
2408 "Line-Out Playback Switch",
2409 "PCM Playback Switch",
2414 * build control elements
2417 #define NID_MAPPING (-1)
2419 #define SUBDEV_SPEAKER_ (0 << 6)
2420 #define SUBDEV_HP_ (1 << 6)
2421 #define SUBDEV_LINE_ (2 << 6)
2422 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2423 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2424 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2426 static void alc_free_kctls(struct hda_codec *codec);
2428 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2429 /* additional beep mixers; the actual parameters are overwritten at build */
2430 static struct snd_kcontrol_new alc_beep_mixer[] = {
2431 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2432 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2437 static int alc_build_controls(struct hda_codec *codec)
2439 struct alc_spec *spec = codec->spec;
2440 struct snd_kcontrol *kctl;
2441 struct snd_kcontrol_new *knew;
2446 for (i = 0; i < spec->num_mixers; i++) {
2447 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2451 if (spec->cap_mixer) {
2452 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2456 if (spec->multiout.dig_out_nid) {
2457 err = snd_hda_create_spdif_out_ctls(codec,
2458 spec->multiout.dig_out_nid);
2461 if (!spec->no_analog) {
2462 err = snd_hda_create_spdif_share_sw(codec,
2466 spec->multiout.share_spdif = 1;
2469 if (spec->dig_in_nid) {
2470 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2475 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2476 /* create beep controls if needed */
2477 if (spec->beep_amp) {
2478 struct snd_kcontrol_new *knew;
2479 for (knew = alc_beep_mixer; knew->name; knew++) {
2480 struct snd_kcontrol *kctl;
2481 kctl = snd_ctl_new1(knew, codec);
2484 kctl->private_value = spec->beep_amp;
2485 err = snd_hda_ctl_add(codec, 0, kctl);
2492 /* if we have no master control, let's create it */
2493 if (!spec->no_analog &&
2494 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2495 unsigned int vmaster_tlv[4];
2496 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2497 HDA_OUTPUT, vmaster_tlv);
2498 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2499 vmaster_tlv, alc_slave_vols);
2503 if (!spec->no_analog &&
2504 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2505 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2506 NULL, alc_slave_sws);
2511 alc_free_kctls(codec); /* no longer needed */
2513 /* assign Capture Source enums to NID */
2514 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2516 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2517 for (i = 0; kctl && i < kctl->count; i++) {
2518 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids,
2519 spec->input_mux->num_items);
2523 if (spec->cap_mixer) {
2524 const char *kname = kctl ? kctl->id.name : NULL;
2525 for (knew = spec->cap_mixer; knew->name; knew++) {
2526 if (kname && strcmp(knew->name, kname) == 0)
2528 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2529 for (i = 0; kctl && i < kctl->count; i++) {
2530 err = snd_hda_add_nid(codec, kctl, i,
2538 /* other nid->control mapping */
2539 for (i = 0; i < spec->num_mixers; i++) {
2540 for (knew = spec->mixers[i]; knew->name; knew++) {
2541 if (knew->iface != NID_MAPPING)
2543 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2546 u = knew->subdevice;
2547 for (j = 0; j < 4; j++, u >>= 8) {
2552 case SUBDEV_SPEAKER_:
2553 nid = spec->autocfg.speaker_pins[nid];
2556 nid = spec->autocfg.line_out_pins[nid];
2559 nid = spec->autocfg.hp_pins[nid];
2564 err = snd_hda_add_nid(codec, kctl, 0, nid);
2568 u = knew->private_value;
2569 for (j = 0; j < 4; j++, u >>= 8) {
2573 err = snd_hda_add_nid(codec, kctl, 0, nid);
2584 * initialize the codec volumes, etc
2588 * generic initialization of ADC, input mixers and output mixers
2590 static struct hda_verb alc880_volume_init_verbs[] = {
2592 * Unmute ADC0-2 and set the default input to mic-in
2594 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2596 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2597 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2598 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2599 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2601 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2603 * Note: PASD motherboards uses the Line In 2 as the input for front
2606 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2607 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2608 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2609 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2610 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2611 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2612 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2613 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2616 * Set up output mixers (0x0c - 0x0f)
2618 /* set vol=0 to output mixers */
2619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2623 /* set up input amps for analog loopback */
2624 /* Amp Indices: DAC = 0, mixer = 1 */
2625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2632 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2638 * 3-stack pin configuration:
2639 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2641 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2643 * preset connection lists of input pins
2644 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2646 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2647 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2648 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2651 * Set pin mode and muting
2653 /* set front pin widgets 0x14 for output */
2654 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2655 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2656 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2657 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2658 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2659 /* Mic2 (as headphone out) for HP output */
2660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2661 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2662 /* Line In pin widget for input */
2663 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2664 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2665 /* Line2 (as front mic) pin widget for input and vref at 80% */
2666 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2667 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2668 /* CD pin widget for input */
2669 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2675 * 5-stack pin configuration:
2676 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2677 * line-in/side = 0x1a, f-mic = 0x1b
2679 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2681 * preset connection lists of input pins
2682 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2684 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2685 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2688 * Set pin mode and muting
2690 /* set pin widgets 0x14-0x17 for output */
2691 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2692 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2693 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2694 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2695 /* unmute pins for output (no gain on this amp) */
2696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2699 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2701 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2704 /* Mic2 (as headphone out) for HP output */
2705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2707 /* Line In pin widget for input */
2708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2710 /* Line2 (as front mic) pin widget for input and vref at 80% */
2711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2712 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2713 /* CD pin widget for input */
2714 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2720 * W810 pin configuration:
2721 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2723 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2724 /* hphone/speaker input selector: front DAC */
2725 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2735 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2741 * Z71V pin configuration:
2742 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2744 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2745 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2746 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2750 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2751 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2752 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2753 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2759 * 6-stack pin configuration:
2760 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2761 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2763 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2764 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2767 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2768 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2769 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2772 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2776 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2777 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2778 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2779 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2780 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2781 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2782 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2789 * Uniwill pin configuration:
2790 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2793 static struct hda_verb alc880_uniwill_init_verbs[] = {
2794 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2797 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2801 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2805 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2806 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2807 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2808 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2809 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2818 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2819 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2821 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2822 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2829 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2831 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2832 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2835 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2836 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2837 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2839 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2847 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2849 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2854 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2855 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2860 static struct hda_verb alc880_beep_init_verbs[] = {
2861 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2865 /* auto-toggle front mic */
2866 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2868 unsigned int present;
2871 present = snd_hda_jack_detect(codec, 0x18);
2872 bits = present ? HDA_AMP_MUTE : 0;
2873 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2876 static void alc880_uniwill_setup(struct hda_codec *codec)
2878 struct alc_spec *spec = codec->spec;
2880 spec->autocfg.hp_pins[0] = 0x14;
2881 spec->autocfg.speaker_pins[0] = 0x15;
2882 spec->autocfg.speaker_pins[0] = 0x16;
2885 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2887 alc_automute_amp(codec);
2888 alc880_uniwill_mic_automute(codec);
2891 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2894 /* Looks like the unsol event is incompatible with the standard
2895 * definition. 4bit tag is placed at 28 bit!
2897 switch (res >> 28) {
2898 case ALC880_MIC_EVENT:
2899 alc880_uniwill_mic_automute(codec);
2902 alc_automute_amp_unsol_event(codec, res);
2907 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2909 struct alc_spec *spec = codec->spec;
2911 spec->autocfg.hp_pins[0] = 0x14;
2912 spec->autocfg.speaker_pins[0] = 0x15;
2915 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2917 unsigned int present;
2919 present = snd_hda_codec_read(codec, 0x21, 0,
2920 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2921 present &= HDA_AMP_VOLMASK;
2922 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2923 HDA_AMP_VOLMASK, present);
2924 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2925 HDA_AMP_VOLMASK, present);
2928 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2931 /* Looks like the unsol event is incompatible with the standard
2932 * definition. 4bit tag is placed at 28 bit!
2934 if ((res >> 28) == ALC880_DCVOL_EVENT)
2935 alc880_uniwill_p53_dcvol_automute(codec);
2937 alc_automute_amp_unsol_event(codec, res);
2941 * F1734 pin configuration:
2942 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2944 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2945 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2946 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2947 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2948 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2949 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2951 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2952 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2953 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2954 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2956 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2957 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2958 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2959 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2960 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2961 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2962 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2963 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2964 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2966 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2967 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2973 * ASUS pin configuration:
2974 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2976 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2977 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2978 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2979 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2980 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2982 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2983 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2984 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2986 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2992 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2994 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3004 /* Enable GPIO mask and set output */
3005 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3006 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3007 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3009 /* Clevo m520g init */
3010 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3011 /* headphone output */
3012 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3014 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3015 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3017 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3018 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3021 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 /* Mic1 (rear panel) */
3023 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3024 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3025 /* Mic2 (front panel) */
3026 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3027 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3030 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3031 /* change to EAPD mode */
3032 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3033 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3038 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3039 /* change to EAPD mode */
3040 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3041 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3043 /* Headphone output */
3044 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3046 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3047 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3049 /* Line In pin widget for input */
3050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3051 /* CD pin widget for input */
3052 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3053 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3054 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3056 /* change to EAPD mode */
3057 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3058 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3064 * LG m1 express dual
3067 * Rear Line-In/Out (blue): 0x14
3068 * Build-in Mic-In: 0x15
3070 * HP-Out (green): 0x1b
3071 * Mic-In/Out (red): 0x19
3075 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3076 static hda_nid_t alc880_lg_dac_nids[3] = {
3080 /* seems analog CD is not working */
3081 static struct hda_input_mux alc880_lg_capture_source = {
3086 { "Internal Mic", 0x6 },
3090 /* 2,4,6 channel modes */
3091 static struct hda_verb alc880_lg_ch2_init[] = {
3092 /* set line-in and mic-in to input */
3093 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3098 static struct hda_verb alc880_lg_ch4_init[] = {
3099 /* set line-in to out and mic-in to input */
3100 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3101 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3105 static struct hda_verb alc880_lg_ch6_init[] = {
3106 /* set line-in and mic-in to output */
3107 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3108 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3112 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3113 { 2, alc880_lg_ch2_init },
3114 { 4, alc880_lg_ch4_init },
3115 { 6, alc880_lg_ch6_init },
3118 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3119 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3120 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3122 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3123 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3124 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3125 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3126 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3131 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3132 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3134 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3135 .name = "Channel Mode",
3136 .info = alc_ch_mode_info,
3137 .get = alc_ch_mode_get,
3138 .put = alc_ch_mode_put,
3143 static struct hda_verb alc880_lg_init_verbs[] = {
3144 /* set capture source to mic-in */
3145 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3146 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3147 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3148 /* mute all amp mixer inputs */
3149 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3150 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3151 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3152 /* line-in to input */
3153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3154 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3159 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3160 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3161 /* mic-in to input */
3162 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3163 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3164 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3166 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3167 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3168 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3170 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3174 /* toggle speaker-output according to the hp-jack state */
3175 static void alc880_lg_setup(struct hda_codec *codec)
3177 struct alc_spec *spec = codec->spec;
3179 spec->autocfg.hp_pins[0] = 0x1b;
3180 spec->autocfg.speaker_pins[0] = 0x17;
3189 * Built-in Mic-In: 0x19
3195 static struct hda_input_mux alc880_lg_lw_capture_source = {
3199 { "Internal Mic", 0x1 },
3204 #define alc880_lg_lw_modes alc880_threestack_modes
3206 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3209 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3210 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3211 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3212 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3213 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3214 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3219 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3220 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3223 .name = "Channel Mode",
3224 .info = alc_ch_mode_info,
3225 .get = alc_ch_mode_get,
3226 .put = alc_ch_mode_put,
3231 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3232 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3233 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3234 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3236 /* set capture source to mic-in */
3237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3240 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3242 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3243 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3245 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3246 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3247 /* mic-in to input */
3248 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3251 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3252 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3254 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3258 /* toggle speaker-output according to the hp-jack state */
3259 static void alc880_lg_lw_setup(struct hda_codec *codec)
3261 struct alc_spec *spec = codec->spec;
3263 spec->autocfg.hp_pins[0] = 0x1b;
3264 spec->autocfg.speaker_pins[0] = 0x14;
3267 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3268 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3269 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3270 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3272 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3273 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3277 static struct hda_input_mux alc880_medion_rim_capture_source = {
3281 { "Internal Mic", 0x1 },
3285 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3286 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3288 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3289 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3292 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3294 /* Mic2 (as headphone out) for HP output */
3295 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3296 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3297 /* Internal Speaker */
3298 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3299 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3301 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3302 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3304 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3308 /* toggle speaker-output according to the hp-jack state */
3309 static void alc880_medion_rim_automute(struct hda_codec *codec)
3311 struct alc_spec *spec = codec->spec;
3312 alc_automute_amp(codec);
3314 if (spec->jack_present)
3315 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3317 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3320 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3323 /* Looks like the unsol event is incompatible with the standard
3324 * definition. 4bit tag is placed at 28 bit!
3326 if ((res >> 28) == ALC880_HP_EVENT)
3327 alc880_medion_rim_automute(codec);
3330 static void alc880_medion_rim_setup(struct hda_codec *codec)
3332 struct alc_spec *spec = codec->spec;
3334 spec->autocfg.hp_pins[0] = 0x14;
3335 spec->autocfg.speaker_pins[0] = 0x1b;
3338 #ifdef CONFIG_SND_HDA_POWER_SAVE
3339 static struct hda_amp_list alc880_loopbacks[] = {
3340 { 0x0b, HDA_INPUT, 0 },
3341 { 0x0b, HDA_INPUT, 1 },
3342 { 0x0b, HDA_INPUT, 2 },
3343 { 0x0b, HDA_INPUT, 3 },
3344 { 0x0b, HDA_INPUT, 4 },
3348 static struct hda_amp_list alc880_lg_loopbacks[] = {
3349 { 0x0b, HDA_INPUT, 1 },
3350 { 0x0b, HDA_INPUT, 6 },
3351 { 0x0b, HDA_INPUT, 7 },
3360 static int alc_init(struct hda_codec *codec)
3362 struct alc_spec *spec = codec->spec;
3366 alc_auto_init_amp(codec, spec->init_amp);
3368 for (i = 0; i < spec->num_init_verbs; i++)
3369 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3371 if (spec->init_hook)
3372 spec->init_hook(codec);
3377 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3379 struct alc_spec *spec = codec->spec;
3381 if (spec->unsol_event)
3382 spec->unsol_event(codec, res);
3385 #ifdef CONFIG_SND_HDA_POWER_SAVE
3386 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3388 struct alc_spec *spec = codec->spec;
3389 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3394 * Analog playback callbacks
3396 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3397 struct hda_codec *codec,
3398 struct snd_pcm_substream *substream)
3400 struct alc_spec *spec = codec->spec;
3401 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3405 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3406 struct hda_codec *codec,
3407 unsigned int stream_tag,
3408 unsigned int format,
3409 struct snd_pcm_substream *substream)
3411 struct alc_spec *spec = codec->spec;
3412 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3413 stream_tag, format, substream);
3416 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3417 struct hda_codec *codec,
3418 struct snd_pcm_substream *substream)
3420 struct alc_spec *spec = codec->spec;
3421 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3427 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3428 struct hda_codec *codec,
3429 struct snd_pcm_substream *substream)
3431 struct alc_spec *spec = codec->spec;
3432 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3435 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3436 struct hda_codec *codec,
3437 unsigned int stream_tag,
3438 unsigned int format,
3439 struct snd_pcm_substream *substream)
3441 struct alc_spec *spec = codec->spec;
3442 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3443 stream_tag, format, substream);
3446 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3447 struct hda_codec *codec,
3448 struct snd_pcm_substream *substream)
3450 struct alc_spec *spec = codec->spec;
3451 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3454 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3455 struct hda_codec *codec,
3456 struct snd_pcm_substream *substream)
3458 struct alc_spec *spec = codec->spec;
3459 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3465 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3466 struct hda_codec *codec,
3467 unsigned int stream_tag,
3468 unsigned int format,
3469 struct snd_pcm_substream *substream)
3471 struct alc_spec *spec = codec->spec;
3473 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3474 stream_tag, 0, format);
3478 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3479 struct hda_codec *codec,
3480 struct snd_pcm_substream *substream)
3482 struct alc_spec *spec = codec->spec;
3484 snd_hda_codec_cleanup_stream(codec,
3485 spec->adc_nids[substream->number + 1]);
3492 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3496 /* NID is set in alc_build_pcms */
3498 .open = alc880_playback_pcm_open,
3499 .prepare = alc880_playback_pcm_prepare,
3500 .cleanup = alc880_playback_pcm_cleanup
3504 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3508 /* NID is set in alc_build_pcms */
3511 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3515 /* NID is set in alc_build_pcms */
3518 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3519 .substreams = 2, /* can be overridden */
3522 /* NID is set in alc_build_pcms */
3524 .prepare = alc880_alt_capture_pcm_prepare,
3525 .cleanup = alc880_alt_capture_pcm_cleanup
3529 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3533 /* NID is set in alc_build_pcms */
3535 .open = alc880_dig_playback_pcm_open,
3536 .close = alc880_dig_playback_pcm_close,
3537 .prepare = alc880_dig_playback_pcm_prepare,
3538 .cleanup = alc880_dig_playback_pcm_cleanup
3542 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3546 /* NID is set in alc_build_pcms */
3549 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3550 static struct hda_pcm_stream alc_pcm_null_stream = {
3556 static int alc_build_pcms(struct hda_codec *codec)
3558 struct alc_spec *spec = codec->spec;
3559 struct hda_pcm *info = spec->pcm_rec;
3562 codec->num_pcms = 1;
3563 codec->pcm_info = info;
3565 if (spec->no_analog)
3568 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3569 "%s Analog", codec->chip_name);
3570 info->name = spec->stream_name_analog;
3572 if (spec->stream_analog_playback) {
3573 if (snd_BUG_ON(!spec->multiout.dac_nids))
3575 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3576 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3578 if (spec->stream_analog_capture) {
3579 if (snd_BUG_ON(!spec->adc_nids))
3581 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3582 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3585 if (spec->channel_mode) {
3586 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3587 for (i = 0; i < spec->num_channel_mode; i++) {
3588 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3589 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3595 /* SPDIF for stream index #1 */
3596 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3597 snprintf(spec->stream_name_digital,
3598 sizeof(spec->stream_name_digital),
3599 "%s Digital", codec->chip_name);
3600 codec->num_pcms = 2;
3601 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3602 info = spec->pcm_rec + 1;
3603 info->name = spec->stream_name_digital;
3604 if (spec->dig_out_type)
3605 info->pcm_type = spec->dig_out_type;
3607 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3608 if (spec->multiout.dig_out_nid &&
3609 spec->stream_digital_playback) {
3610 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3613 if (spec->dig_in_nid &&
3614 spec->stream_digital_capture) {
3615 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3616 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3618 /* FIXME: do we need this for all Realtek codec models? */
3619 codec->spdif_status_reset = 1;
3622 if (spec->no_analog)
3625 /* If the use of more than one ADC is requested for the current
3626 * model, configure a second analog capture-only PCM.
3628 /* Additional Analaog capture for index #2 */
3629 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3630 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3631 codec->num_pcms = 3;
3632 info = spec->pcm_rec + 2;
3633 info->name = spec->stream_name_analog;
3634 if (spec->alt_dac_nid) {
3635 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3636 *spec->stream_analog_alt_playback;
3637 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3640 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3641 alc_pcm_null_stream;
3642 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3644 if (spec->num_adc_nids > 1) {
3645 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3646 *spec->stream_analog_alt_capture;
3647 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3649 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3650 spec->num_adc_nids - 1;
3652 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3653 alc_pcm_null_stream;
3654 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3661 static void alc_free_kctls(struct hda_codec *codec)
3663 struct alc_spec *spec = codec->spec;
3665 if (spec->kctls.list) {
3666 struct snd_kcontrol_new *kctl = spec->kctls.list;
3668 for (i = 0; i < spec->kctls.used; i++)
3669 kfree(kctl[i].name);
3671 snd_array_free(&spec->kctls);
3674 static void alc_free(struct hda_codec *codec)
3676 struct alc_spec *spec = codec->spec;
3681 alc_free_kctls(codec);
3683 snd_hda_detach_beep_device(codec);
3686 #ifdef SND_HDA_NEEDS_RESUME
3687 static int alc_resume(struct hda_codec *codec)
3689 codec->patch_ops.init(codec);
3690 snd_hda_codec_resume_amp(codec);
3691 snd_hda_codec_resume_cache(codec);
3698 static struct hda_codec_ops alc_patch_ops = {
3699 .build_controls = alc_build_controls,
3700 .build_pcms = alc_build_pcms,
3703 .unsol_event = alc_unsol_event,
3704 #ifdef SND_HDA_NEEDS_RESUME
3705 .resume = alc_resume,
3707 #ifdef CONFIG_SND_HDA_POWER_SAVE
3708 .check_power_status = alc_check_power_status,
3714 * Test configuration for debugging
3716 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3719 #ifdef CONFIG_SND_DEBUG
3720 static hda_nid_t alc880_test_dac_nids[4] = {
3721 0x02, 0x03, 0x04, 0x05
3724 static struct hda_input_mux alc880_test_capture_source = {
3733 { "Surround", 0x6 },
3737 static struct hda_channel_mode alc880_test_modes[4] = {
3744 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3745 struct snd_ctl_elem_info *uinfo)
3747 static char *texts[] = {
3748 "N/A", "Line Out", "HP Out",
3749 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3751 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3753 uinfo->value.enumerated.items = 8;
3754 if (uinfo->value.enumerated.item >= 8)
3755 uinfo->value.enumerated.item = 7;
3756 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3760 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3761 struct snd_ctl_elem_value *ucontrol)
3763 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3764 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3765 unsigned int pin_ctl, item = 0;
3767 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3768 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3769 if (pin_ctl & AC_PINCTL_OUT_EN) {
3770 if (pin_ctl & AC_PINCTL_HP_EN)
3774 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3775 switch (pin_ctl & AC_PINCTL_VREFEN) {
3776 case AC_PINCTL_VREF_HIZ: item = 3; break;
3777 case AC_PINCTL_VREF_50: item = 4; break;
3778 case AC_PINCTL_VREF_GRD: item = 5; break;
3779 case AC_PINCTL_VREF_80: item = 6; break;
3780 case AC_PINCTL_VREF_100: item = 7; break;
3783 ucontrol->value.enumerated.item[0] = item;
3787 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3788 struct snd_ctl_elem_value *ucontrol)
3790 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3791 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3792 static unsigned int ctls[] = {
3793 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3794 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3795 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3796 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3797 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3798 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3800 unsigned int old_ctl, new_ctl;
3802 old_ctl = snd_hda_codec_read(codec, nid, 0,
3803 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3804 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3805 if (old_ctl != new_ctl) {
3807 snd_hda_codec_write_cache(codec, nid, 0,
3808 AC_VERB_SET_PIN_WIDGET_CONTROL,
3810 val = ucontrol->value.enumerated.item[0] >= 3 ?
3812 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3819 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3820 struct snd_ctl_elem_info *uinfo)
3822 static char *texts[] = {
3823 "Front", "Surround", "CLFE", "Side"
3825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3827 uinfo->value.enumerated.items = 4;
3828 if (uinfo->value.enumerated.item >= 4)
3829 uinfo->value.enumerated.item = 3;
3830 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3834 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3835 struct snd_ctl_elem_value *ucontrol)
3837 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3838 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3841 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3842 ucontrol->value.enumerated.item[0] = sel & 3;
3846 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3847 struct snd_ctl_elem_value *ucontrol)
3849 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3850 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3853 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3854 if (ucontrol->value.enumerated.item[0] != sel) {
3855 sel = ucontrol->value.enumerated.item[0] & 3;
3856 snd_hda_codec_write_cache(codec, nid, 0,
3857 AC_VERB_SET_CONNECT_SEL, sel);
3863 #define PIN_CTL_TEST(xname,nid) { \
3864 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3866 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3867 .info = alc_test_pin_ctl_info, \
3868 .get = alc_test_pin_ctl_get, \
3869 .put = alc_test_pin_ctl_put, \
3870 .private_value = nid \
3873 #define PIN_SRC_TEST(xname,nid) { \
3874 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3876 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3877 .info = alc_test_pin_src_info, \
3878 .get = alc_test_pin_src_get, \
3879 .put = alc_test_pin_src_put, \
3880 .private_value = nid \
3883 static struct snd_kcontrol_new alc880_test_mixer[] = {
3884 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3885 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3886 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3887 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3888 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3889 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3890 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3891 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3892 PIN_CTL_TEST("Front Pin Mode", 0x14),
3893 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3894 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3895 PIN_CTL_TEST("Side Pin Mode", 0x17),
3896 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3897 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3898 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3899 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3900 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3901 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3902 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3903 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3904 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3905 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3906 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3907 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3908 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3909 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3910 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3911 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3912 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3913 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3916 .name = "Channel Mode",
3917 .info = alc_ch_mode_info,
3918 .get = alc_ch_mode_get,
3919 .put = alc_ch_mode_put,
3924 static struct hda_verb alc880_test_init_verbs[] = {
3925 /* Unmute inputs of 0x0c - 0x0f */
3926 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3927 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3928 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3929 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3930 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3931 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3932 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3933 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3934 /* Vol output for 0x0c-0x0f */
3935 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3936 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3937 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3938 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3939 /* Set output pins 0x14-0x17 */
3940 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3942 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3943 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3944 /* Unmute output pins 0x14-0x17 */
3945 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3946 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3947 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3948 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3949 /* Set input pins 0x18-0x1c */
3950 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3951 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3952 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3953 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3954 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3955 /* Mute input pins 0x18-0x1b */
3956 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3957 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3958 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3959 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3961 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3962 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3963 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3964 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3965 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3966 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3967 /* Analog input/passthru */
3968 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3969 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3970 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3971 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3972 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3980 static const char *alc880_models[ALC880_MODEL_LAST] = {
3981 [ALC880_3ST] = "3stack",
3982 [ALC880_TCL_S700] = "tcl",
3983 [ALC880_3ST_DIG] = "3stack-digout",
3984 [ALC880_CLEVO] = "clevo",
3985 [ALC880_5ST] = "5stack",
3986 [ALC880_5ST_DIG] = "5stack-digout",
3987 [ALC880_W810] = "w810",
3988 [ALC880_Z71V] = "z71v",
3989 [ALC880_6ST] = "6stack",
3990 [ALC880_6ST_DIG] = "6stack-digout",
3991 [ALC880_ASUS] = "asus",
3992 [ALC880_ASUS_W1V] = "asus-w1v",
3993 [ALC880_ASUS_DIG] = "asus-dig",
3994 [ALC880_ASUS_DIG2] = "asus-dig2",
3995 [ALC880_UNIWILL_DIG] = "uniwill",
3996 [ALC880_UNIWILL_P53] = "uniwill-p53",
3997 [ALC880_FUJITSU] = "fujitsu",
3998 [ALC880_F1734] = "F1734",
4000 [ALC880_LG_LW] = "lg-lw",
4001 [ALC880_MEDION_RIM] = "medion",
4002 #ifdef CONFIG_SND_DEBUG
4003 [ALC880_TEST] = "test",
4005 [ALC880_AUTO] = "auto",
4008 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4009 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4010 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4011 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4012 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4013 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4014 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4015 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4016 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4017 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4018 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4019 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4020 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4021 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4022 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4023 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4024 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4025 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4026 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4027 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4028 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4029 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4030 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4031 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4032 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4033 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4034 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4035 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4036 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4037 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4038 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4039 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4040 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4041 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4042 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4043 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4044 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4045 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4046 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4047 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4048 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4049 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4050 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4051 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4052 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4053 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4054 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4055 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4056 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4057 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4058 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4059 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4060 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4061 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4062 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4063 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4064 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4065 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4066 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4067 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4068 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4069 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4070 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4071 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4072 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4073 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4074 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4075 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4076 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4078 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4079 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4080 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4085 * ALC880 codec presets
4087 static struct alc_config_preset alc880_presets[] = {
4089 .mixers = { alc880_three_stack_mixer },
4090 .init_verbs = { alc880_volume_init_verbs,
4091 alc880_pin_3stack_init_verbs },
4092 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4093 .dac_nids = alc880_dac_nids,
4094 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4095 .channel_mode = alc880_threestack_modes,
4097 .input_mux = &alc880_capture_source,
4099 [ALC880_3ST_DIG] = {
4100 .mixers = { alc880_three_stack_mixer },
4101 .init_verbs = { alc880_volume_init_verbs,
4102 alc880_pin_3stack_init_verbs },
4103 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4104 .dac_nids = alc880_dac_nids,
4105 .dig_out_nid = ALC880_DIGOUT_NID,
4106 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4107 .channel_mode = alc880_threestack_modes,
4109 .input_mux = &alc880_capture_source,
4111 [ALC880_TCL_S700] = {
4112 .mixers = { alc880_tcl_s700_mixer },
4113 .init_verbs = { alc880_volume_init_verbs,
4114 alc880_pin_tcl_S700_init_verbs,
4115 alc880_gpio2_init_verbs },
4116 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4117 .dac_nids = alc880_dac_nids,
4118 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4119 .num_adc_nids = 1, /* single ADC */
4121 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4122 .channel_mode = alc880_2_jack_modes,
4123 .input_mux = &alc880_capture_source,
4126 .mixers = { alc880_three_stack_mixer,
4127 alc880_five_stack_mixer},
4128 .init_verbs = { alc880_volume_init_verbs,
4129 alc880_pin_5stack_init_verbs },
4130 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4131 .dac_nids = alc880_dac_nids,
4132 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4133 .channel_mode = alc880_fivestack_modes,
4134 .input_mux = &alc880_capture_source,
4136 [ALC880_5ST_DIG] = {
4137 .mixers = { alc880_three_stack_mixer,
4138 alc880_five_stack_mixer },
4139 .init_verbs = { alc880_volume_init_verbs,
4140 alc880_pin_5stack_init_verbs },
4141 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4142 .dac_nids = alc880_dac_nids,
4143 .dig_out_nid = ALC880_DIGOUT_NID,
4144 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4145 .channel_mode = alc880_fivestack_modes,
4146 .input_mux = &alc880_capture_source,
4149 .mixers = { alc880_six_stack_mixer },
4150 .init_verbs = { alc880_volume_init_verbs,
4151 alc880_pin_6stack_init_verbs },
4152 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4153 .dac_nids = alc880_6st_dac_nids,
4154 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4155 .channel_mode = alc880_sixstack_modes,
4156 .input_mux = &alc880_6stack_capture_source,
4158 [ALC880_6ST_DIG] = {
4159 .mixers = { alc880_six_stack_mixer },
4160 .init_verbs = { alc880_volume_init_verbs,
4161 alc880_pin_6stack_init_verbs },
4162 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4163 .dac_nids = alc880_6st_dac_nids,
4164 .dig_out_nid = ALC880_DIGOUT_NID,
4165 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4166 .channel_mode = alc880_sixstack_modes,
4167 .input_mux = &alc880_6stack_capture_source,
4170 .mixers = { alc880_w810_base_mixer },
4171 .init_verbs = { alc880_volume_init_verbs,
4172 alc880_pin_w810_init_verbs,
4173 alc880_gpio2_init_verbs },
4174 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4175 .dac_nids = alc880_w810_dac_nids,
4176 .dig_out_nid = ALC880_DIGOUT_NID,
4177 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4178 .channel_mode = alc880_w810_modes,
4179 .input_mux = &alc880_capture_source,
4182 .mixers = { alc880_z71v_mixer },
4183 .init_verbs = { alc880_volume_init_verbs,
4184 alc880_pin_z71v_init_verbs },
4185 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4186 .dac_nids = alc880_z71v_dac_nids,
4187 .dig_out_nid = ALC880_DIGOUT_NID,
4189 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4190 .channel_mode = alc880_2_jack_modes,
4191 .input_mux = &alc880_capture_source,
4194 .mixers = { alc880_f1734_mixer },
4195 .init_verbs = { alc880_volume_init_verbs,
4196 alc880_pin_f1734_init_verbs },
4197 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4198 .dac_nids = alc880_f1734_dac_nids,
4200 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4201 .channel_mode = alc880_2_jack_modes,
4202 .input_mux = &alc880_f1734_capture_source,
4203 .unsol_event = alc880_uniwill_p53_unsol_event,
4204 .setup = alc880_uniwill_p53_setup,
4205 .init_hook = alc_automute_amp,
4208 .mixers = { alc880_asus_mixer },
4209 .init_verbs = { alc880_volume_init_verbs,
4210 alc880_pin_asus_init_verbs,
4211 alc880_gpio1_init_verbs },
4212 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4213 .dac_nids = alc880_asus_dac_nids,
4214 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4215 .channel_mode = alc880_asus_modes,
4217 .input_mux = &alc880_capture_source,
4219 [ALC880_ASUS_DIG] = {
4220 .mixers = { alc880_asus_mixer },
4221 .init_verbs = { alc880_volume_init_verbs,
4222 alc880_pin_asus_init_verbs,
4223 alc880_gpio1_init_verbs },
4224 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4225 .dac_nids = alc880_asus_dac_nids,
4226 .dig_out_nid = ALC880_DIGOUT_NID,
4227 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4228 .channel_mode = alc880_asus_modes,
4230 .input_mux = &alc880_capture_source,
4232 [ALC880_ASUS_DIG2] = {
4233 .mixers = { alc880_asus_mixer },
4234 .init_verbs = { alc880_volume_init_verbs,
4235 alc880_pin_asus_init_verbs,
4236 alc880_gpio2_init_verbs }, /* use GPIO2 */
4237 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4238 .dac_nids = alc880_asus_dac_nids,
4239 .dig_out_nid = ALC880_DIGOUT_NID,
4240 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4241 .channel_mode = alc880_asus_modes,
4243 .input_mux = &alc880_capture_source,
4245 [ALC880_ASUS_W1V] = {
4246 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4247 .init_verbs = { alc880_volume_init_verbs,
4248 alc880_pin_asus_init_verbs,
4249 alc880_gpio1_init_verbs },
4250 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4251 .dac_nids = alc880_asus_dac_nids,
4252 .dig_out_nid = ALC880_DIGOUT_NID,
4253 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4254 .channel_mode = alc880_asus_modes,
4256 .input_mux = &alc880_capture_source,
4258 [ALC880_UNIWILL_DIG] = {
4259 .mixers = { alc880_asus_mixer },
4260 .init_verbs = { alc880_volume_init_verbs,
4261 alc880_pin_asus_init_verbs },
4262 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4263 .dac_nids = alc880_asus_dac_nids,
4264 .dig_out_nid = ALC880_DIGOUT_NID,
4265 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4266 .channel_mode = alc880_asus_modes,
4268 .input_mux = &alc880_capture_source,
4270 [ALC880_UNIWILL] = {
4271 .mixers = { alc880_uniwill_mixer },
4272 .init_verbs = { alc880_volume_init_verbs,
4273 alc880_uniwill_init_verbs },
4274 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4275 .dac_nids = alc880_asus_dac_nids,
4276 .dig_out_nid = ALC880_DIGOUT_NID,
4277 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4278 .channel_mode = alc880_threestack_modes,
4280 .input_mux = &alc880_capture_source,
4281 .unsol_event = alc880_uniwill_unsol_event,
4282 .setup = alc880_uniwill_setup,
4283 .init_hook = alc880_uniwill_init_hook,
4285 [ALC880_UNIWILL_P53] = {
4286 .mixers = { alc880_uniwill_p53_mixer },
4287 .init_verbs = { alc880_volume_init_verbs,
4288 alc880_uniwill_p53_init_verbs },
4289 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4290 .dac_nids = alc880_asus_dac_nids,
4291 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4292 .channel_mode = alc880_threestack_modes,
4293 .input_mux = &alc880_capture_source,
4294 .unsol_event = alc880_uniwill_p53_unsol_event,
4295 .setup = alc880_uniwill_p53_setup,
4296 .init_hook = alc_automute_amp,
4298 [ALC880_FUJITSU] = {
4299 .mixers = { alc880_fujitsu_mixer },
4300 .init_verbs = { alc880_volume_init_verbs,
4301 alc880_uniwill_p53_init_verbs,
4302 alc880_beep_init_verbs },
4303 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4304 .dac_nids = alc880_dac_nids,
4305 .dig_out_nid = ALC880_DIGOUT_NID,
4306 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4307 .channel_mode = alc880_2_jack_modes,
4308 .input_mux = &alc880_capture_source,
4309 .unsol_event = alc880_uniwill_p53_unsol_event,
4310 .setup = alc880_uniwill_p53_setup,
4311 .init_hook = alc_automute_amp,
4314 .mixers = { alc880_three_stack_mixer },
4315 .init_verbs = { alc880_volume_init_verbs,
4316 alc880_pin_clevo_init_verbs },
4317 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4318 .dac_nids = alc880_dac_nids,
4320 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4321 .channel_mode = alc880_threestack_modes,
4323 .input_mux = &alc880_capture_source,
4326 .mixers = { alc880_lg_mixer },
4327 .init_verbs = { alc880_volume_init_verbs,
4328 alc880_lg_init_verbs },
4329 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4330 .dac_nids = alc880_lg_dac_nids,
4331 .dig_out_nid = ALC880_DIGOUT_NID,
4332 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4333 .channel_mode = alc880_lg_ch_modes,
4335 .input_mux = &alc880_lg_capture_source,
4336 .unsol_event = alc_automute_amp_unsol_event,
4337 .setup = alc880_lg_setup,
4338 .init_hook = alc_automute_amp,
4339 #ifdef CONFIG_SND_HDA_POWER_SAVE
4340 .loopbacks = alc880_lg_loopbacks,
4344 .mixers = { alc880_lg_lw_mixer },
4345 .init_verbs = { alc880_volume_init_verbs,
4346 alc880_lg_lw_init_verbs },
4347 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4348 .dac_nids = alc880_dac_nids,
4349 .dig_out_nid = ALC880_DIGOUT_NID,
4350 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4351 .channel_mode = alc880_lg_lw_modes,
4352 .input_mux = &alc880_lg_lw_capture_source,
4353 .unsol_event = alc_automute_amp_unsol_event,
4354 .setup = alc880_lg_lw_setup,
4355 .init_hook = alc_automute_amp,
4357 [ALC880_MEDION_RIM] = {
4358 .mixers = { alc880_medion_rim_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_medion_rim_init_verbs,
4361 alc_gpio2_init_verbs },
4362 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4363 .dac_nids = alc880_dac_nids,
4364 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4366 .channel_mode = alc880_2_jack_modes,
4367 .input_mux = &alc880_medion_rim_capture_source,
4368 .unsol_event = alc880_medion_rim_unsol_event,
4369 .setup = alc880_medion_rim_setup,
4370 .init_hook = alc880_medion_rim_automute,
4372 #ifdef CONFIG_SND_DEBUG
4374 .mixers = { alc880_test_mixer },
4375 .init_verbs = { alc880_test_init_verbs },
4376 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4377 .dac_nids = alc880_test_dac_nids,
4378 .dig_out_nid = ALC880_DIGOUT_NID,
4379 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4380 .channel_mode = alc880_test_modes,
4381 .input_mux = &alc880_test_capture_source,
4387 * Automatic parse of I/O pins from the BIOS configuration
4392 ALC_CTL_WIDGET_MUTE,
4395 static struct snd_kcontrol_new alc880_control_templates[] = {
4396 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4397 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4398 HDA_BIND_MUTE(NULL, 0, 0, 0),
4401 /* add dynamic controls */
4402 static int add_control(struct alc_spec *spec, int type, const char *name,
4405 struct snd_kcontrol_new *knew;
4407 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4408 knew = snd_array_new(&spec->kctls);
4411 *knew = alc880_control_templates[type];
4412 knew->name = kstrdup(name, GFP_KERNEL);
4415 if (get_amp_nid_(val))
4416 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4417 knew->private_value = val;
4421 static int add_control_with_pfx(struct alc_spec *spec, int type,
4422 const char *pfx, const char *dir,
4423 const char *sfx, unsigned long val)
4426 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4427 return add_control(spec, type, name, val);
4430 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4431 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4432 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4433 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4435 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4436 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4437 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4438 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4439 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4440 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4441 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4442 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4443 #define ALC880_PIN_CD_NID 0x1c
4445 /* fill in the dac_nids table from the parsed pin configuration */
4446 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4447 const struct auto_pin_cfg *cfg)
4453 memset(assigned, 0, sizeof(assigned));
4454 spec->multiout.dac_nids = spec->private_dac_nids;
4456 /* check the pins hardwired to audio widget */
4457 for (i = 0; i < cfg->line_outs; i++) {
4458 nid = cfg->line_out_pins[i];
4459 if (alc880_is_fixed_pin(nid)) {
4460 int idx = alc880_fixed_pin_idx(nid);
4461 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4465 /* left pins can be connect to any audio widget */
4466 for (i = 0; i < cfg->line_outs; i++) {
4467 nid = cfg->line_out_pins[i];
4468 if (alc880_is_fixed_pin(nid))
4470 /* search for an empty channel */
4471 for (j = 0; j < cfg->line_outs; j++) {
4473 spec->multiout.dac_nids[i] =
4474 alc880_idx_to_dac(j);
4480 spec->multiout.num_dacs = cfg->line_outs;
4484 /* add playback controls from the parsed DAC table */
4485 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4486 const struct auto_pin_cfg *cfg)
4488 static const char *chname[4] = {
4489 "Front", "Surround", NULL /*CLFE*/, "Side"
4494 for (i = 0; i < cfg->line_outs; i++) {
4495 if (!spec->multiout.dac_nids[i])
4497 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4500 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4502 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4506 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4508 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4512 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4514 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4518 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4520 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4526 if (cfg->line_outs == 1 &&
4527 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4531 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4532 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4536 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4537 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4546 /* add playback controls for speaker and HP outputs */
4547 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4556 if (alc880_is_fixed_pin(pin)) {
4557 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4558 /* specify the DAC as the extra output */
4559 if (!spec->multiout.hp_nid)
4560 spec->multiout.hp_nid = nid;
4562 spec->multiout.extra_out_nid[0] = nid;
4563 /* control HP volume/switch on the output mixer amp */
4564 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4566 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4569 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4570 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4573 } else if (alc880_is_multi_pin(pin)) {
4574 /* set manual connection */
4575 /* we have only a switch on HP-out PIN */
4576 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4577 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4584 /* create input playback/capture controls for the given pin */
4585 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4586 const char *ctlname,
4587 int idx, hda_nid_t mix_nid)
4591 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4592 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4595 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4596 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4602 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4604 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4605 return (pincap & AC_PINCAP_IN) != 0;
4608 /* create playback/capture controls for input pins */
4609 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4610 const struct auto_pin_cfg *cfg,
4612 hda_nid_t cap1, hda_nid_t cap2)
4614 struct alc_spec *spec = codec->spec;
4615 struct hda_input_mux *imux = &spec->private_imux[0];
4618 for (i = 0; i < AUTO_PIN_LAST; i++) {
4621 pin = cfg->input_pins[i];
4622 if (!alc_is_input_pin(codec, pin))
4626 idx = get_connection_index(codec, mixer, pin);
4628 err = new_analog_input(spec, pin,
4629 auto_pin_cfg_labels[i],
4638 idx = get_connection_index(codec, cap1, pin);
4639 if (idx < 0 && cap2)
4640 idx = get_connection_index(codec, cap2, pin);
4642 imux->items[imux->num_items].label =
4643 auto_pin_cfg_labels[i];
4644 imux->items[imux->num_items].index = idx;
4651 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4652 const struct auto_pin_cfg *cfg)
4654 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4657 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4658 unsigned int pin_type)
4660 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4663 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4667 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4668 hda_nid_t nid, int pin_type,
4671 alc_set_pin_output(codec, nid, pin_type);
4672 /* need the manual connection? */
4673 if (alc880_is_multi_pin(nid)) {
4674 struct alc_spec *spec = codec->spec;
4675 int idx = alc880_multi_pin_idx(nid);
4676 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4677 AC_VERB_SET_CONNECT_SEL,
4678 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4682 static int get_pin_type(int line_out_type)
4684 if (line_out_type == AUTO_PIN_HP_OUT)
4690 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4692 struct alc_spec *spec = codec->spec;
4695 for (i = 0; i < spec->autocfg.line_outs; i++) {
4696 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4697 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4698 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4702 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4704 struct alc_spec *spec = codec->spec;
4707 pin = spec->autocfg.speaker_pins[0];
4708 if (pin) /* connect to front */
4709 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4710 pin = spec->autocfg.hp_pins[0];
4711 if (pin) /* connect to front */
4712 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4715 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4717 struct alc_spec *spec = codec->spec;
4720 for (i = 0; i < AUTO_PIN_LAST; i++) {
4721 hda_nid_t nid = spec->autocfg.input_pins[i];
4722 if (alc_is_input_pin(codec, nid)) {
4723 alc_set_input_pin(codec, nid, i);
4724 if (nid != ALC880_PIN_CD_NID &&
4725 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4726 snd_hda_codec_write(codec, nid, 0,
4727 AC_VERB_SET_AMP_GAIN_MUTE,
4733 /* parse the BIOS configuration and set up the alc_spec */
4734 /* return 1 if successful, 0 if the proper config is not found,
4735 * or a negative error code
4737 static int alc880_parse_auto_config(struct hda_codec *codec)
4739 struct alc_spec *spec = codec->spec;
4741 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4743 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4747 if (!spec->autocfg.line_outs)
4748 return 0; /* can't find valid BIOS pin config */
4750 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4753 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4756 err = alc880_auto_create_extra_out(spec,
4757 spec->autocfg.speaker_pins[0],
4761 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4765 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4769 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4771 /* check multiple SPDIF-out (for recent codecs) */
4772 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4774 err = snd_hda_get_connections(codec,
4775 spec->autocfg.dig_out_pins[i],
4780 spec->multiout.dig_out_nid = dig_nid;
4782 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4783 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4785 spec->slave_dig_outs[i - 1] = dig_nid;
4788 if (spec->autocfg.dig_in_pin)
4789 spec->dig_in_nid = ALC880_DIGIN_NID;
4791 if (spec->kctls.list)
4792 add_mixer(spec, spec->kctls.list);
4794 add_verb(spec, alc880_volume_init_verbs);
4796 spec->num_mux_defs = 1;
4797 spec->input_mux = &spec->private_imux[0];
4799 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4804 /* additional initialization for auto-configuration model */
4805 static void alc880_auto_init(struct hda_codec *codec)
4807 struct alc_spec *spec = codec->spec;
4808 alc880_auto_init_multi_out(codec);
4809 alc880_auto_init_extra_out(codec);
4810 alc880_auto_init_analog_input(codec);
4811 if (spec->unsol_event)
4812 alc_inithook(codec);
4815 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4816 * one of two digital mic pins, e.g. on ALC272
4818 static void fixup_automic_adc(struct hda_codec *codec)
4820 struct alc_spec *spec = codec->spec;
4823 for (i = 0; i < spec->num_adc_nids; i++) {
4824 hda_nid_t cap = spec->capsrc_nids ?
4825 spec->capsrc_nids[i] : spec->adc_nids[i];
4828 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4831 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4834 spec->int_mic.mux_idx = iidx;
4835 spec->ext_mic.mux_idx = eidx;
4836 if (spec->capsrc_nids)
4837 spec->capsrc_nids += i;
4838 spec->adc_nids += i;
4839 spec->num_adc_nids = 1;
4842 snd_printd(KERN_INFO "hda_codec: %s: "
4843 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4844 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4845 spec->auto_mic = 0; /* disable auto-mic to be sure */
4848 static void set_capture_mixer(struct hda_codec *codec)
4850 struct alc_spec *spec = codec->spec;
4851 static struct snd_kcontrol_new *caps[2][3] = {
4852 { alc_capture_mixer_nosrc1,
4853 alc_capture_mixer_nosrc2,
4854 alc_capture_mixer_nosrc3 },
4855 { alc_capture_mixer1,
4857 alc_capture_mixer3 },
4859 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4861 if (spec->auto_mic) {
4863 fixup_automic_adc(codec);
4864 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4868 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4872 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4873 #define set_beep_amp(spec, nid, idx, dir) \
4874 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4876 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4880 * OK, here we have finally the patch for ALC880
4883 static int patch_alc880(struct hda_codec *codec)
4885 struct alc_spec *spec;
4889 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4895 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4898 if (board_config < 0) {
4899 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4901 board_config = ALC880_AUTO;
4904 if (board_config == ALC880_AUTO) {
4905 /* automatic parse from the BIOS config */
4906 err = alc880_parse_auto_config(codec);
4912 "hda_codec: Cannot set up configuration "
4913 "from BIOS. Using 3-stack mode...\n");
4914 board_config = ALC880_3ST;
4918 err = snd_hda_attach_beep_device(codec, 0x1);
4924 if (board_config != ALC880_AUTO)
4925 setup_preset(codec, &alc880_presets[board_config]);
4927 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4928 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4929 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4931 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4932 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4934 if (!spec->adc_nids && spec->input_mux) {
4935 /* check whether NID 0x07 is valid */
4936 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4938 wcap = get_wcaps_type(wcap);
4939 if (wcap != AC_WID_AUD_IN) {
4940 spec->adc_nids = alc880_adc_nids_alt;
4941 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4943 spec->adc_nids = alc880_adc_nids;
4944 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4947 set_capture_mixer(codec);
4948 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
4950 spec->vmaster_nid = 0x0c;
4952 codec->patch_ops = alc_patch_ops;
4953 if (board_config == ALC880_AUTO)
4954 spec->init_hook = alc880_auto_init;
4955 #ifdef CONFIG_SND_HDA_POWER_SAVE
4956 if (!spec->loopback.amplist)
4957 spec->loopback.amplist = alc880_loopbacks;
4959 codec->proc_widget_hook = print_realtek_coef;
4969 static hda_nid_t alc260_dac_nids[1] = {
4974 static hda_nid_t alc260_adc_nids[1] = {
4979 static hda_nid_t alc260_adc_nids_alt[1] = {
4984 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
4985 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
4987 static hda_nid_t alc260_dual_adc_nids[2] = {
4992 #define ALC260_DIGOUT_NID 0x03
4993 #define ALC260_DIGIN_NID 0x06
4995 static struct hda_input_mux alc260_capture_source = {
4999 { "Front Mic", 0x1 },
5005 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5006 * headphone jack and the internal CD lines since these are the only pins at
5007 * which audio can appear. For flexibility, also allow the option of
5008 * recording the mixer output on the second ADC (ADC0 doesn't have a
5009 * connection to the mixer output).
5011 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5015 { "Mic/Line", 0x0 },
5017 { "Headphone", 0x2 },
5023 { "Mic/Line", 0x0 },
5025 { "Headphone", 0x2 },
5032 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5033 * the Fujitsu S702x, but jacks are marked differently.
5035 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5042 { "Headphone", 0x5 },
5051 { "Headphone", 0x6 },
5057 /* Maxdata Favorit 100XS */
5058 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5062 { "Line/Mic", 0x0 },
5069 { "Line/Mic", 0x0 },
5077 * This is just place-holder, so there's something for alc_build_pcms to look
5078 * at when it calculates the maximum number of channels. ALC260 has no mixer
5079 * element which allows changing the channel mode, so the verb list is
5082 static struct hda_channel_mode alc260_modes[1] = {
5087 /* Mixer combinations
5089 * basic: base_output + input + pc_beep + capture
5090 * HP: base_output + input + capture_alt
5091 * HP_3013: hp_3013 + input + capture
5092 * fujitsu: fujitsu + capture
5093 * acer: acer + capture
5096 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5097 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5098 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5100 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5101 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5102 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5106 static struct snd_kcontrol_new alc260_input_mixer[] = {
5107 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5108 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5109 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5110 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5112 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5113 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5114 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5118 /* update HP, line and mono out pins according to the master switch */
5119 static void alc260_hp_master_update(struct hda_codec *codec,
5120 hda_nid_t hp, hda_nid_t line,
5123 struct alc_spec *spec = codec->spec;
5124 unsigned int val = spec->master_sw ? PIN_HP : 0;
5125 /* change HP and line-out pins */
5126 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5128 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5130 /* mono (speaker) depending on the HP jack sense */
5131 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5132 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5136 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5137 struct snd_ctl_elem_value *ucontrol)
5139 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5140 struct alc_spec *spec = codec->spec;
5141 *ucontrol->value.integer.value = spec->master_sw;
5145 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5146 struct snd_ctl_elem_value *ucontrol)
5148 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5149 struct alc_spec *spec = codec->spec;
5150 int val = !!*ucontrol->value.integer.value;
5151 hda_nid_t hp, line, mono;
5153 if (val == spec->master_sw)
5155 spec->master_sw = val;
5156 hp = (kcontrol->private_value >> 16) & 0xff;
5157 line = (kcontrol->private_value >> 8) & 0xff;
5158 mono = kcontrol->private_value & 0xff;
5159 alc260_hp_master_update(codec, hp, line, mono);
5163 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5165 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5166 .name = "Master Playback Switch",
5167 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5168 .info = snd_ctl_boolean_mono_info,
5169 .get = alc260_hp_master_sw_get,
5170 .put = alc260_hp_master_sw_put,
5171 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5173 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5174 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5175 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5176 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5177 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5179 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5183 static struct hda_verb alc260_hp_unsol_verbs[] = {
5184 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5188 static void alc260_hp_automute(struct hda_codec *codec)
5190 struct alc_spec *spec = codec->spec;
5192 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5193 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5196 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5198 if ((res >> 26) == ALC880_HP_EVENT)
5199 alc260_hp_automute(codec);
5202 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5204 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5205 .name = "Master Playback Switch",
5206 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5207 .info = snd_ctl_boolean_mono_info,
5208 .get = alc260_hp_master_sw_get,
5209 .put = alc260_hp_master_sw_put,
5210 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5212 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5213 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5214 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5215 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5218 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5219 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5223 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5224 .ops = &snd_hda_bind_vol,
5226 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5227 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5228 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5233 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5234 .ops = &snd_hda_bind_sw,
5236 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5237 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5242 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5243 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5244 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5245 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5246 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5250 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5251 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5255 static void alc260_hp_3013_automute(struct hda_codec *codec)
5257 struct alc_spec *spec = codec->spec;
5259 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5260 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5263 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5266 if ((res >> 26) == ALC880_HP_EVENT)
5267 alc260_hp_3013_automute(codec);
5270 static void alc260_hp_3012_automute(struct hda_codec *codec)
5272 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5274 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5276 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5278 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5282 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5285 if ((res >> 26) == ALC880_HP_EVENT)
5286 alc260_hp_3012_automute(codec);
5289 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5290 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5292 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5293 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5294 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5295 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5296 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5297 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5298 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5299 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5300 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5301 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5302 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5306 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5307 * versions of the ALC260 don't act on requests to enable mic bias from NID
5308 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5309 * datasheet doesn't mention this restriction. At this stage it's not clear
5310 * whether this behaviour is intentional or is a hardware bug in chip
5311 * revisions available in early 2006. Therefore for now allow the
5312 * "Headphone Jack Mode" control to span all choices, but if it turns out
5313 * that the lack of mic bias for this NID is intentional we could change the
5314 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5316 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5317 * don't appear to make the mic bias available from the "line" jack, even
5318 * though the NID used for this jack (0x14) can supply it. The theory is
5319 * that perhaps Acer have included blocking capacitors between the ALC260
5320 * and the output jack. If this turns out to be the case for all such
5321 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5322 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5324 * The C20x Tablet series have a mono internal speaker which is controlled
5325 * via the chip's Mono sum widget and pin complex, so include the necessary
5326 * controls for such models. On models without a "mono speaker" the control
5327 * won't do anything.
5329 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5330 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5331 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5332 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5333 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5335 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5337 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5338 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5340 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5341 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5342 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5343 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5344 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5348 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5350 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5351 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5352 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5353 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5354 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5355 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5356 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5360 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5361 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5363 static struct snd_kcontrol_new alc260_will_mixer[] = {
5364 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5365 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5367 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5368 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5369 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5370 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5371 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5372 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5373 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5377 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5378 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5380 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5381 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5382 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5383 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5384 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5385 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5386 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5387 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5388 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5389 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5390 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5395 * initialization verbs
5397 static struct hda_verb alc260_init_verbs[] = {
5398 /* Line In pin widget for input */
5399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5400 /* CD pin widget for input */
5401 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5402 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5403 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5404 /* Mic2 (front panel) pin widget for input and vref at 80% */
5405 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5406 /* LINE-2 is used for line-out in rear */
5407 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5408 /* select line-out */
5409 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5411 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5413 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5415 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5416 /* mute capture amp left and right */
5417 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5418 /* set connection select to line in (default select for this ADC) */
5419 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5420 /* mute capture amp left and right */
5421 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5422 /* set connection select to line in (default select for this ADC) */
5423 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5424 /* set vol=0 Line-Out mixer amp left and right */
5425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5426 /* unmute pin widget amp left and right (no gain on this amp) */
5427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5428 /* set vol=0 HP mixer amp left and right */
5429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5430 /* unmute pin widget amp left and right (no gain on this amp) */
5431 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5432 /* set vol=0 Mono mixer amp left and right */
5433 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5434 /* unmute pin widget amp left and right (no gain on this amp) */
5435 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5436 /* unmute LINE-2 out pin */
5437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5438 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5441 /* mute analog inputs */
5442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5444 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5445 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5446 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5447 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5448 /* mute Front out path */
5449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5450 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5451 /* mute Headphone out path */
5452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5453 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5454 /* mute Mono out path */
5455 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5456 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5460 #if 0 /* should be identical with alc260_init_verbs? */
5461 static struct hda_verb alc260_hp_init_verbs[] = {
5462 /* Headphone and output */
5463 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5465 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5466 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5467 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5468 /* Mic2 (front panel) pin widget for input and vref at 80% */
5469 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5470 /* Line In pin widget for input */
5471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5472 /* Line-2 pin widget for output */
5473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5474 /* CD pin widget for input */
5475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5476 /* unmute amp left and right */
5477 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5478 /* set connection select to line in (default select for this ADC) */
5479 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5480 /* unmute Line-Out mixer amp left and right (volume = 0) */
5481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5482 /* mute pin widget amp left and right (no gain on this amp) */
5483 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5484 /* unmute HP mixer amp left and right (volume = 0) */
5485 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5486 /* mute pin widget amp left and right (no gain on this amp) */
5487 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5488 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5491 /* mute analog inputs */
5492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5497 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5498 /* Unmute Front out path */
5499 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5501 /* Unmute Headphone out path */
5502 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5504 /* Unmute Mono out path */
5505 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5506 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5511 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5512 /* Line out and output */
5513 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5515 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5516 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5517 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5518 /* Mic2 (front panel) pin widget for input and vref at 80% */
5519 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5520 /* Line In pin widget for input */
5521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5522 /* Headphone pin widget for output */
5523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5524 /* CD pin widget for input */
5525 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5526 /* unmute amp left and right */
5527 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5528 /* set connection select to line in (default select for this ADC) */
5529 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5530 /* unmute Line-Out mixer amp left and right (volume = 0) */
5531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5532 /* mute pin widget amp left and right (no gain on this amp) */
5533 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5534 /* unmute HP mixer amp left and right (volume = 0) */
5535 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5536 /* mute pin widget amp left and right (no gain on this amp) */
5537 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5538 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5541 /* mute analog inputs */
5542 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5547 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5548 /* Unmute Front out path */
5549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5551 /* Unmute Headphone out path */
5552 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5554 /* Unmute Mono out path */
5555 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5556 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5560 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5561 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5562 * audio = 0x16, internal speaker = 0x10.
5564 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5565 /* Disable all GPIOs */
5566 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5567 /* Internal speaker is connected to headphone pin */
5568 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5569 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5571 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5572 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5573 /* Ensure all other unused pins are disabled and muted. */
5574 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5576 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5577 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5578 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5579 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5580 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5581 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5583 /* Disable digital (SPDIF) pins */
5584 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5585 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5587 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5588 * when acting as an output.
5590 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5592 /* Start with output sum widgets muted and their output gains at min */
5593 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5595 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5596 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5599 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5600 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5601 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5603 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5604 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5605 /* Unmute Line1 pin widget output buffer since it starts as an output.
5606 * If the pin mode is changed by the user the pin mode control will
5607 * take care of enabling the pin's input/output buffers as needed.
5608 * Therefore there's no need to enable the input buffer at this
5611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5612 /* Unmute input buffer of pin widget used for Line-in (no equiv
5615 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5617 /* Mute capture amp left and right */
5618 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5619 /* Set ADC connection select to match default mixer setting - line
5622 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5624 /* Do the same for the second ADC: mute capture input amp and
5625 * set ADC connection to line in (on mic1 pin)
5627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5628 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5630 /* Mute all inputs to mixer widget (even unconnected ones) */
5631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5632 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5633 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5634 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5635 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5636 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5637 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5638 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5643 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5644 * similar laptops (adapted from Fujitsu init verbs).
5646 static struct hda_verb alc260_acer_init_verbs[] = {
5647 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5648 * the headphone jack. Turn this on and rely on the standard mute
5649 * methods whenever the user wants to turn these outputs off.
5651 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5652 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5653 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5654 /* Internal speaker/Headphone jack is connected to Line-out pin */
5655 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5656 /* Internal microphone/Mic jack is connected to Mic1 pin */
5657 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5658 /* Line In jack is connected to Line1 pin */
5659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5660 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5661 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5662 /* Ensure all other unused pins are disabled and muted. */
5663 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5664 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5666 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5667 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5668 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5669 /* Disable digital (SPDIF) pins */
5670 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5671 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5673 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5674 * bus when acting as outputs.
5676 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5677 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5679 /* Start with output sum widgets muted and their output gains at min */
5680 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5682 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5683 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5684 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5685 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5686 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5687 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5688 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5690 /* Unmute Line-out pin widget amp left and right
5691 * (no equiv mixer ctrl)
5693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5694 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5695 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5696 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5697 * inputs. If the pin mode is changed by the user the pin mode control
5698 * will take care of enabling the pin's input/output buffers as needed.
5699 * Therefore there's no need to enable the input buffer at this
5702 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5703 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5705 /* Mute capture amp left and right */
5706 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5707 /* Set ADC connection select to match default mixer setting - mic
5710 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5712 /* Do similar with the second ADC: mute capture input amp and
5713 * set ADC connection to mic to match ALSA's default state.
5715 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5718 /* Mute all inputs to mixer widget (even unconnected ones) */
5719 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5720 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5721 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5724 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5725 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5726 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5731 /* Initialisation sequence for Maxdata Favorit 100XS
5732 * (adapted from Acer init verbs).
5734 static struct hda_verb alc260_favorit100_init_verbs[] = {
5735 /* GPIO 0 enables the output jack.
5736 * Turn this on and rely on the standard mute
5737 * methods whenever the user wants to turn these outputs off.
5739 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5740 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5741 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5742 /* Line/Mic input jack is connected to Mic1 pin */
5743 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5744 /* Ensure all other unused pins are disabled and muted. */
5745 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5746 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5747 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5748 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5749 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5750 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5751 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5752 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5753 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5754 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5755 /* Disable digital (SPDIF) pins */
5756 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5757 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5759 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5760 * bus when acting as outputs.
5762 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5763 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5765 /* Start with output sum widgets muted and their output gains at min */
5766 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5768 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5769 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5770 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5771 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5772 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5773 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5774 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5776 /* Unmute Line-out pin widget amp left and right
5777 * (no equiv mixer ctrl)
5779 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5780 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5781 * inputs. If the pin mode is changed by the user the pin mode control
5782 * will take care of enabling the pin's input/output buffers as needed.
5783 * Therefore there's no need to enable the input buffer at this
5786 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5788 /* Mute capture amp left and right */
5789 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5790 /* Set ADC connection select to match default mixer setting - mic
5793 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5795 /* Do similar with the second ADC: mute capture input amp and
5796 * set ADC connection to mic to match ALSA's default state.
5798 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5799 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5801 /* Mute all inputs to mixer widget (even unconnected ones) */
5802 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5803 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5804 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5805 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5806 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5807 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5808 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5809 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5814 static struct hda_verb alc260_will_verbs[] = {
5815 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5816 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5817 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5818 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5819 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5820 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5824 static struct hda_verb alc260_replacer_672v_verbs[] = {
5825 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5826 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5827 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5829 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5830 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5831 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5833 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5837 /* toggle speaker-output according to the hp-jack state */
5838 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5840 unsigned int present;
5842 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5843 present = snd_hda_jack_detect(codec, 0x0f);
5845 snd_hda_codec_write_cache(codec, 0x01, 0,
5846 AC_VERB_SET_GPIO_DATA, 1);
5847 snd_hda_codec_write_cache(codec, 0x0f, 0,
5848 AC_VERB_SET_PIN_WIDGET_CONTROL,
5851 snd_hda_codec_write_cache(codec, 0x01, 0,
5852 AC_VERB_SET_GPIO_DATA, 0);
5853 snd_hda_codec_write_cache(codec, 0x0f, 0,
5854 AC_VERB_SET_PIN_WIDGET_CONTROL,
5859 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5862 if ((res >> 26) == ALC880_HP_EVENT)
5863 alc260_replacer_672v_automute(codec);
5866 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5867 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5868 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5869 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5870 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5871 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5873 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5874 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5875 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5876 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5880 /* Test configuration for debugging, modelled after the ALC880 test
5883 #ifdef CONFIG_SND_DEBUG
5884 static hda_nid_t alc260_test_dac_nids[1] = {
5887 static hda_nid_t alc260_test_adc_nids[2] = {
5890 /* For testing the ALC260, each input MUX needs its own definition since
5891 * the signal assignments are different. This assumes that the first ADC
5894 static struct hda_input_mux alc260_test_capture_sources[2] = {
5898 { "MIC1 pin", 0x0 },
5899 { "MIC2 pin", 0x1 },
5900 { "LINE1 pin", 0x2 },
5901 { "LINE2 pin", 0x3 },
5903 { "LINE-OUT pin", 0x5 },
5904 { "HP-OUT pin", 0x6 },
5910 { "MIC1 pin", 0x0 },
5911 { "MIC2 pin", 0x1 },
5912 { "LINE1 pin", 0x2 },
5913 { "LINE2 pin", 0x3 },
5916 { "LINE-OUT pin", 0x6 },
5917 { "HP-OUT pin", 0x7 },
5921 static struct snd_kcontrol_new alc260_test_mixer[] = {
5922 /* Output driver widgets */
5923 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5924 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5925 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5926 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5927 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5928 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5930 /* Modes for retasking pin widgets
5931 * Note: the ALC260 doesn't seem to act on requests to enable mic
5932 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5933 * mention this restriction. At this stage it's not clear whether
5934 * this behaviour is intentional or is a hardware bug in chip
5935 * revisions available at least up until early 2006. Therefore for
5936 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5937 * choices, but if it turns out that the lack of mic bias for these
5938 * NIDs is intentional we could change their modes from
5939 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5941 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5942 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5943 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5944 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5945 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5946 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5948 /* Loopback mixer controls */
5949 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
5950 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
5951 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
5952 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
5953 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
5954 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
5955 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
5956 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
5957 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5958 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5959 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
5960 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
5961 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
5962 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
5964 /* Controls for GPIO pins, assuming they are configured as outputs */
5965 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
5966 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
5967 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
5968 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
5970 /* Switches to allow the digital IO pins to be enabled. The datasheet
5971 * is ambigious as to which NID is which; testing on laptops which
5972 * make this output available should provide clarification.
5974 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
5975 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
5977 /* A switch allowing EAPD to be enabled. Some laptops seem to use
5978 * this output to turn on an external amplifier.
5980 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
5981 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
5985 static struct hda_verb alc260_test_init_verbs[] = {
5986 /* Enable all GPIOs as outputs with an initial value of 0 */
5987 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
5988 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5989 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
5991 /* Enable retasking pins as output, initially without power amp */
5992 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5993 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5996 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5997 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5999 /* Disable digital (SPDIF) pins initially, but users can enable
6000 * them via a mixer switch. In the case of SPDIF-out, this initverb
6001 * payload also sets the generation to 0, output to be in "consumer"
6002 * PCM format, copyright asserted, no pre-emphasis and no validity
6005 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6006 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6008 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6009 * OUT1 sum bus when acting as an output.
6011 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6012 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6013 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6014 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6016 /* Start with output sum widgets muted and their output gains at min */
6017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6018 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6019 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6020 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6021 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6022 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6023 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6024 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6025 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6027 /* Unmute retasking pin widget output buffers since the default
6028 * state appears to be output. As the pin mode is changed by the
6029 * user the pin mode control will take care of enabling the pin's
6030 * input/output buffers as needed.
6032 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6033 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6034 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6035 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6036 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6037 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6038 /* Also unmute the mono-out pin widget */
6039 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6041 /* Mute capture amp left and right */
6042 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6043 /* Set ADC connection select to match default mixer setting (mic1
6046 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6048 /* Do the same for the second ADC: mute capture input amp and
6049 * set ADC connection to mic1 pin
6051 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6052 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6054 /* Mute all inputs to mixer widget (even unconnected ones) */
6055 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6056 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6057 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6058 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6059 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6060 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6061 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6062 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6068 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6069 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6071 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6072 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6075 * for BIOS auto-configuration
6078 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6079 const char *pfx, int *vol_bits)
6082 unsigned long vol_val, sw_val;
6085 if (nid >= 0x0f && nid < 0x11) {
6086 nid_vol = nid - 0x7;
6087 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6088 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6089 } else if (nid == 0x11) {
6090 nid_vol = nid - 0x7;
6091 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6092 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6093 } else if (nid >= 0x12 && nid <= 0x15) {
6095 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6096 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6100 if (!(*vol_bits & (1 << nid_vol))) {
6101 /* first control for the volume widget */
6102 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6105 *vol_bits |= (1 << nid_vol);
6107 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6113 /* add playback controls from the parsed DAC table */
6114 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6115 const struct auto_pin_cfg *cfg)
6121 spec->multiout.num_dacs = 1;
6122 spec->multiout.dac_nids = spec->private_dac_nids;
6123 spec->multiout.dac_nids[0] = 0x02;
6125 nid = cfg->line_out_pins[0];
6128 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6130 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6134 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6139 nid = cfg->speaker_pins[0];
6141 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6146 nid = cfg->hp_pins[0];
6148 err = alc260_add_playback_controls(spec, nid, "Headphone",
6156 /* create playback/capture controls for input pins */
6157 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6158 const struct auto_pin_cfg *cfg)
6160 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6163 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6164 hda_nid_t nid, int pin_type,
6167 alc_set_pin_output(codec, nid, pin_type);
6168 /* need the manual connection? */
6170 int idx = nid - 0x12;
6171 snd_hda_codec_write(codec, idx + 0x0b, 0,
6172 AC_VERB_SET_CONNECT_SEL, sel_idx);
6176 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6178 struct alc_spec *spec = codec->spec;
6181 nid = spec->autocfg.line_out_pins[0];
6183 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6184 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6187 nid = spec->autocfg.speaker_pins[0];
6189 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6191 nid = spec->autocfg.hp_pins[0];
6193 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6196 #define ALC260_PIN_CD_NID 0x16
6197 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6199 struct alc_spec *spec = codec->spec;
6202 for (i = 0; i < AUTO_PIN_LAST; i++) {
6203 hda_nid_t nid = spec->autocfg.input_pins[i];
6205 alc_set_input_pin(codec, nid, i);
6206 if (nid != ALC260_PIN_CD_NID &&
6207 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6208 snd_hda_codec_write(codec, nid, 0,
6209 AC_VERB_SET_AMP_GAIN_MUTE,
6216 * generic initialization of ADC, input mixers and output mixers
6218 static struct hda_verb alc260_volume_init_verbs[] = {
6220 * Unmute ADC0-1 and set the default input to mic-in
6222 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6223 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6224 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6225 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6227 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6229 * Note: PASD motherboards uses the Line In 2 as the input for
6230 * front panel mic (mic 2)
6232 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6233 /* mute analog inputs */
6234 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6236 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6237 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6241 * Set up output mixers (0x08 - 0x0a)
6243 /* set vol=0 to output mixers */
6244 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6245 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6246 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6247 /* set up input amps for analog loopback */
6248 /* Amp Indices: DAC = 0, mixer = 1 */
6249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6253 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6254 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6259 static int alc260_parse_auto_config(struct hda_codec *codec)
6261 struct alc_spec *spec = codec->spec;
6263 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6265 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6269 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6272 if (!spec->kctls.list)
6273 return 0; /* can't find valid BIOS pin config */
6274 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6278 spec->multiout.max_channels = 2;
6280 if (spec->autocfg.dig_outs)
6281 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6282 if (spec->kctls.list)
6283 add_mixer(spec, spec->kctls.list);
6285 add_verb(spec, alc260_volume_init_verbs);
6287 spec->num_mux_defs = 1;
6288 spec->input_mux = &spec->private_imux[0];
6290 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6295 /* additional initialization for auto-configuration model */
6296 static void alc260_auto_init(struct hda_codec *codec)
6298 struct alc_spec *spec = codec->spec;
6299 alc260_auto_init_multi_out(codec);
6300 alc260_auto_init_analog_input(codec);
6301 if (spec->unsol_event)
6302 alc_inithook(codec);
6305 #ifdef CONFIG_SND_HDA_POWER_SAVE
6306 static struct hda_amp_list alc260_loopbacks[] = {
6307 { 0x07, HDA_INPUT, 0 },
6308 { 0x07, HDA_INPUT, 1 },
6309 { 0x07, HDA_INPUT, 2 },
6310 { 0x07, HDA_INPUT, 3 },
6311 { 0x07, HDA_INPUT, 4 },
6317 * ALC260 configurations
6319 static const char *alc260_models[ALC260_MODEL_LAST] = {
6320 [ALC260_BASIC] = "basic",
6322 [ALC260_HP_3013] = "hp-3013",
6323 [ALC260_HP_DC7600] = "hp-dc7600",
6324 [ALC260_FUJITSU_S702X] = "fujitsu",
6325 [ALC260_ACER] = "acer",
6326 [ALC260_WILL] = "will",
6327 [ALC260_REPLACER_672V] = "replacer",
6328 [ALC260_FAVORIT100] = "favorit100",
6329 #ifdef CONFIG_SND_DEBUG
6330 [ALC260_TEST] = "test",
6332 [ALC260_AUTO] = "auto",
6335 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6336 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6337 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6338 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6339 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6340 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6341 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6342 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6343 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6344 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6345 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6346 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6347 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6348 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6349 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6350 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6351 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6352 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6353 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6354 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6358 static struct alc_config_preset alc260_presets[] = {
6360 .mixers = { alc260_base_output_mixer,
6361 alc260_input_mixer },
6362 .init_verbs = { alc260_init_verbs },
6363 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6364 .dac_nids = alc260_dac_nids,
6365 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6366 .adc_nids = alc260_adc_nids,
6367 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6368 .channel_mode = alc260_modes,
6369 .input_mux = &alc260_capture_source,
6372 .mixers = { alc260_hp_output_mixer,
6373 alc260_input_mixer },
6374 .init_verbs = { alc260_init_verbs,
6375 alc260_hp_unsol_verbs },
6376 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6377 .dac_nids = alc260_dac_nids,
6378 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6379 .adc_nids = alc260_adc_nids_alt,
6380 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6381 .channel_mode = alc260_modes,
6382 .input_mux = &alc260_capture_source,
6383 .unsol_event = alc260_hp_unsol_event,
6384 .init_hook = alc260_hp_automute,
6386 [ALC260_HP_DC7600] = {
6387 .mixers = { alc260_hp_dc7600_mixer,
6388 alc260_input_mixer },
6389 .init_verbs = { alc260_init_verbs,
6390 alc260_hp_dc7600_verbs },
6391 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6392 .dac_nids = alc260_dac_nids,
6393 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6394 .adc_nids = alc260_adc_nids_alt,
6395 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6396 .channel_mode = alc260_modes,
6397 .input_mux = &alc260_capture_source,
6398 .unsol_event = alc260_hp_3012_unsol_event,
6399 .init_hook = alc260_hp_3012_automute,
6401 [ALC260_HP_3013] = {
6402 .mixers = { alc260_hp_3013_mixer,
6403 alc260_input_mixer },
6404 .init_verbs = { alc260_hp_3013_init_verbs,
6405 alc260_hp_3013_unsol_verbs },
6406 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6407 .dac_nids = alc260_dac_nids,
6408 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6409 .adc_nids = alc260_adc_nids_alt,
6410 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6411 .channel_mode = alc260_modes,
6412 .input_mux = &alc260_capture_source,
6413 .unsol_event = alc260_hp_3013_unsol_event,
6414 .init_hook = alc260_hp_3013_automute,
6416 [ALC260_FUJITSU_S702X] = {
6417 .mixers = { alc260_fujitsu_mixer },
6418 .init_verbs = { alc260_fujitsu_init_verbs },
6419 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6420 .dac_nids = alc260_dac_nids,
6421 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6422 .adc_nids = alc260_dual_adc_nids,
6423 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6424 .channel_mode = alc260_modes,
6425 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6426 .input_mux = alc260_fujitsu_capture_sources,
6429 .mixers = { alc260_acer_mixer },
6430 .init_verbs = { alc260_acer_init_verbs },
6431 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6432 .dac_nids = alc260_dac_nids,
6433 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6434 .adc_nids = alc260_dual_adc_nids,
6435 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6436 .channel_mode = alc260_modes,
6437 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6438 .input_mux = alc260_acer_capture_sources,
6440 [ALC260_FAVORIT100] = {
6441 .mixers = { alc260_favorit100_mixer },
6442 .init_verbs = { alc260_favorit100_init_verbs },
6443 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6444 .dac_nids = alc260_dac_nids,
6445 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6446 .adc_nids = alc260_dual_adc_nids,
6447 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6448 .channel_mode = alc260_modes,
6449 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6450 .input_mux = alc260_favorit100_capture_sources,
6453 .mixers = { alc260_will_mixer },
6454 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6455 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6456 .dac_nids = alc260_dac_nids,
6457 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6458 .adc_nids = alc260_adc_nids,
6459 .dig_out_nid = ALC260_DIGOUT_NID,
6460 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6461 .channel_mode = alc260_modes,
6462 .input_mux = &alc260_capture_source,
6464 [ALC260_REPLACER_672V] = {
6465 .mixers = { alc260_replacer_672v_mixer },
6466 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6467 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6468 .dac_nids = alc260_dac_nids,
6469 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6470 .adc_nids = alc260_adc_nids,
6471 .dig_out_nid = ALC260_DIGOUT_NID,
6472 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6473 .channel_mode = alc260_modes,
6474 .input_mux = &alc260_capture_source,
6475 .unsol_event = alc260_replacer_672v_unsol_event,
6476 .init_hook = alc260_replacer_672v_automute,
6478 #ifdef CONFIG_SND_DEBUG
6480 .mixers = { alc260_test_mixer },
6481 .init_verbs = { alc260_test_init_verbs },
6482 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6483 .dac_nids = alc260_test_dac_nids,
6484 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6485 .adc_nids = alc260_test_adc_nids,
6486 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6487 .channel_mode = alc260_modes,
6488 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6489 .input_mux = alc260_test_capture_sources,
6494 static int patch_alc260(struct hda_codec *codec)
6496 struct alc_spec *spec;
6497 int err, board_config;
6499 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6505 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6508 if (board_config < 0) {
6509 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6511 board_config = ALC260_AUTO;
6514 if (board_config == ALC260_AUTO) {
6515 /* automatic parse from the BIOS config */
6516 err = alc260_parse_auto_config(codec);
6522 "hda_codec: Cannot set up configuration "
6523 "from BIOS. Using base mode...\n");
6524 board_config = ALC260_BASIC;
6528 err = snd_hda_attach_beep_device(codec, 0x1);
6534 if (board_config != ALC260_AUTO)
6535 setup_preset(codec, &alc260_presets[board_config]);
6537 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6538 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6540 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6541 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6543 if (!spec->adc_nids && spec->input_mux) {
6544 /* check whether NID 0x04 is valid */
6545 unsigned int wcap = get_wcaps(codec, 0x04);
6546 wcap = get_wcaps_type(wcap);
6548 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6549 spec->adc_nids = alc260_adc_nids_alt;
6550 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6552 spec->adc_nids = alc260_adc_nids;
6553 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6556 set_capture_mixer(codec);
6557 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6559 spec->vmaster_nid = 0x08;
6561 codec->patch_ops = alc_patch_ops;
6562 if (board_config == ALC260_AUTO)
6563 spec->init_hook = alc260_auto_init;
6564 #ifdef CONFIG_SND_HDA_POWER_SAVE
6565 if (!spec->loopback.amplist)
6566 spec->loopback.amplist = alc260_loopbacks;
6568 codec->proc_widget_hook = print_realtek_coef;
6575 * ALC882/883/885/888/889 support
6577 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6578 * configuration. Each pin widget can choose any input DACs and a mixer.
6579 * Each ADC is connected from a mixer of all inputs. This makes possible
6580 * 6-channel independent captures.
6582 * In addition, an independent DAC for the multi-playback (not used in this
6585 #define ALC882_DIGOUT_NID 0x06
6586 #define ALC882_DIGIN_NID 0x0a
6587 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6588 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6589 #define ALC1200_DIGOUT_NID 0x10
6592 static struct hda_channel_mode alc882_ch_modes[1] = {
6597 static hda_nid_t alc882_dac_nids[4] = {
6598 /* front, rear, clfe, rear_surr */
6599 0x02, 0x03, 0x04, 0x05
6601 #define alc883_dac_nids alc882_dac_nids
6604 #define alc882_adc_nids alc880_adc_nids
6605 #define alc882_adc_nids_alt alc880_adc_nids_alt
6606 #define alc883_adc_nids alc882_adc_nids_alt
6607 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6608 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6609 #define alc889_adc_nids alc880_adc_nids
6611 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6612 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6613 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6614 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6615 #define alc889_capsrc_nids alc882_capsrc_nids
6618 /* FIXME: should be a matrix-type input source selection */
6620 static struct hda_input_mux alc882_capture_source = {
6624 { "Front Mic", 0x1 },
6630 #define alc883_capture_source alc882_capture_source
6632 static struct hda_input_mux alc889_capture_source = {
6635 { "Front Mic", 0x0 },
6641 static struct hda_input_mux mb5_capture_source = {
6650 static struct hda_input_mux alc883_3stack_6ch_intel = {
6654 { "Front Mic", 0x0 },
6660 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6668 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6678 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6686 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6690 { "Front Mic", 0x1 },
6695 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6703 static struct hda_input_mux alc889A_mb31_capture_source = {
6707 /* Front Mic (0x01) unused */
6709 /* Line 2 (0x03) unused */
6710 /* CD (0x04) unused? */
6717 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6724 static struct hda_verb alc882_3ST_ch2_init[] = {
6725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6735 static struct hda_verb alc882_3ST_ch4_init[] = {
6736 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6737 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6738 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6739 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6740 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6747 static struct hda_verb alc882_3ST_ch6_init[] = {
6748 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6749 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6750 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6751 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6752 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6753 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6757 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6758 { 2, alc882_3ST_ch2_init },
6759 { 4, alc882_3ST_ch4_init },
6760 { 6, alc882_3ST_ch6_init },
6763 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6768 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6769 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6770 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6771 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6772 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6773 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6780 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6781 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6782 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6783 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6784 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6785 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6786 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6793 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6794 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6795 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6796 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6797 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6798 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6799 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6800 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6804 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6805 { 2, alc883_3ST_ch2_clevo_init },
6806 { 4, alc883_3ST_ch4_clevo_init },
6807 { 6, alc883_3ST_ch6_clevo_init },
6814 static struct hda_verb alc882_sixstack_ch6_init[] = {
6815 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6816 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6817 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6818 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6825 static struct hda_verb alc882_sixstack_ch8_init[] = {
6826 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6827 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6828 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6829 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6833 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6834 { 6, alc882_sixstack_ch6_init },
6835 { 8, alc882_sixstack_ch8_init },
6839 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6845 static struct hda_verb alc885_mbp_ch2_init[] = {
6846 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6847 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6848 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6855 static struct hda_verb alc885_mbp_ch4_init[] = {
6856 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6857 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6858 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6859 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6860 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6864 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6865 { 2, alc885_mbp_ch2_init },
6866 { 4, alc885_mbp_ch4_init },
6871 * Speakers/Woofer/HP = Front
6874 static struct hda_verb alc885_mb5_ch2_init[] = {
6875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6882 * Speakers/HP = Front
6886 static struct hda_verb alc885_mb5_ch6_init[] = {
6887 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6888 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6889 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6893 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6894 { 2, alc885_mb5_ch2_init },
6895 { 6, alc885_mb5_ch6_init },
6902 static struct hda_verb alc883_4ST_ch2_init[] = {
6903 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6904 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6905 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6906 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6907 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6908 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6915 static struct hda_verb alc883_4ST_ch4_init[] = {
6916 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6917 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6918 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6919 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6920 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6921 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6922 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6929 static struct hda_verb alc883_4ST_ch6_init[] = {
6930 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6931 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6932 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6933 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6934 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6935 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6936 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6937 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6944 static struct hda_verb alc883_4ST_ch8_init[] = {
6945 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6946 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6947 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
6948 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6949 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6950 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6951 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6952 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6953 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6957 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
6958 { 2, alc883_4ST_ch2_init },
6959 { 4, alc883_4ST_ch4_init },
6960 { 6, alc883_4ST_ch6_init },
6961 { 8, alc883_4ST_ch8_init },
6968 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
6969 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6970 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6971 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6972 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6979 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
6980 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6981 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6982 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6984 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6991 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
6992 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6993 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6994 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
6995 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6996 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6997 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7001 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7002 { 2, alc883_3ST_ch2_intel_init },
7003 { 4, alc883_3ST_ch4_intel_init },
7004 { 6, alc883_3ST_ch6_intel_init },
7010 static struct hda_verb alc889_ch2_intel_init[] = {
7011 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7012 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7013 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7014 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7015 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7016 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7023 static struct hda_verb alc889_ch6_intel_init[] = {
7024 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7025 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7026 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7027 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7028 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7029 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7036 static struct hda_verb alc889_ch8_intel_init[] = {
7037 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7038 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7039 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7040 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7041 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7042 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7043 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7047 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7048 { 2, alc889_ch2_intel_init },
7049 { 6, alc889_ch6_intel_init },
7050 { 8, alc889_ch8_intel_init },
7056 static struct hda_verb alc883_sixstack_ch6_init[] = {
7057 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7058 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7059 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7060 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7067 static struct hda_verb alc883_sixstack_ch8_init[] = {
7068 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7069 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7070 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7071 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7075 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7076 { 6, alc883_sixstack_ch6_init },
7077 { 8, alc883_sixstack_ch8_init },
7081 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7082 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7084 static struct snd_kcontrol_new alc882_base_mixer[] = {
7085 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7086 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7087 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7088 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7089 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7090 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7091 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7092 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7093 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7094 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7095 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7096 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7097 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7098 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7099 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7101 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7102 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7103 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7104 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7109 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7110 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7111 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7112 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7113 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7115 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7116 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7118 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7119 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7124 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7126 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7127 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7128 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7129 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7130 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7131 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7132 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7133 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7134 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7135 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7136 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7137 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7138 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7142 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7143 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7144 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7145 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7146 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7148 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7150 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7151 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7156 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7158 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7160 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7169 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7170 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7171 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7173 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7174 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7180 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7181 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7186 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7187 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7189 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7190 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7191 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7193 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7194 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7195 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7198 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7199 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7206 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7207 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7208 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7209 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7210 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7211 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7213 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7220 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7222 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7223 .name = "Channel Mode",
7224 .info = alc_ch_mode_info,
7225 .get = alc_ch_mode_get,
7226 .put = alc_ch_mode_put,
7231 static struct hda_verb alc882_base_init_verbs[] = {
7232 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7233 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7234 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7235 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7237 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7238 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7239 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7241 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7242 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7243 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7245 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7246 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7247 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7249 /* mute analog input loopbacks */
7250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7256 /* Front Pin: output 0 (0x0c) */
7257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7259 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7260 /* Rear Pin: output 1 (0x0d) */
7261 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7262 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7263 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7264 /* CLFE Pin: output 2 (0x0e) */
7265 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7266 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7267 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7268 /* Side Pin: output 3 (0x0f) */
7269 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7270 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7271 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7272 /* Mic (rear) pin: input vref at 80% */
7273 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7274 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7275 /* Front Mic pin: input vref at 80% */
7276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7278 /* Line In pin: input */
7279 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7280 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7281 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7282 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7283 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7284 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7285 /* CD pin widget for input */
7286 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7288 /* FIXME: use matrix-type input source selection */
7289 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7300 /* ADC2: mute amp left and right */
7301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7302 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7303 /* ADC3: mute amp left and right */
7304 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7310 static struct hda_verb alc882_adc1_init_verbs[] = {
7311 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7312 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7313 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7314 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7315 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7316 /* ADC1: mute amp left and right */
7317 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7318 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7322 static struct hda_verb alc882_eapd_verbs[] = {
7323 /* change to EAPD mode */
7324 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7325 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7329 static struct hda_verb alc889_eapd_verbs[] = {
7330 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7331 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7335 static struct hda_verb alc_hp15_unsol_verbs[] = {
7336 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7341 static struct hda_verb alc885_init_verbs[] = {
7342 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7348 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7349 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7351 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7352 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7353 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7355 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7359 /* mute analog input loopbacks */
7360 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7361 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7362 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7364 /* Front HP Pin: output 0 (0x0c) */
7365 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7367 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7368 /* Front Pin: output 0 (0x0c) */
7369 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7370 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7371 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7372 /* Rear Pin: output 1 (0x0d) */
7373 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7374 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7375 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7376 /* CLFE Pin: output 2 (0x0e) */
7377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7378 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7379 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7380 /* Side Pin: output 3 (0x0f) */
7381 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7382 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7383 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7384 /* Mic (rear) pin: input vref at 80% */
7385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7387 /* Front Mic pin: input vref at 80% */
7388 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7389 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7390 /* Line In pin: input */
7391 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7392 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7394 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7396 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7400 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7401 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7402 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7405 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7407 /* ADC2: mute amp left and right */
7408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7409 /* ADC3: mute amp left and right */
7410 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 static struct hda_verb alc885_init_input_verbs[] = {
7416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7418 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7423 /* Unmute Selector 24h and set the default input to front mic */
7424 static struct hda_verb alc889_init_input_verbs[] = {
7425 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7431 #define alc883_init_verbs alc882_base_init_verbs
7434 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7435 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7436 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7438 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7439 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7440 /* FIXME: this looks suspicious...
7441 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7442 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7447 static struct hda_verb alc882_macpro_init_verbs[] = {
7448 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7452 /* Front Pin: output 0 (0x0c) */
7453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7454 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7455 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7456 /* Front Mic pin: input vref at 80% */
7457 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7458 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7459 /* Speaker: output */
7460 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7461 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7462 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7463 /* Headphone output (output 0 - 0x0c) */
7464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7466 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7468 /* FIXME: use matrix-type input source selection */
7469 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7470 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7474 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7477 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7479 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7483 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7485 /* ADC1: mute amp left and right */
7486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7487 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7488 /* ADC2: mute amp left and right */
7489 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7490 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* ADC3: mute amp left and right */
7492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7493 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7499 static struct hda_verb alc885_mb5_init_verbs[] = {
7501 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7502 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7503 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7504 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7507 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7508 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7509 /* Surround mixer */
7510 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7511 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7512 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7516 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7518 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7520 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7521 /* Front Pin (0x0c) */
7522 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7524 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7525 /* LFE Pin (0x0e) */
7526 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7527 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7528 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7531 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7532 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7533 /* Front Mic pin: input vref at 80% */
7534 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7535 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7538 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7547 /* Macbook Pro rev3 */
7548 static struct hda_verb alc885_mbp3_init_verbs[] = {
7549 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7550 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7554 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7555 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7558 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7561 /* Front Pin: output 0 (0x0c) */
7562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7563 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7564 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7565 /* HP Pin: output 0 (0x0e) */
7566 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7567 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7568 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7569 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7570 /* Mic (rear) pin: input vref at 80% */
7571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7573 /* Front Mic pin: input vref at 80% */
7574 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7575 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7576 /* Line In pin: use output 1 when in LineOut mode */
7577 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7578 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7579 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7581 /* FIXME: use matrix-type input source selection */
7582 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7583 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7584 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7585 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7586 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7587 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7589 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7590 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7591 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7592 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7595 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7596 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7597 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7598 /* ADC1: mute amp left and right */
7599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7600 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7601 /* ADC2: mute amp left and right */
7602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7603 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7604 /* ADC3: mute amp left and right */
7605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7606 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7612 static struct hda_verb alc885_imac91_init_verbs[] = {
7613 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7615 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7616 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7618 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7621 /* HP Pin: output 0 (0x0c) */
7622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7624 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7625 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7626 /* Internal Speakers: output 0 (0x0d) */
7627 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7628 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7629 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7630 /* Mic (rear) pin: input vref at 80% */
7631 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7632 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7633 /* Front Mic pin: input vref at 80% */
7634 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7635 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7636 /* Line In pin: use output 1 when in LineOut mode */
7637 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7638 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7639 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7641 /* FIXME: use matrix-type input source selection */
7642 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7643 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7647 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7658 /* ADC1: mute amp left and right */
7659 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7660 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7661 /* ADC2: mute amp left and right */
7662 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7663 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7664 /* ADC3: mute amp left and right */
7665 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7666 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7671 /* iMac 24 mixer. */
7672 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7673 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7674 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7678 /* iMac 24 init verbs. */
7679 static struct hda_verb alc885_imac24_init_verbs[] = {
7680 /* Internal speakers: output 0 (0x0c) */
7681 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7683 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7684 /* Internal speakers: output 0 (0x0c) */
7685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7687 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7688 /* Headphone: output 0 (0x0c) */
7689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7691 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7692 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7693 /* Front Mic: input vref at 80% */
7694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7699 /* Toggle speaker-output according to the hp-jack state */
7700 static void alc885_imac24_setup(struct hda_codec *codec)
7702 struct alc_spec *spec = codec->spec;
7704 spec->autocfg.hp_pins[0] = 0x14;
7705 spec->autocfg.speaker_pins[0] = 0x18;
7706 spec->autocfg.speaker_pins[1] = 0x1a;
7709 static void alc885_mbp3_setup(struct hda_codec *codec)
7711 struct alc_spec *spec = codec->spec;
7713 spec->autocfg.hp_pins[0] = 0x15;
7714 spec->autocfg.speaker_pins[0] = 0x14;
7717 static void alc885_imac91_automute(struct hda_codec *codec)
7719 unsigned int present;
7721 present = snd_hda_codec_read(codec, 0x14, 0,
7722 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7723 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7724 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7725 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7726 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7730 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7733 /* Headphone insertion or removal. */
7734 if ((res >> 26) == ALC880_HP_EVENT)
7735 alc885_imac91_automute(codec);
7738 static struct hda_verb alc882_targa_verbs[] = {
7739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7743 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7745 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7746 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7747 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7749 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7753 /* toggle speaker-output according to the hp-jack state */
7754 static void alc882_targa_automute(struct hda_codec *codec)
7756 struct alc_spec *spec = codec->spec;
7757 alc_automute_amp(codec);
7758 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7759 spec->jack_present ? 1 : 3);
7762 static void alc882_targa_setup(struct hda_codec *codec)
7764 struct alc_spec *spec = codec->spec;
7766 spec->autocfg.hp_pins[0] = 0x14;
7767 spec->autocfg.speaker_pins[0] = 0x1b;
7770 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7772 if ((res >> 26) == ALC880_HP_EVENT)
7773 alc882_targa_automute(codec);
7776 static struct hda_verb alc882_asus_a7j_verbs[] = {
7777 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7782 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7784 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7785 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7786 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7788 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7789 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7790 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7794 static struct hda_verb alc882_asus_a7m_verbs[] = {
7795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7796 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7800 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7802 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7803 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7804 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7806 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7807 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7808 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7812 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7814 unsigned int gpiostate, gpiomask, gpiodir;
7816 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7817 AC_VERB_GET_GPIO_DATA, 0);
7820 gpiostate |= (1 << pin);
7822 gpiostate &= ~(1 << pin);
7824 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7825 AC_VERB_GET_GPIO_MASK, 0);
7826 gpiomask |= (1 << pin);
7828 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7829 AC_VERB_GET_GPIO_DIRECTION, 0);
7830 gpiodir |= (1 << pin);
7833 snd_hda_codec_write(codec, codec->afg, 0,
7834 AC_VERB_SET_GPIO_MASK, gpiomask);
7835 snd_hda_codec_write(codec, codec->afg, 0,
7836 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7840 snd_hda_codec_write(codec, codec->afg, 0,
7841 AC_VERB_SET_GPIO_DATA, gpiostate);
7844 /* set up GPIO at initialization */
7845 static void alc885_macpro_init_hook(struct hda_codec *codec)
7847 alc882_gpio_mute(codec, 0, 0);
7848 alc882_gpio_mute(codec, 1, 0);
7851 /* set up GPIO and update auto-muting at initialization */
7852 static void alc885_imac24_init_hook(struct hda_codec *codec)
7854 alc885_macpro_init_hook(codec);
7855 alc_automute_amp(codec);
7859 * generic initialization of ADC, input mixers and output mixers
7861 static struct hda_verb alc883_auto_init_verbs[] = {
7863 * Unmute ADC0-2 and set the default input to mic-in
7865 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7866 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7867 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7868 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7870 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7872 * Note: PASD motherboards uses the Line In 2 as the input for
7873 * front panel mic (mic 2)
7875 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7876 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7877 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7878 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7879 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7880 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7883 * Set up output mixers (0x0c - 0x0f)
7885 /* set vol=0 to output mixers */
7886 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7887 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7888 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7889 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7890 /* set up input amps for analog loopback */
7891 /* Amp Indices: DAC = 0, mixer = 1 */
7892 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7893 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7894 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7895 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7896 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7897 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7898 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7899 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7900 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7901 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7903 /* FIXME: use matrix-type input source selection */
7904 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7906 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7907 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7908 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7909 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7911 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7912 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7914 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7919 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7920 static struct hda_verb alc889A_mb31_ch2_init[] = {
7921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7922 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7923 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7924 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7928 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7929 static struct hda_verb alc889A_mb31_ch4_init[] = {
7930 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7931 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7932 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7933 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7937 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7938 static struct hda_verb alc889A_mb31_ch5_init[] = {
7939 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7940 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7941 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7942 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7946 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7947 static struct hda_verb alc889A_mb31_ch6_init[] = {
7948 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
7949 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
7950 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7951 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7955 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
7956 { 2, alc889A_mb31_ch2_init },
7957 { 4, alc889A_mb31_ch4_init },
7958 { 5, alc889A_mb31_ch5_init },
7959 { 6, alc889A_mb31_ch6_init },
7962 static struct hda_verb alc883_medion_eapd_verbs[] = {
7963 /* eanable EAPD on medion laptop */
7964 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7965 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
7969 #define alc883_base_mixer alc882_base_mixer
7971 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7972 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7973 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7974 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7975 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7976 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7977 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7978 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7979 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7981 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7982 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7983 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7984 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7988 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7989 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7990 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
7991 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7992 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7994 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7995 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7996 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7997 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
7998 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8002 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8003 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8004 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8006 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8007 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8008 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8009 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8010 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8011 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8012 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8016 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8017 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8022 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8023 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8025 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8027 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8028 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8029 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8033 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8034 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8035 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8037 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8038 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8039 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8040 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8041 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8042 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8043 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8044 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8052 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8056 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8057 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8058 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8060 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8061 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8063 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8064 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8065 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8066 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8067 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8068 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8070 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8072 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8075 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8076 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8080 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8081 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8082 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8084 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8085 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8087 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8088 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8089 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8094 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8096 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8097 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8100 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8104 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8105 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8106 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8107 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8108 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8109 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8110 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8111 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8112 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8114 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8115 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8116 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8117 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8120 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8122 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8127 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8128 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8129 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8130 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8131 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8138 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8139 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8140 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8141 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8148 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8149 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8150 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8152 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8158 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8160 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8164 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8165 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8167 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8169 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8173 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8174 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8177 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8178 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8180 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8185 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8186 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8187 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8188 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8189 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8190 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8192 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8193 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8194 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8198 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8199 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8200 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8201 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8202 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8203 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8205 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8207 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8211 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8223 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8226 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8227 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8234 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8238 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8239 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8242 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8243 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8244 0x0d, 1, 0x0, HDA_OUTPUT),
8245 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8246 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8247 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8248 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8249 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8250 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8251 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8253 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8257 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8258 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8259 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8263 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8266 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8268 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8269 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8271 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8272 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8273 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8274 /* Output switches */
8275 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8276 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8277 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8279 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8280 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8283 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8289 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8290 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8291 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8292 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8293 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8294 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8299 static struct hda_bind_ctls alc883_bind_cap_vol = {
8300 .ops = &snd_hda_bind_vol,
8302 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8303 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8308 static struct hda_bind_ctls alc883_bind_cap_switch = {
8309 .ops = &snd_hda_bind_sw,
8311 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8312 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8317 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8318 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8319 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8321 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8322 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8324 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8325 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8329 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8330 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8331 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8333 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8334 /* .name = "Capture Source", */
8335 .name = "Input Source",
8337 .info = alc_mux_enum_info,
8338 .get = alc_mux_enum_get,
8339 .put = alc_mux_enum_put,
8344 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8346 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8347 .name = "Channel Mode",
8348 .info = alc_ch_mode_info,
8349 .get = alc_ch_mode_get,
8350 .put = alc_ch_mode_put,
8355 /* toggle speaker-output according to the hp-jack state */
8356 static void alc883_mitac_setup(struct hda_codec *codec)
8358 struct alc_spec *spec = codec->spec;
8360 spec->autocfg.hp_pins[0] = 0x15;
8361 spec->autocfg.speaker_pins[0] = 0x14;
8362 spec->autocfg.speaker_pins[1] = 0x17;
8365 /* auto-toggle front mic */
8367 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8369 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8371 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8375 static struct hda_verb alc883_mitac_verbs[] = {
8377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8378 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8380 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8381 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8383 /* enable unsolicited event */
8384 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8385 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8390 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8392 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8393 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8395 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8397 /* enable unsolicited event */
8399 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8400 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8406 static struct hda_verb alc883_clevo_m720_verbs[] = {
8408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8409 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8411 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8414 /* enable unsolicited event */
8415 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8416 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8421 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8423 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8426 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8427 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8429 /* enable unsolicited event */
8430 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8435 static struct hda_verb alc883_targa_verbs[] = {
8436 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8437 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8442 /* Connect Line-Out side jack (SPDIF) to Side */
8443 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8444 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8445 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8446 /* Connect Mic jack to CLFE */
8447 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8449 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8450 /* Connect Line-in jack to Surround */
8451 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8452 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8453 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8454 /* Connect HP out jack to Front */
8455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8456 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8457 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8459 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8464 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8467 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8471 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8472 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8473 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8474 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8475 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8479 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8481 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8482 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8483 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8484 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8488 static struct hda_verb alc883_haier_w66_verbs[] = {
8489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8494 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8496 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8497 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8501 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8505 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8506 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8507 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8508 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8509 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8513 static struct hda_verb alc888_6st_dell_verbs[] = {
8514 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8518 static struct hda_verb alc883_vaiott_verbs[] = {
8520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8521 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8523 /* enable unsolicited event */
8524 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8529 static void alc888_3st_hp_setup(struct hda_codec *codec)
8531 struct alc_spec *spec = codec->spec;
8533 spec->autocfg.hp_pins[0] = 0x1b;
8534 spec->autocfg.speaker_pins[0] = 0x14;
8535 spec->autocfg.speaker_pins[1] = 0x16;
8536 spec->autocfg.speaker_pins[2] = 0x18;
8539 static struct hda_verb alc888_3st_hp_verbs[] = {
8540 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8541 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8542 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8543 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8550 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8551 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8552 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8553 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8554 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8561 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8562 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8563 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8564 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8565 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8566 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8573 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8574 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8575 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8576 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8577 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8578 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8579 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8583 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8584 { 2, alc888_3st_hp_2ch_init },
8585 { 4, alc888_3st_hp_4ch_init },
8586 { 6, alc888_3st_hp_6ch_init },
8589 /* toggle front-jack and RCA according to the hp-jack state */
8590 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8592 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8594 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8595 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8596 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8597 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8600 /* toggle RCA according to the front-jack state */
8601 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8603 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8605 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8606 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8609 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8612 if ((res >> 26) == ALC880_HP_EVENT)
8613 alc888_lenovo_ms7195_front_automute(codec);
8614 if ((res >> 26) == ALC880_FRONT_EVENT)
8615 alc888_lenovo_ms7195_rca_automute(codec);
8618 static struct hda_verb alc883_medion_md2_verbs[] = {
8619 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8620 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8624 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8628 /* toggle speaker-output according to the hp-jack state */
8629 static void alc883_medion_md2_setup(struct hda_codec *codec)
8631 struct alc_spec *spec = codec->spec;
8633 spec->autocfg.hp_pins[0] = 0x14;
8634 spec->autocfg.speaker_pins[0] = 0x15;
8637 /* toggle speaker-output according to the hp-jack state */
8638 #define alc883_targa_init_hook alc882_targa_init_hook
8639 #define alc883_targa_unsol_event alc882_targa_unsol_event
8641 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8643 unsigned int present;
8645 present = snd_hda_jack_detect(codec, 0x18);
8646 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8647 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8650 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8652 struct alc_spec *spec = codec->spec;
8654 spec->autocfg.hp_pins[0] = 0x15;
8655 spec->autocfg.speaker_pins[0] = 0x14;
8658 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8660 alc_automute_amp(codec);
8661 alc883_clevo_m720_mic_automute(codec);
8664 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8667 switch (res >> 26) {
8668 case ALC880_MIC_EVENT:
8669 alc883_clevo_m720_mic_automute(codec);
8672 alc_automute_amp_unsol_event(codec, res);
8677 /* toggle speaker-output according to the hp-jack state */
8678 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8680 struct alc_spec *spec = codec->spec;
8682 spec->autocfg.hp_pins[0] = 0x14;
8683 spec->autocfg.speaker_pins[0] = 0x15;
8686 static void alc883_haier_w66_setup(struct hda_codec *codec)
8688 struct alc_spec *spec = codec->spec;
8690 spec->autocfg.hp_pins[0] = 0x1b;
8691 spec->autocfg.speaker_pins[0] = 0x14;
8694 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8696 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8698 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8699 HDA_AMP_MUTE, bits);
8702 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8704 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8706 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8707 HDA_AMP_MUTE, bits);
8708 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8709 HDA_AMP_MUTE, bits);
8712 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8715 if ((res >> 26) == ALC880_HP_EVENT)
8716 alc883_lenovo_101e_all_automute(codec);
8717 if ((res >> 26) == ALC880_FRONT_EVENT)
8718 alc883_lenovo_101e_ispeaker_automute(codec);
8721 /* toggle speaker-output according to the hp-jack state */
8722 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8724 struct alc_spec *spec = codec->spec;
8726 spec->autocfg.hp_pins[0] = 0x14;
8727 spec->autocfg.speaker_pins[0] = 0x15;
8728 spec->autocfg.speaker_pins[1] = 0x16;
8731 static struct hda_verb alc883_acer_eapd_verbs[] = {
8732 /* HP Pin: output 0 (0x0c) */
8733 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8734 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8735 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8736 /* Front Pin: output 0 (0x0c) */
8737 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8738 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8739 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8740 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8741 /* eanable EAPD on medion laptop */
8742 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8743 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8744 /* enable unsolicited event */
8745 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8749 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8750 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8751 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8752 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8756 static void alc888_6st_dell_setup(struct hda_codec *codec)
8758 struct alc_spec *spec = codec->spec;
8760 spec->autocfg.hp_pins[0] = 0x1b;
8761 spec->autocfg.speaker_pins[0] = 0x14;
8762 spec->autocfg.speaker_pins[1] = 0x15;
8763 spec->autocfg.speaker_pins[2] = 0x16;
8764 spec->autocfg.speaker_pins[3] = 0x17;
8767 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8769 struct alc_spec *spec = codec->spec;
8771 spec->autocfg.hp_pins[0] = 0x1b;
8772 spec->autocfg.speaker_pins[0] = 0x14;
8773 spec->autocfg.speaker_pins[1] = 0x15;
8774 spec->autocfg.speaker_pins[2] = 0x16;
8775 spec->autocfg.speaker_pins[3] = 0x17;
8776 spec->autocfg.speaker_pins[4] = 0x1a;
8779 static void alc883_vaiott_setup(struct hda_codec *codec)
8781 struct alc_spec *spec = codec->spec;
8783 spec->autocfg.hp_pins[0] = 0x15;
8784 spec->autocfg.speaker_pins[0] = 0x14;
8785 spec->autocfg.speaker_pins[1] = 0x17;
8788 static struct hda_verb alc888_asus_m90v_verbs[] = {
8789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8790 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8791 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8792 /* enable unsolicited event */
8793 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8794 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8798 static void alc883_mode2_setup(struct hda_codec *codec)
8800 struct alc_spec *spec = codec->spec;
8802 spec->autocfg.hp_pins[0] = 0x1b;
8803 spec->autocfg.speaker_pins[0] = 0x14;
8804 spec->autocfg.speaker_pins[1] = 0x15;
8805 spec->autocfg.speaker_pins[2] = 0x16;
8806 spec->ext_mic.pin = 0x18;
8807 spec->int_mic.pin = 0x19;
8808 spec->ext_mic.mux_idx = 0;
8809 spec->int_mic.mux_idx = 1;
8813 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8814 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8817 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8818 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8819 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8820 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8821 /* enable unsolicited event */
8822 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8826 static void alc883_eee1601_inithook(struct hda_codec *codec)
8828 struct alc_spec *spec = codec->spec;
8830 spec->autocfg.hp_pins[0] = 0x14;
8831 spec->autocfg.speaker_pins[0] = 0x1b;
8832 alc_automute_pin(codec);
8835 static struct hda_verb alc889A_mb31_verbs[] = {
8836 /* Init rear pin (used as headphone output) */
8837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8838 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8839 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8840 /* Init line pin (used as output in 4ch and 6ch mode) */
8841 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8842 /* Init line 2 pin (used as headphone out by default) */
8843 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8844 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8848 /* Mute speakers according to the headphone jack state */
8849 static void alc889A_mb31_automute(struct hda_codec *codec)
8851 unsigned int present;
8853 /* Mute only in 2ch or 4ch mode */
8854 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8856 present = snd_hda_jack_detect(codec, 0x15);
8857 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8858 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8859 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8860 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8864 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8866 if ((res >> 26) == ALC880_HP_EVENT)
8867 alc889A_mb31_automute(codec);
8871 #ifdef CONFIG_SND_HDA_POWER_SAVE
8872 #define alc882_loopbacks alc880_loopbacks
8875 /* pcm configuration: identical with ALC880 */
8876 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8877 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8878 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8879 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8881 static hda_nid_t alc883_slave_dig_outs[] = {
8882 ALC1200_DIGOUT_NID, 0,
8885 static hda_nid_t alc1200_slave_dig_outs[] = {
8886 ALC883_DIGOUT_NID, 0,
8890 * configuration and preset
8892 static const char *alc882_models[ALC882_MODEL_LAST] = {
8893 [ALC882_3ST_DIG] = "3stack-dig",
8894 [ALC882_6ST_DIG] = "6stack-dig",
8895 [ALC882_ARIMA] = "arima",
8896 [ALC882_W2JC] = "w2jc",
8897 [ALC882_TARGA] = "targa",
8898 [ALC882_ASUS_A7J] = "asus-a7j",
8899 [ALC882_ASUS_A7M] = "asus-a7m",
8900 [ALC885_MACPRO] = "macpro",
8901 [ALC885_MB5] = "mb5",
8902 [ALC885_MBP3] = "mbp3",
8903 [ALC885_IMAC24] = "imac24",
8904 [ALC885_IMAC91] = "imac91",
8905 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8906 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8907 [ALC883_3ST_6ch] = "3stack-6ch",
8908 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8909 [ALC883_TARGA_DIG] = "targa-dig",
8910 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8911 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8912 [ALC883_ACER] = "acer",
8913 [ALC883_ACER_ASPIRE] = "acer-aspire",
8914 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8915 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8916 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8917 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8918 [ALC883_MEDION] = "medion",
8919 [ALC883_MEDION_MD2] = "medion-md2",
8920 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8921 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8922 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8923 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8924 [ALC888_LENOVO_SKY] = "lenovo-sky",
8925 [ALC883_HAIER_W66] = "haier-w66",
8926 [ALC888_3ST_HP] = "3stack-hp",
8927 [ALC888_6ST_DELL] = "6stack-dell",
8928 [ALC883_MITAC] = "mitac",
8929 [ALC883_CLEVO_M540R] = "clevo-m540r",
8930 [ALC883_CLEVO_M720] = "clevo-m720",
8931 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8932 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8933 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8934 [ALC889A_INTEL] = "intel-alc889a",
8935 [ALC889_INTEL] = "intel-x58",
8936 [ALC1200_ASUS_P5Q] = "asus-p5q",
8937 [ALC889A_MB31] = "mb31",
8938 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8939 [ALC882_AUTO] = "auto",
8942 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8943 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8945 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8946 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8947 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
8948 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
8949 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
8950 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
8951 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
8952 ALC888_ACER_ASPIRE_4930G),
8953 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
8954 ALC888_ACER_ASPIRE_4930G),
8955 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
8956 ALC888_ACER_ASPIRE_8930G),
8957 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
8958 ALC888_ACER_ASPIRE_8930G),
8959 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
8960 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
8961 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
8962 ALC888_ACER_ASPIRE_6530G),
8963 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
8964 ALC888_ACER_ASPIRE_6530G),
8965 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
8966 ALC888_ACER_ASPIRE_7730G),
8967 /* default Acer -- disabled as it causes more problems.
8968 * model=auto should work fine now
8970 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
8972 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
8974 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
8975 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8976 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8977 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8978 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8979 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
8981 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
8982 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
8983 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
8984 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8985 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
8986 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
8987 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
8988 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8989 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
8990 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
8991 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
8993 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
8994 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
8995 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
8996 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
8997 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
8998 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
8999 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9000 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9001 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9003 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9004 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9005 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9006 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9007 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
9008 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9009 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9010 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9011 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9012 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9013 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9014 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9015 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9016 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9017 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9018 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9019 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9020 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9021 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9022 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9023 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9024 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9025 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9026 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9027 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9028 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9029 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9030 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9031 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9033 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9034 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9035 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9036 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9037 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9038 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9039 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9040 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9041 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9042 ALC883_FUJITSU_PI2515),
9043 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9044 ALC888_FUJITSU_XA3530),
9045 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9046 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9047 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9048 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9049 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9050 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9051 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9052 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9053 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9055 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9056 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9057 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9058 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9059 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9060 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9061 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9066 /* codec SSID table for Intel Mac */
9067 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9068 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9069 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9070 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9071 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9072 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9073 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9074 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9075 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9076 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9077 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9078 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9079 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9080 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9081 * so apparently no perfect solution yet
9083 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9084 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9088 static struct alc_config_preset alc882_presets[] = {
9089 [ALC882_3ST_DIG] = {
9090 .mixers = { alc882_base_mixer },
9091 .init_verbs = { alc882_base_init_verbs,
9092 alc882_adc1_init_verbs },
9093 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9094 .dac_nids = alc882_dac_nids,
9095 .dig_out_nid = ALC882_DIGOUT_NID,
9096 .dig_in_nid = ALC882_DIGIN_NID,
9097 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9098 .channel_mode = alc882_ch_modes,
9100 .input_mux = &alc882_capture_source,
9102 [ALC882_6ST_DIG] = {
9103 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9104 .init_verbs = { alc882_base_init_verbs,
9105 alc882_adc1_init_verbs },
9106 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9107 .dac_nids = alc882_dac_nids,
9108 .dig_out_nid = ALC882_DIGOUT_NID,
9109 .dig_in_nid = ALC882_DIGIN_NID,
9110 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9111 .channel_mode = alc882_sixstack_modes,
9112 .input_mux = &alc882_capture_source,
9115 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9116 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9117 alc882_eapd_verbs },
9118 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9119 .dac_nids = alc882_dac_nids,
9120 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9121 .channel_mode = alc882_sixstack_modes,
9122 .input_mux = &alc882_capture_source,
9125 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9126 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9127 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9128 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9129 .dac_nids = alc882_dac_nids,
9130 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9131 .channel_mode = alc880_threestack_modes,
9133 .input_mux = &alc882_capture_source,
9134 .dig_out_nid = ALC882_DIGOUT_NID,
9137 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9138 .init_verbs = { alc885_mbp3_init_verbs,
9139 alc880_gpio1_init_verbs },
9141 .dac_nids = alc882_dac_nids,
9143 .channel_mode = alc885_mbp_4ch_modes,
9144 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9145 .input_mux = &alc882_capture_source,
9146 .dig_out_nid = ALC882_DIGOUT_NID,
9147 .dig_in_nid = ALC882_DIGIN_NID,
9148 .unsol_event = alc_automute_amp_unsol_event,
9149 .setup = alc885_mbp3_setup,
9150 .init_hook = alc_automute_amp,
9153 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9154 .init_verbs = { alc885_mb5_init_verbs,
9155 alc880_gpio1_init_verbs },
9156 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9157 .dac_nids = alc882_dac_nids,
9158 .channel_mode = alc885_mb5_6ch_modes,
9159 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9160 .input_mux = &mb5_capture_source,
9161 .dig_out_nid = ALC882_DIGOUT_NID,
9162 .dig_in_nid = ALC882_DIGIN_NID,
9165 .mixers = { alc882_macpro_mixer },
9166 .init_verbs = { alc882_macpro_init_verbs },
9167 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9168 .dac_nids = alc882_dac_nids,
9169 .dig_out_nid = ALC882_DIGOUT_NID,
9170 .dig_in_nid = ALC882_DIGIN_NID,
9171 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9172 .channel_mode = alc882_ch_modes,
9173 .input_mux = &alc882_capture_source,
9174 .init_hook = alc885_macpro_init_hook,
9177 .mixers = { alc885_imac24_mixer },
9178 .init_verbs = { alc885_imac24_init_verbs },
9179 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9180 .dac_nids = alc882_dac_nids,
9181 .dig_out_nid = ALC882_DIGOUT_NID,
9182 .dig_in_nid = ALC882_DIGIN_NID,
9183 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9184 .channel_mode = alc882_ch_modes,
9185 .input_mux = &alc882_capture_source,
9186 .unsol_event = alc_automute_amp_unsol_event,
9187 .setup = alc885_imac24_setup,
9188 .init_hook = alc885_imac24_init_hook,
9191 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9192 .init_verbs = { alc885_imac91_init_verbs,
9193 alc880_gpio1_init_verbs },
9194 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9195 .dac_nids = alc882_dac_nids,
9196 .channel_mode = alc885_mbp_4ch_modes,
9197 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9198 .input_mux = &alc882_capture_source,
9199 .dig_out_nid = ALC882_DIGOUT_NID,
9200 .dig_in_nid = ALC882_DIGIN_NID,
9201 .unsol_event = alc885_imac91_unsol_event,
9202 .init_hook = alc885_imac91_automute,
9205 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9206 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9207 alc880_gpio3_init_verbs, alc882_targa_verbs},
9208 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9209 .dac_nids = alc882_dac_nids,
9210 .dig_out_nid = ALC882_DIGOUT_NID,
9211 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9212 .adc_nids = alc882_adc_nids,
9213 .capsrc_nids = alc882_capsrc_nids,
9214 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9215 .channel_mode = alc882_3ST_6ch_modes,
9217 .input_mux = &alc882_capture_source,
9218 .unsol_event = alc882_targa_unsol_event,
9219 .setup = alc882_targa_setup,
9220 .init_hook = alc882_targa_automute,
9222 [ALC882_ASUS_A7J] = {
9223 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9224 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9225 alc882_asus_a7j_verbs},
9226 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9227 .dac_nids = alc882_dac_nids,
9228 .dig_out_nid = ALC882_DIGOUT_NID,
9229 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9230 .adc_nids = alc882_adc_nids,
9231 .capsrc_nids = alc882_capsrc_nids,
9232 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9233 .channel_mode = alc882_3ST_6ch_modes,
9235 .input_mux = &alc882_capture_source,
9237 [ALC882_ASUS_A7M] = {
9238 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9239 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9240 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9241 alc882_asus_a7m_verbs },
9242 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9243 .dac_nids = alc882_dac_nids,
9244 .dig_out_nid = ALC882_DIGOUT_NID,
9245 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9246 .channel_mode = alc880_threestack_modes,
9248 .input_mux = &alc882_capture_source,
9250 [ALC883_3ST_2ch_DIG] = {
9251 .mixers = { alc883_3ST_2ch_mixer },
9252 .init_verbs = { alc883_init_verbs },
9253 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9254 .dac_nids = alc883_dac_nids,
9255 .dig_out_nid = ALC883_DIGOUT_NID,
9256 .dig_in_nid = ALC883_DIGIN_NID,
9257 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9258 .channel_mode = alc883_3ST_2ch_modes,
9259 .input_mux = &alc883_capture_source,
9261 [ALC883_3ST_6ch_DIG] = {
9262 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9263 .init_verbs = { alc883_init_verbs },
9264 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9265 .dac_nids = alc883_dac_nids,
9266 .dig_out_nid = ALC883_DIGOUT_NID,
9267 .dig_in_nid = ALC883_DIGIN_NID,
9268 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9269 .channel_mode = alc883_3ST_6ch_modes,
9271 .input_mux = &alc883_capture_source,
9273 [ALC883_3ST_6ch] = {
9274 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9275 .init_verbs = { alc883_init_verbs },
9276 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9277 .dac_nids = alc883_dac_nids,
9278 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9279 .channel_mode = alc883_3ST_6ch_modes,
9281 .input_mux = &alc883_capture_source,
9283 [ALC883_3ST_6ch_INTEL] = {
9284 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9285 .init_verbs = { alc883_init_verbs },
9286 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9287 .dac_nids = alc883_dac_nids,
9288 .dig_out_nid = ALC883_DIGOUT_NID,
9289 .dig_in_nid = ALC883_DIGIN_NID,
9290 .slave_dig_outs = alc883_slave_dig_outs,
9291 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9292 .channel_mode = alc883_3ST_6ch_intel_modes,
9294 .input_mux = &alc883_3stack_6ch_intel,
9297 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9298 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9299 alc_hp15_unsol_verbs },
9300 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9301 .dac_nids = alc883_dac_nids,
9302 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9303 .adc_nids = alc889_adc_nids,
9304 .dig_out_nid = ALC883_DIGOUT_NID,
9305 .dig_in_nid = ALC883_DIGIN_NID,
9306 .slave_dig_outs = alc883_slave_dig_outs,
9307 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9308 .channel_mode = alc889_8ch_intel_modes,
9309 .capsrc_nids = alc889_capsrc_nids,
9310 .input_mux = &alc889_capture_source,
9311 .setup = alc889_automute_setup,
9312 .init_hook = alc_automute_amp,
9313 .unsol_event = alc_automute_amp_unsol_event,
9317 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9318 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9319 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9320 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9321 .dac_nids = alc883_dac_nids,
9322 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9323 .adc_nids = alc889_adc_nids,
9324 .dig_out_nid = ALC883_DIGOUT_NID,
9325 .dig_in_nid = ALC883_DIGIN_NID,
9326 .slave_dig_outs = alc883_slave_dig_outs,
9327 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9328 .channel_mode = alc889_8ch_intel_modes,
9329 .capsrc_nids = alc889_capsrc_nids,
9330 .input_mux = &alc889_capture_source,
9331 .setup = alc889_automute_setup,
9332 .init_hook = alc889_intel_init_hook,
9333 .unsol_event = alc_automute_amp_unsol_event,
9336 [ALC883_6ST_DIG] = {
9337 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9338 .init_verbs = { alc883_init_verbs },
9339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9340 .dac_nids = alc883_dac_nids,
9341 .dig_out_nid = ALC883_DIGOUT_NID,
9342 .dig_in_nid = ALC883_DIGIN_NID,
9343 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9344 .channel_mode = alc883_sixstack_modes,
9345 .input_mux = &alc883_capture_source,
9347 [ALC883_TARGA_DIG] = {
9348 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9349 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9350 alc883_targa_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_targa_unsol_event,
9359 .setup = alc882_targa_setup,
9360 .init_hook = alc882_targa_automute,
9362 [ALC883_TARGA_2ch_DIG] = {
9363 .mixers = { alc883_targa_2ch_mixer},
9364 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9365 alc883_targa_verbs},
9366 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9367 .dac_nids = alc883_dac_nids,
9368 .adc_nids = alc883_adc_nids_alt,
9369 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9370 .dig_out_nid = ALC883_DIGOUT_NID,
9371 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9372 .channel_mode = alc883_3ST_2ch_modes,
9373 .input_mux = &alc883_capture_source,
9374 .unsol_event = alc883_targa_unsol_event,
9375 .setup = alc882_targa_setup,
9376 .init_hook = alc882_targa_automute,
9378 [ALC883_TARGA_8ch_DIG] = {
9379 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9380 alc883_chmode_mixer },
9381 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9382 alc883_targa_verbs },
9383 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9384 .dac_nids = alc883_dac_nids,
9385 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9386 .adc_nids = alc883_adc_nids_rev,
9387 .capsrc_nids = alc883_capsrc_nids_rev,
9388 .dig_out_nid = ALC883_DIGOUT_NID,
9389 .dig_in_nid = ALC883_DIGIN_NID,
9390 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9391 .channel_mode = alc883_4ST_8ch_modes,
9393 .input_mux = &alc883_capture_source,
9394 .unsol_event = alc883_targa_unsol_event,
9395 .setup = alc882_targa_setup,
9396 .init_hook = alc882_targa_automute,
9399 .mixers = { alc883_base_mixer },
9400 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9401 * and the headphone jack. Turn this on and rely on the
9402 * standard mute methods whenever the user wants to turn
9403 * these outputs off.
9405 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9407 .dac_nids = alc883_dac_nids,
9408 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9409 .channel_mode = alc883_3ST_2ch_modes,
9410 .input_mux = &alc883_capture_source,
9412 [ALC883_ACER_ASPIRE] = {
9413 .mixers = { alc883_acer_aspire_mixer },
9414 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9415 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9416 .dac_nids = alc883_dac_nids,
9417 .dig_out_nid = ALC883_DIGOUT_NID,
9418 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9419 .channel_mode = alc883_3ST_2ch_modes,
9420 .input_mux = &alc883_capture_source,
9421 .unsol_event = alc_automute_amp_unsol_event,
9422 .setup = alc883_acer_aspire_setup,
9423 .init_hook = alc_automute_amp,
9425 [ALC888_ACER_ASPIRE_4930G] = {
9426 .mixers = { alc888_base_mixer,
9427 alc883_chmode_mixer },
9428 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9429 alc888_acer_aspire_4930g_verbs },
9430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9431 .dac_nids = alc883_dac_nids,
9432 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9433 .adc_nids = alc883_adc_nids_rev,
9434 .capsrc_nids = alc883_capsrc_nids_rev,
9435 .dig_out_nid = ALC883_DIGOUT_NID,
9436 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9437 .channel_mode = alc883_3ST_6ch_modes,
9440 ARRAY_SIZE(alc888_2_capture_sources),
9441 .input_mux = alc888_2_capture_sources,
9442 .unsol_event = alc_automute_amp_unsol_event,
9443 .setup = alc888_acer_aspire_4930g_setup,
9444 .init_hook = alc_automute_amp,
9446 [ALC888_ACER_ASPIRE_6530G] = {
9447 .mixers = { alc888_acer_aspire_6530_mixer },
9448 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9449 alc888_acer_aspire_6530g_verbs },
9450 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9451 .dac_nids = alc883_dac_nids,
9452 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9453 .adc_nids = alc883_adc_nids_rev,
9454 .capsrc_nids = alc883_capsrc_nids_rev,
9455 .dig_out_nid = ALC883_DIGOUT_NID,
9456 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9457 .channel_mode = alc883_3ST_2ch_modes,
9459 ARRAY_SIZE(alc888_2_capture_sources),
9460 .input_mux = alc888_acer_aspire_6530_sources,
9461 .unsol_event = alc_automute_amp_unsol_event,
9462 .setup = alc888_acer_aspire_6530g_setup,
9463 .init_hook = alc_automute_amp,
9465 [ALC888_ACER_ASPIRE_8930G] = {
9466 .mixers = { alc888_base_mixer,
9467 alc883_chmode_mixer },
9468 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9469 alc889_acer_aspire_8930g_verbs },
9470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9471 .dac_nids = alc883_dac_nids,
9472 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9473 .adc_nids = alc889_adc_nids,
9474 .capsrc_nids = alc889_capsrc_nids,
9475 .dig_out_nid = ALC883_DIGOUT_NID,
9476 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9477 .channel_mode = alc883_3ST_6ch_modes,
9479 .const_channel_count = 6,
9481 ARRAY_SIZE(alc889_capture_sources),
9482 .input_mux = alc889_capture_sources,
9483 .unsol_event = alc_automute_amp_unsol_event,
9484 .setup = alc889_acer_aspire_8930g_setup,
9485 .init_hook = alc_automute_amp,
9487 [ALC888_ACER_ASPIRE_7730G] = {
9488 .mixers = { alc883_3ST_6ch_mixer,
9489 alc883_chmode_mixer },
9490 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9491 alc888_acer_aspire_7730G_verbs },
9492 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9493 .dac_nids = alc883_dac_nids,
9494 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9495 .adc_nids = alc883_adc_nids_rev,
9496 .capsrc_nids = alc883_capsrc_nids_rev,
9497 .dig_out_nid = ALC883_DIGOUT_NID,
9498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9499 .channel_mode = alc883_3ST_6ch_modes,
9501 .const_channel_count = 6,
9502 .input_mux = &alc883_capture_source,
9503 .unsol_event = alc_automute_amp_unsol_event,
9504 .setup = alc888_acer_aspire_6530g_setup,
9505 .init_hook = alc_automute_amp,
9508 .mixers = { alc883_fivestack_mixer,
9509 alc883_chmode_mixer },
9510 .init_verbs = { alc883_init_verbs,
9511 alc883_medion_eapd_verbs },
9512 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9513 .dac_nids = alc883_dac_nids,
9514 .adc_nids = alc883_adc_nids_alt,
9515 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9516 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9517 .channel_mode = alc883_sixstack_modes,
9518 .input_mux = &alc883_capture_source,
9520 [ALC883_MEDION_MD2] = {
9521 .mixers = { alc883_medion_md2_mixer},
9522 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9523 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9524 .dac_nids = alc883_dac_nids,
9525 .dig_out_nid = ALC883_DIGOUT_NID,
9526 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9527 .channel_mode = alc883_3ST_2ch_modes,
9528 .input_mux = &alc883_capture_source,
9529 .unsol_event = alc_automute_amp_unsol_event,
9530 .setup = alc883_medion_md2_setup,
9531 .init_hook = alc_automute_amp,
9533 [ALC883_LAPTOP_EAPD] = {
9534 .mixers = { alc883_base_mixer },
9535 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9536 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9537 .dac_nids = alc883_dac_nids,
9538 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9539 .channel_mode = alc883_3ST_2ch_modes,
9540 .input_mux = &alc883_capture_source,
9542 [ALC883_CLEVO_M540R] = {
9543 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9544 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9546 .dac_nids = alc883_dac_nids,
9547 .dig_out_nid = ALC883_DIGOUT_NID,
9548 .dig_in_nid = ALC883_DIGIN_NID,
9549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9550 .channel_mode = alc883_3ST_6ch_clevo_modes,
9552 .input_mux = &alc883_capture_source,
9553 /* This machine has the hardware HP auto-muting, thus
9554 * we need no software mute via unsol event
9557 [ALC883_CLEVO_M720] = {
9558 .mixers = { alc883_clevo_m720_mixer },
9559 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9560 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9561 .dac_nids = alc883_dac_nids,
9562 .dig_out_nid = ALC883_DIGOUT_NID,
9563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9564 .channel_mode = alc883_3ST_2ch_modes,
9565 .input_mux = &alc883_capture_source,
9566 .unsol_event = alc883_clevo_m720_unsol_event,
9567 .setup = alc883_clevo_m720_setup,
9568 .init_hook = alc883_clevo_m720_init_hook,
9570 [ALC883_LENOVO_101E_2ch] = {
9571 .mixers = { alc883_lenovo_101e_2ch_mixer},
9572 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9574 .dac_nids = alc883_dac_nids,
9575 .adc_nids = alc883_adc_nids_alt,
9576 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9577 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9578 .channel_mode = alc883_3ST_2ch_modes,
9579 .input_mux = &alc883_lenovo_101e_capture_source,
9580 .unsol_event = alc883_lenovo_101e_unsol_event,
9581 .init_hook = alc883_lenovo_101e_all_automute,
9583 [ALC883_LENOVO_NB0763] = {
9584 .mixers = { alc883_lenovo_nb0763_mixer },
9585 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9586 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9587 .dac_nids = alc883_dac_nids,
9588 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9589 .channel_mode = alc883_3ST_2ch_modes,
9591 .input_mux = &alc883_lenovo_nb0763_capture_source,
9592 .unsol_event = alc_automute_amp_unsol_event,
9593 .setup = alc883_medion_md2_setup,
9594 .init_hook = alc_automute_amp,
9596 [ALC888_LENOVO_MS7195_DIG] = {
9597 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9598 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9599 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9600 .dac_nids = alc883_dac_nids,
9601 .dig_out_nid = ALC883_DIGOUT_NID,
9602 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9603 .channel_mode = alc883_3ST_6ch_modes,
9605 .input_mux = &alc883_capture_source,
9606 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9607 .init_hook = alc888_lenovo_ms7195_front_automute,
9609 [ALC883_HAIER_W66] = {
9610 .mixers = { alc883_targa_2ch_mixer},
9611 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9612 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9613 .dac_nids = alc883_dac_nids,
9614 .dig_out_nid = ALC883_DIGOUT_NID,
9615 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9616 .channel_mode = alc883_3ST_2ch_modes,
9617 .input_mux = &alc883_capture_source,
9618 .unsol_event = alc_automute_amp_unsol_event,
9619 .setup = alc883_haier_w66_setup,
9620 .init_hook = alc_automute_amp,
9623 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9624 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9625 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9626 .dac_nids = alc883_dac_nids,
9627 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9628 .channel_mode = alc888_3st_hp_modes,
9630 .input_mux = &alc883_capture_source,
9631 .unsol_event = alc_automute_amp_unsol_event,
9632 .setup = alc888_3st_hp_setup,
9633 .init_hook = alc_automute_amp,
9635 [ALC888_6ST_DELL] = {
9636 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9637 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9638 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9639 .dac_nids = alc883_dac_nids,
9640 .dig_out_nid = ALC883_DIGOUT_NID,
9641 .dig_in_nid = ALC883_DIGIN_NID,
9642 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9643 .channel_mode = alc883_sixstack_modes,
9644 .input_mux = &alc883_capture_source,
9645 .unsol_event = alc_automute_amp_unsol_event,
9646 .setup = alc888_6st_dell_setup,
9647 .init_hook = alc_automute_amp,
9650 .mixers = { alc883_mitac_mixer },
9651 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9652 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9653 .dac_nids = alc883_dac_nids,
9654 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9655 .channel_mode = alc883_3ST_2ch_modes,
9656 .input_mux = &alc883_capture_source,
9657 .unsol_event = alc_automute_amp_unsol_event,
9658 .setup = alc883_mitac_setup,
9659 .init_hook = alc_automute_amp,
9661 [ALC883_FUJITSU_PI2515] = {
9662 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9663 .init_verbs = { alc883_init_verbs,
9664 alc883_2ch_fujitsu_pi2515_verbs},
9665 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9666 .dac_nids = alc883_dac_nids,
9667 .dig_out_nid = ALC883_DIGOUT_NID,
9668 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9669 .channel_mode = alc883_3ST_2ch_modes,
9670 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9671 .unsol_event = alc_automute_amp_unsol_event,
9672 .setup = alc883_2ch_fujitsu_pi2515_setup,
9673 .init_hook = alc_automute_amp,
9675 [ALC888_FUJITSU_XA3530] = {
9676 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9677 .init_verbs = { alc883_init_verbs,
9678 alc888_fujitsu_xa3530_verbs },
9679 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9680 .dac_nids = alc883_dac_nids,
9681 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9682 .adc_nids = alc883_adc_nids_rev,
9683 .capsrc_nids = alc883_capsrc_nids_rev,
9684 .dig_out_nid = ALC883_DIGOUT_NID,
9685 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9686 .channel_mode = alc888_4ST_8ch_intel_modes,
9688 ARRAY_SIZE(alc888_2_capture_sources),
9689 .input_mux = alc888_2_capture_sources,
9690 .unsol_event = alc_automute_amp_unsol_event,
9691 .setup = alc888_fujitsu_xa3530_setup,
9692 .init_hook = alc_automute_amp,
9694 [ALC888_LENOVO_SKY] = {
9695 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9696 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9698 .dac_nids = alc883_dac_nids,
9699 .dig_out_nid = ALC883_DIGOUT_NID,
9700 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9701 .channel_mode = alc883_sixstack_modes,
9703 .input_mux = &alc883_lenovo_sky_capture_source,
9704 .unsol_event = alc_automute_amp_unsol_event,
9705 .setup = alc888_lenovo_sky_setup,
9706 .init_hook = alc_automute_amp,
9708 [ALC888_ASUS_M90V] = {
9709 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9710 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9712 .dac_nids = alc883_dac_nids,
9713 .dig_out_nid = ALC883_DIGOUT_NID,
9714 .dig_in_nid = ALC883_DIGIN_NID,
9715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9716 .channel_mode = alc883_3ST_6ch_modes,
9718 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9719 .unsol_event = alc_sku_unsol_event,
9720 .setup = alc883_mode2_setup,
9721 .init_hook = alc_inithook,
9723 [ALC888_ASUS_EEE1601] = {
9724 .mixers = { alc883_asus_eee1601_mixer },
9725 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9726 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9727 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9728 .dac_nids = alc883_dac_nids,
9729 .dig_out_nid = ALC883_DIGOUT_NID,
9730 .dig_in_nid = ALC883_DIGIN_NID,
9731 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9732 .channel_mode = alc883_3ST_2ch_modes,
9734 .input_mux = &alc883_asus_eee1601_capture_source,
9735 .unsol_event = alc_sku_unsol_event,
9736 .init_hook = alc883_eee1601_inithook,
9738 [ALC1200_ASUS_P5Q] = {
9739 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9740 .init_verbs = { alc883_init_verbs },
9741 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9742 .dac_nids = alc883_dac_nids,
9743 .dig_out_nid = ALC1200_DIGOUT_NID,
9744 .dig_in_nid = ALC883_DIGIN_NID,
9745 .slave_dig_outs = alc1200_slave_dig_outs,
9746 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9747 .channel_mode = alc883_sixstack_modes,
9748 .input_mux = &alc883_capture_source,
9751 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9752 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9753 alc880_gpio1_init_verbs },
9754 .adc_nids = alc883_adc_nids,
9755 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9756 .dac_nids = alc883_dac_nids,
9757 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9758 .channel_mode = alc889A_mb31_6ch_modes,
9759 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9760 .input_mux = &alc889A_mb31_capture_source,
9761 .dig_out_nid = ALC883_DIGOUT_NID,
9762 .unsol_event = alc889A_mb31_unsol_event,
9763 .init_hook = alc889A_mb31_automute,
9765 [ALC883_SONY_VAIO_TT] = {
9766 .mixers = { alc883_vaiott_mixer },
9767 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9768 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9769 .dac_nids = alc883_dac_nids,
9770 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9771 .channel_mode = alc883_3ST_2ch_modes,
9772 .input_mux = &alc883_capture_source,
9773 .unsol_event = alc_automute_amp_unsol_event,
9774 .setup = alc883_vaiott_setup,
9775 .init_hook = alc_automute_amp,
9784 PINFIX_ABIT_AW9D_MAX
9787 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9788 { 0x15, 0x01080104 }, /* side */
9789 { 0x16, 0x01011012 }, /* rear */
9790 { 0x17, 0x01016011 }, /* clfe */
9794 static const struct alc_fixup alc882_fixups[] = {
9795 [PINFIX_ABIT_AW9D_MAX] = {
9796 .pins = alc882_abit_aw9d_pinfix
9800 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9801 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9806 * BIOS auto configuration
9808 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9809 const struct auto_pin_cfg *cfg)
9811 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9814 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9815 hda_nid_t nid, int pin_type,
9819 struct alc_spec *spec = codec->spec;
9822 alc_set_pin_output(codec, nid, pin_type);
9823 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9826 idx = spec->multiout.dac_nids[dac_idx] - 2;
9827 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9831 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9833 struct alc_spec *spec = codec->spec;
9836 for (i = 0; i <= HDA_SIDE; i++) {
9837 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9838 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9840 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9845 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9847 struct alc_spec *spec = codec->spec;
9850 pin = spec->autocfg.hp_pins[0];
9851 if (pin) /* connect to front */
9853 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9854 pin = spec->autocfg.speaker_pins[0];
9856 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9859 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9861 struct alc_spec *spec = codec->spec;
9864 for (i = 0; i < AUTO_PIN_LAST; i++) {
9865 hda_nid_t nid = spec->autocfg.input_pins[i];
9868 alc_set_input_pin(codec, nid, i);
9869 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9870 snd_hda_codec_write(codec, nid, 0,
9871 AC_VERB_SET_AMP_GAIN_MUTE,
9876 static void alc882_auto_init_input_src(struct hda_codec *codec)
9878 struct alc_spec *spec = codec->spec;
9881 for (c = 0; c < spec->num_adc_nids; c++) {
9882 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9883 hda_nid_t nid = spec->capsrc_nids[c];
9884 unsigned int mux_idx;
9885 const struct hda_input_mux *imux;
9886 int conns, mute, idx, item;
9888 conns = snd_hda_get_connections(codec, nid, conn_list,
9889 ARRAY_SIZE(conn_list));
9892 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9893 imux = &spec->input_mux[mux_idx];
9894 for (idx = 0; idx < conns; idx++) {
9895 /* if the current connection is the selected one,
9896 * unmute it as default - otherwise mute it
9898 mute = AMP_IN_MUTE(idx);
9899 for (item = 0; item < imux->num_items; item++) {
9900 if (imux->items[item].index == idx) {
9901 if (spec->cur_mux[c] == item)
9902 mute = AMP_IN_UNMUTE(idx);
9906 /* check if we have a selector or mixer
9907 * we could check for the widget type instead, but
9908 * just check for Amp-In presence (in case of mixer
9909 * without amp-in there is something wrong, this
9910 * function shouldn't be used or capsrc nid is wrong)
9912 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9913 snd_hda_codec_write(codec, nid, 0,
9914 AC_VERB_SET_AMP_GAIN_MUTE,
9916 else if (mute != AMP_IN_MUTE(idx))
9917 snd_hda_codec_write(codec, nid, 0,
9918 AC_VERB_SET_CONNECT_SEL,
9924 /* add mic boosts if needed */
9925 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9927 struct alc_spec *spec = codec->spec;
9931 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9932 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9933 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9935 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9939 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
9940 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9941 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9943 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9950 /* almost identical with ALC880 parser... */
9951 static int alc882_parse_auto_config(struct hda_codec *codec)
9953 struct alc_spec *spec = codec->spec;
9954 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
9957 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
9961 if (!spec->autocfg.line_outs)
9962 return 0; /* can't find valid BIOS pin config */
9964 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
9967 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
9970 err = alc880_auto_create_extra_out(spec,
9971 spec->autocfg.speaker_pins[0],
9975 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
9979 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
9983 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
9985 /* check multiple SPDIF-out (for recent codecs) */
9986 for (i = 0; i < spec->autocfg.dig_outs; i++) {
9988 err = snd_hda_get_connections(codec,
9989 spec->autocfg.dig_out_pins[i],
9994 spec->multiout.dig_out_nid = dig_nid;
9996 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
9997 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
9999 spec->slave_dig_outs[i - 1] = dig_nid;
10002 if (spec->autocfg.dig_in_pin)
10003 spec->dig_in_nid = ALC880_DIGIN_NID;
10005 if (spec->kctls.list)
10006 add_mixer(spec, spec->kctls.list);
10008 add_verb(spec, alc883_auto_init_verbs);
10009 /* if ADC 0x07 is available, initialize it, too */
10010 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10011 add_verb(spec, alc882_adc1_init_verbs);
10013 spec->num_mux_defs = 1;
10014 spec->input_mux = &spec->private_imux[0];
10016 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10018 err = alc_auto_add_mic_boost(codec);
10022 return 1; /* config found */
10025 /* additional initialization for auto-configuration model */
10026 static void alc882_auto_init(struct hda_codec *codec)
10028 struct alc_spec *spec = codec->spec;
10029 alc882_auto_init_multi_out(codec);
10030 alc882_auto_init_hp_out(codec);
10031 alc882_auto_init_analog_input(codec);
10032 alc882_auto_init_input_src(codec);
10033 if (spec->unsol_event)
10034 alc_inithook(codec);
10037 static int patch_alc882(struct hda_codec *codec)
10039 struct alc_spec *spec;
10040 int err, board_config;
10042 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10046 codec->spec = spec;
10048 switch (codec->vendor_id) {
10053 /* ALC883 and variants */
10054 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10058 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10062 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10063 board_config = snd_hda_check_board_codec_sid_config(codec,
10064 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10066 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10067 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10069 board_config = ALC882_AUTO;
10072 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10074 if (board_config == ALC882_AUTO) {
10075 /* automatic parse from the BIOS config */
10076 err = alc882_parse_auto_config(codec);
10082 "hda_codec: Cannot set up configuration "
10083 "from BIOS. Using base mode...\n");
10084 board_config = ALC882_3ST_DIG;
10088 err = snd_hda_attach_beep_device(codec, 0x1);
10094 if (board_config != ALC882_AUTO)
10095 setup_preset(codec, &alc882_presets[board_config]);
10097 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10098 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10099 /* FIXME: setup DAC5 */
10100 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10101 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10103 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10104 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10106 if (codec->vendor_id == 0x10ec0888)
10107 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10109 if (!spec->adc_nids && spec->input_mux) {
10111 spec->num_adc_nids = 0;
10112 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10113 const struct hda_input_mux *imux = spec->input_mux;
10115 hda_nid_t items[16];
10116 hda_nid_t nid = alc882_adc_nids[i];
10117 unsigned int wcap = get_wcaps(codec, nid);
10119 wcap = get_wcaps_type(wcap);
10120 if (wcap != AC_WID_AUD_IN)
10122 spec->private_adc_nids[spec->num_adc_nids] = nid;
10123 err = snd_hda_get_connections(codec, nid, &cap, 1);
10126 err = snd_hda_get_connections(codec, cap, items,
10127 ARRAY_SIZE(items));
10130 for (j = 0; j < imux->num_items; j++)
10131 if (imux->items[j].index >= err)
10133 if (j < imux->num_items)
10135 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10136 spec->num_adc_nids++;
10138 spec->adc_nids = spec->private_adc_nids;
10139 spec->capsrc_nids = spec->private_capsrc_nids;
10142 set_capture_mixer(codec);
10143 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10145 spec->vmaster_nid = 0x0c;
10147 codec->patch_ops = alc_patch_ops;
10148 if (board_config == ALC882_AUTO)
10149 spec->init_hook = alc882_auto_init;
10150 #ifdef CONFIG_SND_HDA_POWER_SAVE
10151 if (!spec->loopback.amplist)
10152 spec->loopback.amplist = alc882_loopbacks;
10154 codec->proc_widget_hook = print_realtek_coef;
10164 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10165 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10167 #define alc262_dac_nids alc260_dac_nids
10168 #define alc262_adc_nids alc882_adc_nids
10169 #define alc262_adc_nids_alt alc882_adc_nids_alt
10170 #define alc262_capsrc_nids alc882_capsrc_nids
10171 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10173 #define alc262_modes alc260_modes
10174 #define alc262_capture_source alc882_capture_source
10176 static hda_nid_t alc262_dmic_adc_nids[1] = {
10181 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10183 static struct snd_kcontrol_new alc262_base_mixer[] = {
10184 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10185 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10186 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10187 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10189 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10193 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10194 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10195 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10196 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10198 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10199 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10203 /* update HP, line and mono-out pins according to the master switch */
10204 static void alc262_hp_master_update(struct hda_codec *codec)
10206 struct alc_spec *spec = codec->spec;
10207 int val = spec->master_sw;
10209 /* HP & line-out */
10210 snd_hda_codec_write_cache(codec, 0x1b, 0,
10211 AC_VERB_SET_PIN_WIDGET_CONTROL,
10213 snd_hda_codec_write_cache(codec, 0x15, 0,
10214 AC_VERB_SET_PIN_WIDGET_CONTROL,
10216 /* mono (speaker) depending on the HP jack sense */
10217 val = val && !spec->jack_present;
10218 snd_hda_codec_write_cache(codec, 0x16, 0,
10219 AC_VERB_SET_PIN_WIDGET_CONTROL,
10220 val ? PIN_OUT : 0);
10223 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10225 struct alc_spec *spec = codec->spec;
10227 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10228 alc262_hp_master_update(codec);
10231 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10233 if ((res >> 26) != ALC880_HP_EVENT)
10235 alc262_hp_bpc_automute(codec);
10238 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10240 struct alc_spec *spec = codec->spec;
10242 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10243 alc262_hp_master_update(codec);
10246 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10249 if ((res >> 26) != ALC880_HP_EVENT)
10251 alc262_hp_wildwest_automute(codec);
10254 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10256 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10257 struct snd_ctl_elem_value *ucontrol)
10259 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10260 struct alc_spec *spec = codec->spec;
10261 int val = !!*ucontrol->value.integer.value;
10263 if (val == spec->master_sw)
10265 spec->master_sw = val;
10266 alc262_hp_master_update(codec);
10270 #define ALC262_HP_MASTER_SWITCH \
10272 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10273 .name = "Master Playback Switch", \
10274 .info = snd_ctl_boolean_mono_info, \
10275 .get = alc262_hp_master_sw_get, \
10276 .put = alc262_hp_master_sw_put, \
10279 .iface = NID_MAPPING, \
10280 .name = "Master Playback Switch", \
10281 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10285 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10286 ALC262_HP_MASTER_SWITCH,
10287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10288 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10290 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10292 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10296 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10297 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10298 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10299 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10300 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10301 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10304 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10305 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10309 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10310 ALC262_HP_MASTER_SWITCH,
10311 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10312 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10313 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10314 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10315 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10317 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10319 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10320 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10322 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10323 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10324 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10325 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10329 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10330 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10331 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10332 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10336 /* mute/unmute internal speaker according to the hp jack and mute state */
10337 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10339 struct alc_spec *spec = codec->spec;
10341 spec->autocfg.hp_pins[0] = 0x15;
10342 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10345 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10346 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10347 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10348 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10356 static struct hda_verb alc262_hp_t5735_verbs[] = {
10357 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10358 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10360 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10364 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10366 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10367 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10368 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10374 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10375 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10376 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10377 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10378 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10379 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10380 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10381 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10382 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10383 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10388 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10395 /* bind hp and internal speaker mute (with plug check) as master switch */
10396 static void alc262_hippo_master_update(struct hda_codec *codec)
10398 struct alc_spec *spec = codec->spec;
10399 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10400 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10401 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10405 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10406 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10407 HDA_AMP_MUTE, mute);
10408 /* mute internal speaker per jack sense */
10409 if (spec->jack_present)
10410 mute = HDA_AMP_MUTE;
10412 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10413 HDA_AMP_MUTE, mute);
10414 if (speaker_nid && speaker_nid != line_nid)
10415 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10416 HDA_AMP_MUTE, mute);
10419 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10421 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10422 struct snd_ctl_elem_value *ucontrol)
10424 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10425 struct alc_spec *spec = codec->spec;
10426 int val = !!*ucontrol->value.integer.value;
10428 if (val == spec->master_sw)
10430 spec->master_sw = val;
10431 alc262_hippo_master_update(codec);
10435 #define ALC262_HIPPO_MASTER_SWITCH \
10437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10438 .name = "Master Playback Switch", \
10439 .info = snd_ctl_boolean_mono_info, \
10440 .get = alc262_hippo_master_sw_get, \
10441 .put = alc262_hippo_master_sw_put, \
10444 .iface = NID_MAPPING, \
10445 .name = "Master Playback Switch", \
10446 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10447 (SUBDEV_SPEAKER(0) << 16), \
10450 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10451 ALC262_HIPPO_MASTER_SWITCH,
10452 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10453 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10454 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10457 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10458 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10459 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10460 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10461 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10462 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10463 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10467 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10468 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10469 ALC262_HIPPO_MASTER_SWITCH,
10470 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10471 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10473 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10475 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10476 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10478 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10479 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10483 /* mute/unmute internal speaker according to the hp jack and mute state */
10484 static void alc262_hippo_automute(struct hda_codec *codec)
10486 struct alc_spec *spec = codec->spec;
10487 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10489 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10490 alc262_hippo_master_update(codec);
10493 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10495 if ((res >> 26) != ALC880_HP_EVENT)
10497 alc262_hippo_automute(codec);
10500 static void alc262_hippo_setup(struct hda_codec *codec)
10502 struct alc_spec *spec = codec->spec;
10504 spec->autocfg.hp_pins[0] = 0x15;
10505 spec->autocfg.speaker_pins[0] = 0x14;
10508 static void alc262_hippo1_setup(struct hda_codec *codec)
10510 struct alc_spec *spec = codec->spec;
10512 spec->autocfg.hp_pins[0] = 0x1b;
10513 spec->autocfg.speaker_pins[0] = 0x14;
10517 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10518 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10519 ALC262_HIPPO_MASTER_SWITCH,
10520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10522 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10523 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10527 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10528 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10529 ALC262_HIPPO_MASTER_SWITCH,
10530 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10531 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10532 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10533 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10534 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10538 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10539 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10540 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10542 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10543 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10544 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10545 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10546 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10547 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10548 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10549 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10550 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10554 static struct hda_verb alc262_tyan_verbs[] = {
10555 /* Headphone automute */
10556 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10557 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10558 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10560 /* P11 AUX_IN, white 4-pin connector */
10561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10562 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10563 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10564 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10569 /* unsolicited event for HP jack sensing */
10570 static void alc262_tyan_setup(struct hda_codec *codec)
10572 struct alc_spec *spec = codec->spec;
10574 spec->autocfg.hp_pins[0] = 0x1b;
10575 spec->autocfg.speaker_pins[0] = 0x15;
10579 #define alc262_capture_mixer alc882_capture_mixer
10580 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10583 * generic initialization of ADC, input mixers and output mixers
10585 static struct hda_verb alc262_init_verbs[] = {
10587 * Unmute ADC0-2 and set the default input to mic-in
10589 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10590 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10591 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10592 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10593 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10596 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10598 * Note: PASD motherboards uses the Line In 2 as the input for
10599 * front panel mic (mic 2)
10601 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10605 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10606 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10609 * Set up output mixers (0x0c - 0x0e)
10611 /* set vol=0 to output mixers */
10612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10613 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10615 /* set up input amps for analog loopback */
10616 /* Amp Indices: DAC = 0, mixer = 1 */
10617 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10618 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10619 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10620 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10621 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10622 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10626 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10627 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10629 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10631 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10633 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10634 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10635 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10637 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10640 /* FIXME: use matrix-type input source selection */
10641 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10642 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10648 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10649 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10650 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10651 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10654 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10661 static struct hda_verb alc262_eapd_verbs[] = {
10662 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10663 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10667 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10668 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10669 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10670 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10672 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10673 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10677 static struct hda_verb alc262_sony_unsol_verbs[] = {
10678 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10679 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10680 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10682 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10687 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10688 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10689 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10690 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10691 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10692 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10696 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10697 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10698 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10701 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10703 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10704 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10708 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10710 struct alc_spec *spec = codec->spec;
10712 spec->autocfg.hp_pins[0] = 0x15;
10713 spec->autocfg.speaker_pins[0] = 0x14;
10714 spec->ext_mic.pin = 0x18;
10715 spec->ext_mic.mux_idx = 0;
10716 spec->int_mic.pin = 0x12;
10717 spec->int_mic.mux_idx = 9;
10718 spec->auto_mic = 1;
10724 * 0x16 = internal speaker
10725 * 0x18 = external mic
10728 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10729 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10730 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10734 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10736 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10737 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10741 static struct hda_verb alc262_nec_verbs[] = {
10742 /* Unmute Speaker */
10743 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10746 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10749 /* External mic to headphone */
10750 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10751 /* External mic to speaker */
10752 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10758 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10759 * 0x1b = port replicator headphone out
10762 #define ALC_HP_EVENT 0x37
10764 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10765 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10766 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10767 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10772 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10773 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10774 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10778 static struct hda_input_mux alc262_fujitsu_capture_source = {
10782 { "Int Mic", 0x1 },
10787 static struct hda_input_mux alc262_HP_capture_source = {
10791 { "Front Mic", 0x1 },
10798 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10802 { "Front Mic", 0x2 },
10808 /* mute/unmute internal speaker according to the hp jacks and mute state */
10809 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10811 struct alc_spec *spec = codec->spec;
10814 if (force || !spec->sense_updated) {
10815 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10816 snd_hda_jack_detect(codec, 0x1b);
10817 spec->sense_updated = 1;
10819 /* unmute internal speaker only if both HPs are unplugged and
10820 * master switch is on
10822 if (spec->jack_present)
10823 mute = HDA_AMP_MUTE;
10825 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10826 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10827 HDA_AMP_MUTE, mute);
10830 /* unsolicited event for HP jack sensing */
10831 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10834 if ((res >> 26) != ALC_HP_EVENT)
10836 alc262_fujitsu_automute(codec, 1);
10839 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10841 alc262_fujitsu_automute(codec, 1);
10844 /* bind volumes of both NID 0x0c and 0x0d */
10845 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10846 .ops = &snd_hda_bind_vol,
10848 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10849 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10854 /* mute/unmute internal speaker according to the hp jack and mute state */
10855 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10857 struct alc_spec *spec = codec->spec;
10860 if (force || !spec->sense_updated) {
10861 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10862 spec->sense_updated = 1;
10864 if (spec->jack_present) {
10865 /* mute internal speaker */
10866 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10867 HDA_AMP_MUTE, HDA_AMP_MUTE);
10868 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10869 HDA_AMP_MUTE, HDA_AMP_MUTE);
10871 /* unmute internal speaker if necessary */
10872 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10873 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10874 HDA_AMP_MUTE, mute);
10875 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10876 HDA_AMP_MUTE, mute);
10880 /* unsolicited event for HP jack sensing */
10881 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10884 if ((res >> 26) != ALC_HP_EVENT)
10886 alc262_lenovo_3000_automute(codec, 1);
10889 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10890 int dir, int idx, long *valp)
10894 for (i = 0; i < 2; i++, valp++)
10895 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10897 *valp ? 0 : HDA_AMP_MUTE);
10901 /* bind hp and internal speaker mute (with plug check) */
10902 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10903 struct snd_ctl_elem_value *ucontrol)
10905 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10906 long *valp = ucontrol->value.integer.value;
10909 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10910 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10912 alc262_fujitsu_automute(codec, 0);
10916 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10917 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10919 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10920 .name = "Master Playback Switch",
10921 .subdevice = HDA_SUBDEV_AMP_FLAG,
10922 .info = snd_hda_mixer_amp_switch_info,
10923 .get = snd_hda_mixer_amp_switch_get,
10924 .put = alc262_fujitsu_master_sw_put,
10925 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10928 .iface = NID_MAPPING,
10929 .name = "Master Playback Switch",
10930 .private_value = 0x1b,
10932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10934 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10937 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10938 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10939 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10943 /* bind hp and internal speaker mute (with plug check) */
10944 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
10945 struct snd_ctl_elem_value *ucontrol)
10947 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10948 long *valp = ucontrol->value.integer.value;
10951 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10953 alc262_lenovo_3000_automute(codec, 0);
10957 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
10958 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10960 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10961 .name = "Master Playback Switch",
10962 .subdevice = HDA_SUBDEV_AMP_FLAG,
10963 .info = snd_hda_mixer_amp_switch_info,
10964 .get = snd_hda_mixer_amp_switch_get,
10965 .put = alc262_lenovo_3000_master_sw_put,
10966 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
10968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10970 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10972 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10973 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
10974 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
10975 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
10979 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
10980 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10981 ALC262_HIPPO_MASTER_SWITCH,
10982 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10983 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10984 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10985 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10986 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10987 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10991 /* additional init verbs for Benq laptops */
10992 static struct hda_verb alc262_EAPD_verbs[] = {
10993 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
10994 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
10998 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
10999 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11000 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11002 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11003 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11007 /* Samsung Q1 Ultra Vista model setup */
11008 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11009 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11010 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11013 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11014 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11018 static struct hda_verb alc262_ultra_verbs[] = {
11020 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11021 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11026 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11027 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11029 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11030 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11032 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11033 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11035 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11036 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11037 /* ADC, choose mic */
11038 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11039 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11040 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11041 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11042 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11043 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11044 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11045 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11046 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11047 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11051 /* mute/unmute internal speaker according to the hp jack and mute state */
11052 static void alc262_ultra_automute(struct hda_codec *codec)
11054 struct alc_spec *spec = codec->spec;
11058 /* auto-mute only when HP is used as HP */
11059 if (!spec->cur_mux[0]) {
11060 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11061 if (spec->jack_present)
11062 mute = HDA_AMP_MUTE;
11064 /* mute/unmute internal speaker */
11065 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11066 HDA_AMP_MUTE, mute);
11067 /* mute/unmute HP */
11068 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11069 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11072 /* unsolicited event for HP jack sensing */
11073 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11076 if ((res >> 26) != ALC880_HP_EVENT)
11078 alc262_ultra_automute(codec);
11081 static struct hda_input_mux alc262_ultra_capture_source = {
11085 { "Headphone", 0x7 },
11089 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11090 struct snd_ctl_elem_value *ucontrol)
11092 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11093 struct alc_spec *spec = codec->spec;
11096 ret = alc_mux_enum_put(kcontrol, ucontrol);
11099 /* reprogram the HP pin as mic or HP according to the input source */
11100 snd_hda_codec_write_cache(codec, 0x15, 0,
11101 AC_VERB_SET_PIN_WIDGET_CONTROL,
11102 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11103 alc262_ultra_automute(codec); /* mute/unmute HP */
11107 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11108 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11109 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11112 .name = "Capture Source",
11113 .info = alc_mux_enum_info,
11114 .get = alc_mux_enum_get,
11115 .put = alc262_ultra_mux_enum_put,
11118 .iface = NID_MAPPING,
11119 .name = "Capture Source",
11120 .private_value = 0x15,
11125 /* We use two mixers depending on the output pin; 0x16 is a mono output
11126 * and thus it's bound with a different mixer.
11127 * This function returns which mixer amp should be used.
11129 static int alc262_check_volbit(hda_nid_t nid)
11133 else if (nid == 0x16)
11139 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11140 const char *pfx, int *vbits)
11145 vbit = alc262_check_volbit(nid);
11148 if (*vbits & vbit) /* a volume control for this mixer already there */
11152 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11154 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11155 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11158 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11166 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11168 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11169 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11172 /* add playback controls from the parsed DAC table */
11173 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11174 const struct auto_pin_cfg *cfg)
11180 spec->multiout.num_dacs = 1; /* only use one dac */
11181 spec->multiout.dac_nids = spec->private_dac_nids;
11182 spec->multiout.dac_nids[0] = 2;
11184 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11186 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11190 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11193 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11196 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11200 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11201 alc262_check_volbit(cfg->speaker_pins[0]) |
11202 alc262_check_volbit(cfg->hp_pins[0]);
11203 if (vbits == 1 || vbits == 2)
11204 pfx = "Master"; /* only one mixer is used */
11205 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11210 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11213 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11217 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11224 #define alc262_auto_create_input_ctls \
11225 alc880_auto_create_input_ctls
11228 * generic initialization of ADC, input mixers and output mixers
11230 static struct hda_verb alc262_volume_init_verbs[] = {
11232 * Unmute ADC0-2 and set the default input to mic-in
11234 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11235 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11236 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11238 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11241 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11243 * Note: PASD motherboards uses the Line In 2 as the input for
11244 * front panel mic (mic 2)
11246 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11254 * Set up output mixers (0x0c - 0x0f)
11256 /* set vol=0 to output mixers */
11257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11261 /* set up input amps for analog loopback */
11262 /* Amp Indices: DAC = 0, mixer = 1 */
11263 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11265 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11266 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11267 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11268 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11270 /* FIXME: use matrix-type input source selection */
11271 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11272 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11273 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11274 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11275 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11276 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11278 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11280 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11281 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11283 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11284 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11285 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11286 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11291 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11293 * Unmute ADC0-2 and set the default input to mic-in
11295 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11296 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11297 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11299 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11300 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11302 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11304 * Note: PASD motherboards uses the Line In 2 as the input for
11305 * front panel mic (mic 2)
11307 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11317 * Set up output mixers (0x0c - 0x0e)
11319 /* set vol=0 to output mixers */
11320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11324 /* set up input amps for analog loopback */
11325 /* Amp Indices: DAC = 0, mixer = 1 */
11326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11335 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11338 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11340 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11341 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11343 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11344 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11346 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11347 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11351 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11353 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11354 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11357 /* FIXME: use matrix-type input source selection */
11358 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11359 /* Input mixer1: only unmute Mic */
11360 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11371 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11372 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11373 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11374 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11375 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11376 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11377 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11378 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11380 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11381 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11382 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11383 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11385 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11386 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11387 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11388 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11390 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11395 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11397 * Unmute ADC0-2 and set the default input to mic-in
11399 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11400 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11401 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11402 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11403 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11404 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11408 * Note: PASD motherboards uses the Line In 2 as the input for front
11409 * panel mic (mic 2)
11411 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11421 * Set up output mixers (0x0c - 0x0e)
11423 /* set vol=0 to output mixers */
11424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11425 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11428 /* set up input amps for analog loopback */
11429 /* Amp Indices: DAC = 0, mixer = 1 */
11430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11440 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11441 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11442 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11444 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11446 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11447 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11449 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11452 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11453 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11454 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11456 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11457 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11459 /* FIXME: use matrix-type input source selection */
11460 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11461 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11467 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11470 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11471 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11475 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11476 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11481 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11482 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11483 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11484 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11486 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11491 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11494 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11495 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11497 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11498 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11500 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11504 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11509 #ifdef CONFIG_SND_HDA_POWER_SAVE
11510 #define alc262_loopbacks alc880_loopbacks
11513 /* pcm configuration: identical with ALC880 */
11514 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11515 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11516 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11517 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11520 * BIOS auto configuration
11522 static int alc262_parse_auto_config(struct hda_codec *codec)
11524 struct alc_spec *spec = codec->spec;
11526 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11528 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11532 if (!spec->autocfg.line_outs) {
11533 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11534 spec->multiout.max_channels = 2;
11535 spec->no_analog = 1;
11538 return 0; /* can't find valid BIOS pin config */
11540 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11543 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11547 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11550 if (spec->autocfg.dig_outs) {
11551 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11552 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11554 if (spec->autocfg.dig_in_pin)
11555 spec->dig_in_nid = ALC262_DIGIN_NID;
11557 if (spec->kctls.list)
11558 add_mixer(spec, spec->kctls.list);
11560 add_verb(spec, alc262_volume_init_verbs);
11561 spec->num_mux_defs = 1;
11562 spec->input_mux = &spec->private_imux[0];
11564 err = alc_auto_add_mic_boost(codec);
11568 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11573 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11574 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11575 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11576 #define alc262_auto_init_input_src alc882_auto_init_input_src
11579 /* init callback for auto-configuration model -- overriding the default init */
11580 static void alc262_auto_init(struct hda_codec *codec)
11582 struct alc_spec *spec = codec->spec;
11583 alc262_auto_init_multi_out(codec);
11584 alc262_auto_init_hp_out(codec);
11585 alc262_auto_init_analog_input(codec);
11586 alc262_auto_init_input_src(codec);
11587 if (spec->unsol_event)
11588 alc_inithook(codec);
11592 * configuration and preset
11594 static const char *alc262_models[ALC262_MODEL_LAST] = {
11595 [ALC262_BASIC] = "basic",
11596 [ALC262_HIPPO] = "hippo",
11597 [ALC262_HIPPO_1] = "hippo_1",
11598 [ALC262_FUJITSU] = "fujitsu",
11599 [ALC262_HP_BPC] = "hp-bpc",
11600 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11601 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11602 [ALC262_HP_RP5700] = "hp-rp5700",
11603 [ALC262_BENQ_ED8] = "benq",
11604 [ALC262_BENQ_T31] = "benq-t31",
11605 [ALC262_SONY_ASSAMD] = "sony-assamd",
11606 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11607 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11608 [ALC262_ULTRA] = "ultra",
11609 [ALC262_LENOVO_3000] = "lenovo-3000",
11610 [ALC262_NEC] = "nec",
11611 [ALC262_TYAN] = "tyan",
11612 [ALC262_AUTO] = "auto",
11615 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11616 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11617 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11618 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11620 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11622 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11624 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11625 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11626 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11627 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11628 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11629 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11630 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11631 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11632 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11633 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11634 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11635 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11636 ALC262_HP_TC_T5735),
11637 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11638 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11639 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11640 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11641 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11642 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11643 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11644 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11645 #if 0 /* disable the quirk since model=auto works better in recent versions */
11646 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11647 ALC262_SONY_ASSAMD),
11649 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11650 ALC262_TOSHIBA_RX1),
11651 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11652 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11653 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11654 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11655 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11657 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11658 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11659 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11660 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11661 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11665 static struct alc_config_preset alc262_presets[] = {
11667 .mixers = { alc262_base_mixer },
11668 .init_verbs = { alc262_init_verbs },
11669 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11670 .dac_nids = alc262_dac_nids,
11672 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11673 .channel_mode = alc262_modes,
11674 .input_mux = &alc262_capture_source,
11677 .mixers = { alc262_hippo_mixer },
11678 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11679 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11680 .dac_nids = alc262_dac_nids,
11682 .dig_out_nid = ALC262_DIGOUT_NID,
11683 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11684 .channel_mode = alc262_modes,
11685 .input_mux = &alc262_capture_source,
11686 .unsol_event = alc262_hippo_unsol_event,
11687 .setup = alc262_hippo_setup,
11688 .init_hook = alc262_hippo_automute,
11690 [ALC262_HIPPO_1] = {
11691 .mixers = { alc262_hippo1_mixer },
11692 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11693 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11694 .dac_nids = alc262_dac_nids,
11696 .dig_out_nid = ALC262_DIGOUT_NID,
11697 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11698 .channel_mode = alc262_modes,
11699 .input_mux = &alc262_capture_source,
11700 .unsol_event = alc262_hippo_unsol_event,
11701 .setup = alc262_hippo1_setup,
11702 .init_hook = alc262_hippo_automute,
11704 [ALC262_FUJITSU] = {
11705 .mixers = { alc262_fujitsu_mixer },
11706 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11707 alc262_fujitsu_unsol_verbs },
11708 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11709 .dac_nids = alc262_dac_nids,
11711 .dig_out_nid = ALC262_DIGOUT_NID,
11712 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11713 .channel_mode = alc262_modes,
11714 .input_mux = &alc262_fujitsu_capture_source,
11715 .unsol_event = alc262_fujitsu_unsol_event,
11716 .init_hook = alc262_fujitsu_init_hook,
11718 [ALC262_HP_BPC] = {
11719 .mixers = { alc262_HP_BPC_mixer },
11720 .init_verbs = { alc262_HP_BPC_init_verbs },
11721 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11722 .dac_nids = alc262_dac_nids,
11724 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11725 .channel_mode = alc262_modes,
11726 .input_mux = &alc262_HP_capture_source,
11727 .unsol_event = alc262_hp_bpc_unsol_event,
11728 .init_hook = alc262_hp_bpc_automute,
11730 [ALC262_HP_BPC_D7000_WF] = {
11731 .mixers = { alc262_HP_BPC_WildWest_mixer },
11732 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11733 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11734 .dac_nids = alc262_dac_nids,
11736 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11737 .channel_mode = alc262_modes,
11738 .input_mux = &alc262_HP_D7000_capture_source,
11739 .unsol_event = alc262_hp_wildwest_unsol_event,
11740 .init_hook = alc262_hp_wildwest_automute,
11742 [ALC262_HP_BPC_D7000_WL] = {
11743 .mixers = { alc262_HP_BPC_WildWest_mixer,
11744 alc262_HP_BPC_WildWest_option_mixer },
11745 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11746 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11747 .dac_nids = alc262_dac_nids,
11749 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11750 .channel_mode = alc262_modes,
11751 .input_mux = &alc262_HP_D7000_capture_source,
11752 .unsol_event = alc262_hp_wildwest_unsol_event,
11753 .init_hook = alc262_hp_wildwest_automute,
11755 [ALC262_HP_TC_T5735] = {
11756 .mixers = { alc262_hp_t5735_mixer },
11757 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11758 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11759 .dac_nids = alc262_dac_nids,
11761 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11762 .channel_mode = alc262_modes,
11763 .input_mux = &alc262_capture_source,
11764 .unsol_event = alc_automute_amp_unsol_event,
11765 .setup = alc262_hp_t5735_setup,
11766 .init_hook = alc_automute_amp,
11768 [ALC262_HP_RP5700] = {
11769 .mixers = { alc262_hp_rp5700_mixer },
11770 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11771 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11772 .dac_nids = alc262_dac_nids,
11773 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11774 .channel_mode = alc262_modes,
11775 .input_mux = &alc262_hp_rp5700_capture_source,
11777 [ALC262_BENQ_ED8] = {
11778 .mixers = { alc262_base_mixer },
11779 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11781 .dac_nids = alc262_dac_nids,
11783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11784 .channel_mode = alc262_modes,
11785 .input_mux = &alc262_capture_source,
11787 [ALC262_SONY_ASSAMD] = {
11788 .mixers = { alc262_sony_mixer },
11789 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11790 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11791 .dac_nids = alc262_dac_nids,
11793 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11794 .channel_mode = alc262_modes,
11795 .input_mux = &alc262_capture_source,
11796 .unsol_event = alc262_hippo_unsol_event,
11797 .setup = alc262_hippo_setup,
11798 .init_hook = alc262_hippo_automute,
11800 [ALC262_BENQ_T31] = {
11801 .mixers = { alc262_benq_t31_mixer },
11802 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11803 alc_hp15_unsol_verbs },
11804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11805 .dac_nids = alc262_dac_nids,
11807 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11808 .channel_mode = alc262_modes,
11809 .input_mux = &alc262_capture_source,
11810 .unsol_event = alc262_hippo_unsol_event,
11811 .setup = alc262_hippo_setup,
11812 .init_hook = alc262_hippo_automute,
11815 .mixers = { alc262_ultra_mixer },
11816 .cap_mixer = alc262_ultra_capture_mixer,
11817 .init_verbs = { alc262_ultra_verbs },
11818 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11819 .dac_nids = alc262_dac_nids,
11820 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11821 .channel_mode = alc262_modes,
11822 .input_mux = &alc262_ultra_capture_source,
11823 .adc_nids = alc262_adc_nids, /* ADC0 */
11824 .capsrc_nids = alc262_capsrc_nids,
11825 .num_adc_nids = 1, /* single ADC */
11826 .unsol_event = alc262_ultra_unsol_event,
11827 .init_hook = alc262_ultra_automute,
11829 [ALC262_LENOVO_3000] = {
11830 .mixers = { alc262_lenovo_3000_mixer },
11831 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11832 alc262_lenovo_3000_unsol_verbs },
11833 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11834 .dac_nids = alc262_dac_nids,
11836 .dig_out_nid = ALC262_DIGOUT_NID,
11837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11838 .channel_mode = alc262_modes,
11839 .input_mux = &alc262_fujitsu_capture_source,
11840 .unsol_event = alc262_lenovo_3000_unsol_event,
11843 .mixers = { alc262_nec_mixer },
11844 .init_verbs = { alc262_nec_verbs },
11845 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11846 .dac_nids = alc262_dac_nids,
11848 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11849 .channel_mode = alc262_modes,
11850 .input_mux = &alc262_capture_source,
11852 [ALC262_TOSHIBA_S06] = {
11853 .mixers = { alc262_toshiba_s06_mixer },
11854 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11855 alc262_eapd_verbs },
11856 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11857 .capsrc_nids = alc262_dmic_capsrc_nids,
11858 .dac_nids = alc262_dac_nids,
11859 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11860 .num_adc_nids = 1, /* single ADC */
11861 .dig_out_nid = ALC262_DIGOUT_NID,
11862 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11863 .channel_mode = alc262_modes,
11864 .unsol_event = alc_sku_unsol_event,
11865 .setup = alc262_toshiba_s06_setup,
11866 .init_hook = alc_inithook,
11868 [ALC262_TOSHIBA_RX1] = {
11869 .mixers = { alc262_toshiba_rx1_mixer },
11870 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11871 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11872 .dac_nids = alc262_dac_nids,
11874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11875 .channel_mode = alc262_modes,
11876 .input_mux = &alc262_capture_source,
11877 .unsol_event = alc262_hippo_unsol_event,
11878 .setup = alc262_hippo_setup,
11879 .init_hook = alc262_hippo_automute,
11882 .mixers = { alc262_tyan_mixer },
11883 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11884 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11885 .dac_nids = alc262_dac_nids,
11887 .dig_out_nid = ALC262_DIGOUT_NID,
11888 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11889 .channel_mode = alc262_modes,
11890 .input_mux = &alc262_capture_source,
11891 .unsol_event = alc_automute_amp_unsol_event,
11892 .setup = alc262_tyan_setup,
11893 .init_hook = alc_automute_amp,
11897 static int patch_alc262(struct hda_codec *codec)
11899 struct alc_spec *spec;
11903 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11907 codec->spec = spec;
11909 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11914 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11915 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11916 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11917 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11921 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11923 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11927 if (board_config < 0) {
11928 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11930 board_config = ALC262_AUTO;
11933 if (board_config == ALC262_AUTO) {
11934 /* automatic parse from the BIOS config */
11935 err = alc262_parse_auto_config(codec);
11941 "hda_codec: Cannot set up configuration "
11942 "from BIOS. Using base mode...\n");
11943 board_config = ALC262_BASIC;
11947 if (!spec->no_analog) {
11948 err = snd_hda_attach_beep_device(codec, 0x1);
11955 if (board_config != ALC262_AUTO)
11956 setup_preset(codec, &alc262_presets[board_config]);
11958 spec->stream_analog_playback = &alc262_pcm_analog_playback;
11959 spec->stream_analog_capture = &alc262_pcm_analog_capture;
11961 spec->stream_digital_playback = &alc262_pcm_digital_playback;
11962 spec->stream_digital_capture = &alc262_pcm_digital_capture;
11964 if (!spec->adc_nids && spec->input_mux) {
11966 /* check whether the digital-mic has to be supported */
11967 for (i = 0; i < spec->input_mux->num_items; i++) {
11968 if (spec->input_mux->items[i].index >= 9)
11971 if (i < spec->input_mux->num_items) {
11972 /* use only ADC0 */
11973 spec->adc_nids = alc262_dmic_adc_nids;
11974 spec->num_adc_nids = 1;
11975 spec->capsrc_nids = alc262_dmic_capsrc_nids;
11977 /* all analog inputs */
11978 /* check whether NID 0x07 is valid */
11979 unsigned int wcap = get_wcaps(codec, 0x07);
11982 wcap = get_wcaps_type(wcap);
11983 if (wcap != AC_WID_AUD_IN) {
11984 spec->adc_nids = alc262_adc_nids_alt;
11985 spec->num_adc_nids =
11986 ARRAY_SIZE(alc262_adc_nids_alt);
11987 spec->capsrc_nids = alc262_capsrc_nids_alt;
11989 spec->adc_nids = alc262_adc_nids;
11990 spec->num_adc_nids =
11991 ARRAY_SIZE(alc262_adc_nids);
11992 spec->capsrc_nids = alc262_capsrc_nids;
11996 if (!spec->cap_mixer && !spec->no_analog)
11997 set_capture_mixer(codec);
11998 if (!spec->no_analog)
11999 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12001 spec->vmaster_nid = 0x0c;
12003 codec->patch_ops = alc_patch_ops;
12004 if (board_config == ALC262_AUTO)
12005 spec->init_hook = alc262_auto_init;
12006 #ifdef CONFIG_SND_HDA_POWER_SAVE
12007 if (!spec->loopback.amplist)
12008 spec->loopback.amplist = alc262_loopbacks;
12010 codec->proc_widget_hook = print_realtek_coef;
12016 * ALC268 channel source setting (2 channel)
12018 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12019 #define alc268_modes alc260_modes
12021 static hda_nid_t alc268_dac_nids[2] = {
12026 static hda_nid_t alc268_adc_nids[2] = {
12031 static hda_nid_t alc268_adc_nids_alt[1] = {
12036 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12038 static struct snd_kcontrol_new alc268_base_mixer[] = {
12039 /* output mixer control */
12040 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12041 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12042 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12043 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12044 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12045 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12046 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12050 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12051 /* output mixer control */
12052 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12053 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12054 ALC262_HIPPO_MASTER_SWITCH,
12055 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12056 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12057 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12061 /* bind Beep switches of both NID 0x0f and 0x10 */
12062 static struct hda_bind_ctls alc268_bind_beep_sw = {
12063 .ops = &snd_hda_bind_sw,
12065 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12066 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12071 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12072 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12073 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12077 static struct hda_verb alc268_eapd_verbs[] = {
12078 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12079 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12083 /* Toshiba specific */
12084 static struct hda_verb alc268_toshiba_verbs[] = {
12085 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12089 /* Acer specific */
12090 /* bind volumes of both NID 0x02 and 0x03 */
12091 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12092 .ops = &snd_hda_bind_vol,
12094 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12095 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12100 /* mute/unmute internal speaker according to the hp jack and mute state */
12101 static void alc268_acer_automute(struct hda_codec *codec, int force)
12103 struct alc_spec *spec = codec->spec;
12106 if (force || !spec->sense_updated) {
12107 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12108 spec->sense_updated = 1;
12110 if (spec->jack_present)
12111 mute = HDA_AMP_MUTE; /* mute internal speaker */
12112 else /* unmute internal speaker if necessary */
12113 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12114 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12115 HDA_AMP_MUTE, mute);
12119 /* bind hp and internal speaker mute (with plug check) */
12120 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12121 struct snd_ctl_elem_value *ucontrol)
12123 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12124 long *valp = ucontrol->value.integer.value;
12127 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12129 alc268_acer_automute(codec, 0);
12133 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12134 /* output mixer control */
12135 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12137 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12138 .name = "Master Playback Switch",
12139 .subdevice = HDA_SUBDEV_AMP_FLAG,
12140 .info = snd_hda_mixer_amp_switch_info,
12141 .get = snd_hda_mixer_amp_switch_get,
12142 .put = alc268_acer_master_sw_put,
12143 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12145 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12149 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12150 /* output mixer control */
12151 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12153 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12154 .name = "Master Playback Switch",
12155 .subdevice = HDA_SUBDEV_AMP_FLAG,
12156 .info = snd_hda_mixer_amp_switch_info,
12157 .get = snd_hda_mixer_amp_switch_get,
12158 .put = alc268_acer_master_sw_put,
12159 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12161 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12162 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12163 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12167 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12168 /* output mixer control */
12169 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12171 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12172 .name = "Master Playback Switch",
12173 .subdevice = HDA_SUBDEV_AMP_FLAG,
12174 .info = snd_hda_mixer_amp_switch_info,
12175 .get = snd_hda_mixer_amp_switch_get,
12176 .put = alc268_acer_master_sw_put,
12177 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12180 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12184 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12185 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12186 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12187 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12188 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12189 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12190 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12194 static struct hda_verb alc268_acer_verbs[] = {
12195 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12196 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12197 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12199 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12200 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12201 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12205 /* unsolicited event for HP jack sensing */
12206 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12207 #define alc268_toshiba_setup alc262_hippo_setup
12208 #define alc268_toshiba_automute alc262_hippo_automute
12210 static void alc268_acer_unsol_event(struct hda_codec *codec,
12213 if ((res >> 26) != ALC880_HP_EVENT)
12215 alc268_acer_automute(codec, 1);
12218 static void alc268_acer_init_hook(struct hda_codec *codec)
12220 alc268_acer_automute(codec, 1);
12223 /* toggle speaker-output according to the hp-jack state */
12224 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12226 unsigned int present;
12227 unsigned char bits;
12229 present = snd_hda_jack_detect(codec, 0x15);
12230 bits = present ? AMP_IN_MUTE(0) : 0;
12231 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12232 AMP_IN_MUTE(0), bits);
12233 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12234 AMP_IN_MUTE(0), bits);
12237 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12240 switch (res >> 26) {
12241 case ALC880_HP_EVENT:
12242 alc268_aspire_one_speaker_automute(codec);
12244 case ALC880_MIC_EVENT:
12245 alc_mic_automute(codec);
12250 static void alc268_acer_lc_setup(struct hda_codec *codec)
12252 struct alc_spec *spec = codec->spec;
12253 spec->ext_mic.pin = 0x18;
12254 spec->ext_mic.mux_idx = 0;
12255 spec->int_mic.pin = 0x12;
12256 spec->int_mic.mux_idx = 6;
12257 spec->auto_mic = 1;
12260 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12262 alc268_aspire_one_speaker_automute(codec);
12263 alc_mic_automute(codec);
12266 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12267 /* output mixer control */
12268 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12269 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12273 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12277 static struct hda_verb alc268_dell_verbs[] = {
12278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12279 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12280 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12281 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12285 /* mute/unmute internal speaker according to the hp jack and mute state */
12286 static void alc268_dell_setup(struct hda_codec *codec)
12288 struct alc_spec *spec = codec->spec;
12290 spec->autocfg.hp_pins[0] = 0x15;
12291 spec->autocfg.speaker_pins[0] = 0x14;
12292 spec->ext_mic.pin = 0x18;
12293 spec->ext_mic.mux_idx = 0;
12294 spec->int_mic.pin = 0x19;
12295 spec->int_mic.mux_idx = 1;
12296 spec->auto_mic = 1;
12299 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12300 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12301 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12302 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12303 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12304 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12305 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12306 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12307 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12311 static struct hda_verb alc267_quanta_il1_verbs[] = {
12312 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12317 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12319 struct alc_spec *spec = codec->spec;
12320 spec->autocfg.hp_pins[0] = 0x15;
12321 spec->autocfg.speaker_pins[0] = 0x14;
12322 spec->ext_mic.pin = 0x18;
12323 spec->ext_mic.mux_idx = 0;
12324 spec->int_mic.pin = 0x19;
12325 spec->int_mic.mux_idx = 1;
12326 spec->auto_mic = 1;
12330 * generic initialization of ADC, input mixers and output mixers
12332 static struct hda_verb alc268_base_init_verbs[] = {
12333 /* Unmute DAC0-1 and set vol = 0 */
12334 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12335 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12338 * Set up output mixers (0x0c - 0x0e)
12340 /* set vol=0 to output mixers */
12341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12342 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12345 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12347 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12348 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12349 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12350 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12351 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12353 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12354 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12356 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12358 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12359 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12362 /* set PCBEEP vol = 0, mute connections */
12363 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12364 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12365 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12367 /* Unmute Selector 23h,24h and set the default input to mic-in */
12369 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12371 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12372 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12378 * generic initialization of ADC, input mixers and output mixers
12380 static struct hda_verb alc268_volume_init_verbs[] = {
12381 /* set output DAC */
12382 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12383 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12385 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12386 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12387 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12388 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12389 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12391 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12392 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12393 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12395 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12396 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12398 /* set PCBEEP vol = 0, mute connections */
12399 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12400 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12401 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12406 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12407 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12408 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12412 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12413 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12414 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12419 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12420 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12421 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12422 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12423 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12428 static struct hda_input_mux alc268_capture_source = {
12432 { "Front Mic", 0x1 },
12438 static struct hda_input_mux alc268_acer_capture_source = {
12442 { "Internal Mic", 0x1 },
12447 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12451 { "Internal Mic", 0x6 },
12456 #ifdef CONFIG_SND_DEBUG
12457 static struct snd_kcontrol_new alc268_test_mixer[] = {
12458 /* Volume widgets */
12459 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12460 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12461 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12462 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12463 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12464 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12465 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12466 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12467 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12468 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12469 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12470 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12471 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12472 /* The below appears problematic on some hardwares */
12473 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12474 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12475 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12476 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12477 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12479 /* Modes for retasking pin widgets */
12480 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12481 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12482 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12483 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12485 /* Controls for GPIO pins, assuming they are configured as outputs */
12486 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12487 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12488 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12489 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12491 /* Switches to allow the digital SPDIF output pin to be enabled.
12492 * The ALC268 does not have an SPDIF input.
12494 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12496 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12497 * this output to turn on an external amplifier.
12499 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12500 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12506 /* create input playback/capture controls for the given pin */
12507 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12508 const char *ctlname, int idx)
12524 if (spec->multiout.dac_nids[0] != dac &&
12525 spec->multiout.dac_nids[1] != dac) {
12526 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12527 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12531 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12535 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12536 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12538 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12539 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12545 /* add playback controls from the parsed DAC table */
12546 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12547 const struct auto_pin_cfg *cfg)
12552 spec->multiout.dac_nids = spec->private_dac_nids;
12554 nid = cfg->line_out_pins[0];
12557 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12561 err = alc268_new_analog_output(spec, nid, name, 0);
12566 nid = cfg->speaker_pins[0];
12568 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12569 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12573 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12577 nid = cfg->hp_pins[0];
12579 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12584 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12586 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12587 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12594 /* create playback/capture controls for input pins */
12595 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12596 const struct auto_pin_cfg *cfg)
12598 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12601 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12602 hda_nid_t nid, int pin_type)
12606 alc_set_pin_output(codec, nid, pin_type);
12607 if (nid == 0x14 || nid == 0x16)
12611 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12614 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12616 struct alc_spec *spec = codec->spec;
12617 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12619 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12620 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12624 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12626 struct alc_spec *spec = codec->spec;
12629 pin = spec->autocfg.hp_pins[0];
12631 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12632 pin = spec->autocfg.speaker_pins[0];
12634 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12637 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12639 struct alc_spec *spec = codec->spec;
12640 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12641 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12642 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12643 unsigned int dac_vol1, dac_vol2;
12645 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12646 snd_hda_codec_write(codec, speaker_nid, 0,
12647 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12648 /* mute mixer inputs from 0x1d */
12649 snd_hda_codec_write(codec, 0x0f, 0,
12650 AC_VERB_SET_AMP_GAIN_MUTE,
12652 snd_hda_codec_write(codec, 0x10, 0,
12653 AC_VERB_SET_AMP_GAIN_MUTE,
12656 /* unmute mixer inputs from 0x1d */
12657 snd_hda_codec_write(codec, 0x0f, 0,
12658 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12659 snd_hda_codec_write(codec, 0x10, 0,
12660 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12663 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12664 if (line_nid == 0x14)
12665 dac_vol2 = AMP_OUT_ZERO;
12666 else if (line_nid == 0x15)
12667 dac_vol1 = AMP_OUT_ZERO;
12668 if (hp_nid == 0x14)
12669 dac_vol2 = AMP_OUT_ZERO;
12670 else if (hp_nid == 0x15)
12671 dac_vol1 = AMP_OUT_ZERO;
12672 if (line_nid != 0x16 || hp_nid != 0x16 ||
12673 spec->autocfg.line_out_pins[1] != 0x16 ||
12674 spec->autocfg.line_out_pins[2] != 0x16)
12675 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12677 snd_hda_codec_write(codec, 0x02, 0,
12678 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12679 snd_hda_codec_write(codec, 0x03, 0,
12680 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12683 /* pcm configuration: identical with ALC880 */
12684 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12685 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12686 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12687 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12690 * BIOS auto configuration
12692 static int alc268_parse_auto_config(struct hda_codec *codec)
12694 struct alc_spec *spec = codec->spec;
12696 static hda_nid_t alc268_ignore[] = { 0 };
12698 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12702 if (!spec->autocfg.line_outs) {
12703 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12704 spec->multiout.max_channels = 2;
12705 spec->no_analog = 1;
12708 return 0; /* can't find valid BIOS pin config */
12710 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12713 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12717 spec->multiout.max_channels = 2;
12720 /* digital only support output */
12721 if (spec->autocfg.dig_outs) {
12722 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12723 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12725 if (spec->kctls.list)
12726 add_mixer(spec, spec->kctls.list);
12728 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12729 add_mixer(spec, alc268_beep_mixer);
12731 add_verb(spec, alc268_volume_init_verbs);
12732 spec->num_mux_defs = 2;
12733 spec->input_mux = &spec->private_imux[0];
12735 err = alc_auto_add_mic_boost(codec);
12739 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12744 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12746 /* init callback for auto-configuration model -- overriding the default init */
12747 static void alc268_auto_init(struct hda_codec *codec)
12749 struct alc_spec *spec = codec->spec;
12750 alc268_auto_init_multi_out(codec);
12751 alc268_auto_init_hp_out(codec);
12752 alc268_auto_init_mono_speaker_out(codec);
12753 alc268_auto_init_analog_input(codec);
12754 if (spec->unsol_event)
12755 alc_inithook(codec);
12759 * configuration and preset
12761 static const char *alc268_models[ALC268_MODEL_LAST] = {
12762 [ALC267_QUANTA_IL1] = "quanta-il1",
12763 [ALC268_3ST] = "3stack",
12764 [ALC268_TOSHIBA] = "toshiba",
12765 [ALC268_ACER] = "acer",
12766 [ALC268_ACER_DMIC] = "acer-dmic",
12767 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12768 [ALC268_DELL] = "dell",
12769 [ALC268_ZEPTO] = "zepto",
12770 #ifdef CONFIG_SND_DEBUG
12771 [ALC268_TEST] = "test",
12773 [ALC268_AUTO] = "auto",
12776 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12777 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12778 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12779 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12780 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12781 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12782 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12783 ALC268_ACER_ASPIRE_ONE),
12784 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12785 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12786 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12787 /* almost compatible with toshiba but with optional digital outs;
12788 * auto-probing seems working fine
12790 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12792 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12793 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12794 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12795 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12796 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12797 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12801 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12802 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12803 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12804 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12805 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12810 static struct alc_config_preset alc268_presets[] = {
12811 [ALC267_QUANTA_IL1] = {
12812 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12813 alc268_capture_nosrc_mixer },
12814 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12815 alc267_quanta_il1_verbs },
12816 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12817 .dac_nids = alc268_dac_nids,
12818 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12819 .adc_nids = alc268_adc_nids_alt,
12821 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12822 .channel_mode = alc268_modes,
12823 .unsol_event = alc_sku_unsol_event,
12824 .setup = alc267_quanta_il1_setup,
12825 .init_hook = alc_inithook,
12828 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12829 alc268_beep_mixer },
12830 .init_verbs = { alc268_base_init_verbs },
12831 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12832 .dac_nids = alc268_dac_nids,
12833 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12834 .adc_nids = alc268_adc_nids_alt,
12835 .capsrc_nids = alc268_capsrc_nids,
12837 .dig_out_nid = ALC268_DIGOUT_NID,
12838 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12839 .channel_mode = alc268_modes,
12840 .input_mux = &alc268_capture_source,
12842 [ALC268_TOSHIBA] = {
12843 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12844 alc268_beep_mixer },
12845 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12846 alc268_toshiba_verbs },
12847 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12848 .dac_nids = alc268_dac_nids,
12849 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12850 .adc_nids = alc268_adc_nids_alt,
12851 .capsrc_nids = alc268_capsrc_nids,
12853 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12854 .channel_mode = alc268_modes,
12855 .input_mux = &alc268_capture_source,
12856 .unsol_event = alc268_toshiba_unsol_event,
12857 .setup = alc268_toshiba_setup,
12858 .init_hook = alc268_toshiba_automute,
12861 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12862 alc268_beep_mixer },
12863 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12864 alc268_acer_verbs },
12865 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12866 .dac_nids = alc268_dac_nids,
12867 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12868 .adc_nids = alc268_adc_nids_alt,
12869 .capsrc_nids = alc268_capsrc_nids,
12871 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12872 .channel_mode = alc268_modes,
12873 .input_mux = &alc268_acer_capture_source,
12874 .unsol_event = alc268_acer_unsol_event,
12875 .init_hook = alc268_acer_init_hook,
12877 [ALC268_ACER_DMIC] = {
12878 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12879 alc268_beep_mixer },
12880 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12881 alc268_acer_verbs },
12882 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12883 .dac_nids = alc268_dac_nids,
12884 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12885 .adc_nids = alc268_adc_nids_alt,
12886 .capsrc_nids = alc268_capsrc_nids,
12888 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12889 .channel_mode = alc268_modes,
12890 .input_mux = &alc268_acer_dmic_capture_source,
12891 .unsol_event = alc268_acer_unsol_event,
12892 .init_hook = alc268_acer_init_hook,
12894 [ALC268_ACER_ASPIRE_ONE] = {
12895 .mixers = { alc268_acer_aspire_one_mixer,
12897 alc268_capture_nosrc_mixer },
12898 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12899 alc268_acer_aspire_one_verbs },
12900 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12901 .dac_nids = alc268_dac_nids,
12902 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12903 .adc_nids = alc268_adc_nids_alt,
12904 .capsrc_nids = alc268_capsrc_nids,
12906 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12907 .channel_mode = alc268_modes,
12908 .unsol_event = alc268_acer_lc_unsol_event,
12909 .setup = alc268_acer_lc_setup,
12910 .init_hook = alc268_acer_lc_init_hook,
12913 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12914 alc268_capture_nosrc_mixer },
12915 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12916 alc268_dell_verbs },
12917 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12918 .dac_nids = alc268_dac_nids,
12919 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12920 .adc_nids = alc268_adc_nids_alt,
12921 .capsrc_nids = alc268_capsrc_nids,
12923 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12924 .channel_mode = alc268_modes,
12925 .unsol_event = alc_sku_unsol_event,
12926 .setup = alc268_dell_setup,
12927 .init_hook = alc_inithook,
12930 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12931 alc268_beep_mixer },
12932 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12933 alc268_toshiba_verbs },
12934 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12935 .dac_nids = alc268_dac_nids,
12936 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12937 .adc_nids = alc268_adc_nids_alt,
12938 .capsrc_nids = alc268_capsrc_nids,
12940 .dig_out_nid = ALC268_DIGOUT_NID,
12941 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12942 .channel_mode = alc268_modes,
12943 .input_mux = &alc268_capture_source,
12944 .setup = alc268_toshiba_setup,
12945 .init_hook = alc268_toshiba_automute,
12947 #ifdef CONFIG_SND_DEBUG
12949 .mixers = { alc268_test_mixer, alc268_capture_mixer },
12950 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12951 alc268_volume_init_verbs },
12952 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12953 .dac_nids = alc268_dac_nids,
12954 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12955 .adc_nids = alc268_adc_nids_alt,
12956 .capsrc_nids = alc268_capsrc_nids,
12958 .dig_out_nid = ALC268_DIGOUT_NID,
12959 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12960 .channel_mode = alc268_modes,
12961 .input_mux = &alc268_capture_source,
12966 static int patch_alc268(struct hda_codec *codec)
12968 struct alc_spec *spec;
12970 int i, has_beep, err;
12972 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
12976 codec->spec = spec;
12978 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
12982 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
12983 board_config = snd_hda_check_board_codec_sid_config(codec,
12984 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
12986 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
12987 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12989 board_config = ALC268_AUTO;
12992 if (board_config == ALC268_AUTO) {
12993 /* automatic parse from the BIOS config */
12994 err = alc268_parse_auto_config(codec);
13000 "hda_codec: Cannot set up configuration "
13001 "from BIOS. Using base mode...\n");
13002 board_config = ALC268_3ST;
13006 if (board_config != ALC268_AUTO)
13007 setup_preset(codec, &alc268_presets[board_config]);
13009 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13010 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13011 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13013 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13016 for (i = 0; i < spec->num_mixers; i++) {
13017 if (spec->mixers[i] == alc268_beep_mixer) {
13024 err = snd_hda_attach_beep_device(codec, 0x1);
13029 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13030 /* override the amp caps for beep generator */
13031 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13032 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13033 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13034 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13035 (0 << AC_AMPCAP_MUTE_SHIFT));
13038 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13039 /* check whether NID 0x07 is valid */
13040 unsigned int wcap = get_wcaps(codec, 0x07);
13043 spec->capsrc_nids = alc268_capsrc_nids;
13045 wcap = get_wcaps_type(wcap);
13046 if (spec->auto_mic ||
13047 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13048 spec->adc_nids = alc268_adc_nids_alt;
13049 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13050 if (spec->auto_mic)
13051 fixup_automic_adc(codec);
13052 if (spec->auto_mic || spec->input_mux->num_items == 1)
13053 add_mixer(spec, alc268_capture_nosrc_mixer);
13055 add_mixer(spec, alc268_capture_alt_mixer);
13057 spec->adc_nids = alc268_adc_nids;
13058 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13059 add_mixer(spec, alc268_capture_mixer);
13061 /* set default input source */
13062 for (i = 0; i < spec->num_adc_nids; i++)
13063 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13064 0, AC_VERB_SET_CONNECT_SEL,
13065 i < spec->num_mux_defs ?
13066 spec->input_mux[i].items[0].index :
13067 spec->input_mux->items[0].index);
13070 spec->vmaster_nid = 0x02;
13072 codec->patch_ops = alc_patch_ops;
13073 if (board_config == ALC268_AUTO)
13074 spec->init_hook = alc268_auto_init;
13076 codec->proc_widget_hook = print_realtek_coef;
13082 * ALC269 channel source setting (2 channel)
13084 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13086 #define alc269_dac_nids alc260_dac_nids
13088 static hda_nid_t alc269_adc_nids[1] = {
13093 static hda_nid_t alc269_capsrc_nids[1] = {
13097 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13101 #define alc269_modes alc260_modes
13102 #define alc269_capture_source alc880_lg_lw_capture_source
13104 static struct snd_kcontrol_new alc269_base_mixer[] = {
13105 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13106 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13107 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13108 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13110 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13111 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13112 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13113 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13114 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13116 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13120 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13121 /* output mixer control */
13122 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13125 .name = "Master Playback Switch",
13126 .subdevice = HDA_SUBDEV_AMP_FLAG,
13127 .info = snd_hda_mixer_amp_switch_info,
13128 .get = snd_hda_mixer_amp_switch_get,
13129 .put = alc268_acer_master_sw_put,
13130 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13132 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13134 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13135 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13136 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13137 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13141 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13142 /* output mixer control */
13143 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13145 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13146 .name = "Master Playback Switch",
13147 .subdevice = HDA_SUBDEV_AMP_FLAG,
13148 .info = snd_hda_mixer_amp_switch_info,
13149 .get = snd_hda_mixer_amp_switch_get,
13150 .put = alc268_acer_master_sw_put,
13151 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13155 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13156 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13157 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13158 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13159 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13160 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13161 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13165 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13166 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13167 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13169 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13173 /* capture mixer elements */
13174 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13175 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13176 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13177 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13182 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13184 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13185 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13186 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13188 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13189 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13190 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13194 static struct hda_verb alc269_lifebook_verbs[] = {
13195 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13196 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13197 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13198 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13199 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13200 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13201 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13202 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13203 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13204 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13208 /* toggle speaker-output according to the hp-jack state */
13209 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13211 unsigned int present;
13212 unsigned char bits;
13214 present = snd_hda_jack_detect(codec, 0x15);
13215 bits = present ? AMP_IN_MUTE(0) : 0;
13216 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13217 AMP_IN_MUTE(0), bits);
13218 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13219 AMP_IN_MUTE(0), bits);
13221 snd_hda_codec_write(codec, 0x20, 0,
13222 AC_VERB_SET_COEF_INDEX, 0x0c);
13223 snd_hda_codec_write(codec, 0x20, 0,
13224 AC_VERB_SET_PROC_COEF, 0x680);
13226 snd_hda_codec_write(codec, 0x20, 0,
13227 AC_VERB_SET_COEF_INDEX, 0x0c);
13228 snd_hda_codec_write(codec, 0x20, 0,
13229 AC_VERB_SET_PROC_COEF, 0x480);
13232 /* toggle speaker-output according to the hp-jacks state */
13233 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13235 unsigned int present;
13236 unsigned char bits;
13238 /* Check laptop headphone socket */
13239 present = snd_hda_jack_detect(codec, 0x15);
13241 /* Check port replicator headphone socket */
13242 present |= snd_hda_jack_detect(codec, 0x1a);
13244 bits = present ? AMP_IN_MUTE(0) : 0;
13245 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13246 AMP_IN_MUTE(0), bits);
13247 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13248 AMP_IN_MUTE(0), bits);
13250 snd_hda_codec_write(codec, 0x20, 0,
13251 AC_VERB_SET_COEF_INDEX, 0x0c);
13252 snd_hda_codec_write(codec, 0x20, 0,
13253 AC_VERB_SET_PROC_COEF, 0x680);
13255 snd_hda_codec_write(codec, 0x20, 0,
13256 AC_VERB_SET_COEF_INDEX, 0x0c);
13257 snd_hda_codec_write(codec, 0x20, 0,
13258 AC_VERB_SET_PROC_COEF, 0x480);
13261 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13263 unsigned int present_laptop;
13264 unsigned int present_dock;
13266 present_laptop = snd_hda_jack_detect(codec, 0x18);
13267 present_dock = snd_hda_jack_detect(codec, 0x1b);
13269 /* Laptop mic port overrides dock mic port, design decision */
13271 snd_hda_codec_write(codec, 0x23, 0,
13272 AC_VERB_SET_CONNECT_SEL, 0x3);
13273 if (present_laptop)
13274 snd_hda_codec_write(codec, 0x23, 0,
13275 AC_VERB_SET_CONNECT_SEL, 0x0);
13276 if (!present_dock && !present_laptop)
13277 snd_hda_codec_write(codec, 0x23, 0,
13278 AC_VERB_SET_CONNECT_SEL, 0x1);
13281 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13284 switch (res >> 26) {
13285 case ALC880_HP_EVENT:
13286 alc269_quanta_fl1_speaker_automute(codec);
13288 case ALC880_MIC_EVENT:
13289 alc_mic_automute(codec);
13294 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13297 if ((res >> 26) == ALC880_HP_EVENT)
13298 alc269_lifebook_speaker_automute(codec);
13299 if ((res >> 26) == ALC880_MIC_EVENT)
13300 alc269_lifebook_mic_autoswitch(codec);
13303 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13305 struct alc_spec *spec = codec->spec;
13306 spec->ext_mic.pin = 0x18;
13307 spec->ext_mic.mux_idx = 0;
13308 spec->int_mic.pin = 0x19;
13309 spec->int_mic.mux_idx = 1;
13310 spec->auto_mic = 1;
13313 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13315 alc269_quanta_fl1_speaker_automute(codec);
13316 alc_mic_automute(codec);
13319 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13321 alc269_lifebook_speaker_automute(codec);
13322 alc269_lifebook_mic_autoswitch(codec);
13325 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13326 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13327 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13328 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13329 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13330 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13331 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13332 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13336 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13337 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13338 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13339 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13340 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13341 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13342 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13346 /* toggle speaker-output according to the hp-jack state */
13347 static void alc269_speaker_automute(struct hda_codec *codec)
13349 unsigned int present;
13350 unsigned char bits;
13352 present = snd_hda_jack_detect(codec, 0x15);
13353 bits = present ? AMP_IN_MUTE(0) : 0;
13354 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13355 AMP_IN_MUTE(0), bits);
13356 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13357 AMP_IN_MUTE(0), bits);
13360 /* unsolicited event for HP jack sensing */
13361 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13364 switch (res >> 26) {
13365 case ALC880_HP_EVENT:
13366 alc269_speaker_automute(codec);
13368 case ALC880_MIC_EVENT:
13369 alc_mic_automute(codec);
13374 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13376 struct alc_spec *spec = codec->spec;
13377 spec->ext_mic.pin = 0x18;
13378 spec->ext_mic.mux_idx = 0;
13379 spec->int_mic.pin = 0x12;
13380 spec->int_mic.mux_idx = 5;
13381 spec->auto_mic = 1;
13384 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13386 struct alc_spec *spec = codec->spec;
13387 spec->ext_mic.pin = 0x18;
13388 spec->ext_mic.mux_idx = 0;
13389 spec->int_mic.pin = 0x19;
13390 spec->int_mic.mux_idx = 1;
13391 spec->auto_mic = 1;
13394 static void alc269_eeepc_inithook(struct hda_codec *codec)
13396 alc269_speaker_automute(codec);
13397 alc_mic_automute(codec);
13401 * generic initialization of ADC, input mixers and output mixers
13403 static struct hda_verb alc269_init_verbs[] = {
13405 * Unmute ADC0 and set the default input to mic-in
13407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13409 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13410 * analog-loopback mixer widget
13411 * Note: PASD motherboards uses the Line In 2 as the input for
13412 * front panel mic (mic 2)
13414 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13418 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13419 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13422 * Set up output mixers (0x0c - 0x0e)
13424 /* set vol=0 to output mixers */
13425 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13426 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13428 /* set up input amps for analog loopback */
13429 /* Amp Indices: DAC = 0, mixer = 1 */
13430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13431 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13440 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13441 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13442 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13443 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13447 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13449 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13450 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13451 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13453 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13454 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13456 /* FIXME: use matrix-type input source selection */
13457 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13458 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13460 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13462 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13465 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13466 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13470 #define alc269_auto_create_multi_out_ctls \
13471 alc268_auto_create_multi_out_ctls
13472 #define alc269_auto_create_input_ctls \
13473 alc268_auto_create_input_ctls
13475 #ifdef CONFIG_SND_HDA_POWER_SAVE
13476 #define alc269_loopbacks alc880_loopbacks
13479 /* pcm configuration: identical with ALC880 */
13480 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13481 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13482 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13483 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13485 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13489 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13490 /* NID is set in alc_build_pcms */
13492 .open = alc880_playback_pcm_open,
13493 .prepare = alc880_playback_pcm_prepare,
13494 .cleanup = alc880_playback_pcm_cleanup
13498 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13502 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13503 /* NID is set in alc_build_pcms */
13507 * BIOS auto configuration
13509 static int alc269_parse_auto_config(struct hda_codec *codec)
13511 struct alc_spec *spec = codec->spec;
13513 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13515 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13520 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13523 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13527 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13529 if (spec->autocfg.dig_outs)
13530 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13532 if (spec->kctls.list)
13533 add_mixer(spec, spec->kctls.list);
13535 add_verb(spec, alc269_init_verbs);
13536 spec->num_mux_defs = 1;
13537 spec->input_mux = &spec->private_imux[0];
13538 /* set default input source */
13539 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13540 0, AC_VERB_SET_CONNECT_SEL,
13541 spec->input_mux->items[0].index);
13543 err = alc_auto_add_mic_boost(codec);
13547 if (!spec->cap_mixer && !spec->no_analog)
13548 set_capture_mixer(codec);
13550 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13555 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13556 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13557 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13560 /* init callback for auto-configuration model -- overriding the default init */
13561 static void alc269_auto_init(struct hda_codec *codec)
13563 struct alc_spec *spec = codec->spec;
13564 alc269_auto_init_multi_out(codec);
13565 alc269_auto_init_hp_out(codec);
13566 alc269_auto_init_analog_input(codec);
13567 if (spec->unsol_event)
13568 alc_inithook(codec);
13572 * configuration and preset
13574 static const char *alc269_models[ALC269_MODEL_LAST] = {
13575 [ALC269_BASIC] = "basic",
13576 [ALC269_QUANTA_FL1] = "quanta",
13577 [ALC269_ASUS_EEEPC_P703] = "eeepc-p703",
13578 [ALC269_ASUS_EEEPC_P901] = "eeepc-p901",
13579 [ALC269_FUJITSU] = "fujitsu",
13580 [ALC269_LIFEBOOK] = "lifebook",
13581 [ALC269_AUTO] = "auto",
13584 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13585 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13586 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13587 ALC269_ASUS_EEEPC_P703),
13588 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703),
13589 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703),
13590 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703),
13591 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703),
13592 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703),
13593 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703),
13594 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13595 ALC269_ASUS_EEEPC_P901),
13596 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13597 ALC269_ASUS_EEEPC_P901),
13598 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901),
13599 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13600 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13604 static struct alc_config_preset alc269_presets[] = {
13606 .mixers = { alc269_base_mixer },
13607 .init_verbs = { alc269_init_verbs },
13608 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13609 .dac_nids = alc269_dac_nids,
13611 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13612 .channel_mode = alc269_modes,
13613 .input_mux = &alc269_capture_source,
13615 [ALC269_QUANTA_FL1] = {
13616 .mixers = { alc269_quanta_fl1_mixer },
13617 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13618 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13619 .dac_nids = alc269_dac_nids,
13621 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13622 .channel_mode = alc269_modes,
13623 .input_mux = &alc269_capture_source,
13624 .unsol_event = alc269_quanta_fl1_unsol_event,
13625 .setup = alc269_quanta_fl1_setup,
13626 .init_hook = alc269_quanta_fl1_init_hook,
13628 [ALC269_ASUS_EEEPC_P703] = {
13629 .mixers = { alc269_eeepc_mixer },
13630 .cap_mixer = alc269_epc_capture_mixer,
13631 .init_verbs = { alc269_init_verbs,
13632 alc269_eeepc_amic_init_verbs },
13633 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13634 .dac_nids = alc269_dac_nids,
13636 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13637 .channel_mode = alc269_modes,
13638 .unsol_event = alc269_eeepc_unsol_event,
13639 .setup = alc269_eeepc_amic_setup,
13640 .init_hook = alc269_eeepc_inithook,
13642 [ALC269_ASUS_EEEPC_P901] = {
13643 .mixers = { alc269_eeepc_mixer },
13644 .cap_mixer = alc269_epc_capture_mixer,
13645 .init_verbs = { alc269_init_verbs,
13646 alc269_eeepc_dmic_init_verbs },
13647 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13648 .dac_nids = alc269_dac_nids,
13650 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13651 .channel_mode = alc269_modes,
13652 .unsol_event = alc269_eeepc_unsol_event,
13653 .setup = alc269_eeepc_dmic_setup,
13654 .init_hook = alc269_eeepc_inithook,
13656 [ALC269_FUJITSU] = {
13657 .mixers = { alc269_fujitsu_mixer },
13658 .cap_mixer = alc269_epc_capture_mixer,
13659 .init_verbs = { alc269_init_verbs,
13660 alc269_eeepc_dmic_init_verbs },
13661 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13662 .dac_nids = alc269_dac_nids,
13664 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13665 .channel_mode = alc269_modes,
13666 .unsol_event = alc269_eeepc_unsol_event,
13667 .setup = alc269_eeepc_dmic_setup,
13668 .init_hook = alc269_eeepc_inithook,
13670 [ALC269_LIFEBOOK] = {
13671 .mixers = { alc269_lifebook_mixer },
13672 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13673 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13674 .dac_nids = alc269_dac_nids,
13676 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13677 .channel_mode = alc269_modes,
13678 .input_mux = &alc269_capture_source,
13679 .unsol_event = alc269_lifebook_unsol_event,
13680 .init_hook = alc269_lifebook_init_hook,
13684 static int patch_alc269(struct hda_codec *codec)
13686 struct alc_spec *spec;
13690 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13694 codec->spec = spec;
13696 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13698 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13699 kfree(codec->chip_name);
13700 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13701 if (!codec->chip_name) {
13707 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13711 if (board_config < 0) {
13712 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13714 board_config = ALC269_AUTO;
13717 if (board_config == ALC269_AUTO) {
13718 /* automatic parse from the BIOS config */
13719 err = alc269_parse_auto_config(codec);
13725 "hda_codec: Cannot set up configuration "
13726 "from BIOS. Using base mode...\n");
13727 board_config = ALC269_BASIC;
13731 err = snd_hda_attach_beep_device(codec, 0x1);
13737 if (board_config != ALC269_AUTO)
13738 setup_preset(codec, &alc269_presets[board_config]);
13740 if (codec->subsystem_id == 0x17aa3bf8) {
13741 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13742 * fix the sample rate of analog I/O to 44.1kHz
13744 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13745 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13747 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13748 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13750 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13751 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13753 spec->adc_nids = alc269_adc_nids;
13754 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13755 spec->capsrc_nids = alc269_capsrc_nids;
13756 if (!spec->cap_mixer)
13757 set_capture_mixer(codec);
13758 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13760 spec->vmaster_nid = 0x02;
13762 codec->patch_ops = alc_patch_ops;
13763 if (board_config == ALC269_AUTO)
13764 spec->init_hook = alc269_auto_init;
13765 #ifdef CONFIG_SND_HDA_POWER_SAVE
13766 if (!spec->loopback.amplist)
13767 spec->loopback.amplist = alc269_loopbacks;
13769 codec->proc_widget_hook = print_realtek_coef;
13775 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13779 * set the path ways for 2 channel output
13780 * need to set the codec line out and mic 1 pin widgets to inputs
13782 static struct hda_verb alc861_threestack_ch2_init[] = {
13783 /* set pin widget 1Ah (line in) for input */
13784 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13785 /* set pin widget 18h (mic1/2) for input, for mic also enable
13788 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13792 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13793 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13799 * need to set the codec line out and mic 1 pin widgets to outputs
13801 static struct hda_verb alc861_threestack_ch6_init[] = {
13802 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13803 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13804 /* set pin widget 18h (mic1) for output (CLFE)*/
13805 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13807 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13808 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13810 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13812 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13813 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13818 static struct hda_channel_mode alc861_threestack_modes[2] = {
13819 { 2, alc861_threestack_ch2_init },
13820 { 6, alc861_threestack_ch6_init },
13822 /* Set mic1 as input and unmute the mixer */
13823 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13824 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13825 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13828 /* Set mic1 as output and mute mixer */
13829 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13830 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13831 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13835 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13836 { 2, alc861_uniwill_m31_ch2_init },
13837 { 4, alc861_uniwill_m31_ch4_init },
13840 /* Set mic1 and line-in as input and unmute the mixer */
13841 static struct hda_verb alc861_asus_ch2_init[] = {
13842 /* set pin widget 1Ah (line in) for input */
13843 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13844 /* set pin widget 18h (mic1/2) for input, for mic also enable
13847 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13849 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13851 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13852 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13856 /* Set mic1 nad line-in as output and mute mixer */
13857 static struct hda_verb alc861_asus_ch6_init[] = {
13858 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13859 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13860 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13861 /* set pin widget 18h (mic1) for output (CLFE)*/
13862 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13863 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13864 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13865 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13867 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13869 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13870 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13875 static struct hda_channel_mode alc861_asus_modes[2] = {
13876 { 2, alc861_asus_ch2_init },
13877 { 6, alc861_asus_ch6_init },
13882 static struct snd_kcontrol_new alc861_base_mixer[] = {
13883 /* output mixer control */
13884 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13885 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13886 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13887 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13888 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13890 /*Input mixer control */
13891 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13892 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13893 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13894 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13895 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13896 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13898 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13899 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13905 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13906 /* output mixer control */
13907 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13908 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13909 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13910 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13911 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13913 /* Input mixer control */
13914 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13915 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13916 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13917 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13918 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13919 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13921 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13922 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13926 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13927 .name = "Channel Mode",
13928 .info = alc_ch_mode_info,
13929 .get = alc_ch_mode_get,
13930 .put = alc_ch_mode_put,
13931 .private_value = ARRAY_SIZE(alc861_threestack_modes),
13936 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
13937 /* output mixer control */
13938 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13939 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13940 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13945 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
13946 /* output mixer control */
13947 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13948 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13949 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13950 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13951 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
13953 /* Input mixer control */
13954 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13955 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13956 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13957 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13958 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13959 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13960 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13961 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13962 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13963 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13967 .name = "Channel Mode",
13968 .info = alc_ch_mode_info,
13969 .get = alc_ch_mode_get,
13970 .put = alc_ch_mode_put,
13971 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
13976 static struct snd_kcontrol_new alc861_asus_mixer[] = {
13977 /* output mixer control */
13978 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13979 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13980 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13984 /* Input mixer control */
13985 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13986 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13987 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13988 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13989 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13990 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13991 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13992 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13993 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
13997 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13998 .name = "Channel Mode",
13999 .info = alc_ch_mode_info,
14000 .get = alc_ch_mode_get,
14001 .put = alc_ch_mode_put,
14002 .private_value = ARRAY_SIZE(alc861_asus_modes),
14007 /* additional mixer */
14008 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14009 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14010 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14015 * generic initialization of ADC, input mixers and output mixers
14017 static struct hda_verb alc861_base_init_verbs[] = {
14019 * Unmute ADC0 and set the default input to mic-in
14021 /* port-A for surround (rear panel) */
14022 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14023 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14024 /* port-B for mic-in (rear panel) with vref */
14025 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14026 /* port-C for line-in (rear panel) */
14027 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14028 /* port-D for Front */
14029 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14030 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14031 /* port-E for HP out (front panel) */
14032 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14033 /* route front PCM to HP */
14034 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14035 /* port-F for mic-in (front panel) with vref */
14036 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14037 /* port-G for CLFE (rear panel) */
14038 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14039 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14040 /* port-H for side (rear panel) */
14041 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14042 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14044 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14045 /* route front mic to ADC1*/
14046 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14047 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14049 /* Unmute DAC0~3 & spdif out*/
14050 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14051 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14052 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14053 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14054 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14056 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14057 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14058 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14059 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14060 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14062 /* Unmute Stereo Mixer 15 */
14063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14064 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14065 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14066 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14068 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14069 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14070 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14072 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14073 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14074 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14075 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14076 /* hp used DAC 3 (Front) */
14077 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14083 static struct hda_verb alc861_threestack_init_verbs[] = {
14085 * Unmute ADC0 and set the default input to mic-in
14087 /* port-A for surround (rear panel) */
14088 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14089 /* port-B for mic-in (rear panel) with vref */
14090 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14091 /* port-C for line-in (rear panel) */
14092 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14093 /* port-D for Front */
14094 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14095 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14096 /* port-E for HP out (front panel) */
14097 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14098 /* route front PCM to HP */
14099 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14100 /* port-F for mic-in (front panel) with vref */
14101 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14102 /* port-G for CLFE (rear panel) */
14103 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14104 /* port-H for side (rear panel) */
14105 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14107 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14108 /* route front mic to ADC1*/
14109 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14110 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14111 /* Unmute DAC0~3 & spdif out*/
14112 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14113 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14114 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14115 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14118 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14119 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14120 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14121 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14122 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14124 /* Unmute Stereo Mixer 15 */
14125 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14126 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14127 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14128 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14130 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14131 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14132 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14133 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14134 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14135 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14136 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14137 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14138 /* hp used DAC 3 (Front) */
14139 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14140 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14144 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14146 * Unmute ADC0 and set the default input to mic-in
14148 /* port-A for surround (rear panel) */
14149 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14150 /* port-B for mic-in (rear panel) with vref */
14151 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14152 /* port-C for line-in (rear panel) */
14153 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14154 /* port-D for Front */
14155 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14156 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14157 /* port-E for HP out (front panel) */
14158 /* this has to be set to VREF80 */
14159 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14160 /* route front PCM to HP */
14161 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14162 /* port-F for mic-in (front panel) with vref */
14163 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14164 /* port-G for CLFE (rear panel) */
14165 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14166 /* port-H for side (rear panel) */
14167 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14169 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14170 /* route front mic to ADC1*/
14171 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14172 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14173 /* Unmute DAC0~3 & spdif out*/
14174 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14175 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14176 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14177 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14180 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14181 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14182 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14183 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14184 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14186 /* Unmute Stereo Mixer 15 */
14187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14188 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14189 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14192 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14193 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14194 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14196 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14197 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14198 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14200 /* hp used DAC 3 (Front) */
14201 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14202 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14206 static struct hda_verb alc861_asus_init_verbs[] = {
14208 * Unmute ADC0 and set the default input to mic-in
14210 /* port-A for surround (rear panel)
14211 * according to codec#0 this is the HP jack
14213 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14214 /* route front PCM to HP */
14215 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14216 /* port-B for mic-in (rear panel) with vref */
14217 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14218 /* port-C for line-in (rear panel) */
14219 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14220 /* port-D for Front */
14221 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14222 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14223 /* port-E for HP out (front panel) */
14224 /* this has to be set to VREF80 */
14225 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14226 /* route front PCM to HP */
14227 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14228 /* port-F for mic-in (front panel) with vref */
14229 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14230 /* port-G for CLFE (rear panel) */
14231 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14232 /* port-H for side (rear panel) */
14233 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14235 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14236 /* route front mic to ADC1*/
14237 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14238 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14239 /* Unmute DAC0~3 & spdif out*/
14240 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14241 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14242 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14243 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14244 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14245 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14246 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14247 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14248 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14249 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14251 /* Unmute Stereo Mixer 15 */
14252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14253 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14254 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14255 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14257 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14258 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14259 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14260 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14261 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14262 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14263 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14264 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14265 /* hp used DAC 3 (Front) */
14266 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14267 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14271 /* additional init verbs for ASUS laptops */
14272 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14273 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14274 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14279 * generic initialization of ADC, input mixers and output mixers
14281 static struct hda_verb alc861_auto_init_verbs[] = {
14283 * Unmute ADC0 and set the default input to mic-in
14285 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14288 /* Unmute DAC0~3 & spdif out*/
14289 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14290 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14291 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14292 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14293 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14295 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14296 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14297 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14298 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14299 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14301 /* Unmute Stereo Mixer 15 */
14302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14305 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14308 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14309 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14310 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14312 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14314 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14317 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14318 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14319 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14320 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14321 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14322 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14323 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14325 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14330 static struct hda_verb alc861_toshiba_init_verbs[] = {
14331 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14336 /* toggle speaker-output according to the hp-jack state */
14337 static void alc861_toshiba_automute(struct hda_codec *codec)
14339 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14341 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14342 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14343 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14344 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14347 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14350 if ((res >> 26) == ALC880_HP_EVENT)
14351 alc861_toshiba_automute(codec);
14354 /* pcm configuration: identical with ALC880 */
14355 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14356 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14357 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14358 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14361 #define ALC861_DIGOUT_NID 0x07
14363 static struct hda_channel_mode alc861_8ch_modes[1] = {
14367 static hda_nid_t alc861_dac_nids[4] = {
14368 /* front, surround, clfe, side */
14369 0x03, 0x06, 0x05, 0x04
14372 static hda_nid_t alc660_dac_nids[3] = {
14373 /* front, clfe, surround */
14377 static hda_nid_t alc861_adc_nids[1] = {
14382 static struct hda_input_mux alc861_capture_source = {
14386 { "Front Mic", 0x3 },
14393 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14395 struct alc_spec *spec = codec->spec;
14396 hda_nid_t mix, srcs[5];
14399 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14401 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14404 for (i = 0; i < num; i++) {
14406 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14407 if (type != AC_WID_AUD_OUT)
14409 for (j = 0; j < spec->multiout.num_dacs; j++)
14410 if (spec->multiout.dac_nids[j] == srcs[i])
14412 if (j >= spec->multiout.num_dacs)
14418 /* fill in the dac_nids table from the parsed pin configuration */
14419 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14420 const struct auto_pin_cfg *cfg)
14422 struct alc_spec *spec = codec->spec;
14424 hda_nid_t nid, dac;
14426 spec->multiout.dac_nids = spec->private_dac_nids;
14427 for (i = 0; i < cfg->line_outs; i++) {
14428 nid = cfg->line_out_pins[i];
14429 dac = alc861_look_for_dac(codec, nid);
14432 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14437 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14438 hda_nid_t nid, unsigned int chs)
14440 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14441 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14444 /* add playback controls from the parsed DAC table */
14445 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14446 const struct auto_pin_cfg *cfg)
14448 struct alc_spec *spec = codec->spec;
14449 static const char *chname[4] = {
14450 "Front", "Surround", NULL /*CLFE*/, "Side"
14455 if (cfg->line_outs == 1) {
14456 const char *pfx = NULL;
14459 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14462 nid = spec->multiout.dac_nids[0];
14463 return alc861_create_out_sw(codec, pfx, nid, 3);
14467 for (i = 0; i < cfg->line_outs; i++) {
14468 nid = spec->multiout.dac_nids[i];
14473 err = alc861_create_out_sw(codec, "Center", nid, 1);
14476 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14480 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14488 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14490 struct alc_spec *spec = codec->spec;
14497 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14498 nid = alc861_look_for_dac(codec, pin);
14500 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14503 spec->multiout.hp_nid = nid;
14509 /* create playback/capture controls for input pins */
14510 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14511 const struct auto_pin_cfg *cfg)
14513 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14516 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14518 int pin_type, hda_nid_t dac)
14520 hda_nid_t mix, srcs[5];
14523 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14525 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14527 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14529 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14532 for (i = 0; i < num; i++) {
14534 if (srcs[i] == dac || srcs[i] == 0x15)
14535 mute = AMP_IN_UNMUTE(i);
14537 mute = AMP_IN_MUTE(i);
14538 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14543 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14545 struct alc_spec *spec = codec->spec;
14548 for (i = 0; i < spec->autocfg.line_outs; i++) {
14549 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14550 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14552 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14553 spec->multiout.dac_nids[i]);
14557 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14559 struct alc_spec *spec = codec->spec;
14561 if (spec->autocfg.hp_outs)
14562 alc861_auto_set_output_and_unmute(codec,
14563 spec->autocfg.hp_pins[0],
14565 spec->multiout.hp_nid);
14566 if (spec->autocfg.speaker_outs)
14567 alc861_auto_set_output_and_unmute(codec,
14568 spec->autocfg.speaker_pins[0],
14570 spec->multiout.dac_nids[0]);
14573 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14575 struct alc_spec *spec = codec->spec;
14578 for (i = 0; i < AUTO_PIN_LAST; i++) {
14579 hda_nid_t nid = spec->autocfg.input_pins[i];
14580 if (nid >= 0x0c && nid <= 0x11)
14581 alc_set_input_pin(codec, nid, i);
14585 /* parse the BIOS configuration and set up the alc_spec */
14586 /* return 1 if successful, 0 if the proper config is not found,
14587 * or a negative error code
14589 static int alc861_parse_auto_config(struct hda_codec *codec)
14591 struct alc_spec *spec = codec->spec;
14593 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14595 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14599 if (!spec->autocfg.line_outs)
14600 return 0; /* can't find valid BIOS pin config */
14602 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14605 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14608 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14611 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14615 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14617 if (spec->autocfg.dig_outs)
14618 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14620 if (spec->kctls.list)
14621 add_mixer(spec, spec->kctls.list);
14623 add_verb(spec, alc861_auto_init_verbs);
14625 spec->num_mux_defs = 1;
14626 spec->input_mux = &spec->private_imux[0];
14628 spec->adc_nids = alc861_adc_nids;
14629 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14630 set_capture_mixer(codec);
14632 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14637 /* additional initialization for auto-configuration model */
14638 static void alc861_auto_init(struct hda_codec *codec)
14640 struct alc_spec *spec = codec->spec;
14641 alc861_auto_init_multi_out(codec);
14642 alc861_auto_init_hp_out(codec);
14643 alc861_auto_init_analog_input(codec);
14644 if (spec->unsol_event)
14645 alc_inithook(codec);
14648 #ifdef CONFIG_SND_HDA_POWER_SAVE
14649 static struct hda_amp_list alc861_loopbacks[] = {
14650 { 0x15, HDA_INPUT, 0 },
14651 { 0x15, HDA_INPUT, 1 },
14652 { 0x15, HDA_INPUT, 2 },
14653 { 0x15, HDA_INPUT, 3 },
14660 * configuration and preset
14662 static const char *alc861_models[ALC861_MODEL_LAST] = {
14663 [ALC861_3ST] = "3stack",
14664 [ALC660_3ST] = "3stack-660",
14665 [ALC861_3ST_DIG] = "3stack-dig",
14666 [ALC861_6ST_DIG] = "6stack-dig",
14667 [ALC861_UNIWILL_M31] = "uniwill-m31",
14668 [ALC861_TOSHIBA] = "toshiba",
14669 [ALC861_ASUS] = "asus",
14670 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14671 [ALC861_AUTO] = "auto",
14674 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14675 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14676 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14677 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14678 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14679 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14680 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14681 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14682 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14683 * Any other models that need this preset?
14685 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14686 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14687 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14688 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14689 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14690 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14691 /* FIXME: the below seems conflict */
14692 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14693 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14694 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14698 static struct alc_config_preset alc861_presets[] = {
14700 .mixers = { alc861_3ST_mixer },
14701 .init_verbs = { alc861_threestack_init_verbs },
14702 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14703 .dac_nids = alc861_dac_nids,
14704 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14705 .channel_mode = alc861_threestack_modes,
14707 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14708 .adc_nids = alc861_adc_nids,
14709 .input_mux = &alc861_capture_source,
14711 [ALC861_3ST_DIG] = {
14712 .mixers = { alc861_base_mixer },
14713 .init_verbs = { alc861_threestack_init_verbs },
14714 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14715 .dac_nids = alc861_dac_nids,
14716 .dig_out_nid = ALC861_DIGOUT_NID,
14717 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14718 .channel_mode = alc861_threestack_modes,
14720 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14721 .adc_nids = alc861_adc_nids,
14722 .input_mux = &alc861_capture_source,
14724 [ALC861_6ST_DIG] = {
14725 .mixers = { alc861_base_mixer },
14726 .init_verbs = { alc861_base_init_verbs },
14727 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14728 .dac_nids = alc861_dac_nids,
14729 .dig_out_nid = ALC861_DIGOUT_NID,
14730 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14731 .channel_mode = alc861_8ch_modes,
14732 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14733 .adc_nids = alc861_adc_nids,
14734 .input_mux = &alc861_capture_source,
14737 .mixers = { alc861_3ST_mixer },
14738 .init_verbs = { alc861_threestack_init_verbs },
14739 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14740 .dac_nids = alc660_dac_nids,
14741 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14742 .channel_mode = alc861_threestack_modes,
14744 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14745 .adc_nids = alc861_adc_nids,
14746 .input_mux = &alc861_capture_source,
14748 [ALC861_UNIWILL_M31] = {
14749 .mixers = { alc861_uniwill_m31_mixer },
14750 .init_verbs = { alc861_uniwill_m31_init_verbs },
14751 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14752 .dac_nids = alc861_dac_nids,
14753 .dig_out_nid = ALC861_DIGOUT_NID,
14754 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14755 .channel_mode = alc861_uniwill_m31_modes,
14757 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14758 .adc_nids = alc861_adc_nids,
14759 .input_mux = &alc861_capture_source,
14761 [ALC861_TOSHIBA] = {
14762 .mixers = { alc861_toshiba_mixer },
14763 .init_verbs = { alc861_base_init_verbs,
14764 alc861_toshiba_init_verbs },
14765 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14766 .dac_nids = alc861_dac_nids,
14767 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14768 .channel_mode = alc883_3ST_2ch_modes,
14769 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14770 .adc_nids = alc861_adc_nids,
14771 .input_mux = &alc861_capture_source,
14772 .unsol_event = alc861_toshiba_unsol_event,
14773 .init_hook = alc861_toshiba_automute,
14776 .mixers = { alc861_asus_mixer },
14777 .init_verbs = { alc861_asus_init_verbs },
14778 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14779 .dac_nids = alc861_dac_nids,
14780 .dig_out_nid = ALC861_DIGOUT_NID,
14781 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14782 .channel_mode = alc861_asus_modes,
14785 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14786 .adc_nids = alc861_adc_nids,
14787 .input_mux = &alc861_capture_source,
14789 [ALC861_ASUS_LAPTOP] = {
14790 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14791 .init_verbs = { alc861_asus_init_verbs,
14792 alc861_asus_laptop_init_verbs },
14793 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14794 .dac_nids = alc861_dac_nids,
14795 .dig_out_nid = ALC861_DIGOUT_NID,
14796 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14797 .channel_mode = alc883_3ST_2ch_modes,
14799 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14800 .adc_nids = alc861_adc_nids,
14801 .input_mux = &alc861_capture_source,
14805 /* Pin config fixes */
14807 PINFIX_FSC_AMILO_PI1505,
14810 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14811 { 0x0b, 0x0221101f }, /* HP */
14812 { 0x0f, 0x90170310 }, /* speaker */
14816 static const struct alc_fixup alc861_fixups[] = {
14817 [PINFIX_FSC_AMILO_PI1505] = {
14818 .pins = alc861_fsc_amilo_pi1505_pinfix
14822 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14823 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14827 static int patch_alc861(struct hda_codec *codec)
14829 struct alc_spec *spec;
14833 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14837 codec->spec = spec;
14839 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14843 if (board_config < 0) {
14844 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14846 board_config = ALC861_AUTO;
14849 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14851 if (board_config == ALC861_AUTO) {
14852 /* automatic parse from the BIOS config */
14853 err = alc861_parse_auto_config(codec);
14859 "hda_codec: Cannot set up configuration "
14860 "from BIOS. Using base mode...\n");
14861 board_config = ALC861_3ST_DIG;
14865 err = snd_hda_attach_beep_device(codec, 0x23);
14871 if (board_config != ALC861_AUTO)
14872 setup_preset(codec, &alc861_presets[board_config]);
14874 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14875 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14877 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14878 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14880 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14882 spec->vmaster_nid = 0x03;
14884 codec->patch_ops = alc_patch_ops;
14885 if (board_config == ALC861_AUTO)
14886 spec->init_hook = alc861_auto_init;
14887 #ifdef CONFIG_SND_HDA_POWER_SAVE
14888 if (!spec->loopback.amplist)
14889 spec->loopback.amplist = alc861_loopbacks;
14891 codec->proc_widget_hook = print_realtek_coef;
14897 * ALC861-VD support
14901 * In addition, an independent DAC
14903 #define ALC861VD_DIGOUT_NID 0x06
14905 static hda_nid_t alc861vd_dac_nids[4] = {
14906 /* front, surr, clfe, side surr */
14907 0x02, 0x03, 0x04, 0x05
14910 /* dac_nids for ALC660vd are in a different order - according to
14911 * Realtek's driver.
14912 * This should probably result in a different mixer for 6stack models
14913 * of ALC660vd codecs, but for now there is only 3stack mixer
14914 * - and it is the same as in 861vd.
14915 * adc_nids in ALC660vd are (is) the same as in 861vd
14917 static hda_nid_t alc660vd_dac_nids[3] = {
14918 /* front, rear, clfe, rear_surr */
14922 static hda_nid_t alc861vd_adc_nids[1] = {
14927 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
14930 /* FIXME: should be a matrix-type input source selection */
14931 static struct hda_input_mux alc861vd_capture_source = {
14935 { "Front Mic", 0x1 },
14941 static struct hda_input_mux alc861vd_dallas_capture_source = {
14944 { "Ext Mic", 0x0 },
14945 { "Int Mic", 0x1 },
14949 static struct hda_input_mux alc861vd_hp_capture_source = {
14952 { "Front Mic", 0x0 },
14953 { "ATAPI Mic", 0x1 },
14960 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
14967 static struct hda_verb alc861vd_6stack_ch6_init[] = {
14968 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14969 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14970 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14971 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14978 static struct hda_verb alc861vd_6stack_ch8_init[] = {
14979 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14980 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14981 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14982 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
14986 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
14987 { 6, alc861vd_6stack_ch6_init },
14988 { 8, alc861vd_6stack_ch8_init },
14991 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
14993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14994 .name = "Channel Mode",
14995 .info = alc_ch_mode_info,
14996 .get = alc_ch_mode_get,
14997 .put = alc_ch_mode_put,
15002 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15003 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15005 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15006 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15009 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15010 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15012 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15014 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15016 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15017 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15019 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15020 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15022 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15024 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15025 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15026 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15028 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15029 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15030 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15032 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15033 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15041 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15042 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15043 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15045 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15047 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15051 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15052 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15055 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15056 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15064 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15065 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15066 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15067 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15069 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15071 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15075 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15076 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15077 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15079 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15080 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15085 /* Pin assignment: Speaker=0x14, HP = 0x15,
15086 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15088 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15089 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15090 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15091 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15092 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15093 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15094 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15095 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15096 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15097 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15098 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15102 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15103 * Front Mic=0x18, ATAPI Mic = 0x19,
15105 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15106 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15107 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15108 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15109 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15112 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15113 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15119 * generic initialization of ADC, input mixers and output mixers
15121 static struct hda_verb alc861vd_volume_init_verbs[] = {
15123 * Unmute ADC0 and set the default input to mic-in
15125 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15126 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15128 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15129 * the analog-loopback mixer widget
15131 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15133 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15134 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15135 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15136 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15138 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15139 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15140 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15141 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15142 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15145 * Set up output mixers (0x02 - 0x05)
15147 /* set vol=0 to output mixers */
15148 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15149 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15150 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15151 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15153 /* set up input amps for analog loopback */
15154 /* Amp Indices: DAC = 0, mixer = 1 */
15155 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15156 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15157 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15158 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15159 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15160 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15161 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15162 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15168 * 3-stack pin configuration:
15169 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15171 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15173 * Set pin mode and muting
15175 /* set front pin widgets 0x14 for output */
15176 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15177 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15178 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15180 /* Mic (rear) pin: input vref at 80% */
15181 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15182 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15183 /* Front Mic pin: input vref at 80% */
15184 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15185 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15186 /* Line In pin: input */
15187 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15188 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15189 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15190 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15191 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15192 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15193 /* CD pin widget for input */
15194 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15200 * 6-stack pin configuration:
15202 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15204 * Set pin mode and muting
15206 /* set front pin widgets 0x14 for output */
15207 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15208 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15209 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15211 /* Rear Pin: output 1 (0x0d) */
15212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15215 /* CLFE Pin: output 2 (0x0e) */
15216 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15218 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15219 /* Side Pin: output 3 (0x0f) */
15220 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15221 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15222 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15224 /* Mic (rear) pin: input vref at 80% */
15225 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15226 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15227 /* Front Mic pin: input vref at 80% */
15228 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15229 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15230 /* Line In pin: input */
15231 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15233 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15235 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15236 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15237 /* CD pin widget for input */
15238 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15243 static struct hda_verb alc861vd_eapd_verbs[] = {
15244 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15248 static struct hda_verb alc660vd_eapd_verbs[] = {
15249 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15250 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15254 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15256 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15257 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15258 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15259 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15263 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15265 unsigned int present;
15266 unsigned char bits;
15268 present = snd_hda_jack_detect(codec, 0x18);
15269 bits = present ? HDA_AMP_MUTE : 0;
15271 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15272 HDA_AMP_MUTE, bits);
15275 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15277 struct alc_spec *spec = codec->spec;
15278 spec->autocfg.hp_pins[0] = 0x1b;
15279 spec->autocfg.speaker_pins[0] = 0x14;
15282 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15284 alc_automute_amp(codec);
15285 alc861vd_lenovo_mic_automute(codec);
15288 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15291 switch (res >> 26) {
15292 case ALC880_MIC_EVENT:
15293 alc861vd_lenovo_mic_automute(codec);
15296 alc_automute_amp_unsol_event(codec, res);
15301 static struct hda_verb alc861vd_dallas_verbs[] = {
15302 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15303 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15304 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15305 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15309 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15312 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15316 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15317 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15318 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15319 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15320 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15321 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15322 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15323 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15327 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15328 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15329 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15331 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15332 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15340 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15341 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15346 /* toggle speaker-output according to the hp-jack state */
15347 static void alc861vd_dallas_setup(struct hda_codec *codec)
15349 struct alc_spec *spec = codec->spec;
15351 spec->autocfg.hp_pins[0] = 0x15;
15352 spec->autocfg.speaker_pins[0] = 0x14;
15355 #ifdef CONFIG_SND_HDA_POWER_SAVE
15356 #define alc861vd_loopbacks alc880_loopbacks
15359 /* pcm configuration: identical with ALC880 */
15360 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15361 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15362 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15363 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15366 * configuration and preset
15368 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15369 [ALC660VD_3ST] = "3stack-660",
15370 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15371 [ALC660VD_ASUS_V1S] = "asus-v1s",
15372 [ALC861VD_3ST] = "3stack",
15373 [ALC861VD_3ST_DIG] = "3stack-digout",
15374 [ALC861VD_6ST_DIG] = "6stack-digout",
15375 [ALC861VD_LENOVO] = "lenovo",
15376 [ALC861VD_DALLAS] = "dallas",
15377 [ALC861VD_HP] = "hp",
15378 [ALC861VD_AUTO] = "auto",
15381 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15382 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15383 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15384 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15385 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15386 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15387 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15388 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15389 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15390 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15391 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15392 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15393 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15394 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15395 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15396 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15400 static struct alc_config_preset alc861vd_presets[] = {
15402 .mixers = { alc861vd_3st_mixer },
15403 .init_verbs = { alc861vd_volume_init_verbs,
15404 alc861vd_3stack_init_verbs },
15405 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15406 .dac_nids = alc660vd_dac_nids,
15407 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15408 .channel_mode = alc861vd_3stack_2ch_modes,
15409 .input_mux = &alc861vd_capture_source,
15411 [ALC660VD_3ST_DIG] = {
15412 .mixers = { alc861vd_3st_mixer },
15413 .init_verbs = { alc861vd_volume_init_verbs,
15414 alc861vd_3stack_init_verbs },
15415 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15416 .dac_nids = alc660vd_dac_nids,
15417 .dig_out_nid = ALC861VD_DIGOUT_NID,
15418 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15419 .channel_mode = alc861vd_3stack_2ch_modes,
15420 .input_mux = &alc861vd_capture_source,
15423 .mixers = { alc861vd_3st_mixer },
15424 .init_verbs = { alc861vd_volume_init_verbs,
15425 alc861vd_3stack_init_verbs },
15426 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15427 .dac_nids = alc861vd_dac_nids,
15428 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15429 .channel_mode = alc861vd_3stack_2ch_modes,
15430 .input_mux = &alc861vd_capture_source,
15432 [ALC861VD_3ST_DIG] = {
15433 .mixers = { alc861vd_3st_mixer },
15434 .init_verbs = { alc861vd_volume_init_verbs,
15435 alc861vd_3stack_init_verbs },
15436 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15437 .dac_nids = alc861vd_dac_nids,
15438 .dig_out_nid = ALC861VD_DIGOUT_NID,
15439 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15440 .channel_mode = alc861vd_3stack_2ch_modes,
15441 .input_mux = &alc861vd_capture_source,
15443 [ALC861VD_6ST_DIG] = {
15444 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15445 .init_verbs = { alc861vd_volume_init_verbs,
15446 alc861vd_6stack_init_verbs },
15447 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15448 .dac_nids = alc861vd_dac_nids,
15449 .dig_out_nid = ALC861VD_DIGOUT_NID,
15450 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15451 .channel_mode = alc861vd_6stack_modes,
15452 .input_mux = &alc861vd_capture_source,
15454 [ALC861VD_LENOVO] = {
15455 .mixers = { alc861vd_lenovo_mixer },
15456 .init_verbs = { alc861vd_volume_init_verbs,
15457 alc861vd_3stack_init_verbs,
15458 alc861vd_eapd_verbs,
15459 alc861vd_lenovo_unsol_verbs },
15460 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15461 .dac_nids = alc660vd_dac_nids,
15462 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15463 .channel_mode = alc861vd_3stack_2ch_modes,
15464 .input_mux = &alc861vd_capture_source,
15465 .unsol_event = alc861vd_lenovo_unsol_event,
15466 .setup = alc861vd_lenovo_setup,
15467 .init_hook = alc861vd_lenovo_init_hook,
15469 [ALC861VD_DALLAS] = {
15470 .mixers = { alc861vd_dallas_mixer },
15471 .init_verbs = { alc861vd_dallas_verbs },
15472 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15473 .dac_nids = alc861vd_dac_nids,
15474 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15475 .channel_mode = alc861vd_3stack_2ch_modes,
15476 .input_mux = &alc861vd_dallas_capture_source,
15477 .unsol_event = alc_automute_amp_unsol_event,
15478 .setup = alc861vd_dallas_setup,
15479 .init_hook = alc_automute_amp,
15482 .mixers = { alc861vd_hp_mixer },
15483 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15484 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15485 .dac_nids = alc861vd_dac_nids,
15486 .dig_out_nid = ALC861VD_DIGOUT_NID,
15487 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15488 .channel_mode = alc861vd_3stack_2ch_modes,
15489 .input_mux = &alc861vd_hp_capture_source,
15490 .unsol_event = alc_automute_amp_unsol_event,
15491 .setup = alc861vd_dallas_setup,
15492 .init_hook = alc_automute_amp,
15494 [ALC660VD_ASUS_V1S] = {
15495 .mixers = { alc861vd_lenovo_mixer },
15496 .init_verbs = { alc861vd_volume_init_verbs,
15497 alc861vd_3stack_init_verbs,
15498 alc861vd_eapd_verbs,
15499 alc861vd_lenovo_unsol_verbs },
15500 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15501 .dac_nids = alc660vd_dac_nids,
15502 .dig_out_nid = ALC861VD_DIGOUT_NID,
15503 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15504 .channel_mode = alc861vd_3stack_2ch_modes,
15505 .input_mux = &alc861vd_capture_source,
15506 .unsol_event = alc861vd_lenovo_unsol_event,
15507 .setup = alc861vd_lenovo_setup,
15508 .init_hook = alc861vd_lenovo_init_hook,
15513 * BIOS auto configuration
15515 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15516 const struct auto_pin_cfg *cfg)
15518 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15522 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15523 hda_nid_t nid, int pin_type, int dac_idx)
15525 alc_set_pin_output(codec, nid, pin_type);
15528 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15530 struct alc_spec *spec = codec->spec;
15533 for (i = 0; i <= HDA_SIDE; i++) {
15534 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15535 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15537 alc861vd_auto_set_output_and_unmute(codec, nid,
15543 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15545 struct alc_spec *spec = codec->spec;
15548 pin = spec->autocfg.hp_pins[0];
15549 if (pin) /* connect to front and use dac 0 */
15550 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15551 pin = spec->autocfg.speaker_pins[0];
15553 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15556 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15558 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15560 struct alc_spec *spec = codec->spec;
15563 for (i = 0; i < AUTO_PIN_LAST; i++) {
15564 hda_nid_t nid = spec->autocfg.input_pins[i];
15565 if (alc_is_input_pin(codec, nid)) {
15566 alc_set_input_pin(codec, nid, i);
15567 if (nid != ALC861VD_PIN_CD_NID &&
15568 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15569 snd_hda_codec_write(codec, nid, 0,
15570 AC_VERB_SET_AMP_GAIN_MUTE,
15576 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15578 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15579 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15581 /* add playback controls from the parsed DAC table */
15582 /* Based on ALC880 version. But ALC861VD has separate,
15583 * different NIDs for mute/unmute switch and volume control */
15584 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15585 const struct auto_pin_cfg *cfg)
15587 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15588 hda_nid_t nid_v, nid_s;
15591 for (i = 0; i < cfg->line_outs; i++) {
15592 if (!spec->multiout.dac_nids[i])
15594 nid_v = alc861vd_idx_to_mixer_vol(
15596 spec->multiout.dac_nids[i]));
15597 nid_s = alc861vd_idx_to_mixer_switch(
15599 spec->multiout.dac_nids[i]));
15603 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15605 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15609 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15611 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15615 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15617 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15621 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15623 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15629 if (cfg->line_outs == 1 &&
15630 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15637 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15638 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15642 if (cfg->line_outs == 1 &&
15643 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15645 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15646 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15655 /* add playback controls for speaker and HP outputs */
15656 /* Based on ALC880 version. But ALC861VD has separate,
15657 * different NIDs for mute/unmute switch and volume control */
15658 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15659 hda_nid_t pin, const char *pfx)
15661 hda_nid_t nid_v, nid_s;
15667 if (alc880_is_fixed_pin(pin)) {
15668 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15669 /* specify the DAC as the extra output */
15670 if (!spec->multiout.hp_nid)
15671 spec->multiout.hp_nid = nid_v;
15673 spec->multiout.extra_out_nid[0] = nid_v;
15674 /* control HP volume/switch on the output mixer amp */
15675 nid_v = alc861vd_idx_to_mixer_vol(
15676 alc880_fixed_pin_idx(pin));
15677 nid_s = alc861vd_idx_to_mixer_switch(
15678 alc880_fixed_pin_idx(pin));
15680 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15681 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15684 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15685 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15688 } else if (alc880_is_multi_pin(pin)) {
15689 /* set manual connection */
15690 /* we have only a switch on HP-out PIN */
15691 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15692 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15699 /* parse the BIOS configuration and set up the alc_spec
15700 * return 1 if successful, 0 if the proper config is not found,
15701 * or a negative error code
15702 * Based on ALC880 version - had to change it to override
15703 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15704 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15706 struct alc_spec *spec = codec->spec;
15708 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15710 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15714 if (!spec->autocfg.line_outs)
15715 return 0; /* can't find valid BIOS pin config */
15717 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15720 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15723 err = alc861vd_auto_create_extra_out(spec,
15724 spec->autocfg.speaker_pins[0],
15728 err = alc861vd_auto_create_extra_out(spec,
15729 spec->autocfg.hp_pins[0],
15733 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15737 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15739 if (spec->autocfg.dig_outs)
15740 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15742 if (spec->kctls.list)
15743 add_mixer(spec, spec->kctls.list);
15745 add_verb(spec, alc861vd_volume_init_verbs);
15747 spec->num_mux_defs = 1;
15748 spec->input_mux = &spec->private_imux[0];
15750 err = alc_auto_add_mic_boost(codec);
15754 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15759 /* additional initialization for auto-configuration model */
15760 static void alc861vd_auto_init(struct hda_codec *codec)
15762 struct alc_spec *spec = codec->spec;
15763 alc861vd_auto_init_multi_out(codec);
15764 alc861vd_auto_init_hp_out(codec);
15765 alc861vd_auto_init_analog_input(codec);
15766 alc861vd_auto_init_input_src(codec);
15767 if (spec->unsol_event)
15768 alc_inithook(codec);
15772 ALC660VD_FIX_ASUS_GPIO1
15776 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15777 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15778 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15779 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15783 static const struct alc_fixup alc861vd_fixups[] = {
15784 [ALC660VD_FIX_ASUS_GPIO1] = {
15785 .verbs = alc660vd_fix_asus_gpio1_verbs,
15789 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15790 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15794 static int patch_alc861vd(struct hda_codec *codec)
15796 struct alc_spec *spec;
15797 int err, board_config;
15799 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15803 codec->spec = spec;
15805 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15809 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15810 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15812 board_config = ALC861VD_AUTO;
15815 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15817 if (board_config == ALC861VD_AUTO) {
15818 /* automatic parse from the BIOS config */
15819 err = alc861vd_parse_auto_config(codec);
15825 "hda_codec: Cannot set up configuration "
15826 "from BIOS. Using base mode...\n");
15827 board_config = ALC861VD_3ST;
15831 err = snd_hda_attach_beep_device(codec, 0x23);
15837 if (board_config != ALC861VD_AUTO)
15838 setup_preset(codec, &alc861vd_presets[board_config]);
15840 if (codec->vendor_id == 0x10ec0660) {
15841 /* always turn on EAPD */
15842 add_verb(spec, alc660vd_eapd_verbs);
15845 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15846 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15848 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15849 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15851 if (!spec->adc_nids) {
15852 spec->adc_nids = alc861vd_adc_nids;
15853 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15855 if (!spec->capsrc_nids)
15856 spec->capsrc_nids = alc861vd_capsrc_nids;
15858 set_capture_mixer(codec);
15859 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15861 spec->vmaster_nid = 0x02;
15863 codec->patch_ops = alc_patch_ops;
15865 if (board_config == ALC861VD_AUTO)
15866 spec->init_hook = alc861vd_auto_init;
15867 #ifdef CONFIG_SND_HDA_POWER_SAVE
15868 if (!spec->loopback.amplist)
15869 spec->loopback.amplist = alc861vd_loopbacks;
15871 codec->proc_widget_hook = print_realtek_coef;
15879 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15880 * configuration. Each pin widget can choose any input DACs and a mixer.
15881 * Each ADC is connected from a mixer of all inputs. This makes possible
15882 * 6-channel independent captures.
15884 * In addition, an independent DAC for the multi-playback (not used in this
15887 #define ALC662_DIGOUT_NID 0x06
15888 #define ALC662_DIGIN_NID 0x0a
15890 static hda_nid_t alc662_dac_nids[4] = {
15891 /* front, rear, clfe, rear_surr */
15895 static hda_nid_t alc272_dac_nids[2] = {
15899 static hda_nid_t alc662_adc_nids[2] = {
15904 static hda_nid_t alc272_adc_nids[1] = {
15909 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
15910 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
15914 /* FIXME: should be a matrix-type input source selection */
15915 static struct hda_input_mux alc662_capture_source = {
15919 { "Front Mic", 0x1 },
15925 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
15933 static struct hda_input_mux alc663_capture_source = {
15937 { "Front Mic", 0x1 },
15942 #if 0 /* set to 1 for testing other input sources below */
15943 static struct hda_input_mux alc272_nc10_capture_source = {
15946 { "Autoselect Mic", 0x0 },
15947 { "Internal Mic", 0x1 },
15948 { "In-0x02", 0x2 },
15949 { "In-0x03", 0x3 },
15950 { "In-0x04", 0x4 },
15951 { "In-0x05", 0x5 },
15952 { "In-0x06", 0x6 },
15953 { "In-0x07", 0x7 },
15954 { "In-0x08", 0x8 },
15955 { "In-0x09", 0x9 },
15956 { "In-0x0a", 0x0a },
15957 { "In-0x0b", 0x0b },
15958 { "In-0x0c", 0x0c },
15959 { "In-0x0d", 0x0d },
15960 { "In-0x0e", 0x0e },
15961 { "In-0x0f", 0x0f },
15969 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
15976 static struct hda_verb alc662_3ST_ch2_init[] = {
15977 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
15978 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15979 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
15980 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
15987 static struct hda_verb alc662_3ST_ch6_init[] = {
15988 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15989 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15990 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
15991 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15992 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
15993 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
15997 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
15998 { 2, alc662_3ST_ch2_init },
15999 { 6, alc662_3ST_ch6_init },
16005 static struct hda_verb alc662_sixstack_ch6_init[] = {
16006 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16007 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16008 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16015 static struct hda_verb alc662_sixstack_ch8_init[] = {
16016 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16017 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16018 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16022 static struct hda_channel_mode alc662_5stack_modes[2] = {
16023 { 2, alc662_sixstack_ch6_init },
16024 { 6, alc662_sixstack_ch8_init },
16027 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16028 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16031 static struct snd_kcontrol_new alc662_base_mixer[] = {
16032 /* output mixer control */
16033 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16034 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16035 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16036 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16037 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16038 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16039 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16040 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16041 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16043 /*Input mixer control */
16044 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16045 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16046 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16047 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16048 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16049 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16055 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16056 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16057 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16059 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16060 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16061 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16062 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16063 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16065 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16066 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16070 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16071 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16072 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16073 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16074 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16075 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16076 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16077 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16078 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16079 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16080 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16081 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16086 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16087 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16091 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16092 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16093 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16094 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16095 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16104 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16105 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16106 ALC262_HIPPO_MASTER_SWITCH,
16108 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16109 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16110 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16112 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16113 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16114 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16118 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16119 ALC262_HIPPO_MASTER_SWITCH,
16120 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16121 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16122 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16123 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16124 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16127 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16132 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16133 .ops = &snd_hda_bind_vol,
16135 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16136 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16141 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16142 .ops = &snd_hda_bind_sw,
16144 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16145 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16150 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16151 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16152 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16153 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16158 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16159 .ops = &snd_hda_bind_sw,
16161 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16162 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16163 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16168 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16169 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16170 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16173 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16174 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16179 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16180 .ops = &snd_hda_bind_sw,
16182 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16183 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16184 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16189 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16190 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16191 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16194 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16195 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16199 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16200 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16201 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16205 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16206 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16210 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16211 .ops = &snd_hda_bind_vol,
16213 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16214 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16219 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16220 .ops = &snd_hda_bind_sw,
16222 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16223 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16228 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16229 HDA_BIND_VOL("Master Playback Volume",
16230 &alc663_asus_two_bind_master_vol),
16231 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16232 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16239 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16240 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16241 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16242 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16249 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16250 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16251 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16252 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16253 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16258 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16259 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16263 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16264 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16265 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16269 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16270 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16271 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16272 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16273 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16277 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16280 .name = "Channel Mode",
16281 .info = alc_ch_mode_info,
16282 .get = alc_ch_mode_get,
16283 .put = alc_ch_mode_put,
16288 static struct hda_verb alc662_init_verbs[] = {
16289 /* ADC: mute amp left and right */
16290 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16291 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16292 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16294 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16295 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16296 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16297 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16298 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16300 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16302 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16303 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16304 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16305 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16307 /* Front Pin: output 0 (0x0c) */
16308 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16309 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16311 /* Rear Pin: output 1 (0x0d) */
16312 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16315 /* CLFE Pin: output 2 (0x0e) */
16316 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16317 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16319 /* Mic (rear) pin: input vref at 80% */
16320 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16321 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16322 /* Front Mic pin: input vref at 80% */
16323 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16324 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16325 /* Line In pin: input */
16326 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16327 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16328 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16330 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16331 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16332 /* CD pin widget for input */
16333 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16335 /* FIXME: use matrix-type input source selection */
16336 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16338 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16339 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16341 /* always trun on EAPD */
16342 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16343 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16348 static struct hda_verb alc662_sue_init_verbs[] = {
16349 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16350 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16354 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16356 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16360 /* Set Unsolicited Event*/
16361 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16362 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16363 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16368 * generic initialization of ADC, input mixers and output mixers
16370 static struct hda_verb alc662_auto_init_verbs[] = {
16372 * Unmute ADC and set the default input to mic-in
16374 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16377 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16379 * Note: PASD motherboards uses the Line In 2 as the input for front
16380 * panel mic (mic 2)
16382 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16385 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16386 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16390 * Set up output mixers (0x0c - 0x0f)
16392 /* set vol=0 to output mixers */
16393 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16394 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16395 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16397 /* set up input amps for analog loopback */
16398 /* Amp Indices: DAC = 0, mixer = 1 */
16399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16407 /* FIXME: use matrix-type input source selection */
16408 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16415 /* additional verbs for ALC663 */
16416 static struct hda_verb alc663_auto_init_verbs[] = {
16417 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16418 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16422 static struct hda_verb alc663_m51va_init_verbs[] = {
16423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16425 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16426 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16427 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16430 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16431 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16435 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16436 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16437 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16438 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16439 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16440 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16441 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16442 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16446 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16447 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16449 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16454 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16458 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16459 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16460 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16461 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16462 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16463 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16464 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16465 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16469 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16470 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16471 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16472 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16473 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16479 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16480 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16481 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16485 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16486 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16488 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16489 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16490 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16492 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16493 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16494 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16495 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16496 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16497 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16501 static struct hda_verb alc663_g71v_init_verbs[] = {
16502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16503 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16504 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16506 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16507 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16508 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16510 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16511 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16512 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16516 static struct hda_verb alc663_g50v_init_verbs[] = {
16517 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16518 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16519 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16521 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16522 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16526 static struct hda_verb alc662_ecs_init_verbs[] = {
16527 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16529 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16534 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16535 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16536 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16537 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16538 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16539 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16540 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16541 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16544 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16545 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16549 static struct hda_verb alc272_dell_init_verbs[] = {
16550 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16551 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16553 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16554 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16555 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16556 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16559 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16560 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16564 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16565 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16566 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16570 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16571 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16572 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16576 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16578 unsigned int present;
16579 unsigned char bits;
16581 present = snd_hda_jack_detect(codec, 0x14);
16582 bits = present ? HDA_AMP_MUTE : 0;
16584 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16585 HDA_AMP_MUTE, bits);
16588 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16590 unsigned int present;
16591 unsigned char bits;
16593 present = snd_hda_jack_detect(codec, 0x1b);
16594 bits = present ? HDA_AMP_MUTE : 0;
16596 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16597 HDA_AMP_MUTE, bits);
16598 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16599 HDA_AMP_MUTE, bits);
16602 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16605 if ((res >> 26) == ALC880_HP_EVENT)
16606 alc662_lenovo_101e_all_automute(codec);
16607 if ((res >> 26) == ALC880_FRONT_EVENT)
16608 alc662_lenovo_101e_ispeaker_automute(codec);
16611 /* unsolicited event for HP jack sensing */
16612 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16615 if ((res >> 26) == ALC880_MIC_EVENT)
16616 alc_mic_automute(codec);
16618 alc262_hippo_unsol_event(codec, res);
16621 static void alc662_eeepc_setup(struct hda_codec *codec)
16623 struct alc_spec *spec = codec->spec;
16625 alc262_hippo1_setup(codec);
16626 spec->ext_mic.pin = 0x18;
16627 spec->ext_mic.mux_idx = 0;
16628 spec->int_mic.pin = 0x19;
16629 spec->int_mic.mux_idx = 1;
16630 spec->auto_mic = 1;
16633 static void alc662_eeepc_inithook(struct hda_codec *codec)
16635 alc262_hippo_automute(codec);
16636 alc_mic_automute(codec);
16639 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16641 struct alc_spec *spec = codec->spec;
16643 spec->autocfg.hp_pins[0] = 0x14;
16644 spec->autocfg.speaker_pins[0] = 0x1b;
16647 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16649 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16651 unsigned int present;
16652 unsigned char bits;
16654 present = snd_hda_jack_detect(codec, 0x21);
16655 bits = present ? HDA_AMP_MUTE : 0;
16656 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16657 AMP_IN_MUTE(0), bits);
16658 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16659 AMP_IN_MUTE(0), bits);
16662 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16664 unsigned int present;
16665 unsigned char bits;
16667 present = snd_hda_jack_detect(codec, 0x21);
16668 bits = present ? HDA_AMP_MUTE : 0;
16669 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16670 AMP_IN_MUTE(0), bits);
16671 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16672 AMP_IN_MUTE(0), bits);
16673 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16674 AMP_IN_MUTE(0), bits);
16675 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16676 AMP_IN_MUTE(0), bits);
16679 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16681 unsigned int present;
16682 unsigned char bits;
16684 present = snd_hda_jack_detect(codec, 0x15);
16685 bits = present ? HDA_AMP_MUTE : 0;
16686 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16687 AMP_IN_MUTE(0), bits);
16688 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16689 AMP_IN_MUTE(0), bits);
16690 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16691 AMP_IN_MUTE(0), bits);
16692 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16693 AMP_IN_MUTE(0), bits);
16696 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16698 unsigned int present;
16699 unsigned char bits;
16701 present = snd_hda_jack_detect(codec, 0x1b);
16702 bits = present ? 0 : PIN_OUT;
16703 snd_hda_codec_write(codec, 0x14, 0,
16704 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16707 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16709 unsigned int present1, present2;
16711 present1 = snd_hda_jack_detect(codec, 0x21);
16712 present2 = snd_hda_jack_detect(codec, 0x15);
16714 if (present1 || present2) {
16715 snd_hda_codec_write_cache(codec, 0x14, 0,
16716 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16718 snd_hda_codec_write_cache(codec, 0x14, 0,
16719 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16723 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16725 unsigned int present1, present2;
16727 present1 = snd_hda_jack_detect(codec, 0x1b);
16728 present2 = snd_hda_jack_detect(codec, 0x15);
16730 if (present1 || present2) {
16731 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16732 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16733 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16734 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16736 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16737 AMP_IN_MUTE(0), 0);
16738 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16739 AMP_IN_MUTE(0), 0);
16743 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16746 switch (res >> 26) {
16747 case ALC880_HP_EVENT:
16748 alc663_m51va_speaker_automute(codec);
16750 case ALC880_MIC_EVENT:
16751 alc_mic_automute(codec);
16756 static void alc663_m51va_setup(struct hda_codec *codec)
16758 struct alc_spec *spec = codec->spec;
16759 spec->ext_mic.pin = 0x18;
16760 spec->ext_mic.mux_idx = 0;
16761 spec->int_mic.pin = 0x12;
16762 spec->int_mic.mux_idx = 1;
16763 spec->auto_mic = 1;
16766 static void alc663_m51va_inithook(struct hda_codec *codec)
16768 alc663_m51va_speaker_automute(codec);
16769 alc_mic_automute(codec);
16772 /* ***************** Mode1 ******************************/
16773 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
16774 #define alc663_mode1_setup alc663_m51va_setup
16775 #define alc663_mode1_inithook alc663_m51va_inithook
16777 /* ***************** Mode2 ******************************/
16778 static void alc662_mode2_unsol_event(struct hda_codec *codec,
16781 switch (res >> 26) {
16782 case ALC880_HP_EVENT:
16783 alc662_f5z_speaker_automute(codec);
16785 case ALC880_MIC_EVENT:
16786 alc_mic_automute(codec);
16791 #define alc662_mode2_setup alc663_m51va_setup
16793 static void alc662_mode2_inithook(struct hda_codec *codec)
16795 alc662_f5z_speaker_automute(codec);
16796 alc_mic_automute(codec);
16798 /* ***************** Mode3 ******************************/
16799 static void alc663_mode3_unsol_event(struct hda_codec *codec,
16802 switch (res >> 26) {
16803 case ALC880_HP_EVENT:
16804 alc663_two_hp_m1_speaker_automute(codec);
16806 case ALC880_MIC_EVENT:
16807 alc_mic_automute(codec);
16812 #define alc663_mode3_setup alc663_m51va_setup
16814 static void alc663_mode3_inithook(struct hda_codec *codec)
16816 alc663_two_hp_m1_speaker_automute(codec);
16817 alc_mic_automute(codec);
16819 /* ***************** Mode4 ******************************/
16820 static void alc663_mode4_unsol_event(struct hda_codec *codec,
16823 switch (res >> 26) {
16824 case ALC880_HP_EVENT:
16825 alc663_21jd_two_speaker_automute(codec);
16827 case ALC880_MIC_EVENT:
16828 alc_mic_automute(codec);
16833 #define alc663_mode4_setup alc663_m51va_setup
16835 static void alc663_mode4_inithook(struct hda_codec *codec)
16837 alc663_21jd_two_speaker_automute(codec);
16838 alc_mic_automute(codec);
16840 /* ***************** Mode5 ******************************/
16841 static void alc663_mode5_unsol_event(struct hda_codec *codec,
16844 switch (res >> 26) {
16845 case ALC880_HP_EVENT:
16846 alc663_15jd_two_speaker_automute(codec);
16848 case ALC880_MIC_EVENT:
16849 alc_mic_automute(codec);
16854 #define alc663_mode5_setup alc663_m51va_setup
16856 static void alc663_mode5_inithook(struct hda_codec *codec)
16858 alc663_15jd_two_speaker_automute(codec);
16859 alc_mic_automute(codec);
16861 /* ***************** Mode6 ******************************/
16862 static void alc663_mode6_unsol_event(struct hda_codec *codec,
16865 switch (res >> 26) {
16866 case ALC880_HP_EVENT:
16867 alc663_two_hp_m2_speaker_automute(codec);
16869 case ALC880_MIC_EVENT:
16870 alc_mic_automute(codec);
16875 #define alc663_mode6_setup alc663_m51va_setup
16877 static void alc663_mode6_inithook(struct hda_codec *codec)
16879 alc663_two_hp_m2_speaker_automute(codec);
16880 alc_mic_automute(codec);
16883 static void alc663_g71v_hp_automute(struct hda_codec *codec)
16885 unsigned int present;
16886 unsigned char bits;
16888 present = snd_hda_jack_detect(codec, 0x21);
16889 bits = present ? HDA_AMP_MUTE : 0;
16890 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16891 HDA_AMP_MUTE, bits);
16892 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16893 HDA_AMP_MUTE, bits);
16896 static void alc663_g71v_front_automute(struct hda_codec *codec)
16898 unsigned int present;
16899 unsigned char bits;
16901 present = snd_hda_jack_detect(codec, 0x15);
16902 bits = present ? HDA_AMP_MUTE : 0;
16903 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16904 HDA_AMP_MUTE, bits);
16907 static void alc663_g71v_unsol_event(struct hda_codec *codec,
16910 switch (res >> 26) {
16911 case ALC880_HP_EVENT:
16912 alc663_g71v_hp_automute(codec);
16914 case ALC880_FRONT_EVENT:
16915 alc663_g71v_front_automute(codec);
16917 case ALC880_MIC_EVENT:
16918 alc_mic_automute(codec);
16923 #define alc663_g71v_setup alc663_m51va_setup
16925 static void alc663_g71v_inithook(struct hda_codec *codec)
16927 alc663_g71v_front_automute(codec);
16928 alc663_g71v_hp_automute(codec);
16929 alc_mic_automute(codec);
16932 static void alc663_g50v_unsol_event(struct hda_codec *codec,
16935 switch (res >> 26) {
16936 case ALC880_HP_EVENT:
16937 alc663_m51va_speaker_automute(codec);
16939 case ALC880_MIC_EVENT:
16940 alc_mic_automute(codec);
16945 #define alc663_g50v_setup alc663_m51va_setup
16947 static void alc663_g50v_inithook(struct hda_codec *codec)
16949 alc663_m51va_speaker_automute(codec);
16950 alc_mic_automute(codec);
16953 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
16954 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16955 ALC262_HIPPO_MASTER_SWITCH,
16957 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
16958 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
16959 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
16961 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16962 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16963 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16967 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
16968 /* Master Playback automatically created from Speaker and Headphone */
16969 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16970 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16971 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16974 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16975 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16976 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16978 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16979 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16980 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16984 #ifdef CONFIG_SND_HDA_POWER_SAVE
16985 #define alc662_loopbacks alc880_loopbacks
16989 /* pcm configuration: identical with ALC880 */
16990 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
16991 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
16992 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
16993 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
16996 * configuration and preset
16998 static const char *alc662_models[ALC662_MODEL_LAST] = {
16999 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17000 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17001 [ALC662_3ST_6ch] = "3stack-6ch",
17002 [ALC662_5ST_DIG] = "6stack-dig",
17003 [ALC662_LENOVO_101E] = "lenovo-101e",
17004 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17005 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17006 [ALC662_ECS] = "ecs",
17007 [ALC663_ASUS_M51VA] = "m51va",
17008 [ALC663_ASUS_G71V] = "g71v",
17009 [ALC663_ASUS_H13] = "h13",
17010 [ALC663_ASUS_G50V] = "g50v",
17011 [ALC663_ASUS_MODE1] = "asus-mode1",
17012 [ALC662_ASUS_MODE2] = "asus-mode2",
17013 [ALC663_ASUS_MODE3] = "asus-mode3",
17014 [ALC663_ASUS_MODE4] = "asus-mode4",
17015 [ALC663_ASUS_MODE5] = "asus-mode5",
17016 [ALC663_ASUS_MODE6] = "asus-mode6",
17017 [ALC272_DELL] = "dell",
17018 [ALC272_DELL_ZM1] = "dell-zm1",
17019 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17020 [ALC662_AUTO] = "auto",
17023 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17024 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17025 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17026 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17027 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17028 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17029 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17030 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17031 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17032 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17033 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17034 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17035 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17036 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17037 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17038 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17039 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17040 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17041 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17042 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17043 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17044 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17045 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17046 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17047 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17048 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17049 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17050 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17051 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17052 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17053 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17054 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17055 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17056 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17057 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17058 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17059 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17060 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17061 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17062 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17063 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17064 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17065 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17066 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17067 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17068 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17069 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17070 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17071 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17072 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17073 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17074 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17075 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17076 ALC662_3ST_6ch_DIG),
17077 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17078 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17079 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17080 ALC662_3ST_6ch_DIG),
17081 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17082 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17083 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17084 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17085 ALC662_3ST_6ch_DIG),
17086 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17088 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17092 static struct alc_config_preset alc662_presets[] = {
17093 [ALC662_3ST_2ch_DIG] = {
17094 .mixers = { alc662_3ST_2ch_mixer },
17095 .init_verbs = { alc662_init_verbs },
17096 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17097 .dac_nids = alc662_dac_nids,
17098 .dig_out_nid = ALC662_DIGOUT_NID,
17099 .dig_in_nid = ALC662_DIGIN_NID,
17100 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17101 .channel_mode = alc662_3ST_2ch_modes,
17102 .input_mux = &alc662_capture_source,
17104 [ALC662_3ST_6ch_DIG] = {
17105 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17106 .init_verbs = { alc662_init_verbs },
17107 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17108 .dac_nids = alc662_dac_nids,
17109 .dig_out_nid = ALC662_DIGOUT_NID,
17110 .dig_in_nid = ALC662_DIGIN_NID,
17111 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17112 .channel_mode = alc662_3ST_6ch_modes,
17114 .input_mux = &alc662_capture_source,
17116 [ALC662_3ST_6ch] = {
17117 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17118 .init_verbs = { alc662_init_verbs },
17119 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17120 .dac_nids = alc662_dac_nids,
17121 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17122 .channel_mode = alc662_3ST_6ch_modes,
17124 .input_mux = &alc662_capture_source,
17126 [ALC662_5ST_DIG] = {
17127 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17128 .init_verbs = { alc662_init_verbs },
17129 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17130 .dac_nids = alc662_dac_nids,
17131 .dig_out_nid = ALC662_DIGOUT_NID,
17132 .dig_in_nid = ALC662_DIGIN_NID,
17133 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17134 .channel_mode = alc662_5stack_modes,
17135 .input_mux = &alc662_capture_source,
17137 [ALC662_LENOVO_101E] = {
17138 .mixers = { alc662_lenovo_101e_mixer },
17139 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17140 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17141 .dac_nids = alc662_dac_nids,
17142 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17143 .channel_mode = alc662_3ST_2ch_modes,
17144 .input_mux = &alc662_lenovo_101e_capture_source,
17145 .unsol_event = alc662_lenovo_101e_unsol_event,
17146 .init_hook = alc662_lenovo_101e_all_automute,
17148 [ALC662_ASUS_EEEPC_P701] = {
17149 .mixers = { alc662_eeepc_p701_mixer },
17150 .init_verbs = { alc662_init_verbs,
17151 alc662_eeepc_sue_init_verbs },
17152 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17153 .dac_nids = alc662_dac_nids,
17154 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17155 .channel_mode = alc662_3ST_2ch_modes,
17156 .unsol_event = alc662_eeepc_unsol_event,
17157 .setup = alc662_eeepc_setup,
17158 .init_hook = alc662_eeepc_inithook,
17160 [ALC662_ASUS_EEEPC_EP20] = {
17161 .mixers = { alc662_eeepc_ep20_mixer,
17162 alc662_chmode_mixer },
17163 .init_verbs = { alc662_init_verbs,
17164 alc662_eeepc_ep20_sue_init_verbs },
17165 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17166 .dac_nids = alc662_dac_nids,
17167 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17168 .channel_mode = alc662_3ST_6ch_modes,
17169 .input_mux = &alc662_lenovo_101e_capture_source,
17170 .unsol_event = alc662_eeepc_unsol_event,
17171 .setup = alc662_eeepc_ep20_setup,
17172 .init_hook = alc662_eeepc_ep20_inithook,
17175 .mixers = { alc662_ecs_mixer },
17176 .init_verbs = { alc662_init_verbs,
17177 alc662_ecs_init_verbs },
17178 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17179 .dac_nids = alc662_dac_nids,
17180 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17181 .channel_mode = alc662_3ST_2ch_modes,
17182 .unsol_event = alc662_eeepc_unsol_event,
17183 .setup = alc662_eeepc_setup,
17184 .init_hook = alc662_eeepc_inithook,
17186 [ALC663_ASUS_M51VA] = {
17187 .mixers = { alc663_m51va_mixer },
17188 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17189 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17190 .dac_nids = alc662_dac_nids,
17191 .dig_out_nid = ALC662_DIGOUT_NID,
17192 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17193 .channel_mode = alc662_3ST_2ch_modes,
17194 .unsol_event = alc663_m51va_unsol_event,
17195 .setup = alc663_m51va_setup,
17196 .init_hook = alc663_m51va_inithook,
17198 [ALC663_ASUS_G71V] = {
17199 .mixers = { alc663_g71v_mixer },
17200 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17201 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17202 .dac_nids = alc662_dac_nids,
17203 .dig_out_nid = ALC662_DIGOUT_NID,
17204 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17205 .channel_mode = alc662_3ST_2ch_modes,
17206 .unsol_event = alc663_g71v_unsol_event,
17207 .setup = alc663_g71v_setup,
17208 .init_hook = alc663_g71v_inithook,
17210 [ALC663_ASUS_H13] = {
17211 .mixers = { alc663_m51va_mixer },
17212 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17213 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17214 .dac_nids = alc662_dac_nids,
17215 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17216 .channel_mode = alc662_3ST_2ch_modes,
17217 .unsol_event = alc663_m51va_unsol_event,
17218 .init_hook = alc663_m51va_inithook,
17220 [ALC663_ASUS_G50V] = {
17221 .mixers = { alc663_g50v_mixer },
17222 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17223 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17224 .dac_nids = alc662_dac_nids,
17225 .dig_out_nid = ALC662_DIGOUT_NID,
17226 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17227 .channel_mode = alc662_3ST_6ch_modes,
17228 .input_mux = &alc663_capture_source,
17229 .unsol_event = alc663_g50v_unsol_event,
17230 .setup = alc663_g50v_setup,
17231 .init_hook = alc663_g50v_inithook,
17233 [ALC663_ASUS_MODE1] = {
17234 .mixers = { alc663_m51va_mixer },
17235 .cap_mixer = alc662_auto_capture_mixer,
17236 .init_verbs = { alc662_init_verbs,
17237 alc663_21jd_amic_init_verbs },
17238 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17240 .dac_nids = alc662_dac_nids,
17241 .dig_out_nid = ALC662_DIGOUT_NID,
17242 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17243 .channel_mode = alc662_3ST_2ch_modes,
17244 .unsol_event = alc663_mode1_unsol_event,
17245 .setup = alc663_mode1_setup,
17246 .init_hook = alc663_mode1_inithook,
17248 [ALC662_ASUS_MODE2] = {
17249 .mixers = { alc662_1bjd_mixer },
17250 .cap_mixer = alc662_auto_capture_mixer,
17251 .init_verbs = { alc662_init_verbs,
17252 alc662_1bjd_amic_init_verbs },
17253 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17254 .dac_nids = alc662_dac_nids,
17255 .dig_out_nid = ALC662_DIGOUT_NID,
17256 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17257 .channel_mode = alc662_3ST_2ch_modes,
17258 .unsol_event = alc662_mode2_unsol_event,
17259 .setup = alc662_mode2_setup,
17260 .init_hook = alc662_mode2_inithook,
17262 [ALC663_ASUS_MODE3] = {
17263 .mixers = { alc663_two_hp_m1_mixer },
17264 .cap_mixer = alc662_auto_capture_mixer,
17265 .init_verbs = { alc662_init_verbs,
17266 alc663_two_hp_amic_m1_init_verbs },
17267 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17269 .dac_nids = alc662_dac_nids,
17270 .dig_out_nid = ALC662_DIGOUT_NID,
17271 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17272 .channel_mode = alc662_3ST_2ch_modes,
17273 .unsol_event = alc663_mode3_unsol_event,
17274 .setup = alc663_mode3_setup,
17275 .init_hook = alc663_mode3_inithook,
17277 [ALC663_ASUS_MODE4] = {
17278 .mixers = { alc663_asus_21jd_clfe_mixer },
17279 .cap_mixer = alc662_auto_capture_mixer,
17280 .init_verbs = { alc662_init_verbs,
17281 alc663_21jd_amic_init_verbs},
17282 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17284 .dac_nids = alc662_dac_nids,
17285 .dig_out_nid = ALC662_DIGOUT_NID,
17286 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17287 .channel_mode = alc662_3ST_2ch_modes,
17288 .unsol_event = alc663_mode4_unsol_event,
17289 .setup = alc663_mode4_setup,
17290 .init_hook = alc663_mode4_inithook,
17292 [ALC663_ASUS_MODE5] = {
17293 .mixers = { alc663_asus_15jd_clfe_mixer },
17294 .cap_mixer = alc662_auto_capture_mixer,
17295 .init_verbs = { alc662_init_verbs,
17296 alc663_15jd_amic_init_verbs },
17297 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17299 .dac_nids = alc662_dac_nids,
17300 .dig_out_nid = ALC662_DIGOUT_NID,
17301 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17302 .channel_mode = alc662_3ST_2ch_modes,
17303 .unsol_event = alc663_mode5_unsol_event,
17304 .setup = alc663_mode5_setup,
17305 .init_hook = alc663_mode5_inithook,
17307 [ALC663_ASUS_MODE6] = {
17308 .mixers = { alc663_two_hp_m2_mixer },
17309 .cap_mixer = alc662_auto_capture_mixer,
17310 .init_verbs = { alc662_init_verbs,
17311 alc663_two_hp_amic_m2_init_verbs },
17312 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17314 .dac_nids = alc662_dac_nids,
17315 .dig_out_nid = ALC662_DIGOUT_NID,
17316 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17317 .channel_mode = alc662_3ST_2ch_modes,
17318 .unsol_event = alc663_mode6_unsol_event,
17319 .setup = alc663_mode6_setup,
17320 .init_hook = alc663_mode6_inithook,
17323 .mixers = { alc663_m51va_mixer },
17324 .cap_mixer = alc272_auto_capture_mixer,
17325 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17326 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17327 .dac_nids = alc662_dac_nids,
17328 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17329 .adc_nids = alc272_adc_nids,
17330 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17331 .capsrc_nids = alc272_capsrc_nids,
17332 .channel_mode = alc662_3ST_2ch_modes,
17333 .unsol_event = alc663_m51va_unsol_event,
17334 .setup = alc663_m51va_setup,
17335 .init_hook = alc663_m51va_inithook,
17337 [ALC272_DELL_ZM1] = {
17338 .mixers = { alc663_m51va_mixer },
17339 .cap_mixer = alc662_auto_capture_mixer,
17340 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17341 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17342 .dac_nids = alc662_dac_nids,
17343 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17344 .adc_nids = alc662_adc_nids,
17346 .capsrc_nids = alc662_capsrc_nids,
17347 .channel_mode = alc662_3ST_2ch_modes,
17348 .unsol_event = alc663_m51va_unsol_event,
17349 .setup = alc663_m51va_setup,
17350 .init_hook = alc663_m51va_inithook,
17352 [ALC272_SAMSUNG_NC10] = {
17353 .mixers = { alc272_nc10_mixer },
17354 .init_verbs = { alc662_init_verbs,
17355 alc663_21jd_amic_init_verbs },
17356 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17357 .dac_nids = alc272_dac_nids,
17358 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17359 .channel_mode = alc662_3ST_2ch_modes,
17360 /*.input_mux = &alc272_nc10_capture_source,*/
17361 .unsol_event = alc663_mode4_unsol_event,
17362 .setup = alc663_mode4_setup,
17363 .init_hook = alc663_mode4_inithook,
17369 * BIOS auto configuration
17372 /* convert from MIX nid to DAC */
17373 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17377 else if (nid >= 0x0c && nid <= 0x0e)
17378 return nid - 0x0c + 0x02;
17383 /* get MIX nid connected to the given pin targeted to DAC */
17384 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17390 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17391 for (i = 0; i < num; i++) {
17392 if (alc662_mix_to_dac(mix[i]) == dac)
17398 /* look for an empty DAC slot */
17399 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17401 struct alc_spec *spec = codec->spec;
17405 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17408 for (i = 0; i < num; i++) {
17409 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17412 for (j = 0; j < spec->multiout.num_dacs; j++)
17413 if (spec->multiout.dac_nids[j] == nid)
17415 if (j >= spec->multiout.num_dacs)
17421 /* fill in the dac_nids table from the parsed pin configuration */
17422 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17423 const struct auto_pin_cfg *cfg)
17425 struct alc_spec *spec = codec->spec;
17429 spec->multiout.dac_nids = spec->private_dac_nids;
17430 for (i = 0; i < cfg->line_outs; i++) {
17431 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17434 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17439 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17440 hda_nid_t nid, unsigned int chs)
17442 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17443 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17446 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17447 hda_nid_t nid, unsigned int chs)
17449 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17450 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17453 #define alc662_add_stereo_vol(spec, pfx, nid) \
17454 alc662_add_vol_ctl(spec, pfx, nid, 3)
17455 #define alc662_add_stereo_sw(spec, pfx, nid) \
17456 alc662_add_sw_ctl(spec, pfx, nid, 3)
17458 /* add playback controls from the parsed DAC table */
17459 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17460 const struct auto_pin_cfg *cfg)
17462 struct alc_spec *spec = codec->spec;
17463 static const char *chname[4] = {
17464 "Front", "Surround", NULL /*CLFE*/, "Side"
17466 hda_nid_t nid, mix;
17469 for (i = 0; i < cfg->line_outs; i++) {
17470 nid = spec->multiout.dac_nids[i];
17473 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17478 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17481 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17484 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17487 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17492 if (cfg->line_outs == 1 &&
17493 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17500 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17503 if (cfg->line_outs == 1 &&
17504 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17506 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17514 /* add playback controls for speaker and HP outputs */
17515 /* return DAC nid if any new DAC is assigned */
17516 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17519 struct alc_spec *spec = codec->spec;
17520 hda_nid_t nid, mix;
17525 nid = alc662_look_for_dac(codec, pin);
17527 /* the corresponding DAC is already occupied */
17528 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17529 return 0; /* no way */
17530 /* create a switch only */
17531 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17532 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17535 mix = alc662_dac_to_mix(codec, pin, nid);
17538 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17541 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17547 /* create playback/capture controls for input pins */
17548 #define alc662_auto_create_input_ctls \
17549 alc882_auto_create_input_ctls
17551 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17552 hda_nid_t nid, int pin_type,
17558 alc_set_pin_output(codec, nid, pin_type);
17559 /* need the manual connection? */
17560 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17563 for (i = 0; i < num; i++) {
17564 if (alc662_mix_to_dac(srcs[i]) != dac)
17566 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17571 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17573 struct alc_spec *spec = codec->spec;
17574 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17577 for (i = 0; i <= HDA_SIDE; i++) {
17578 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17580 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17581 spec->multiout.dac_nids[i]);
17585 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17587 struct alc_spec *spec = codec->spec;
17590 pin = spec->autocfg.hp_pins[0];
17592 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17593 spec->multiout.hp_nid);
17594 pin = spec->autocfg.speaker_pins[0];
17596 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17597 spec->multiout.extra_out_nid[0]);
17600 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17602 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17604 struct alc_spec *spec = codec->spec;
17607 for (i = 0; i < AUTO_PIN_LAST; i++) {
17608 hda_nid_t nid = spec->autocfg.input_pins[i];
17609 if (alc_is_input_pin(codec, nid)) {
17610 alc_set_input_pin(codec, nid, i);
17611 if (nid != ALC662_PIN_CD_NID &&
17612 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17613 snd_hda_codec_write(codec, nid, 0,
17614 AC_VERB_SET_AMP_GAIN_MUTE,
17620 #define alc662_auto_init_input_src alc882_auto_init_input_src
17622 static int alc662_parse_auto_config(struct hda_codec *codec)
17624 struct alc_spec *spec = codec->spec;
17626 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17628 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17632 if (!spec->autocfg.line_outs)
17633 return 0; /* can't find valid BIOS pin config */
17635 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17638 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17641 err = alc662_auto_create_extra_out(codec,
17642 spec->autocfg.speaker_pins[0],
17647 spec->multiout.extra_out_nid[0] = err;
17648 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17653 spec->multiout.hp_nid = err;
17654 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17658 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17660 if (spec->autocfg.dig_outs)
17661 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17663 if (spec->kctls.list)
17664 add_mixer(spec, spec->kctls.list);
17666 spec->num_mux_defs = 1;
17667 spec->input_mux = &spec->private_imux[0];
17669 add_verb(spec, alc662_auto_init_verbs);
17670 if (codec->vendor_id == 0x10ec0663)
17671 add_verb(spec, alc663_auto_init_verbs);
17673 err = alc_auto_add_mic_boost(codec);
17677 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
17682 /* additional initialization for auto-configuration model */
17683 static void alc662_auto_init(struct hda_codec *codec)
17685 struct alc_spec *spec = codec->spec;
17686 alc662_auto_init_multi_out(codec);
17687 alc662_auto_init_hp_out(codec);
17688 alc662_auto_init_analog_input(codec);
17689 alc662_auto_init_input_src(codec);
17690 if (spec->unsol_event)
17691 alc_inithook(codec);
17694 static int patch_alc662(struct hda_codec *codec)
17696 struct alc_spec *spec;
17697 int err, board_config;
17699 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17703 codec->spec = spec;
17705 alc_fix_pll_init(codec, 0x20, 0x04, 15);
17707 if (alc_read_coef_idx(codec, 0)==0x8020){
17708 kfree(codec->chip_name);
17709 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
17710 if (!codec->chip_name) {
17716 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
17719 if (board_config < 0) {
17720 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17722 board_config = ALC662_AUTO;
17725 if (board_config == ALC662_AUTO) {
17726 /* automatic parse from the BIOS config */
17727 err = alc662_parse_auto_config(codec);
17733 "hda_codec: Cannot set up configuration "
17734 "from BIOS. Using base mode...\n");
17735 board_config = ALC662_3ST_2ch_DIG;
17739 err = snd_hda_attach_beep_device(codec, 0x1);
17745 if (board_config != ALC662_AUTO)
17746 setup_preset(codec, &alc662_presets[board_config]);
17748 spec->stream_analog_playback = &alc662_pcm_analog_playback;
17749 spec->stream_analog_capture = &alc662_pcm_analog_capture;
17751 spec->stream_digital_playback = &alc662_pcm_digital_playback;
17752 spec->stream_digital_capture = &alc662_pcm_digital_capture;
17754 if (!spec->adc_nids) {
17755 spec->adc_nids = alc662_adc_nids;
17756 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
17758 if (!spec->capsrc_nids)
17759 spec->capsrc_nids = alc662_capsrc_nids;
17761 if (!spec->cap_mixer)
17762 set_capture_mixer(codec);
17763 if (codec->vendor_id == 0x10ec0662)
17764 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17766 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
17768 spec->vmaster_nid = 0x02;
17770 codec->patch_ops = alc_patch_ops;
17771 if (board_config == ALC662_AUTO)
17772 spec->init_hook = alc662_auto_init;
17773 #ifdef CONFIG_SND_HDA_POWER_SAVE
17774 if (!spec->loopback.amplist)
17775 spec->loopback.amplist = alc662_loopbacks;
17777 codec->proc_widget_hook = print_realtek_coef;
17782 static int patch_alc888(struct hda_codec *codec)
17784 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
17785 kfree(codec->chip_name);
17786 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
17787 if (!codec->chip_name) {
17791 return patch_alc662(codec);
17793 return patch_alc882(codec);
17799 static struct hda_codec_preset snd_hda_preset_realtek[] = {
17800 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
17801 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
17802 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
17803 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
17804 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
17805 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
17806 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
17807 .patch = patch_alc861 },
17808 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
17809 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
17810 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
17811 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
17812 .patch = patch_alc882 },
17813 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
17814 .patch = patch_alc662 },
17815 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
17816 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
17817 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
17818 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
17819 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
17820 .patch = patch_alc882 },
17821 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
17822 .patch = patch_alc882 },
17823 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
17824 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
17825 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
17826 .patch = patch_alc882 },
17827 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
17828 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
17829 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
17830 {} /* terminator */
17833 MODULE_ALIAS("snd-hda-codec-id:10ec*");
17835 MODULE_LICENSE("GPL");
17836 MODULE_DESCRIPTION("Realtek HD-audio codec");
17838 static struct hda_codec_preset_list realtek_list = {
17839 .preset = snd_hda_preset_realtek,
17840 .owner = THIS_MODULE,
17843 static int __init patch_realtek_init(void)
17845 return snd_hda_add_codec_preset(&realtek_list);
17848 static void __exit patch_realtek_exit(void)
17850 snd_hda_delete_codec_preset(&realtek_list);
17853 module_init(patch_realtek_init)
17854 module_exit(patch_realtek_exit)