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 */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
637 .info = alc_pin_mode_info, \
638 .get = alc_pin_mode_get, \
639 .put = alc_pin_mode_put, \
640 .private_value = nid | (dir<<16) }
642 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
643 * together using a mask with more than one bit set. This control is
644 * currently used only by the ALC260 test model. At this stage they are not
645 * needed for any "production" models.
647 #ifdef CONFIG_SND_DEBUG
648 #define alc_gpio_data_info snd_ctl_boolean_mono_info
650 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long *valp = ucontrol->value.integer.value;
657 unsigned int val = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_GPIO_DATA, 0x00);
660 *valp = (val & mask) != 0;
663 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 hda_nid_t nid = kcontrol->private_value & 0xffff;
669 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
670 long val = *ucontrol->value.integer.value;
671 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
672 AC_VERB_GET_GPIO_DATA,
675 /* Set/unset the masked GPIO bit(s) as needed */
676 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
681 snd_hda_codec_write_cache(codec, nid, 0,
682 AC_VERB_SET_GPIO_DATA, gpio_data);
686 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
689 .info = alc_gpio_data_info, \
690 .get = alc_gpio_data_get, \
691 .put = alc_gpio_data_put, \
692 .private_value = nid | (mask<<16) }
693 #endif /* CONFIG_SND_DEBUG */
695 /* A switch control to allow the enabling of the digital IO pins on the
696 * ALC260. This is incredibly simplistic; the intention of this control is
697 * to provide something in the test model allowing digital outputs to be
698 * identified if present. If models are found which can utilise these
699 * outputs a more complete mixer control can be devised for those models if
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
705 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_DIGI_CONVERT_1,
730 /* Set/unset the masked control bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
741 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_spdif_ctrl_info, \
745 .get = alc_spdif_ctrl_get, \
746 .put = alc_spdif_ctrl_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
751 * Again, this is only used in the ALC26x test models to help identify when
752 * the EAPD line must be asserted for features to work.
754 #ifdef CONFIG_SND_DEBUG
755 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
757 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
758 struct snd_ctl_elem_value *ucontrol)
760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
761 hda_nid_t nid = kcontrol->private_value & 0xffff;
762 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
763 long *valp = ucontrol->value.integer.value;
764 unsigned int val = snd_hda_codec_read(codec, nid, 0,
765 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
767 *valp = (val & mask) != 0;
771 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
772 struct snd_ctl_elem_value *ucontrol)
775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
776 hda_nid_t nid = kcontrol->private_value & 0xffff;
777 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
778 long val = *ucontrol->value.integer.value;
779 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
780 AC_VERB_GET_EAPD_BTLENABLE,
783 /* Set/unset the masked control bit(s) as needed */
784 change = (!val ? 0 : mask) != (ctrl_data & mask);
789 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
795 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
796 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
797 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
798 .info = alc_eapd_ctrl_info, \
799 .get = alc_eapd_ctrl_get, \
800 .put = alc_eapd_ctrl_put, \
801 .private_value = nid | (mask<<16) }
802 #endif /* CONFIG_SND_DEBUG */
805 * set up the input pin config (depending on the given auto-pin type)
807 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
810 unsigned int val = PIN_IN;
812 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
814 pincap = snd_hda_query_pin_caps(codec, nid);
815 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
816 if (pincap & AC_PINCAP_VREF_80)
818 else if (pincap & AC_PINCAP_VREF_50)
820 else if (pincap & AC_PINCAP_VREF_100)
822 else if (pincap & AC_PINCAP_VREF_GRD)
825 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
830 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
832 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
834 spec->mixers[spec->num_mixers++] = mix;
837 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
839 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
841 spec->init_verbs[spec->num_init_verbs++] = verb;
844 #ifdef CONFIG_PROC_FS
848 static void print_realtek_coef(struct snd_info_buffer *buffer,
849 struct hda_codec *codec, hda_nid_t nid)
855 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
856 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
857 coeff = snd_hda_codec_read(codec, nid, 0,
858 AC_VERB_GET_COEF_INDEX, 0);
859 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
862 #define print_realtek_coef NULL
866 * set up from the preset table
868 static void setup_preset(struct hda_codec *codec,
869 const struct alc_config_preset *preset)
871 struct alc_spec *spec = codec->spec;
874 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
875 add_mixer(spec, preset->mixers[i]);
876 spec->cap_mixer = preset->cap_mixer;
877 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
879 add_verb(spec, preset->init_verbs[i]);
881 spec->channel_mode = preset->channel_mode;
882 spec->num_channel_mode = preset->num_channel_mode;
883 spec->need_dac_fix = preset->need_dac_fix;
884 spec->const_channel_count = preset->const_channel_count;
886 if (preset->const_channel_count)
887 spec->multiout.max_channels = preset->const_channel_count;
889 spec->multiout.max_channels = spec->channel_mode[0].channels;
890 spec->ext_channel_count = spec->channel_mode[0].channels;
892 spec->multiout.num_dacs = preset->num_dacs;
893 spec->multiout.dac_nids = preset->dac_nids;
894 spec->multiout.dig_out_nid = preset->dig_out_nid;
895 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
896 spec->multiout.hp_nid = preset->hp_nid;
898 spec->num_mux_defs = preset->num_mux_defs;
899 if (!spec->num_mux_defs)
900 spec->num_mux_defs = 1;
901 spec->input_mux = preset->input_mux;
903 spec->num_adc_nids = preset->num_adc_nids;
904 spec->adc_nids = preset->adc_nids;
905 spec->capsrc_nids = preset->capsrc_nids;
906 spec->dig_in_nid = preset->dig_in_nid;
908 spec->unsol_event = preset->unsol_event;
909 spec->init_hook = preset->init_hook;
910 #ifdef CONFIG_SND_HDA_POWER_SAVE
911 spec->power_hook = preset->power_hook;
912 spec->loopback.amplist = preset->loopbacks;
916 preset->setup(codec);
919 /* Enable GPIO mask and set output */
920 static struct hda_verb alc_gpio1_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
927 static struct hda_verb alc_gpio2_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
934 static struct hda_verb alc_gpio3_init_verbs[] = {
935 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
936 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
942 * Fix hardware PLL issue
943 * On some codecs, the analog PLL gating control must be off while
944 * the default value is 1.
946 static void alc_fix_pll(struct hda_codec *codec)
948 struct alc_spec *spec = codec->spec;
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
956 AC_VERB_GET_PROC_COEF, 0);
957 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
959 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
960 val & ~(1 << spec->pll_coef_bit));
963 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
964 unsigned int coef_idx, unsigned int coef_bit)
966 struct alc_spec *spec = codec->spec;
968 spec->pll_coef_idx = coef_idx;
969 spec->pll_coef_bit = coef_bit;
973 static void alc_automute_pin(struct hda_codec *codec)
975 struct alc_spec *spec = codec->spec;
976 unsigned int nid = spec->autocfg.hp_pins[0];
981 spec->jack_present = snd_hda_jack_detect(codec, nid);
982 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
983 nid = spec->autocfg.speaker_pins[i];
986 snd_hda_codec_write(codec, nid, 0,
987 AC_VERB_SET_PIN_WIDGET_CONTROL,
988 spec->jack_present ? 0 : PIN_OUT);
992 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
995 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
998 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
999 for (i = 0; i < nums; i++)
1005 static void alc_mic_automute(struct hda_codec *codec)
1007 struct alc_spec *spec = codec->spec;
1008 struct alc_mic_route *dead, *alive;
1009 unsigned int present, type;
1012 if (!spec->auto_mic)
1014 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1016 if (snd_BUG_ON(!spec->adc_nids))
1019 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1021 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1023 alive = &spec->ext_mic;
1024 dead = &spec->int_mic;
1026 alive = &spec->int_mic;
1027 dead = &spec->ext_mic;
1030 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1031 if (type == AC_WID_AUD_MIX) {
1032 /* Matrix-mixer style (e.g. ALC882) */
1033 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1036 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 HDA_AMP_MUTE, HDA_AMP_MUTE);
1040 /* MUX style (e.g. ALC880) */
1041 snd_hda_codec_write_cache(codec, cap_nid, 0,
1042 AC_VERB_SET_CONNECT_SEL,
1046 /* FIXME: analog mixer */
1049 /* unsolicited event for HP jack sensing */
1050 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1052 if (codec->vendor_id == 0x10ec0880)
1057 case ALC880_HP_EVENT:
1058 alc_automute_pin(codec);
1060 case ALC880_MIC_EVENT:
1061 alc_mic_automute(codec);
1066 static void alc_inithook(struct hda_codec *codec)
1068 alc_automute_pin(codec);
1069 alc_mic_automute(codec);
1072 /* additional initialization for ALC888 variants */
1073 static void alc888_coef_init(struct hda_codec *codec)
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1080 if ((tmp & 0xf0) == 0x20)
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x830);
1086 snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF, 0x3030);
1090 static void alc889_coef_init(struct hda_codec *codec)
1094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1095 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1100 /* turn on/off EAPD control (only if available) */
1101 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1103 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1105 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1106 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1110 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1115 case ALC_INIT_GPIO1:
1116 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1118 case ALC_INIT_GPIO2:
1119 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1121 case ALC_INIT_GPIO3:
1122 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1124 case ALC_INIT_DEFAULT:
1125 switch (codec->vendor_id) {
1127 set_eapd(codec, 0x0f, 1);
1128 set_eapd(codec, 0x10, 1);
1141 set_eapd(codec, 0x14, 1);
1142 set_eapd(codec, 0x15, 1);
1145 switch (codec->vendor_id) {
1147 snd_hda_codec_write(codec, 0x1a, 0,
1148 AC_VERB_SET_COEF_INDEX, 7);
1149 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1150 AC_VERB_GET_PROC_COEF, 0);
1151 snd_hda_codec_write(codec, 0x1a, 0,
1152 AC_VERB_SET_COEF_INDEX, 7);
1153 snd_hda_codec_write(codec, 0x1a, 0,
1154 AC_VERB_SET_PROC_COEF,
1164 alc889_coef_init(codec);
1167 alc888_coef_init(codec);
1171 snd_hda_codec_write(codec, 0x20, 0,
1172 AC_VERB_SET_COEF_INDEX, 7);
1173 tmp = snd_hda_codec_read(codec, 0x20, 0,
1174 AC_VERB_GET_PROC_COEF, 0);
1175 snd_hda_codec_write(codec, 0x20, 0,
1176 AC_VERB_SET_COEF_INDEX, 7);
1177 snd_hda_codec_write(codec, 0x20, 0,
1178 AC_VERB_SET_PROC_COEF,
1186 static void alc_init_auto_hp(struct hda_codec *codec)
1188 struct alc_spec *spec = codec->spec;
1190 if (!spec->autocfg.hp_pins[0])
1193 if (!spec->autocfg.speaker_pins[0]) {
1194 if (spec->autocfg.line_out_pins[0] &&
1195 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1196 spec->autocfg.speaker_pins[0] =
1197 spec->autocfg.line_out_pins[0];
1202 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1203 spec->autocfg.hp_pins[0]);
1204 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1205 AC_VERB_SET_UNSOLICITED_ENABLE,
1206 AC_USRSP_EN | ALC880_HP_EVENT);
1207 spec->unsol_event = alc_sku_unsol_event;
1210 static void alc_init_auto_mic(struct hda_codec *codec)
1212 struct alc_spec *spec = codec->spec;
1213 struct auto_pin_cfg *cfg = &spec->autocfg;
1214 hda_nid_t fixed, ext;
1217 /* there must be only two mic inputs exclusively */
1218 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1219 if (cfg->input_pins[i])
1223 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1224 hda_nid_t nid = cfg->input_pins[i];
1225 unsigned int defcfg;
1228 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1229 switch (get_defcfg_connect(defcfg)) {
1230 case AC_JACK_PORT_FIXED:
1232 return; /* already occupied */
1235 case AC_JACK_PORT_COMPLEX:
1237 return; /* already occupied */
1241 return; /* invalid entry */
1246 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1247 return; /* no unsol support */
1248 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1250 spec->ext_mic.pin = ext;
1251 spec->int_mic.pin = fixed;
1252 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1253 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1255 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1256 AC_VERB_SET_UNSOLICITED_ENABLE,
1257 AC_USRSP_EN | ALC880_MIC_EVENT);
1258 spec->unsol_event = alc_sku_unsol_event;
1261 /* check subsystem ID and set up device-specific initialization;
1262 * return 1 if initialized, 0 if invalid SSID
1264 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1265 * 31 ~ 16 : Manufacture ID
1267 * 7 ~ 0 : Assembly ID
1268 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1270 static int alc_subsystem_id(struct hda_codec *codec,
1271 hda_nid_t porta, hda_nid_t porte,
1274 unsigned int ass, tmp, i;
1276 struct alc_spec *spec = codec->spec;
1278 ass = codec->subsystem_id & 0xffff;
1279 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1282 /* invalid SSID, check the special NID pin defcfg instead */
1284 * 31~30 : port connectivity
1287 * 19~16 : Check sum (15:1)
1292 if (codec->vendor_id == 0x10ec0260)
1294 ass = snd_hda_codec_get_pincfg(codec, nid);
1295 snd_printd("realtek: No valid SSID, "
1296 "checking pincfg 0x%08x for NID 0x%x\n",
1298 if (!(ass & 1) && !(ass & 0x100000))
1300 if ((ass >> 30) != 1) /* no physical connection */
1305 for (i = 1; i < 16; i++) {
1309 if (((ass >> 16) & 0xf) != tmp)
1312 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1313 ass & 0xffff, codec->vendor_id);
1317 * 2 : 0 --> Desktop, 1 --> Laptop
1318 * 3~5 : External Amplifier control
1321 tmp = (ass & 0x38) >> 3; /* external Amp control */
1324 spec->init_amp = ALC_INIT_GPIO1;
1327 spec->init_amp = ALC_INIT_GPIO2;
1330 spec->init_amp = ALC_INIT_GPIO3;
1333 spec->init_amp = ALC_INIT_DEFAULT;
1337 /* is laptop or Desktop and enable the function "Mute internal speaker
1338 * when the external headphone out jack is plugged"
1340 if (!(ass & 0x8000))
1343 * 10~8 : Jack location
1344 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1346 * 15 : 1 --> enable the function "Mute internal speaker
1347 * when the external headphone out jack is plugged"
1349 if (!spec->autocfg.hp_pins[0]) {
1351 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1360 for (i = 0; i < spec->autocfg.line_outs; i++)
1361 if (spec->autocfg.line_out_pins[i] == nid)
1363 spec->autocfg.hp_pins[0] = nid;
1366 alc_init_auto_hp(codec);
1367 alc_init_auto_mic(codec);
1371 static void alc_ssid_check(struct hda_codec *codec,
1372 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1374 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1375 struct alc_spec *spec = codec->spec;
1376 snd_printd("realtek: "
1377 "Enable default setup for auto mode as fallback\n");
1378 spec->init_amp = ALC_INIT_DEFAULT;
1379 alc_init_auto_hp(codec);
1380 alc_init_auto_mic(codec);
1385 * Fix-up pin default configurations and add default verbs
1394 const struct alc_pincfg *pins;
1395 const struct hda_verb *verbs;
1398 static void alc_pick_fixup(struct hda_codec *codec,
1399 const struct snd_pci_quirk *quirk,
1400 const struct alc_fixup *fix)
1402 const struct alc_pincfg *cfg;
1404 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1408 fix += quirk->value;
1411 for (; cfg->nid; cfg++)
1412 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1415 add_verb(codec->spec, fix->verbs);
1418 static int alc_read_coef_idx(struct hda_codec *codec,
1419 unsigned int coef_idx)
1422 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1424 val = snd_hda_codec_read(codec, 0x20, 0,
1425 AC_VERB_GET_PROC_COEF, 0);
1436 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1437 /* Mic-in jack as mic in */
1438 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1439 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1440 /* Line-in jack as Line in */
1441 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1442 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1443 /* Line-Out as Front */
1444 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1451 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1452 /* Mic-in jack as mic in */
1453 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1454 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1455 /* Line-in jack as Surround */
1456 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1457 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1458 /* Line-Out as Front */
1459 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1466 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1467 /* Mic-in jack as CLFE */
1468 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1469 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1470 /* Line-in jack as Surround */
1471 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1472 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1473 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1474 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1481 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1482 /* Mic-in jack as CLFE */
1483 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1484 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1485 /* Line-in jack as Surround */
1486 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1487 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1488 /* Line-Out as Side */
1489 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1493 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1494 { 2, alc888_4ST_ch2_intel_init },
1495 { 4, alc888_4ST_ch4_intel_init },
1496 { 6, alc888_4ST_ch6_intel_init },
1497 { 8, alc888_4ST_ch8_intel_init },
1501 * ALC888 Fujitsu Siemens Amillo xa3530
1504 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1505 /* Front Mic: set to PIN_IN (empty by default) */
1506 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1507 /* Connect Internal HP to Front */
1508 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1510 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1511 /* Connect Bass HP to Front */
1512 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1513 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1514 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1515 /* Connect Line-Out side jack (SPDIF) to Side */
1516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1518 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1519 /* Connect Mic jack to CLFE */
1520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1522 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1523 /* Connect Line-in jack to Surround */
1524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1526 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1527 /* Connect HP out jack to Front */
1528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1529 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1530 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1531 /* Enable unsolicited event for HP jack and Line-out jack */
1532 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1533 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1537 static void alc_automute_amp(struct hda_codec *codec)
1539 struct alc_spec *spec = codec->spec;
1544 spec->jack_present = 0;
1545 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1546 nid = spec->autocfg.hp_pins[i];
1549 if (snd_hda_jack_detect(codec, nid)) {
1550 spec->jack_present = 1;
1555 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1556 /* Toggle internal speakers muting */
1557 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1558 nid = spec->autocfg.speaker_pins[i];
1561 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1562 HDA_AMP_MUTE, mute);
1566 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1569 if (codec->vendor_id == 0x10ec0880)
1573 if (res == ALC880_HP_EVENT)
1574 alc_automute_amp(codec);
1577 static void alc889_automute_setup(struct hda_codec *codec)
1579 struct alc_spec *spec = codec->spec;
1581 spec->autocfg.hp_pins[0] = 0x15;
1582 spec->autocfg.speaker_pins[0] = 0x14;
1583 spec->autocfg.speaker_pins[1] = 0x16;
1584 spec->autocfg.speaker_pins[2] = 0x17;
1585 spec->autocfg.speaker_pins[3] = 0x19;
1586 spec->autocfg.speaker_pins[4] = 0x1a;
1589 static void alc889_intel_init_hook(struct hda_codec *codec)
1591 alc889_coef_init(codec);
1592 alc_automute_amp(codec);
1595 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1597 struct alc_spec *spec = codec->spec;
1599 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1600 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1601 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1602 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1606 * ALC888 Acer Aspire 4930G model
1609 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1610 /* Front Mic: set to PIN_IN (empty by default) */
1611 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1612 /* Unselect Front Mic by default in input mixer 3 */
1613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1614 /* Enable unsolicited event for HP jack */
1615 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1616 /* Connect Internal HP to front */
1617 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1618 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1619 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1620 /* Connect HP out to front */
1621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1628 * ALC888 Acer Aspire 6530G model
1631 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1632 /* Bias voltage on for external mic port */
1633 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1634 /* Front Mic: set to PIN_IN (empty by default) */
1635 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1636 /* Unselect Front Mic by default in input mixer 3 */
1637 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1638 /* Enable unsolicited event for HP jack */
1639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1640 /* Enable speaker output */
1641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1643 /* Enable headphone output */
1644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1646 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1651 * ALC889 Acer Aspire 8930G model
1654 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1655 /* Front Mic: set to PIN_IN (empty by default) */
1656 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1657 /* Unselect Front Mic by default in input mixer 3 */
1658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1659 /* Enable unsolicited event for HP jack */
1660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1661 /* Connect Internal Front to Front */
1662 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1663 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1664 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1665 /* Connect Internal Rear to Rear */
1666 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1667 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1668 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1669 /* Connect Internal CLFE to CLFE */
1670 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1671 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1672 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1673 /* Connect HP out to Front */
1674 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1675 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1676 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1677 /* Enable all DACs */
1678 /* DAC DISABLE/MUTE 1? */
1679 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1680 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1681 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1682 /* DAC DISABLE/MUTE 2? */
1683 /* some bit here disables the other DACs. Init=0x4900 */
1684 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1685 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1687 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1688 * which makes the stereo useless. However, either the mic or the ALC889
1689 * makes the signal become a difference/sum signal instead of standard
1690 * stereo, which is annoying. So instead we flip this bit which makes the
1691 * codec replicate the sum signal to both channels, turning it into a
1694 /* DMIC_CONTROL? Init value = 0x0001 */
1695 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1696 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1700 static struct hda_input_mux alc888_2_capture_sources[2] = {
1701 /* Front mic only available on one ADC */
1708 { "Front Mic", 0xb },
1721 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1722 /* Interal mic only available on one ADC */
1729 { "Input Mix", 0xa },
1739 { "Input Mix", 0xa },
1744 static struct hda_input_mux alc889_capture_sources[3] = {
1745 /* Digital mic only available on first "ADC" */
1752 { "Front Mic", 0xb },
1753 { "Input Mix", 0xa },
1762 { "Input Mix", 0xa },
1771 { "Input Mix", 0xa },
1776 static struct snd_kcontrol_new alc888_base_mixer[] = {
1777 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1778 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1779 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1780 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1781 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1784 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1785 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1786 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1788 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1789 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1790 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1793 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1794 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1798 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1799 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1800 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1802 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1803 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1805 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1806 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1807 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1808 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1809 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1810 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1811 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1812 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1817 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1819 struct alc_spec *spec = codec->spec;
1821 spec->autocfg.hp_pins[0] = 0x15;
1822 spec->autocfg.speaker_pins[0] = 0x14;
1823 spec->autocfg.speaker_pins[1] = 0x16;
1824 spec->autocfg.speaker_pins[2] = 0x17;
1827 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1829 struct alc_spec *spec = codec->spec;
1831 spec->autocfg.hp_pins[0] = 0x15;
1832 spec->autocfg.speaker_pins[0] = 0x14;
1833 spec->autocfg.speaker_pins[1] = 0x16;
1834 spec->autocfg.speaker_pins[2] = 0x17;
1837 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1839 struct alc_spec *spec = codec->spec;
1841 spec->autocfg.hp_pins[0] = 0x15;
1842 spec->autocfg.speaker_pins[0] = 0x14;
1843 spec->autocfg.speaker_pins[1] = 0x16;
1844 spec->autocfg.speaker_pins[2] = 0x1b;
1848 * ALC880 3-stack model
1850 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1851 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1852 * F-Mic = 0x1b, HP = 0x19
1855 static hda_nid_t alc880_dac_nids[4] = {
1856 /* front, rear, clfe, rear_surr */
1857 0x02, 0x05, 0x04, 0x03
1860 static hda_nid_t alc880_adc_nids[3] = {
1865 /* The datasheet says the node 0x07 is connected from inputs,
1866 * but it shows zero connection in the real implementation on some devices.
1867 * Note: this is a 915GAV bug, fixed on 915GLV
1869 static hda_nid_t alc880_adc_nids_alt[2] = {
1874 #define ALC880_DIGOUT_NID 0x06
1875 #define ALC880_DIGIN_NID 0x0a
1877 static struct hda_input_mux alc880_capture_source = {
1881 { "Front Mic", 0x3 },
1887 /* channel source setting (2/6 channel selection for 3-stack) */
1889 static struct hda_verb alc880_threestack_ch2_init[] = {
1890 /* set line-in to input, mute it */
1891 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1892 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1893 /* set mic-in to input vref 80%, mute it */
1894 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1895 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1900 static struct hda_verb alc880_threestack_ch6_init[] = {
1901 /* set line-in to output, unmute it */
1902 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1903 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1904 /* set mic-in to output, unmute it */
1905 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1906 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1910 static struct hda_channel_mode alc880_threestack_modes[2] = {
1911 { 2, alc880_threestack_ch2_init },
1912 { 6, alc880_threestack_ch6_init },
1915 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1916 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1917 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1918 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1919 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1920 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1921 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1922 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1923 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1924 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1925 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1926 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1927 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1934 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1935 .name = "Channel Mode",
1936 .info = alc_ch_mode_info,
1937 .get = alc_ch_mode_get,
1938 .put = alc_ch_mode_put,
1943 /* capture mixer elements */
1944 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1945 struct snd_ctl_elem_info *uinfo)
1947 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1948 struct alc_spec *spec = codec->spec;
1951 mutex_lock(&codec->control_mutex);
1952 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1954 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1955 mutex_unlock(&codec->control_mutex);
1959 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1960 unsigned int size, unsigned int __user *tlv)
1962 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1963 struct alc_spec *spec = codec->spec;
1966 mutex_lock(&codec->control_mutex);
1967 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1969 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1970 mutex_unlock(&codec->control_mutex);
1974 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1975 struct snd_ctl_elem_value *ucontrol);
1977 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1978 struct snd_ctl_elem_value *ucontrol,
1981 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1982 struct alc_spec *spec = codec->spec;
1983 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1986 mutex_lock(&codec->control_mutex);
1987 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1989 err = func(kcontrol, ucontrol);
1990 mutex_unlock(&codec->control_mutex);
1994 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1995 struct snd_ctl_elem_value *ucontrol)
1997 return alc_cap_getput_caller(kcontrol, ucontrol,
1998 snd_hda_mixer_amp_volume_get);
2001 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2002 struct snd_ctl_elem_value *ucontrol)
2004 return alc_cap_getput_caller(kcontrol, ucontrol,
2005 snd_hda_mixer_amp_volume_put);
2008 /* capture mixer elements */
2009 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2011 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2012 struct snd_ctl_elem_value *ucontrol)
2014 return alc_cap_getput_caller(kcontrol, ucontrol,
2015 snd_hda_mixer_amp_switch_get);
2018 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2019 struct snd_ctl_elem_value *ucontrol)
2021 return alc_cap_getput_caller(kcontrol, ucontrol,
2022 snd_hda_mixer_amp_switch_put);
2025 #define _DEFINE_CAPMIX(num) \
2027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2028 .name = "Capture Switch", \
2029 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2031 .info = alc_cap_sw_info, \
2032 .get = alc_cap_sw_get, \
2033 .put = alc_cap_sw_put, \
2036 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2037 .name = "Capture Volume", \
2038 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2039 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2040 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2042 .info = alc_cap_vol_info, \
2043 .get = alc_cap_vol_get, \
2044 .put = alc_cap_vol_put, \
2045 .tlv = { .c = alc_cap_vol_tlv }, \
2048 #define _DEFINE_CAPSRC(num) \
2050 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2051 /* .name = "Capture Source", */ \
2052 .name = "Input Source", \
2054 .info = alc_mux_enum_info, \
2055 .get = alc_mux_enum_get, \
2056 .put = alc_mux_enum_put, \
2059 #define DEFINE_CAPMIX(num) \
2060 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2061 _DEFINE_CAPMIX(num), \
2062 _DEFINE_CAPSRC(num), \
2066 #define DEFINE_CAPMIX_NOSRC(num) \
2067 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2068 _DEFINE_CAPMIX(num), \
2072 /* up to three ADCs */
2076 DEFINE_CAPMIX_NOSRC(1);
2077 DEFINE_CAPMIX_NOSRC(2);
2078 DEFINE_CAPMIX_NOSRC(3);
2081 * ALC880 5-stack model
2083 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2085 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2086 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2089 /* additional mixers to alc880_three_stack_mixer */
2090 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2091 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2092 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2096 /* channel source setting (6/8 channel selection for 5-stack) */
2098 static struct hda_verb alc880_fivestack_ch6_init[] = {
2099 /* set line-in to input, mute it */
2100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2106 static struct hda_verb alc880_fivestack_ch8_init[] = {
2107 /* set line-in to output, unmute it */
2108 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2109 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2113 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2114 { 6, alc880_fivestack_ch6_init },
2115 { 8, alc880_fivestack_ch8_init },
2120 * ALC880 6-stack model
2122 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2123 * Side = 0x05 (0x0f)
2124 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2125 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2128 static hda_nid_t alc880_6st_dac_nids[4] = {
2129 /* front, rear, clfe, rear_surr */
2130 0x02, 0x03, 0x04, 0x05
2133 static struct hda_input_mux alc880_6stack_capture_source = {
2137 { "Front Mic", 0x1 },
2143 /* fixed 8-channels */
2144 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2148 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2149 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2150 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2151 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2152 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2153 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2154 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2155 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2156 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2157 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2158 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2159 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2160 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2161 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2162 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2165 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2166 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2169 .name = "Channel Mode",
2170 .info = alc_ch_mode_info,
2171 .get = alc_ch_mode_get,
2172 .put = alc_ch_mode_put,
2181 * W810 has rear IO for:
2184 * Center/LFE (DAC 04)
2187 * The system also has a pair of internal speakers, and a headphone jack.
2188 * These are both connected to Line2 on the codec, hence to DAC 02.
2190 * There is a variable resistor to control the speaker or headphone
2191 * volume. This is a hardware-only device without a software API.
2193 * Plugging headphones in will disable the internal speakers. This is
2194 * implemented in hardware, not via the driver using jack sense. In
2195 * a similar fashion, plugging into the rear socket marked "front" will
2196 * disable both the speakers and headphones.
2198 * For input, there's a microphone jack, and an "audio in" jack.
2199 * These may not do anything useful with this driver yet, because I
2200 * haven't setup any initialization verbs for these yet...
2203 static hda_nid_t alc880_w810_dac_nids[3] = {
2204 /* front, rear/surround, clfe */
2208 /* fixed 6 channels */
2209 static struct hda_channel_mode alc880_w810_modes[1] = {
2213 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2214 static struct snd_kcontrol_new alc880_w810_base_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("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2220 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2221 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2222 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2223 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2231 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2232 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2236 static hda_nid_t alc880_z71v_dac_nids[1] = {
2239 #define ALC880_Z71V_HP_DAC 0x03
2241 /* fixed 2 channels */
2242 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2246 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2249 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2250 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2251 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2252 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2260 * ALC880 F1734 model
2262 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2263 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2266 static hda_nid_t alc880_f1734_dac_nids[1] = {
2269 #define ALC880_F1734_HP_DAC 0x02
2271 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2272 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2273 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2275 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2276 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2277 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2278 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2279 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2283 static struct hda_input_mux alc880_f1734_capture_source = {
2295 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2296 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2297 * Mic = 0x18, Line = 0x1a
2300 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2301 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2303 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2304 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2305 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2306 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2307 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2308 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2309 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2310 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2311 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2317 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2319 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2320 .name = "Channel Mode",
2321 .info = alc_ch_mode_info,
2322 .get = alc_ch_mode_get,
2323 .put = alc_ch_mode_put,
2329 * ALC880 ASUS W1V model
2331 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2332 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2333 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2336 /* additional mixers to alc880_asus_mixer */
2337 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2338 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2339 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2344 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2346 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2349 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2353 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2358 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2360 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2361 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2362 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2363 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2365 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2366 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2367 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2368 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2369 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2370 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2371 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2372 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2374 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2377 .name = "Channel Mode",
2378 .info = alc_ch_mode_info,
2379 .get = alc_ch_mode_get,
2380 .put = alc_ch_mode_put,
2385 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2386 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2387 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2388 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2389 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2390 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2391 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2393 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2394 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2395 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2399 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2400 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2401 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2402 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2403 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2404 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2405 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2410 * virtual master controls
2414 * slave controls for virtual master
2416 static const char *alc_slave_vols[] = {
2417 "Front Playback Volume",
2418 "Surround Playback Volume",
2419 "Center Playback Volume",
2420 "LFE Playback Volume",
2421 "Side Playback Volume",
2422 "Headphone Playback Volume",
2423 "Speaker Playback Volume",
2424 "Mono Playback Volume",
2425 "Line-Out Playback Volume",
2426 "PCM Playback Volume",
2430 static const char *alc_slave_sws[] = {
2431 "Front Playback Switch",
2432 "Surround Playback Switch",
2433 "Center Playback Switch",
2434 "LFE Playback Switch",
2435 "Side Playback Switch",
2436 "Headphone Playback Switch",
2437 "Speaker Playback Switch",
2438 "Mono Playback Switch",
2439 "IEC958 Playback Switch",
2440 "Line-Out Playback Switch",
2441 "PCM Playback Switch",
2446 * build control elements
2449 #define NID_MAPPING (-1)
2451 #define SUBDEV_SPEAKER_ (0 << 6)
2452 #define SUBDEV_HP_ (1 << 6)
2453 #define SUBDEV_LINE_ (2 << 6)
2454 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2455 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2456 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2458 static void alc_free_kctls(struct hda_codec *codec);
2460 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2461 /* additional beep mixers; the actual parameters are overwritten at build */
2462 static struct snd_kcontrol_new alc_beep_mixer[] = {
2463 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2464 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2469 static int alc_build_controls(struct hda_codec *codec)
2471 struct alc_spec *spec = codec->spec;
2472 struct snd_kcontrol *kctl;
2473 struct snd_kcontrol_new *knew;
2478 for (i = 0; i < spec->num_mixers; i++) {
2479 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2483 if (spec->cap_mixer) {
2484 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2488 if (spec->multiout.dig_out_nid) {
2489 err = snd_hda_create_spdif_out_ctls(codec,
2490 spec->multiout.dig_out_nid);
2493 if (!spec->no_analog) {
2494 err = snd_hda_create_spdif_share_sw(codec,
2498 spec->multiout.share_spdif = 1;
2501 if (spec->dig_in_nid) {
2502 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2507 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2508 /* create beep controls if needed */
2509 if (spec->beep_amp) {
2510 struct snd_kcontrol_new *knew;
2511 for (knew = alc_beep_mixer; knew->name; knew++) {
2512 struct snd_kcontrol *kctl;
2513 kctl = snd_ctl_new1(knew, codec);
2516 kctl->private_value = spec->beep_amp;
2517 err = snd_hda_ctl_add(codec, 0, kctl);
2524 /* if we have no master control, let's create it */
2525 if (!spec->no_analog &&
2526 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2527 unsigned int vmaster_tlv[4];
2528 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2529 HDA_OUTPUT, vmaster_tlv);
2530 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2531 vmaster_tlv, alc_slave_vols);
2535 if (!spec->no_analog &&
2536 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2537 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2538 NULL, alc_slave_sws);
2543 alc_free_kctls(codec); /* no longer needed */
2545 /* assign Capture Source enums to NID */
2546 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2548 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2549 for (i = 0; kctl && i < kctl->count; i++) {
2550 hda_nid_t *nids = spec->capsrc_nids;
2552 nids = spec->adc_nids;
2553 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2557 if (spec->cap_mixer) {
2558 const char *kname = kctl ? kctl->id.name : NULL;
2559 for (knew = spec->cap_mixer; knew->name; knew++) {
2560 if (kname && strcmp(knew->name, kname) == 0)
2562 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2563 for (i = 0; kctl && i < kctl->count; i++) {
2564 err = snd_hda_add_nid(codec, kctl, i,
2572 /* other nid->control mapping */
2573 for (i = 0; i < spec->num_mixers; i++) {
2574 for (knew = spec->mixers[i]; knew->name; knew++) {
2575 if (knew->iface != NID_MAPPING)
2577 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2580 u = knew->subdevice;
2581 for (j = 0; j < 4; j++, u >>= 8) {
2586 case SUBDEV_SPEAKER_:
2587 nid = spec->autocfg.speaker_pins[nid];
2590 nid = spec->autocfg.line_out_pins[nid];
2593 nid = spec->autocfg.hp_pins[nid];
2598 err = snd_hda_add_nid(codec, kctl, 0, nid);
2602 u = knew->private_value;
2603 for (j = 0; j < 4; j++, u >>= 8) {
2607 err = snd_hda_add_nid(codec, kctl, 0, nid);
2618 * initialize the codec volumes, etc
2622 * generic initialization of ADC, input mixers and output mixers
2624 static struct hda_verb alc880_volume_init_verbs[] = {
2626 * Unmute ADC0-2 and set the default input to mic-in
2628 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2629 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2630 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2631 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2632 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2633 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2635 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2637 * Note: PASD motherboards uses the Line In 2 as the input for front
2640 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2650 * Set up output mixers (0x0c - 0x0f)
2652 /* set vol=0 to output mixers */
2653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2654 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2657 /* set up input amps for analog loopback */
2658 /* Amp Indices: DAC = 0, mixer = 1 */
2659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2672 * 3-stack pin configuration:
2673 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2675 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2677 * preset connection lists of input pins
2678 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2680 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2681 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2682 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2685 * Set pin mode and muting
2687 /* set front pin widgets 0x14 for output */
2688 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2690 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2691 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2692 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2693 /* Mic2 (as headphone out) for HP output */
2694 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2695 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2696 /* Line In pin widget for input */
2697 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2698 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2699 /* Line2 (as front mic) pin widget for input and vref at 80% */
2700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2701 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2702 /* CD pin widget for input */
2703 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2709 * 5-stack pin configuration:
2710 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2711 * line-in/side = 0x1a, f-mic = 0x1b
2713 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2715 * preset connection lists of input pins
2716 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2718 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2719 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2722 * Set pin mode and muting
2724 /* set pin widgets 0x14-0x17 for output */
2725 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 /* unmute pins for output (no gain on this amp) */
2730 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2736 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2738 /* Mic2 (as headphone out) for HP output */
2739 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2740 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2741 /* Line In pin widget for input */
2742 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2743 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2744 /* Line2 (as front mic) pin widget for input and vref at 80% */
2745 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2746 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2747 /* CD pin widget for input */
2748 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2754 * W810 pin configuration:
2755 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2757 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2758 /* hphone/speaker input selector: front DAC */
2759 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2762 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2763 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2764 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2766 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2768 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2769 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2775 * Z71V pin configuration:
2776 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2778 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2780 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2782 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2784 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2785 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2786 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2787 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2793 * 6-stack pin configuration:
2794 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2795 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2797 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2798 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2800 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2801 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2802 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2803 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2806 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2809 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2810 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2811 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2812 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2813 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2814 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2815 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2816 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2817 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2823 * Uniwill pin configuration:
2824 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2827 static struct hda_verb alc880_uniwill_init_verbs[] = {
2828 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2830 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2831 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2833 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2835 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2836 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2837 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2845 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2846 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2847 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2848 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2849 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2850 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2852 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2853 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2855 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2856 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2863 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2865 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2866 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2869 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2870 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2871 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2872 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2873 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2881 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2882 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2883 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2884 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2885 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2886 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2888 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2889 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2894 static struct hda_verb alc880_beep_init_verbs[] = {
2895 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2899 /* auto-toggle front mic */
2900 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2902 unsigned int present;
2905 present = snd_hda_jack_detect(codec, 0x18);
2906 bits = present ? HDA_AMP_MUTE : 0;
2907 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2910 static void alc880_uniwill_setup(struct hda_codec *codec)
2912 struct alc_spec *spec = codec->spec;
2914 spec->autocfg.hp_pins[0] = 0x14;
2915 spec->autocfg.speaker_pins[0] = 0x15;
2916 spec->autocfg.speaker_pins[0] = 0x16;
2919 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2921 alc_automute_amp(codec);
2922 alc880_uniwill_mic_automute(codec);
2925 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2928 /* Looks like the unsol event is incompatible with the standard
2929 * definition. 4bit tag is placed at 28 bit!
2931 switch (res >> 28) {
2932 case ALC880_MIC_EVENT:
2933 alc880_uniwill_mic_automute(codec);
2936 alc_automute_amp_unsol_event(codec, res);
2941 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2943 struct alc_spec *spec = codec->spec;
2945 spec->autocfg.hp_pins[0] = 0x14;
2946 spec->autocfg.speaker_pins[0] = 0x15;
2949 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2951 unsigned int present;
2953 present = snd_hda_codec_read(codec, 0x21, 0,
2954 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2955 present &= HDA_AMP_VOLMASK;
2956 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2957 HDA_AMP_VOLMASK, present);
2958 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2959 HDA_AMP_VOLMASK, present);
2962 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2965 /* Looks like the unsol event is incompatible with the standard
2966 * definition. 4bit tag is placed at 28 bit!
2968 if ((res >> 28) == ALC880_DCVOL_EVENT)
2969 alc880_uniwill_p53_dcvol_automute(codec);
2971 alc_automute_amp_unsol_event(codec, res);
2975 * F1734 pin configuration:
2976 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2978 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2979 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2980 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2981 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2982 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2983 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2985 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2986 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2987 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2991 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2992 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2993 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2994 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2995 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2996 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2997 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2998 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3000 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3001 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3007 * ASUS pin configuration:
3008 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3010 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3011 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3012 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3013 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3014 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3016 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3018 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3025 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3026 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3027 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3028 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3029 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3033 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3038 /* Enable GPIO mask and set output */
3039 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3040 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3041 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3043 /* Clevo m520g init */
3044 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3045 /* headphone output */
3046 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3049 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3051 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3052 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3055 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 /* Mic1 (rear panel) */
3057 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3058 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 /* Mic2 (front panel) */
3060 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3061 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 /* change to EAPD mode */
3066 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3067 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3072 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3073 /* change to EAPD mode */
3074 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3075 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3077 /* Headphone output */
3078 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3080 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3081 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3083 /* Line In pin widget for input */
3084 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3085 /* CD pin widget for input */
3086 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3087 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3088 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3090 /* change to EAPD mode */
3091 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3092 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3098 * LG m1 express dual
3101 * Rear Line-In/Out (blue): 0x14
3102 * Build-in Mic-In: 0x15
3104 * HP-Out (green): 0x1b
3105 * Mic-In/Out (red): 0x19
3109 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3110 static hda_nid_t alc880_lg_dac_nids[3] = {
3114 /* seems analog CD is not working */
3115 static struct hda_input_mux alc880_lg_capture_source = {
3120 { "Internal Mic", 0x6 },
3124 /* 2,4,6 channel modes */
3125 static struct hda_verb alc880_lg_ch2_init[] = {
3126 /* set line-in and mic-in to input */
3127 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3128 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3132 static struct hda_verb alc880_lg_ch4_init[] = {
3133 /* set line-in to out and mic-in to input */
3134 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3135 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3139 static struct hda_verb alc880_lg_ch6_init[] = {
3140 /* set line-in and mic-in to output */
3141 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3142 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3146 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3147 { 2, alc880_lg_ch2_init },
3148 { 4, alc880_lg_ch4_init },
3149 { 6, alc880_lg_ch6_init },
3152 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3153 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3154 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3155 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3156 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3157 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3158 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3159 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3160 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3161 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3162 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3163 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3164 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3166 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3168 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3169 .name = "Channel Mode",
3170 .info = alc_ch_mode_info,
3171 .get = alc_ch_mode_get,
3172 .put = alc_ch_mode_put,
3177 static struct hda_verb alc880_lg_init_verbs[] = {
3178 /* set capture source to mic-in */
3179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3180 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3181 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3182 /* mute all amp mixer inputs */
3183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3186 /* line-in to input */
3187 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3190 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3191 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3193 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3194 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3195 /* mic-in to input */
3196 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3197 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3198 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3200 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3201 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3202 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3204 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3208 /* toggle speaker-output according to the hp-jack state */
3209 static void alc880_lg_setup(struct hda_codec *codec)
3211 struct alc_spec *spec = codec->spec;
3213 spec->autocfg.hp_pins[0] = 0x1b;
3214 spec->autocfg.speaker_pins[0] = 0x17;
3223 * Built-in Mic-In: 0x19
3229 static struct hda_input_mux alc880_lg_lw_capture_source = {
3233 { "Internal Mic", 0x1 },
3238 #define alc880_lg_lw_modes alc880_threestack_modes
3240 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3241 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3242 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3243 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3244 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3245 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3246 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3247 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3248 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3253 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3254 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3256 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3257 .name = "Channel Mode",
3258 .info = alc_ch_mode_info,
3259 .get = alc_ch_mode_get,
3260 .put = alc_ch_mode_put,
3265 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3266 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3267 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3268 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3270 /* set capture source to mic-in */
3271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3272 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3274 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3279 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3280 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3281 /* mic-in to input */
3282 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3283 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3285 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3286 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3288 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3292 /* toggle speaker-output according to the hp-jack state */
3293 static void alc880_lg_lw_setup(struct hda_codec *codec)
3295 struct alc_spec *spec = codec->spec;
3297 spec->autocfg.hp_pins[0] = 0x1b;
3298 spec->autocfg.speaker_pins[0] = 0x14;
3301 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3302 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3303 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3304 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3306 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3307 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3311 static struct hda_input_mux alc880_medion_rim_capture_source = {
3315 { "Internal Mic", 0x1 },
3319 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3320 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3322 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3323 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3325 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3326 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3327 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3328 /* Mic2 (as headphone out) for HP output */
3329 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3330 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3331 /* Internal Speaker */
3332 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3333 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3335 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3336 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3338 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3342 /* toggle speaker-output according to the hp-jack state */
3343 static void alc880_medion_rim_automute(struct hda_codec *codec)
3345 struct alc_spec *spec = codec->spec;
3346 alc_automute_amp(codec);
3348 if (spec->jack_present)
3349 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3351 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3354 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3357 /* Looks like the unsol event is incompatible with the standard
3358 * definition. 4bit tag is placed at 28 bit!
3360 if ((res >> 28) == ALC880_HP_EVENT)
3361 alc880_medion_rim_automute(codec);
3364 static void alc880_medion_rim_setup(struct hda_codec *codec)
3366 struct alc_spec *spec = codec->spec;
3368 spec->autocfg.hp_pins[0] = 0x14;
3369 spec->autocfg.speaker_pins[0] = 0x1b;
3372 #ifdef CONFIG_SND_HDA_POWER_SAVE
3373 static struct hda_amp_list alc880_loopbacks[] = {
3374 { 0x0b, HDA_INPUT, 0 },
3375 { 0x0b, HDA_INPUT, 1 },
3376 { 0x0b, HDA_INPUT, 2 },
3377 { 0x0b, HDA_INPUT, 3 },
3378 { 0x0b, HDA_INPUT, 4 },
3382 static struct hda_amp_list alc880_lg_loopbacks[] = {
3383 { 0x0b, HDA_INPUT, 1 },
3384 { 0x0b, HDA_INPUT, 6 },
3385 { 0x0b, HDA_INPUT, 7 },
3394 static int alc_init(struct hda_codec *codec)
3396 struct alc_spec *spec = codec->spec;
3400 alc_auto_init_amp(codec, spec->init_amp);
3402 for (i = 0; i < spec->num_init_verbs; i++)
3403 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3405 if (spec->init_hook)
3406 spec->init_hook(codec);
3411 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3413 struct alc_spec *spec = codec->spec;
3415 if (spec->unsol_event)
3416 spec->unsol_event(codec, res);
3419 #ifdef CONFIG_SND_HDA_POWER_SAVE
3420 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3422 struct alc_spec *spec = codec->spec;
3423 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3428 * Analog playback callbacks
3430 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3431 struct hda_codec *codec,
3432 struct snd_pcm_substream *substream)
3434 struct alc_spec *spec = codec->spec;
3435 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3439 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3440 struct hda_codec *codec,
3441 unsigned int stream_tag,
3442 unsigned int format,
3443 struct snd_pcm_substream *substream)
3445 struct alc_spec *spec = codec->spec;
3446 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3447 stream_tag, format, substream);
3450 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3451 struct hda_codec *codec,
3452 struct snd_pcm_substream *substream)
3454 struct alc_spec *spec = codec->spec;
3455 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3461 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3462 struct hda_codec *codec,
3463 struct snd_pcm_substream *substream)
3465 struct alc_spec *spec = codec->spec;
3466 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3469 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3470 struct hda_codec *codec,
3471 unsigned int stream_tag,
3472 unsigned int format,
3473 struct snd_pcm_substream *substream)
3475 struct alc_spec *spec = codec->spec;
3476 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3477 stream_tag, format, substream);
3480 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3481 struct hda_codec *codec,
3482 struct snd_pcm_substream *substream)
3484 struct alc_spec *spec = codec->spec;
3485 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3488 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3489 struct hda_codec *codec,
3490 struct snd_pcm_substream *substream)
3492 struct alc_spec *spec = codec->spec;
3493 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3499 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3500 struct hda_codec *codec,
3501 unsigned int stream_tag,
3502 unsigned int format,
3503 struct snd_pcm_substream *substream)
3505 struct alc_spec *spec = codec->spec;
3507 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3508 stream_tag, 0, format);
3512 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3513 struct hda_codec *codec,
3514 struct snd_pcm_substream *substream)
3516 struct alc_spec *spec = codec->spec;
3518 snd_hda_codec_cleanup_stream(codec,
3519 spec->adc_nids[substream->number + 1]);
3526 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3530 /* NID is set in alc_build_pcms */
3532 .open = alc880_playback_pcm_open,
3533 .prepare = alc880_playback_pcm_prepare,
3534 .cleanup = alc880_playback_pcm_cleanup
3538 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3542 /* NID is set in alc_build_pcms */
3545 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3549 /* NID is set in alc_build_pcms */
3552 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3553 .substreams = 2, /* can be overridden */
3556 /* NID is set in alc_build_pcms */
3558 .prepare = alc880_alt_capture_pcm_prepare,
3559 .cleanup = alc880_alt_capture_pcm_cleanup
3563 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3567 /* NID is set in alc_build_pcms */
3569 .open = alc880_dig_playback_pcm_open,
3570 .close = alc880_dig_playback_pcm_close,
3571 .prepare = alc880_dig_playback_pcm_prepare,
3572 .cleanup = alc880_dig_playback_pcm_cleanup
3576 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3580 /* NID is set in alc_build_pcms */
3583 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3584 static struct hda_pcm_stream alc_pcm_null_stream = {
3590 static int alc_build_pcms(struct hda_codec *codec)
3592 struct alc_spec *spec = codec->spec;
3593 struct hda_pcm *info = spec->pcm_rec;
3596 codec->num_pcms = 1;
3597 codec->pcm_info = info;
3599 if (spec->no_analog)
3602 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3603 "%s Analog", codec->chip_name);
3604 info->name = spec->stream_name_analog;
3606 if (spec->stream_analog_playback) {
3607 if (snd_BUG_ON(!spec->multiout.dac_nids))
3609 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3610 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3612 if (spec->stream_analog_capture) {
3613 if (snd_BUG_ON(!spec->adc_nids))
3615 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3616 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3619 if (spec->channel_mode) {
3620 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3621 for (i = 0; i < spec->num_channel_mode; i++) {
3622 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3623 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3629 /* SPDIF for stream index #1 */
3630 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3631 snprintf(spec->stream_name_digital,
3632 sizeof(spec->stream_name_digital),
3633 "%s Digital", codec->chip_name);
3634 codec->num_pcms = 2;
3635 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3636 info = spec->pcm_rec + 1;
3637 info->name = spec->stream_name_digital;
3638 if (spec->dig_out_type)
3639 info->pcm_type = spec->dig_out_type;
3641 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3642 if (spec->multiout.dig_out_nid &&
3643 spec->stream_digital_playback) {
3644 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3645 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3647 if (spec->dig_in_nid &&
3648 spec->stream_digital_capture) {
3649 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3650 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3652 /* FIXME: do we need this for all Realtek codec models? */
3653 codec->spdif_status_reset = 1;
3656 if (spec->no_analog)
3659 /* If the use of more than one ADC is requested for the current
3660 * model, configure a second analog capture-only PCM.
3662 /* Additional Analaog capture for index #2 */
3663 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3664 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3665 codec->num_pcms = 3;
3666 info = spec->pcm_rec + 2;
3667 info->name = spec->stream_name_analog;
3668 if (spec->alt_dac_nid) {
3669 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3670 *spec->stream_analog_alt_playback;
3671 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3674 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3675 alc_pcm_null_stream;
3676 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3678 if (spec->num_adc_nids > 1) {
3679 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3680 *spec->stream_analog_alt_capture;
3681 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3683 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3684 spec->num_adc_nids - 1;
3686 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3687 alc_pcm_null_stream;
3688 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3695 static inline void alc_shutup(struct hda_codec *codec)
3697 snd_hda_shutup_pins(codec);
3700 static void alc_free_kctls(struct hda_codec *codec)
3702 struct alc_spec *spec = codec->spec;
3704 if (spec->kctls.list) {
3705 struct snd_kcontrol_new *kctl = spec->kctls.list;
3707 for (i = 0; i < spec->kctls.used; i++)
3708 kfree(kctl[i].name);
3710 snd_array_free(&spec->kctls);
3713 static void alc_free(struct hda_codec *codec)
3715 struct alc_spec *spec = codec->spec;
3721 alc_free_kctls(codec);
3723 snd_hda_detach_beep_device(codec);
3726 #ifdef CONFIG_SND_HDA_POWER_SAVE
3727 static void alc_power_eapd(struct hda_codec *codec)
3729 /* We currently only handle front, HP */
3730 switch (codec->vendor_id) {
3732 set_eapd(codec, 0x0f, 0);
3733 set_eapd(codec, 0x10, 0);
3746 set_eapd(codec, 0x14, 0);
3747 set_eapd(codec, 0x15, 0);
3752 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3754 struct alc_spec *spec = codec->spec;
3756 if (spec && spec->power_hook)
3757 spec->power_hook(codec);
3762 #ifdef SND_HDA_NEEDS_RESUME
3763 static int alc_resume(struct hda_codec *codec)
3765 codec->patch_ops.init(codec);
3766 snd_hda_codec_resume_amp(codec);
3767 snd_hda_codec_resume_cache(codec);
3774 static struct hda_codec_ops alc_patch_ops = {
3775 .build_controls = alc_build_controls,
3776 .build_pcms = alc_build_pcms,
3779 .unsol_event = alc_unsol_event,
3780 #ifdef SND_HDA_NEEDS_RESUME
3781 .resume = alc_resume,
3783 #ifdef CONFIG_SND_HDA_POWER_SAVE
3784 .suspend = alc_suspend,
3785 .check_power_status = alc_check_power_status,
3787 .reboot_notify = alc_shutup,
3792 * Test configuration for debugging
3794 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3797 #ifdef CONFIG_SND_DEBUG
3798 static hda_nid_t alc880_test_dac_nids[4] = {
3799 0x02, 0x03, 0x04, 0x05
3802 static struct hda_input_mux alc880_test_capture_source = {
3811 { "Surround", 0x6 },
3815 static struct hda_channel_mode alc880_test_modes[4] = {
3822 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3823 struct snd_ctl_elem_info *uinfo)
3825 static char *texts[] = {
3826 "N/A", "Line Out", "HP Out",
3827 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3829 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3831 uinfo->value.enumerated.items = 8;
3832 if (uinfo->value.enumerated.item >= 8)
3833 uinfo->value.enumerated.item = 7;
3834 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3838 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3839 struct snd_ctl_elem_value *ucontrol)
3841 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3842 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3843 unsigned int pin_ctl, item = 0;
3845 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3846 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3847 if (pin_ctl & AC_PINCTL_OUT_EN) {
3848 if (pin_ctl & AC_PINCTL_HP_EN)
3852 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3853 switch (pin_ctl & AC_PINCTL_VREFEN) {
3854 case AC_PINCTL_VREF_HIZ: item = 3; break;
3855 case AC_PINCTL_VREF_50: item = 4; break;
3856 case AC_PINCTL_VREF_GRD: item = 5; break;
3857 case AC_PINCTL_VREF_80: item = 6; break;
3858 case AC_PINCTL_VREF_100: item = 7; break;
3861 ucontrol->value.enumerated.item[0] = item;
3865 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3866 struct snd_ctl_elem_value *ucontrol)
3868 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3869 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3870 static unsigned int ctls[] = {
3871 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3872 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3873 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3874 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3875 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3876 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3878 unsigned int old_ctl, new_ctl;
3880 old_ctl = snd_hda_codec_read(codec, nid, 0,
3881 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3882 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3883 if (old_ctl != new_ctl) {
3885 snd_hda_codec_write_cache(codec, nid, 0,
3886 AC_VERB_SET_PIN_WIDGET_CONTROL,
3888 val = ucontrol->value.enumerated.item[0] >= 3 ?
3890 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3897 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3898 struct snd_ctl_elem_info *uinfo)
3900 static char *texts[] = {
3901 "Front", "Surround", "CLFE", "Side"
3903 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3905 uinfo->value.enumerated.items = 4;
3906 if (uinfo->value.enumerated.item >= 4)
3907 uinfo->value.enumerated.item = 3;
3908 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3912 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3913 struct snd_ctl_elem_value *ucontrol)
3915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3916 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3919 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3920 ucontrol->value.enumerated.item[0] = sel & 3;
3924 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3925 struct snd_ctl_elem_value *ucontrol)
3927 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3928 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3931 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3932 if (ucontrol->value.enumerated.item[0] != sel) {
3933 sel = ucontrol->value.enumerated.item[0] & 3;
3934 snd_hda_codec_write_cache(codec, nid, 0,
3935 AC_VERB_SET_CONNECT_SEL, sel);
3941 #define PIN_CTL_TEST(xname,nid) { \
3942 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3944 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3945 .info = alc_test_pin_ctl_info, \
3946 .get = alc_test_pin_ctl_get, \
3947 .put = alc_test_pin_ctl_put, \
3948 .private_value = nid \
3951 #define PIN_SRC_TEST(xname,nid) { \
3952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3954 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3955 .info = alc_test_pin_src_info, \
3956 .get = alc_test_pin_src_get, \
3957 .put = alc_test_pin_src_put, \
3958 .private_value = nid \
3961 static struct snd_kcontrol_new alc880_test_mixer[] = {
3962 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3963 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3964 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3965 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3966 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3967 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3968 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3969 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3970 PIN_CTL_TEST("Front Pin Mode", 0x14),
3971 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3972 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3973 PIN_CTL_TEST("Side Pin Mode", 0x17),
3974 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3975 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3976 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3977 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3978 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3979 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3980 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3981 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3982 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3983 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3984 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3985 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3986 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3987 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3988 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3989 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3990 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3991 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3993 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3994 .name = "Channel Mode",
3995 .info = alc_ch_mode_info,
3996 .get = alc_ch_mode_get,
3997 .put = alc_ch_mode_put,
4002 static struct hda_verb alc880_test_init_verbs[] = {
4003 /* Unmute inputs of 0x0c - 0x0f */
4004 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4005 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4006 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4007 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4008 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4010 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4011 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4012 /* Vol output for 0x0c-0x0f */
4013 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4014 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4015 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4016 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4017 /* Set output pins 0x14-0x17 */
4018 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4020 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4021 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4022 /* Unmute output pins 0x14-0x17 */
4023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4024 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4025 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4026 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4027 /* Set input pins 0x18-0x1c */
4028 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4030 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4031 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4032 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4033 /* Mute input pins 0x18-0x1b */
4034 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4035 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4036 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4037 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4039 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4040 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4041 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4042 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4043 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4044 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4045 /* Analog input/passthru */
4046 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4047 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4048 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4049 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4050 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4058 static const char *alc880_models[ALC880_MODEL_LAST] = {
4059 [ALC880_3ST] = "3stack",
4060 [ALC880_TCL_S700] = "tcl",
4061 [ALC880_3ST_DIG] = "3stack-digout",
4062 [ALC880_CLEVO] = "clevo",
4063 [ALC880_5ST] = "5stack",
4064 [ALC880_5ST_DIG] = "5stack-digout",
4065 [ALC880_W810] = "w810",
4066 [ALC880_Z71V] = "z71v",
4067 [ALC880_6ST] = "6stack",
4068 [ALC880_6ST_DIG] = "6stack-digout",
4069 [ALC880_ASUS] = "asus",
4070 [ALC880_ASUS_W1V] = "asus-w1v",
4071 [ALC880_ASUS_DIG] = "asus-dig",
4072 [ALC880_ASUS_DIG2] = "asus-dig2",
4073 [ALC880_UNIWILL_DIG] = "uniwill",
4074 [ALC880_UNIWILL_P53] = "uniwill-p53",
4075 [ALC880_FUJITSU] = "fujitsu",
4076 [ALC880_F1734] = "F1734",
4078 [ALC880_LG_LW] = "lg-lw",
4079 [ALC880_MEDION_RIM] = "medion",
4080 #ifdef CONFIG_SND_DEBUG
4081 [ALC880_TEST] = "test",
4083 [ALC880_AUTO] = "auto",
4086 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4087 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4088 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4089 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4090 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4091 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4092 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4093 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4094 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4095 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4096 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4097 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4098 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4099 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4100 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4101 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4102 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4103 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4104 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4105 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4106 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4107 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4108 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4109 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4110 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4111 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4112 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4113 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4114 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4115 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4116 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4117 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4118 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4119 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4120 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4121 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4122 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4123 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4124 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4125 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4126 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4127 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4128 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4129 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4130 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4131 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4132 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4133 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4135 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4136 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4137 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4138 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4139 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4140 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4141 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4142 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4143 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4144 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4145 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4146 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4147 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4148 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4149 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4150 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4151 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4152 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4153 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4154 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4156 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4157 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4158 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4163 * ALC880 codec presets
4165 static struct alc_config_preset alc880_presets[] = {
4167 .mixers = { alc880_three_stack_mixer },
4168 .init_verbs = { alc880_volume_init_verbs,
4169 alc880_pin_3stack_init_verbs },
4170 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4171 .dac_nids = alc880_dac_nids,
4172 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4173 .channel_mode = alc880_threestack_modes,
4175 .input_mux = &alc880_capture_source,
4177 [ALC880_3ST_DIG] = {
4178 .mixers = { alc880_three_stack_mixer },
4179 .init_verbs = { alc880_volume_init_verbs,
4180 alc880_pin_3stack_init_verbs },
4181 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4182 .dac_nids = alc880_dac_nids,
4183 .dig_out_nid = ALC880_DIGOUT_NID,
4184 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4185 .channel_mode = alc880_threestack_modes,
4187 .input_mux = &alc880_capture_source,
4189 [ALC880_TCL_S700] = {
4190 .mixers = { alc880_tcl_s700_mixer },
4191 .init_verbs = { alc880_volume_init_verbs,
4192 alc880_pin_tcl_S700_init_verbs,
4193 alc880_gpio2_init_verbs },
4194 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4195 .dac_nids = alc880_dac_nids,
4196 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4197 .num_adc_nids = 1, /* single ADC */
4199 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4200 .channel_mode = alc880_2_jack_modes,
4201 .input_mux = &alc880_capture_source,
4204 .mixers = { alc880_three_stack_mixer,
4205 alc880_five_stack_mixer},
4206 .init_verbs = { alc880_volume_init_verbs,
4207 alc880_pin_5stack_init_verbs },
4208 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4209 .dac_nids = alc880_dac_nids,
4210 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4211 .channel_mode = alc880_fivestack_modes,
4212 .input_mux = &alc880_capture_source,
4214 [ALC880_5ST_DIG] = {
4215 .mixers = { alc880_three_stack_mixer,
4216 alc880_five_stack_mixer },
4217 .init_verbs = { alc880_volume_init_verbs,
4218 alc880_pin_5stack_init_verbs },
4219 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4220 .dac_nids = alc880_dac_nids,
4221 .dig_out_nid = ALC880_DIGOUT_NID,
4222 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4223 .channel_mode = alc880_fivestack_modes,
4224 .input_mux = &alc880_capture_source,
4227 .mixers = { alc880_six_stack_mixer },
4228 .init_verbs = { alc880_volume_init_verbs,
4229 alc880_pin_6stack_init_verbs },
4230 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4231 .dac_nids = alc880_6st_dac_nids,
4232 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4233 .channel_mode = alc880_sixstack_modes,
4234 .input_mux = &alc880_6stack_capture_source,
4236 [ALC880_6ST_DIG] = {
4237 .mixers = { alc880_six_stack_mixer },
4238 .init_verbs = { alc880_volume_init_verbs,
4239 alc880_pin_6stack_init_verbs },
4240 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4241 .dac_nids = alc880_6st_dac_nids,
4242 .dig_out_nid = ALC880_DIGOUT_NID,
4243 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4244 .channel_mode = alc880_sixstack_modes,
4245 .input_mux = &alc880_6stack_capture_source,
4248 .mixers = { alc880_w810_base_mixer },
4249 .init_verbs = { alc880_volume_init_verbs,
4250 alc880_pin_w810_init_verbs,
4251 alc880_gpio2_init_verbs },
4252 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4253 .dac_nids = alc880_w810_dac_nids,
4254 .dig_out_nid = ALC880_DIGOUT_NID,
4255 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4256 .channel_mode = alc880_w810_modes,
4257 .input_mux = &alc880_capture_source,
4260 .mixers = { alc880_z71v_mixer },
4261 .init_verbs = { alc880_volume_init_verbs,
4262 alc880_pin_z71v_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4264 .dac_nids = alc880_z71v_dac_nids,
4265 .dig_out_nid = ALC880_DIGOUT_NID,
4267 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4268 .channel_mode = alc880_2_jack_modes,
4269 .input_mux = &alc880_capture_source,
4272 .mixers = { alc880_f1734_mixer },
4273 .init_verbs = { alc880_volume_init_verbs,
4274 alc880_pin_f1734_init_verbs },
4275 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4276 .dac_nids = alc880_f1734_dac_nids,
4278 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4279 .channel_mode = alc880_2_jack_modes,
4280 .input_mux = &alc880_f1734_capture_source,
4281 .unsol_event = alc880_uniwill_p53_unsol_event,
4282 .setup = alc880_uniwill_p53_setup,
4283 .init_hook = alc_automute_amp,
4286 .mixers = { alc880_asus_mixer },
4287 .init_verbs = { alc880_volume_init_verbs,
4288 alc880_pin_asus_init_verbs,
4289 alc880_gpio1_init_verbs },
4290 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4291 .dac_nids = alc880_asus_dac_nids,
4292 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4293 .channel_mode = alc880_asus_modes,
4295 .input_mux = &alc880_capture_source,
4297 [ALC880_ASUS_DIG] = {
4298 .mixers = { alc880_asus_mixer },
4299 .init_verbs = { alc880_volume_init_verbs,
4300 alc880_pin_asus_init_verbs,
4301 alc880_gpio1_init_verbs },
4302 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4303 .dac_nids = alc880_asus_dac_nids,
4304 .dig_out_nid = ALC880_DIGOUT_NID,
4305 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4306 .channel_mode = alc880_asus_modes,
4308 .input_mux = &alc880_capture_source,
4310 [ALC880_ASUS_DIG2] = {
4311 .mixers = { alc880_asus_mixer },
4312 .init_verbs = { alc880_volume_init_verbs,
4313 alc880_pin_asus_init_verbs,
4314 alc880_gpio2_init_verbs }, /* use GPIO2 */
4315 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4316 .dac_nids = alc880_asus_dac_nids,
4317 .dig_out_nid = ALC880_DIGOUT_NID,
4318 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4319 .channel_mode = alc880_asus_modes,
4321 .input_mux = &alc880_capture_source,
4323 [ALC880_ASUS_W1V] = {
4324 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4325 .init_verbs = { alc880_volume_init_verbs,
4326 alc880_pin_asus_init_verbs,
4327 alc880_gpio1_init_verbs },
4328 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4329 .dac_nids = alc880_asus_dac_nids,
4330 .dig_out_nid = ALC880_DIGOUT_NID,
4331 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4332 .channel_mode = alc880_asus_modes,
4334 .input_mux = &alc880_capture_source,
4336 [ALC880_UNIWILL_DIG] = {
4337 .mixers = { alc880_asus_mixer },
4338 .init_verbs = { alc880_volume_init_verbs,
4339 alc880_pin_asus_init_verbs },
4340 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4341 .dac_nids = alc880_asus_dac_nids,
4342 .dig_out_nid = ALC880_DIGOUT_NID,
4343 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4344 .channel_mode = alc880_asus_modes,
4346 .input_mux = &alc880_capture_source,
4348 [ALC880_UNIWILL] = {
4349 .mixers = { alc880_uniwill_mixer },
4350 .init_verbs = { alc880_volume_init_verbs,
4351 alc880_uniwill_init_verbs },
4352 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4353 .dac_nids = alc880_asus_dac_nids,
4354 .dig_out_nid = ALC880_DIGOUT_NID,
4355 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4356 .channel_mode = alc880_threestack_modes,
4358 .input_mux = &alc880_capture_source,
4359 .unsol_event = alc880_uniwill_unsol_event,
4360 .setup = alc880_uniwill_setup,
4361 .init_hook = alc880_uniwill_init_hook,
4363 [ALC880_UNIWILL_P53] = {
4364 .mixers = { alc880_uniwill_p53_mixer },
4365 .init_verbs = { alc880_volume_init_verbs,
4366 alc880_uniwill_p53_init_verbs },
4367 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4368 .dac_nids = alc880_asus_dac_nids,
4369 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4370 .channel_mode = alc880_threestack_modes,
4371 .input_mux = &alc880_capture_source,
4372 .unsol_event = alc880_uniwill_p53_unsol_event,
4373 .setup = alc880_uniwill_p53_setup,
4374 .init_hook = alc_automute_amp,
4376 [ALC880_FUJITSU] = {
4377 .mixers = { alc880_fujitsu_mixer },
4378 .init_verbs = { alc880_volume_init_verbs,
4379 alc880_uniwill_p53_init_verbs,
4380 alc880_beep_init_verbs },
4381 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4382 .dac_nids = alc880_dac_nids,
4383 .dig_out_nid = ALC880_DIGOUT_NID,
4384 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4385 .channel_mode = alc880_2_jack_modes,
4386 .input_mux = &alc880_capture_source,
4387 .unsol_event = alc880_uniwill_p53_unsol_event,
4388 .setup = alc880_uniwill_p53_setup,
4389 .init_hook = alc_automute_amp,
4392 .mixers = { alc880_three_stack_mixer },
4393 .init_verbs = { alc880_volume_init_verbs,
4394 alc880_pin_clevo_init_verbs },
4395 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4396 .dac_nids = alc880_dac_nids,
4398 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4399 .channel_mode = alc880_threestack_modes,
4401 .input_mux = &alc880_capture_source,
4404 .mixers = { alc880_lg_mixer },
4405 .init_verbs = { alc880_volume_init_verbs,
4406 alc880_lg_init_verbs },
4407 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4408 .dac_nids = alc880_lg_dac_nids,
4409 .dig_out_nid = ALC880_DIGOUT_NID,
4410 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4411 .channel_mode = alc880_lg_ch_modes,
4413 .input_mux = &alc880_lg_capture_source,
4414 .unsol_event = alc_automute_amp_unsol_event,
4415 .setup = alc880_lg_setup,
4416 .init_hook = alc_automute_amp,
4417 #ifdef CONFIG_SND_HDA_POWER_SAVE
4418 .loopbacks = alc880_lg_loopbacks,
4422 .mixers = { alc880_lg_lw_mixer },
4423 .init_verbs = { alc880_volume_init_verbs,
4424 alc880_lg_lw_init_verbs },
4425 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4426 .dac_nids = alc880_dac_nids,
4427 .dig_out_nid = ALC880_DIGOUT_NID,
4428 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4429 .channel_mode = alc880_lg_lw_modes,
4430 .input_mux = &alc880_lg_lw_capture_source,
4431 .unsol_event = alc_automute_amp_unsol_event,
4432 .setup = alc880_lg_lw_setup,
4433 .init_hook = alc_automute_amp,
4435 [ALC880_MEDION_RIM] = {
4436 .mixers = { alc880_medion_rim_mixer },
4437 .init_verbs = { alc880_volume_init_verbs,
4438 alc880_medion_rim_init_verbs,
4439 alc_gpio2_init_verbs },
4440 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4441 .dac_nids = alc880_dac_nids,
4442 .dig_out_nid = ALC880_DIGOUT_NID,
4443 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4444 .channel_mode = alc880_2_jack_modes,
4445 .input_mux = &alc880_medion_rim_capture_source,
4446 .unsol_event = alc880_medion_rim_unsol_event,
4447 .setup = alc880_medion_rim_setup,
4448 .init_hook = alc880_medion_rim_automute,
4450 #ifdef CONFIG_SND_DEBUG
4452 .mixers = { alc880_test_mixer },
4453 .init_verbs = { alc880_test_init_verbs },
4454 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4455 .dac_nids = alc880_test_dac_nids,
4456 .dig_out_nid = ALC880_DIGOUT_NID,
4457 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4458 .channel_mode = alc880_test_modes,
4459 .input_mux = &alc880_test_capture_source,
4465 * Automatic parse of I/O pins from the BIOS configuration
4470 ALC_CTL_WIDGET_MUTE,
4473 static struct snd_kcontrol_new alc880_control_templates[] = {
4474 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4475 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4476 HDA_BIND_MUTE(NULL, 0, 0, 0),
4479 /* add dynamic controls */
4480 static int add_control(struct alc_spec *spec, int type, const char *name,
4483 struct snd_kcontrol_new *knew;
4485 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4486 knew = snd_array_new(&spec->kctls);
4489 *knew = alc880_control_templates[type];
4490 knew->name = kstrdup(name, GFP_KERNEL);
4493 if (get_amp_nid_(val))
4494 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4495 knew->private_value = val;
4499 static int add_control_with_pfx(struct alc_spec *spec, int type,
4500 const char *pfx, const char *dir,
4501 const char *sfx, unsigned long val)
4504 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4505 return add_control(spec, type, name, val);
4508 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4509 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4510 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4511 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4513 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4514 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4515 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4516 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4517 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4518 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4519 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4520 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4521 #define ALC880_PIN_CD_NID 0x1c
4523 /* fill in the dac_nids table from the parsed pin configuration */
4524 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4525 const struct auto_pin_cfg *cfg)
4531 memset(assigned, 0, sizeof(assigned));
4532 spec->multiout.dac_nids = spec->private_dac_nids;
4534 /* check the pins hardwired to audio widget */
4535 for (i = 0; i < cfg->line_outs; i++) {
4536 nid = cfg->line_out_pins[i];
4537 if (alc880_is_fixed_pin(nid)) {
4538 int idx = alc880_fixed_pin_idx(nid);
4539 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4543 /* left pins can be connect to any audio widget */
4544 for (i = 0; i < cfg->line_outs; i++) {
4545 nid = cfg->line_out_pins[i];
4546 if (alc880_is_fixed_pin(nid))
4548 /* search for an empty channel */
4549 for (j = 0; j < cfg->line_outs; j++) {
4551 spec->multiout.dac_nids[i] =
4552 alc880_idx_to_dac(j);
4558 spec->multiout.num_dacs = cfg->line_outs;
4562 /* add playback controls from the parsed DAC table */
4563 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4564 const struct auto_pin_cfg *cfg)
4566 static const char *chname[4] = {
4567 "Front", "Surround", NULL /*CLFE*/, "Side"
4572 for (i = 0; i < cfg->line_outs; i++) {
4573 if (!spec->multiout.dac_nids[i])
4575 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4578 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4580 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4584 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4586 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4590 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4592 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4596 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4598 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4604 if (cfg->line_outs == 1 &&
4605 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4609 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4610 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4614 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4615 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4624 /* add playback controls for speaker and HP outputs */
4625 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4634 if (alc880_is_fixed_pin(pin)) {
4635 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4636 /* specify the DAC as the extra output */
4637 if (!spec->multiout.hp_nid)
4638 spec->multiout.hp_nid = nid;
4640 spec->multiout.extra_out_nid[0] = nid;
4641 /* control HP volume/switch on the output mixer amp */
4642 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4643 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4644 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4647 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4648 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4651 } else if (alc880_is_multi_pin(pin)) {
4652 /* set manual connection */
4653 /* we have only a switch on HP-out PIN */
4654 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4655 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4662 /* create input playback/capture controls for the given pin */
4663 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4664 const char *ctlname,
4665 int idx, hda_nid_t mix_nid)
4669 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4670 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4673 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4674 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4680 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4682 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4683 return (pincap & AC_PINCAP_IN) != 0;
4686 /* create playback/capture controls for input pins */
4687 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4688 const struct auto_pin_cfg *cfg,
4690 hda_nid_t cap1, hda_nid_t cap2)
4692 struct alc_spec *spec = codec->spec;
4693 struct hda_input_mux *imux = &spec->private_imux[0];
4696 for (i = 0; i < AUTO_PIN_LAST; i++) {
4699 pin = cfg->input_pins[i];
4700 if (!alc_is_input_pin(codec, pin))
4704 idx = get_connection_index(codec, mixer, pin);
4706 err = new_analog_input(spec, pin,
4707 auto_pin_cfg_labels[i],
4716 idx = get_connection_index(codec, cap1, pin);
4717 if (idx < 0 && cap2)
4718 idx = get_connection_index(codec, cap2, pin);
4720 imux->items[imux->num_items].label =
4721 auto_pin_cfg_labels[i];
4722 imux->items[imux->num_items].index = idx;
4729 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4730 const struct auto_pin_cfg *cfg)
4732 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4735 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4736 unsigned int pin_type)
4738 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4741 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4745 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4746 hda_nid_t nid, int pin_type,
4749 alc_set_pin_output(codec, nid, pin_type);
4750 /* need the manual connection? */
4751 if (alc880_is_multi_pin(nid)) {
4752 struct alc_spec *spec = codec->spec;
4753 int idx = alc880_multi_pin_idx(nid);
4754 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4755 AC_VERB_SET_CONNECT_SEL,
4756 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4760 static int get_pin_type(int line_out_type)
4762 if (line_out_type == AUTO_PIN_HP_OUT)
4768 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4770 struct alc_spec *spec = codec->spec;
4773 for (i = 0; i < spec->autocfg.line_outs; i++) {
4774 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4775 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4776 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4780 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4782 struct alc_spec *spec = codec->spec;
4785 pin = spec->autocfg.speaker_pins[0];
4786 if (pin) /* connect to front */
4787 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4788 pin = spec->autocfg.hp_pins[0];
4789 if (pin) /* connect to front */
4790 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4793 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4795 struct alc_spec *spec = codec->spec;
4798 for (i = 0; i < AUTO_PIN_LAST; i++) {
4799 hda_nid_t nid = spec->autocfg.input_pins[i];
4800 if (alc_is_input_pin(codec, nid)) {
4801 alc_set_input_pin(codec, nid, i);
4802 if (nid != ALC880_PIN_CD_NID &&
4803 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4804 snd_hda_codec_write(codec, nid, 0,
4805 AC_VERB_SET_AMP_GAIN_MUTE,
4811 /* parse the BIOS configuration and set up the alc_spec */
4812 /* return 1 if successful, 0 if the proper config is not found,
4813 * or a negative error code
4815 static int alc880_parse_auto_config(struct hda_codec *codec)
4817 struct alc_spec *spec = codec->spec;
4819 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4821 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4825 if (!spec->autocfg.line_outs)
4826 return 0; /* can't find valid BIOS pin config */
4828 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4831 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4834 err = alc880_auto_create_extra_out(spec,
4835 spec->autocfg.speaker_pins[0],
4839 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4843 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4847 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4849 /* check multiple SPDIF-out (for recent codecs) */
4850 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4852 err = snd_hda_get_connections(codec,
4853 spec->autocfg.dig_out_pins[i],
4858 spec->multiout.dig_out_nid = dig_nid;
4860 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4861 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4863 spec->slave_dig_outs[i - 1] = dig_nid;
4866 if (spec->autocfg.dig_in_pin)
4867 spec->dig_in_nid = ALC880_DIGIN_NID;
4869 if (spec->kctls.list)
4870 add_mixer(spec, spec->kctls.list);
4872 add_verb(spec, alc880_volume_init_verbs);
4874 spec->num_mux_defs = 1;
4875 spec->input_mux = &spec->private_imux[0];
4877 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4882 /* additional initialization for auto-configuration model */
4883 static void alc880_auto_init(struct hda_codec *codec)
4885 struct alc_spec *spec = codec->spec;
4886 alc880_auto_init_multi_out(codec);
4887 alc880_auto_init_extra_out(codec);
4888 alc880_auto_init_analog_input(codec);
4889 if (spec->unsol_event)
4890 alc_inithook(codec);
4893 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4894 * one of two digital mic pins, e.g. on ALC272
4896 static void fixup_automic_adc(struct hda_codec *codec)
4898 struct alc_spec *spec = codec->spec;
4901 for (i = 0; i < spec->num_adc_nids; i++) {
4902 hda_nid_t cap = spec->capsrc_nids ?
4903 spec->capsrc_nids[i] : spec->adc_nids[i];
4906 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4909 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4912 spec->int_mic.mux_idx = iidx;
4913 spec->ext_mic.mux_idx = eidx;
4914 if (spec->capsrc_nids)
4915 spec->capsrc_nids += i;
4916 spec->adc_nids += i;
4917 spec->num_adc_nids = 1;
4920 snd_printd(KERN_INFO "hda_codec: %s: "
4921 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4922 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4923 spec->auto_mic = 0; /* disable auto-mic to be sure */
4926 /* choose the ADC/MUX containing the input pin and initialize the setup */
4927 static void fixup_single_adc(struct hda_codec *codec)
4929 struct alc_spec *spec = codec->spec;
4933 /* search for the input pin; there must be only one */
4934 for (i = 0; i < AUTO_PIN_LAST; i++) {
4935 if (spec->autocfg.input_pins[i]) {
4936 pin = spec->autocfg.input_pins[i];
4943 /* set the default connection to that pin */
4944 for (i = 0; i < spec->num_adc_nids; i++) {
4945 hda_nid_t cap = spec->capsrc_nids ?
4946 spec->capsrc_nids[i] : spec->adc_nids[i];
4949 idx = get_connection_index(codec, cap, pin);
4952 /* use only this ADC */
4953 if (spec->capsrc_nids)
4954 spec->capsrc_nids += i;
4955 spec->adc_nids += i;
4956 spec->num_adc_nids = 1;
4957 /* select or unmute this route */
4958 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4959 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4962 snd_hda_codec_write_cache(codec, cap, 0,
4963 AC_VERB_SET_CONNECT_SEL, idx);
4969 static void set_capture_mixer(struct hda_codec *codec)
4971 struct alc_spec *spec = codec->spec;
4972 static struct snd_kcontrol_new *caps[2][3] = {
4973 { alc_capture_mixer_nosrc1,
4974 alc_capture_mixer_nosrc2,
4975 alc_capture_mixer_nosrc3 },
4976 { alc_capture_mixer1,
4978 alc_capture_mixer3 },
4980 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4983 fixup_automic_adc(codec);
4984 else if (spec->input_mux) {
4985 if (spec->input_mux->num_items > 1)
4987 else if (spec->input_mux->num_items == 1)
4988 fixup_single_adc(codec);
4990 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4994 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4995 #define set_beep_amp(spec, nid, idx, dir) \
4996 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4998 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5002 * OK, here we have finally the patch for ALC880
5005 static int patch_alc880(struct hda_codec *codec)
5007 struct alc_spec *spec;
5011 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5017 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5020 if (board_config < 0) {
5021 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5023 board_config = ALC880_AUTO;
5026 if (board_config == ALC880_AUTO) {
5027 /* automatic parse from the BIOS config */
5028 err = alc880_parse_auto_config(codec);
5034 "hda_codec: Cannot set up configuration "
5035 "from BIOS. Using 3-stack mode...\n");
5036 board_config = ALC880_3ST;
5040 err = snd_hda_attach_beep_device(codec, 0x1);
5046 if (board_config != ALC880_AUTO)
5047 setup_preset(codec, &alc880_presets[board_config]);
5049 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5050 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5051 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5053 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5054 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5056 if (!spec->adc_nids && spec->input_mux) {
5057 /* check whether NID 0x07 is valid */
5058 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5060 wcap = get_wcaps_type(wcap);
5061 if (wcap != AC_WID_AUD_IN) {
5062 spec->adc_nids = alc880_adc_nids_alt;
5063 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5065 spec->adc_nids = alc880_adc_nids;
5066 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5069 set_capture_mixer(codec);
5070 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5072 spec->vmaster_nid = 0x0c;
5074 codec->patch_ops = alc_patch_ops;
5075 if (board_config == ALC880_AUTO)
5076 spec->init_hook = alc880_auto_init;
5077 #ifdef CONFIG_SND_HDA_POWER_SAVE
5078 if (!spec->loopback.amplist)
5079 spec->loopback.amplist = alc880_loopbacks;
5081 codec->proc_widget_hook = print_realtek_coef;
5091 static hda_nid_t alc260_dac_nids[1] = {
5096 static hda_nid_t alc260_adc_nids[1] = {
5101 static hda_nid_t alc260_adc_nids_alt[1] = {
5106 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5107 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5109 static hda_nid_t alc260_dual_adc_nids[2] = {
5114 #define ALC260_DIGOUT_NID 0x03
5115 #define ALC260_DIGIN_NID 0x06
5117 static struct hda_input_mux alc260_capture_source = {
5121 { "Front Mic", 0x1 },
5127 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5128 * headphone jack and the internal CD lines since these are the only pins at
5129 * which audio can appear. For flexibility, also allow the option of
5130 * recording the mixer output on the second ADC (ADC0 doesn't have a
5131 * connection to the mixer output).
5133 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5137 { "Mic/Line", 0x0 },
5139 { "Headphone", 0x2 },
5145 { "Mic/Line", 0x0 },
5147 { "Headphone", 0x2 },
5154 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5155 * the Fujitsu S702x, but jacks are marked differently.
5157 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5164 { "Headphone", 0x5 },
5173 { "Headphone", 0x6 },
5179 /* Maxdata Favorit 100XS */
5180 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5184 { "Line/Mic", 0x0 },
5191 { "Line/Mic", 0x0 },
5199 * This is just place-holder, so there's something for alc_build_pcms to look
5200 * at when it calculates the maximum number of channels. ALC260 has no mixer
5201 * element which allows changing the channel mode, so the verb list is
5204 static struct hda_channel_mode alc260_modes[1] = {
5209 /* Mixer combinations
5211 * basic: base_output + input + pc_beep + capture
5212 * HP: base_output + input + capture_alt
5213 * HP_3013: hp_3013 + input + capture
5214 * fujitsu: fujitsu + capture
5215 * acer: acer + capture
5218 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5219 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5220 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5221 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5222 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5223 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5224 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5228 static struct snd_kcontrol_new alc260_input_mixer[] = {
5229 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5230 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5231 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5232 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5234 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5235 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5236 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5240 /* update HP, line and mono out pins according to the master switch */
5241 static void alc260_hp_master_update(struct hda_codec *codec,
5242 hda_nid_t hp, hda_nid_t line,
5245 struct alc_spec *spec = codec->spec;
5246 unsigned int val = spec->master_sw ? PIN_HP : 0;
5247 /* change HP and line-out pins */
5248 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5250 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5252 /* mono (speaker) depending on the HP jack sense */
5253 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5254 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5258 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5259 struct snd_ctl_elem_value *ucontrol)
5261 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5262 struct alc_spec *spec = codec->spec;
5263 *ucontrol->value.integer.value = spec->master_sw;
5267 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5268 struct snd_ctl_elem_value *ucontrol)
5270 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5271 struct alc_spec *spec = codec->spec;
5272 int val = !!*ucontrol->value.integer.value;
5273 hda_nid_t hp, line, mono;
5275 if (val == spec->master_sw)
5277 spec->master_sw = val;
5278 hp = (kcontrol->private_value >> 16) & 0xff;
5279 line = (kcontrol->private_value >> 8) & 0xff;
5280 mono = kcontrol->private_value & 0xff;
5281 alc260_hp_master_update(codec, hp, line, mono);
5285 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5287 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5288 .name = "Master Playback Switch",
5289 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5290 .info = snd_ctl_boolean_mono_info,
5291 .get = alc260_hp_master_sw_get,
5292 .put = alc260_hp_master_sw_put,
5293 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5295 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5296 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5297 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5298 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5299 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5301 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5305 static struct hda_verb alc260_hp_unsol_verbs[] = {
5306 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5310 static void alc260_hp_automute(struct hda_codec *codec)
5312 struct alc_spec *spec = codec->spec;
5314 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5315 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5318 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5320 if ((res >> 26) == ALC880_HP_EVENT)
5321 alc260_hp_automute(codec);
5324 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5326 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5327 .name = "Master Playback Switch",
5328 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5329 .info = snd_ctl_boolean_mono_info,
5330 .get = alc260_hp_master_sw_get,
5331 .put = alc260_hp_master_sw_put,
5332 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5334 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5335 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5336 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5337 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5340 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5341 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5345 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5346 .ops = &snd_hda_bind_vol,
5348 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5349 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5350 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5355 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5356 .ops = &snd_hda_bind_sw,
5358 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5359 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5364 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5365 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5366 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5367 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5368 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5372 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5373 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5377 static void alc260_hp_3013_automute(struct hda_codec *codec)
5379 struct alc_spec *spec = codec->spec;
5381 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5382 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5385 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5388 if ((res >> 26) == ALC880_HP_EVENT)
5389 alc260_hp_3013_automute(codec);
5392 static void alc260_hp_3012_automute(struct hda_codec *codec)
5394 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5396 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5398 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5400 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5404 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5407 if ((res >> 26) == ALC880_HP_EVENT)
5408 alc260_hp_3012_automute(codec);
5411 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5412 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5414 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5415 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5416 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5417 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5418 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5419 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5420 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5421 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5422 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5423 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5424 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5428 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5429 * versions of the ALC260 don't act on requests to enable mic bias from NID
5430 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5431 * datasheet doesn't mention this restriction. At this stage it's not clear
5432 * whether this behaviour is intentional or is a hardware bug in chip
5433 * revisions available in early 2006. Therefore for now allow the
5434 * "Headphone Jack Mode" control to span all choices, but if it turns out
5435 * that the lack of mic bias for this NID is intentional we could change the
5436 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5438 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5439 * don't appear to make the mic bias available from the "line" jack, even
5440 * though the NID used for this jack (0x14) can supply it. The theory is
5441 * that perhaps Acer have included blocking capacitors between the ALC260
5442 * and the output jack. If this turns out to be the case for all such
5443 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5444 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5446 * The C20x Tablet series have a mono internal speaker which is controlled
5447 * via the chip's Mono sum widget and pin complex, so include the necessary
5448 * controls for such models. On models without a "mono speaker" the control
5449 * won't do anything.
5451 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5452 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5453 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5454 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5455 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5457 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5459 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5460 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5462 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5463 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5464 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5465 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5466 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5470 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5472 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5473 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5474 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5475 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5476 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5477 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5478 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5482 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5483 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5485 static struct snd_kcontrol_new alc260_will_mixer[] = {
5486 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5487 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5488 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5489 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5490 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5491 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5492 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5493 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5494 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5495 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5499 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5500 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5502 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5503 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5504 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5506 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5507 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5508 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5509 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5510 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5511 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5512 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5517 * initialization verbs
5519 static struct hda_verb alc260_init_verbs[] = {
5520 /* Line In pin widget for input */
5521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5522 /* CD pin widget for input */
5523 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5524 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5525 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5526 /* Mic2 (front panel) pin widget for input and vref at 80% */
5527 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5528 /* LINE-2 is used for line-out in rear */
5529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5530 /* select line-out */
5531 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5533 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5535 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5537 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5538 /* mute capture amp left and right */
5539 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5540 /* set connection select to line in (default select for this ADC) */
5541 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5542 /* mute capture amp left and right */
5543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5544 /* set connection select to line in (default select for this ADC) */
5545 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5546 /* set vol=0 Line-Out mixer amp left and right */
5547 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5548 /* unmute pin widget amp left and right (no gain on this amp) */
5549 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5550 /* set vol=0 HP mixer amp left and right */
5551 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5552 /* unmute pin widget amp left and right (no gain on this amp) */
5553 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5554 /* set vol=0 Mono mixer amp left and right */
5555 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5556 /* unmute pin widget amp left and right (no gain on this amp) */
5557 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5558 /* unmute LINE-2 out pin */
5559 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5560 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5563 /* mute analog inputs */
5564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5569 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5570 /* mute Front out path */
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5573 /* mute Headphone out path */
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5576 /* mute Mono out path */
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5578 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5582 #if 0 /* should be identical with alc260_init_verbs? */
5583 static struct hda_verb alc260_hp_init_verbs[] = {
5584 /* Headphone and output */
5585 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5587 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5588 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5589 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5590 /* Mic2 (front panel) pin widget for input and vref at 80% */
5591 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5592 /* Line In pin widget for input */
5593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5594 /* Line-2 pin widget for output */
5595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5596 /* CD pin widget for input */
5597 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5598 /* unmute amp left and right */
5599 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5600 /* set connection select to line in (default select for this ADC) */
5601 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5602 /* unmute Line-Out mixer amp left and right (volume = 0) */
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5604 /* mute pin widget amp left and right (no gain on this amp) */
5605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5606 /* unmute HP mixer amp left and right (volume = 0) */
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5608 /* mute pin widget amp left and right (no gain on this amp) */
5609 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5610 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5613 /* mute analog inputs */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5619 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5620 /* Unmute Front out path */
5621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5623 /* Unmute Headphone out path */
5624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5626 /* Unmute Mono out path */
5627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5628 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5633 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5634 /* Line out and output */
5635 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5637 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5638 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5639 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5640 /* Mic2 (front panel) pin widget for input and vref at 80% */
5641 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5642 /* Line In pin widget for input */
5643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5644 /* Headphone pin widget for output */
5645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5646 /* CD pin widget for input */
5647 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5648 /* unmute amp left and right */
5649 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5650 /* set connection select to line in (default select for this ADC) */
5651 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5652 /* unmute Line-Out mixer amp left and right (volume = 0) */
5653 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5654 /* mute pin widget amp left and right (no gain on this amp) */
5655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5656 /* unmute HP mixer amp left and right (volume = 0) */
5657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5658 /* mute pin widget amp left and right (no gain on this amp) */
5659 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5660 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5663 /* mute analog inputs */
5664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5665 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5666 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5669 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5670 /* Unmute Front out path */
5671 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5672 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5673 /* Unmute Headphone out path */
5674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5675 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5676 /* Unmute Mono out path */
5677 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5678 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5682 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5683 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5684 * audio = 0x16, internal speaker = 0x10.
5686 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5687 /* Disable all GPIOs */
5688 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5689 /* Internal speaker is connected to headphone pin */
5690 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5691 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5692 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5693 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5694 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5695 /* Ensure all other unused pins are disabled and muted. */
5696 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5697 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5698 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5699 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5700 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5701 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5703 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5705 /* Disable digital (SPDIF) pins */
5706 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5707 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5709 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5710 * when acting as an output.
5712 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5714 /* Start with output sum widgets muted and their output gains at min */
5715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5717 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5718 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5720 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5721 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5722 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5723 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5725 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5726 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5727 /* Unmute Line1 pin widget output buffer since it starts as an output.
5728 * If the pin mode is changed by the user the pin mode control will
5729 * take care of enabling the pin's input/output buffers as needed.
5730 * Therefore there's no need to enable the input buffer at this
5733 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5734 /* Unmute input buffer of pin widget used for Line-in (no equiv
5737 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5739 /* Mute capture amp left and right */
5740 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5741 /* Set ADC connection select to match default mixer setting - line
5744 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5746 /* Do the same for the second ADC: mute capture input amp and
5747 * set ADC connection to line in (on mic1 pin)
5749 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5750 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5752 /* Mute all inputs to mixer widget (even unconnected ones) */
5753 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5754 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5756 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5757 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5758 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5765 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5766 * similar laptops (adapted from Fujitsu init verbs).
5768 static struct hda_verb alc260_acer_init_verbs[] = {
5769 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5770 * the headphone jack. Turn this on and rely on the standard mute
5771 * methods whenever the user wants to turn these outputs off.
5773 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5774 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5775 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5776 /* Internal speaker/Headphone jack is connected to Line-out pin */
5777 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5778 /* Internal microphone/Mic jack is connected to Mic1 pin */
5779 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5780 /* Line In jack is connected to Line1 pin */
5781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5782 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5783 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5784 /* Ensure all other unused pins are disabled and muted. */
5785 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5786 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5787 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5788 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5790 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5791 /* Disable digital (SPDIF) pins */
5792 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5793 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5795 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5796 * bus when acting as outputs.
5798 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5799 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5801 /* Start with output sum widgets muted and their output gains at min */
5802 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5803 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5804 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5805 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5807 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5808 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5810 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5812 /* Unmute Line-out pin widget amp left and right
5813 * (no equiv mixer ctrl)
5815 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5816 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5817 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5818 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5819 * inputs. If the pin mode is changed by the user the pin mode control
5820 * will take care of enabling the pin's input/output buffers as needed.
5821 * Therefore there's no need to enable the input buffer at this
5824 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5825 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5827 /* Mute capture amp left and right */
5828 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5829 /* Set ADC connection select to match default mixer setting - mic
5832 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5834 /* Do similar with the second ADC: mute capture input amp and
5835 * set ADC connection to mic to match ALSA's default state.
5837 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5838 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5840 /* Mute all inputs to mixer widget (even unconnected ones) */
5841 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5842 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5843 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5853 /* Initialisation sequence for Maxdata Favorit 100XS
5854 * (adapted from Acer init verbs).
5856 static struct hda_verb alc260_favorit100_init_verbs[] = {
5857 /* GPIO 0 enables the output jack.
5858 * Turn this on and rely on the standard mute
5859 * methods whenever the user wants to turn these outputs off.
5861 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5862 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5863 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5864 /* Line/Mic input jack is connected to Mic1 pin */
5865 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5866 /* Ensure all other unused pins are disabled and muted. */
5867 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5868 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5869 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5870 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5872 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5874 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5876 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5877 /* Disable digital (SPDIF) pins */
5878 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5879 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5881 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5882 * bus when acting as outputs.
5884 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5885 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5887 /* Start with output sum widgets muted and their output gains at min */
5888 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5889 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5890 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5891 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5892 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5893 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5894 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5895 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5896 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5898 /* Unmute Line-out pin widget amp left and right
5899 * (no equiv mixer ctrl)
5901 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5902 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5903 * inputs. If the pin mode is changed by the user the pin mode control
5904 * will take care of enabling the pin's input/output buffers as needed.
5905 * Therefore there's no need to enable the input buffer at this
5908 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5910 /* Mute capture amp left and right */
5911 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5912 /* Set ADC connection select to match default mixer setting - mic
5915 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5917 /* Do similar with the second ADC: mute capture input amp and
5918 * set ADC connection to mic to match ALSA's default state.
5920 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5921 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5923 /* Mute all inputs to mixer widget (even unconnected ones) */
5924 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5925 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5926 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5927 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5928 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5929 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5930 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5931 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5936 static struct hda_verb alc260_will_verbs[] = {
5937 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5938 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5939 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5940 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5941 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5942 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5946 static struct hda_verb alc260_replacer_672v_verbs[] = {
5947 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5948 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5949 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5951 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5952 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5953 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5955 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5959 /* toggle speaker-output according to the hp-jack state */
5960 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5962 unsigned int present;
5964 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5965 present = snd_hda_jack_detect(codec, 0x0f);
5967 snd_hda_codec_write_cache(codec, 0x01, 0,
5968 AC_VERB_SET_GPIO_DATA, 1);
5969 snd_hda_codec_write_cache(codec, 0x0f, 0,
5970 AC_VERB_SET_PIN_WIDGET_CONTROL,
5973 snd_hda_codec_write_cache(codec, 0x01, 0,
5974 AC_VERB_SET_GPIO_DATA, 0);
5975 snd_hda_codec_write_cache(codec, 0x0f, 0,
5976 AC_VERB_SET_PIN_WIDGET_CONTROL,
5981 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5984 if ((res >> 26) == ALC880_HP_EVENT)
5985 alc260_replacer_672v_automute(codec);
5988 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5989 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5990 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5991 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5992 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5993 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5995 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5996 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5997 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5998 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6002 /* Test configuration for debugging, modelled after the ALC880 test
6005 #ifdef CONFIG_SND_DEBUG
6006 static hda_nid_t alc260_test_dac_nids[1] = {
6009 static hda_nid_t alc260_test_adc_nids[2] = {
6012 /* For testing the ALC260, each input MUX needs its own definition since
6013 * the signal assignments are different. This assumes that the first ADC
6016 static struct hda_input_mux alc260_test_capture_sources[2] = {
6020 { "MIC1 pin", 0x0 },
6021 { "MIC2 pin", 0x1 },
6022 { "LINE1 pin", 0x2 },
6023 { "LINE2 pin", 0x3 },
6025 { "LINE-OUT pin", 0x5 },
6026 { "HP-OUT pin", 0x6 },
6032 { "MIC1 pin", 0x0 },
6033 { "MIC2 pin", 0x1 },
6034 { "LINE1 pin", 0x2 },
6035 { "LINE2 pin", 0x3 },
6038 { "LINE-OUT pin", 0x6 },
6039 { "HP-OUT pin", 0x7 },
6043 static struct snd_kcontrol_new alc260_test_mixer[] = {
6044 /* Output driver widgets */
6045 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6046 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6047 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6048 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6049 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6050 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6052 /* Modes for retasking pin widgets
6053 * Note: the ALC260 doesn't seem to act on requests to enable mic
6054 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6055 * mention this restriction. At this stage it's not clear whether
6056 * this behaviour is intentional or is a hardware bug in chip
6057 * revisions available at least up until early 2006. Therefore for
6058 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6059 * choices, but if it turns out that the lack of mic bias for these
6060 * NIDs is intentional we could change their modes from
6061 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6063 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6064 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6065 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6066 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6067 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6068 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6070 /* Loopback mixer controls */
6071 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6072 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6073 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6074 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6075 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6076 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6077 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6078 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6079 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6080 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6081 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6082 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6083 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6084 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6086 /* Controls for GPIO pins, assuming they are configured as outputs */
6087 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6088 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6089 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6090 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6092 /* Switches to allow the digital IO pins to be enabled. The datasheet
6093 * is ambigious as to which NID is which; testing on laptops which
6094 * make this output available should provide clarification.
6096 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6097 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6099 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6100 * this output to turn on an external amplifier.
6102 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6103 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6107 static struct hda_verb alc260_test_init_verbs[] = {
6108 /* Enable all GPIOs as outputs with an initial value of 0 */
6109 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6110 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6111 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6113 /* Enable retasking pins as output, initially without power amp */
6114 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6115 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6116 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6117 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6118 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6119 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6121 /* Disable digital (SPDIF) pins initially, but users can enable
6122 * them via a mixer switch. In the case of SPDIF-out, this initverb
6123 * payload also sets the generation to 0, output to be in "consumer"
6124 * PCM format, copyright asserted, no pre-emphasis and no validity
6127 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6128 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6130 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6131 * OUT1 sum bus when acting as an output.
6133 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6134 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6135 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6136 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6138 /* Start with output sum widgets muted and their output gains at min */
6139 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6141 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6142 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6143 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6145 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6146 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6147 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6149 /* Unmute retasking pin widget output buffers since the default
6150 * state appears to be output. As the pin mode is changed by the
6151 * user the pin mode control will take care of enabling the pin's
6152 * input/output buffers as needed.
6154 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6155 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6157 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6158 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6159 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6160 /* Also unmute the mono-out pin widget */
6161 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6163 /* Mute capture amp left and right */
6164 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6165 /* Set ADC connection select to match default mixer setting (mic1
6168 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6170 /* Do the same for the second ADC: mute capture input amp and
6171 * set ADC connection to mic1 pin
6173 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6174 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6176 /* Mute all inputs to mixer widget (even unconnected ones) */
6177 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6179 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6183 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6184 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6190 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6191 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6193 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6194 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6197 * for BIOS auto-configuration
6200 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6201 const char *pfx, int *vol_bits)
6204 unsigned long vol_val, sw_val;
6207 if (nid >= 0x0f && nid < 0x11) {
6208 nid_vol = nid - 0x7;
6209 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6210 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6211 } else if (nid == 0x11) {
6212 nid_vol = nid - 0x7;
6213 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6214 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6215 } else if (nid >= 0x12 && nid <= 0x15) {
6217 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6218 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6222 if (!(*vol_bits & (1 << nid_vol))) {
6223 /* first control for the volume widget */
6224 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6227 *vol_bits |= (1 << nid_vol);
6229 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6235 /* add playback controls from the parsed DAC table */
6236 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6237 const struct auto_pin_cfg *cfg)
6243 spec->multiout.num_dacs = 1;
6244 spec->multiout.dac_nids = spec->private_dac_nids;
6245 spec->multiout.dac_nids[0] = 0x02;
6247 nid = cfg->line_out_pins[0];
6250 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6252 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6256 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6261 nid = cfg->speaker_pins[0];
6263 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6268 nid = cfg->hp_pins[0];
6270 err = alc260_add_playback_controls(spec, nid, "Headphone",
6278 /* create playback/capture controls for input pins */
6279 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6280 const struct auto_pin_cfg *cfg)
6282 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6285 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6286 hda_nid_t nid, int pin_type,
6289 alc_set_pin_output(codec, nid, pin_type);
6290 /* need the manual connection? */
6292 int idx = nid - 0x12;
6293 snd_hda_codec_write(codec, idx + 0x0b, 0,
6294 AC_VERB_SET_CONNECT_SEL, sel_idx);
6298 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6300 struct alc_spec *spec = codec->spec;
6303 nid = spec->autocfg.line_out_pins[0];
6305 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6306 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6309 nid = spec->autocfg.speaker_pins[0];
6311 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6313 nid = spec->autocfg.hp_pins[0];
6315 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6318 #define ALC260_PIN_CD_NID 0x16
6319 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6321 struct alc_spec *spec = codec->spec;
6324 for (i = 0; i < AUTO_PIN_LAST; i++) {
6325 hda_nid_t nid = spec->autocfg.input_pins[i];
6327 alc_set_input_pin(codec, nid, i);
6328 if (nid != ALC260_PIN_CD_NID &&
6329 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6330 snd_hda_codec_write(codec, nid, 0,
6331 AC_VERB_SET_AMP_GAIN_MUTE,
6338 * generic initialization of ADC, input mixers and output mixers
6340 static struct hda_verb alc260_volume_init_verbs[] = {
6342 * Unmute ADC0-1 and set the default input to mic-in
6344 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6345 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6346 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6347 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6349 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6351 * Note: PASD motherboards uses the Line In 2 as the input for
6352 * front panel mic (mic 2)
6354 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6355 /* mute analog inputs */
6356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6357 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6360 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6363 * Set up output mixers (0x08 - 0x0a)
6365 /* set vol=0 to output mixers */
6366 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6368 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6369 /* set up input amps for analog loopback */
6370 /* Amp Indices: DAC = 0, mixer = 1 */
6371 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6372 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6373 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6374 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6375 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6376 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6381 static int alc260_parse_auto_config(struct hda_codec *codec)
6383 struct alc_spec *spec = codec->spec;
6385 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6387 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6391 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6394 if (!spec->kctls.list)
6395 return 0; /* can't find valid BIOS pin config */
6396 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6400 spec->multiout.max_channels = 2;
6402 if (spec->autocfg.dig_outs)
6403 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6404 if (spec->kctls.list)
6405 add_mixer(spec, spec->kctls.list);
6407 add_verb(spec, alc260_volume_init_verbs);
6409 spec->num_mux_defs = 1;
6410 spec->input_mux = &spec->private_imux[0];
6412 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6417 /* additional initialization for auto-configuration model */
6418 static void alc260_auto_init(struct hda_codec *codec)
6420 struct alc_spec *spec = codec->spec;
6421 alc260_auto_init_multi_out(codec);
6422 alc260_auto_init_analog_input(codec);
6423 if (spec->unsol_event)
6424 alc_inithook(codec);
6427 #ifdef CONFIG_SND_HDA_POWER_SAVE
6428 static struct hda_amp_list alc260_loopbacks[] = {
6429 { 0x07, HDA_INPUT, 0 },
6430 { 0x07, HDA_INPUT, 1 },
6431 { 0x07, HDA_INPUT, 2 },
6432 { 0x07, HDA_INPUT, 3 },
6433 { 0x07, HDA_INPUT, 4 },
6439 * ALC260 configurations
6441 static const char *alc260_models[ALC260_MODEL_LAST] = {
6442 [ALC260_BASIC] = "basic",
6444 [ALC260_HP_3013] = "hp-3013",
6445 [ALC260_HP_DC7600] = "hp-dc7600",
6446 [ALC260_FUJITSU_S702X] = "fujitsu",
6447 [ALC260_ACER] = "acer",
6448 [ALC260_WILL] = "will",
6449 [ALC260_REPLACER_672V] = "replacer",
6450 [ALC260_FAVORIT100] = "favorit100",
6451 #ifdef CONFIG_SND_DEBUG
6452 [ALC260_TEST] = "test",
6454 [ALC260_AUTO] = "auto",
6457 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6458 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6459 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6460 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6461 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6462 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6463 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6464 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6465 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6466 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6467 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6468 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6469 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6470 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6471 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6472 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6473 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6474 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6475 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6476 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6477 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6481 static struct alc_config_preset alc260_presets[] = {
6483 .mixers = { alc260_base_output_mixer,
6484 alc260_input_mixer },
6485 .init_verbs = { alc260_init_verbs },
6486 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6487 .dac_nids = alc260_dac_nids,
6488 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6489 .adc_nids = alc260_adc_nids,
6490 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6491 .channel_mode = alc260_modes,
6492 .input_mux = &alc260_capture_source,
6495 .mixers = { alc260_hp_output_mixer,
6496 alc260_input_mixer },
6497 .init_verbs = { alc260_init_verbs,
6498 alc260_hp_unsol_verbs },
6499 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6500 .dac_nids = alc260_dac_nids,
6501 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6502 .adc_nids = alc260_adc_nids_alt,
6503 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6504 .channel_mode = alc260_modes,
6505 .input_mux = &alc260_capture_source,
6506 .unsol_event = alc260_hp_unsol_event,
6507 .init_hook = alc260_hp_automute,
6509 [ALC260_HP_DC7600] = {
6510 .mixers = { alc260_hp_dc7600_mixer,
6511 alc260_input_mixer },
6512 .init_verbs = { alc260_init_verbs,
6513 alc260_hp_dc7600_verbs },
6514 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6515 .dac_nids = alc260_dac_nids,
6516 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6517 .adc_nids = alc260_adc_nids_alt,
6518 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6519 .channel_mode = alc260_modes,
6520 .input_mux = &alc260_capture_source,
6521 .unsol_event = alc260_hp_3012_unsol_event,
6522 .init_hook = alc260_hp_3012_automute,
6524 [ALC260_HP_3013] = {
6525 .mixers = { alc260_hp_3013_mixer,
6526 alc260_input_mixer },
6527 .init_verbs = { alc260_hp_3013_init_verbs,
6528 alc260_hp_3013_unsol_verbs },
6529 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6530 .dac_nids = alc260_dac_nids,
6531 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6532 .adc_nids = alc260_adc_nids_alt,
6533 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6534 .channel_mode = alc260_modes,
6535 .input_mux = &alc260_capture_source,
6536 .unsol_event = alc260_hp_3013_unsol_event,
6537 .init_hook = alc260_hp_3013_automute,
6539 [ALC260_FUJITSU_S702X] = {
6540 .mixers = { alc260_fujitsu_mixer },
6541 .init_verbs = { alc260_fujitsu_init_verbs },
6542 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6543 .dac_nids = alc260_dac_nids,
6544 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6545 .adc_nids = alc260_dual_adc_nids,
6546 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6547 .channel_mode = alc260_modes,
6548 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6549 .input_mux = alc260_fujitsu_capture_sources,
6552 .mixers = { alc260_acer_mixer },
6553 .init_verbs = { alc260_acer_init_verbs },
6554 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6555 .dac_nids = alc260_dac_nids,
6556 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6557 .adc_nids = alc260_dual_adc_nids,
6558 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6559 .channel_mode = alc260_modes,
6560 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6561 .input_mux = alc260_acer_capture_sources,
6563 [ALC260_FAVORIT100] = {
6564 .mixers = { alc260_favorit100_mixer },
6565 .init_verbs = { alc260_favorit100_init_verbs },
6566 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6567 .dac_nids = alc260_dac_nids,
6568 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6569 .adc_nids = alc260_dual_adc_nids,
6570 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6571 .channel_mode = alc260_modes,
6572 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6573 .input_mux = alc260_favorit100_capture_sources,
6576 .mixers = { alc260_will_mixer },
6577 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6578 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6579 .dac_nids = alc260_dac_nids,
6580 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6581 .adc_nids = alc260_adc_nids,
6582 .dig_out_nid = ALC260_DIGOUT_NID,
6583 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6584 .channel_mode = alc260_modes,
6585 .input_mux = &alc260_capture_source,
6587 [ALC260_REPLACER_672V] = {
6588 .mixers = { alc260_replacer_672v_mixer },
6589 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6590 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6591 .dac_nids = alc260_dac_nids,
6592 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6593 .adc_nids = alc260_adc_nids,
6594 .dig_out_nid = ALC260_DIGOUT_NID,
6595 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6596 .channel_mode = alc260_modes,
6597 .input_mux = &alc260_capture_source,
6598 .unsol_event = alc260_replacer_672v_unsol_event,
6599 .init_hook = alc260_replacer_672v_automute,
6601 #ifdef CONFIG_SND_DEBUG
6603 .mixers = { alc260_test_mixer },
6604 .init_verbs = { alc260_test_init_verbs },
6605 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6606 .dac_nids = alc260_test_dac_nids,
6607 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6608 .adc_nids = alc260_test_adc_nids,
6609 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6610 .channel_mode = alc260_modes,
6611 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6612 .input_mux = alc260_test_capture_sources,
6617 static int patch_alc260(struct hda_codec *codec)
6619 struct alc_spec *spec;
6620 int err, board_config;
6622 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6628 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6631 if (board_config < 0) {
6632 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6634 board_config = ALC260_AUTO;
6637 if (board_config == ALC260_AUTO) {
6638 /* automatic parse from the BIOS config */
6639 err = alc260_parse_auto_config(codec);
6645 "hda_codec: Cannot set up configuration "
6646 "from BIOS. Using base mode...\n");
6647 board_config = ALC260_BASIC;
6651 err = snd_hda_attach_beep_device(codec, 0x1);
6657 if (board_config != ALC260_AUTO)
6658 setup_preset(codec, &alc260_presets[board_config]);
6660 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6661 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6663 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6664 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6666 if (!spec->adc_nids && spec->input_mux) {
6667 /* check whether NID 0x04 is valid */
6668 unsigned int wcap = get_wcaps(codec, 0x04);
6669 wcap = get_wcaps_type(wcap);
6671 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6672 spec->adc_nids = alc260_adc_nids_alt;
6673 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6675 spec->adc_nids = alc260_adc_nids;
6676 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6679 set_capture_mixer(codec);
6680 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6682 spec->vmaster_nid = 0x08;
6684 codec->patch_ops = alc_patch_ops;
6685 if (board_config == ALC260_AUTO)
6686 spec->init_hook = alc260_auto_init;
6687 #ifdef CONFIG_SND_HDA_POWER_SAVE
6688 if (!spec->loopback.amplist)
6689 spec->loopback.amplist = alc260_loopbacks;
6691 codec->proc_widget_hook = print_realtek_coef;
6698 * ALC882/883/885/888/889 support
6700 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6701 * configuration. Each pin widget can choose any input DACs and a mixer.
6702 * Each ADC is connected from a mixer of all inputs. This makes possible
6703 * 6-channel independent captures.
6705 * In addition, an independent DAC for the multi-playback (not used in this
6708 #define ALC882_DIGOUT_NID 0x06
6709 #define ALC882_DIGIN_NID 0x0a
6710 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6711 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6712 #define ALC1200_DIGOUT_NID 0x10
6715 static struct hda_channel_mode alc882_ch_modes[1] = {
6720 static hda_nid_t alc882_dac_nids[4] = {
6721 /* front, rear, clfe, rear_surr */
6722 0x02, 0x03, 0x04, 0x05
6724 #define alc883_dac_nids alc882_dac_nids
6727 #define alc882_adc_nids alc880_adc_nids
6728 #define alc882_adc_nids_alt alc880_adc_nids_alt
6729 #define alc883_adc_nids alc882_adc_nids_alt
6730 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6731 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6732 #define alc889_adc_nids alc880_adc_nids
6734 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6735 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6736 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6737 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6738 #define alc889_capsrc_nids alc882_capsrc_nids
6741 /* FIXME: should be a matrix-type input source selection */
6743 static struct hda_input_mux alc882_capture_source = {
6747 { "Front Mic", 0x1 },
6753 #define alc883_capture_source alc882_capture_source
6755 static struct hda_input_mux alc889_capture_source = {
6758 { "Front Mic", 0x0 },
6764 static struct hda_input_mux mb5_capture_source = {
6773 static struct hda_input_mux alc883_3stack_6ch_intel = {
6777 { "Front Mic", 0x0 },
6783 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6791 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6801 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6809 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6813 { "Front Mic", 0x1 },
6818 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6826 static struct hda_input_mux alc889A_mb31_capture_source = {
6830 /* Front Mic (0x01) unused */
6832 /* Line 2 (0x03) unused */
6833 /* CD (0x04) unused? */
6840 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6847 static struct hda_verb alc882_3ST_ch2_init[] = {
6848 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6849 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6858 static struct hda_verb alc882_3ST_ch4_init[] = {
6859 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6860 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6861 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6862 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6863 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6870 static struct hda_verb alc882_3ST_ch6_init[] = {
6871 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6872 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6873 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6876 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6880 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6881 { 2, alc882_3ST_ch2_init },
6882 { 4, alc882_3ST_ch4_init },
6883 { 6, alc882_3ST_ch6_init },
6886 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6891 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6892 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6893 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6894 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6895 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6896 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6903 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6904 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
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_OUT },
6908 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6909 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6916 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6917 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6918 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6919 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6920 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6921 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6922 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6923 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6927 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6928 { 2, alc883_3ST_ch2_clevo_init },
6929 { 4, alc883_3ST_ch4_clevo_init },
6930 { 6, alc883_3ST_ch6_clevo_init },
6937 static struct hda_verb alc882_sixstack_ch6_init[] = {
6938 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6939 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6940 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6941 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6948 static struct hda_verb alc882_sixstack_ch8_init[] = {
6949 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6950 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6951 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6952 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6957 { 6, alc882_sixstack_ch6_init },
6958 { 8, alc882_sixstack_ch8_init },
6962 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6968 static struct hda_verb alc885_mbp_ch2_init[] = {
6969 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6970 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6971 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6978 static struct hda_verb alc885_mbp_ch4_init[] = {
6979 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6980 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6981 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6982 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6983 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6987 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6988 { 2, alc885_mbp_ch2_init },
6989 { 4, alc885_mbp_ch4_init },
6994 * Speakers/Woofer/HP = Front
6997 static struct hda_verb alc885_mb5_ch2_init[] = {
6998 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7005 * Speakers/HP = Front
7009 static struct hda_verb alc885_mb5_ch6_init[] = {
7010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7011 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7016 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7017 { 2, alc885_mb5_ch2_init },
7018 { 6, alc885_mb5_ch6_init },
7025 static struct hda_verb alc883_4ST_ch2_init[] = {
7026 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7027 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7028 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7029 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7030 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7031 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7038 static struct hda_verb alc883_4ST_ch4_init[] = {
7039 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7040 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7041 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7042 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7043 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7044 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7045 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7052 static struct hda_verb alc883_4ST_ch6_init[] = {
7053 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7054 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7055 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7056 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7057 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7058 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7059 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7060 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7067 static struct hda_verb alc883_4ST_ch8_init[] = {
7068 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7069 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7070 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7071 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7072 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7073 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7076 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7080 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7081 { 2, alc883_4ST_ch2_init },
7082 { 4, alc883_4ST_ch4_init },
7083 { 6, alc883_4ST_ch6_init },
7084 { 8, alc883_4ST_ch8_init },
7091 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7092 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7093 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7094 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7095 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7102 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7103 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7104 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7105 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7106 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7107 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7114 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7115 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7116 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7117 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7118 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7119 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7120 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7124 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7125 { 2, alc883_3ST_ch2_intel_init },
7126 { 4, alc883_3ST_ch4_intel_init },
7127 { 6, alc883_3ST_ch6_intel_init },
7133 static struct hda_verb alc889_ch2_intel_init[] = {
7134 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7135 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7136 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7137 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7138 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7139 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7146 static struct hda_verb alc889_ch6_intel_init[] = {
7147 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7148 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7149 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7150 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7151 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7152 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7159 static struct hda_verb alc889_ch8_intel_init[] = {
7160 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7161 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7162 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7163 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7164 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7165 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7166 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7170 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7171 { 2, alc889_ch2_intel_init },
7172 { 6, alc889_ch6_intel_init },
7173 { 8, alc889_ch8_intel_init },
7179 static struct hda_verb alc883_sixstack_ch6_init[] = {
7180 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7181 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7182 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7183 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7190 static struct hda_verb alc883_sixstack_ch8_init[] = {
7191 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7192 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7193 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7194 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7198 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7199 { 6, alc883_sixstack_ch6_init },
7200 { 8, alc883_sixstack_ch8_init },
7204 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7205 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7207 static struct snd_kcontrol_new alc882_base_mixer[] = {
7208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7210 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7211 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7212 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7213 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7214 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7215 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7217 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7218 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7227 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7232 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7233 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7234 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7236 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7239 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7241 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7242 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7247 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7248 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7249 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7250 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7251 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7252 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7253 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7255 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7257 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7259 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7260 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7261 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7265 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7266 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7267 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7268 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7271 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7273 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7274 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7279 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7280 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7281 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7285 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7292 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7296 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7297 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7298 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7299 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7303 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7304 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7305 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7309 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7310 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7312 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7313 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7314 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7315 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7316 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7317 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7318 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7319 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7320 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7321 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7322 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7329 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7330 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7331 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7333 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7334 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7335 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7336 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7338 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7343 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7345 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7346 .name = "Channel Mode",
7347 .info = alc_ch_mode_info,
7348 .get = alc_ch_mode_get,
7349 .put = alc_ch_mode_put,
7354 static struct hda_verb alc882_base_init_verbs[] = {
7355 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7356 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7357 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7358 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7360 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7365 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7366 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7368 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7369 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7370 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7372 /* mute analog input loopbacks */
7373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7379 /* Front Pin: output 0 (0x0c) */
7380 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7381 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7382 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7383 /* Rear Pin: output 1 (0x0d) */
7384 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7385 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7387 /* CLFE Pin: output 2 (0x0e) */
7388 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7389 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7390 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7391 /* Side Pin: output 3 (0x0f) */
7392 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7393 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7394 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7395 /* Mic (rear) pin: input vref at 80% */
7396 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7397 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7398 /* Front Mic pin: input vref at 80% */
7399 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7400 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7401 /* Line In pin: input */
7402 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7403 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7404 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7405 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7406 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7407 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7408 /* CD pin widget for input */
7409 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7411 /* FIXME: use matrix-type input source selection */
7412 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7416 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7417 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7421 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7422 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7423 /* ADC2: mute amp left and right */
7424 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7425 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7426 /* ADC3: mute amp left and right */
7427 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7428 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7433 static struct hda_verb alc882_adc1_init_verbs[] = {
7434 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7439 /* ADC1: mute amp left and right */
7440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7441 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7445 static struct hda_verb alc882_eapd_verbs[] = {
7446 /* change to EAPD mode */
7447 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7448 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7452 static struct hda_verb alc889_eapd_verbs[] = {
7453 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7454 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7458 static struct hda_verb alc_hp15_unsol_verbs[] = {
7459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7464 static struct hda_verb alc885_init_verbs[] = {
7465 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7468 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7470 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7471 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7479 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7480 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7482 /* mute analog input loopbacks */
7483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7487 /* Front HP Pin: output 0 (0x0c) */
7488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7489 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7490 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7491 /* Front Pin: output 0 (0x0c) */
7492 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7493 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7494 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7495 /* Rear Pin: output 1 (0x0d) */
7496 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7497 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7498 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7499 /* CLFE Pin: output 2 (0x0e) */
7500 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7501 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7502 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7503 /* Side Pin: output 3 (0x0f) */
7504 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7505 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7506 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7507 /* Mic (rear) pin: input vref at 80% */
7508 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7510 /* Front Mic pin: input vref at 80% */
7511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7513 /* Line In pin: input */
7514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7517 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7521 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7523 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7524 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7525 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7530 /* ADC2: mute amp left and right */
7531 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7532 /* ADC3: mute amp left and right */
7533 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7538 static struct hda_verb alc885_init_input_verbs[] = {
7539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7540 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7546 /* Unmute Selector 24h and set the default input to front mic */
7547 static struct hda_verb alc889_init_input_verbs[] = {
7548 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7554 #define alc883_init_verbs alc882_base_init_verbs
7557 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7558 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7559 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7560 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7561 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7562 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7563 /* FIXME: this looks suspicious...
7564 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7565 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7570 static struct hda_verb alc882_macpro_init_verbs[] = {
7571 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7573 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7574 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7575 /* Front Pin: output 0 (0x0c) */
7576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 /* Front Mic pin: input vref at 80% */
7580 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7581 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7582 /* Speaker: output */
7583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7584 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7585 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7586 /* Headphone output (output 0 - 0x0c) */
7587 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7589 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7591 /* FIXME: use matrix-type input source selection */
7592 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7593 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7599 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7600 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7601 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7602 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7606 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7607 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7608 /* ADC1: mute amp left and right */
7609 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7610 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7611 /* ADC2: mute amp left and right */
7612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7613 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7614 /* ADC3: mute amp left and right */
7615 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7616 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7622 static struct hda_verb alc885_mb5_init_verbs[] = {
7624 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7625 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7626 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7627 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7629 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7630 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7631 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7632 /* Surround mixer */
7633 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7634 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7637 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7638 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7641 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7642 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7643 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7644 /* Front Pin (0x0c) */
7645 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7647 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7648 /* LFE Pin (0x0e) */
7649 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7650 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7651 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7656 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7657 /* Front Mic pin: input vref at 80% */
7658 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7661 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7662 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7664 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7665 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7666 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7667 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7671 /* Macbook Pro rev3 */
7672 static struct hda_verb alc885_mbp3_init_verbs[] = {
7673 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7676 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7678 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7685 /* Front Pin: output 0 (0x0c) */
7686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7688 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7689 /* HP Pin: output 0 (0x0e) */
7690 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7691 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7692 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7693 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7694 /* Mic (rear) pin: input vref at 80% */
7695 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7697 /* Front Mic pin: input vref at 80% */
7698 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7699 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7700 /* Line In pin: use output 1 when in LineOut mode */
7701 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7702 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7703 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7705 /* FIXME: use matrix-type input source selection */
7706 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7707 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7710 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7711 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7715 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7716 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7720 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7721 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7722 /* ADC1: mute amp left and right */
7723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7724 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7725 /* ADC2: mute amp left and right */
7726 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7727 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7728 /* ADC3: mute amp left and right */
7729 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7730 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7736 static struct hda_verb alc885_imac91_init_verbs[] = {
7737 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7738 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7739 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7740 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7742 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7743 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7744 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7745 /* HP Pin: output 0 (0x0c) */
7746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7747 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7748 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7749 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7750 /* Internal Speakers: output 0 (0x0d) */
7751 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7752 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7753 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7754 /* Mic (rear) pin: input vref at 80% */
7755 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7756 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7757 /* Front Mic pin: input vref at 80% */
7758 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7759 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7760 /* Line In pin: use output 1 when in LineOut mode */
7761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7763 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7765 /* FIXME: use matrix-type input source selection */
7766 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7767 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7768 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7769 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7770 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7771 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7773 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7774 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7775 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7776 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7778 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7779 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7780 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7781 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7782 /* ADC1: mute amp left and right */
7783 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7784 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7785 /* ADC2: mute amp left and right */
7786 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7787 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7788 /* ADC3: mute amp left and right */
7789 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7790 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7795 /* iMac 24 mixer. */
7796 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7797 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7798 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7802 /* iMac 24 init verbs. */
7803 static struct hda_verb alc885_imac24_init_verbs[] = {
7804 /* Internal speakers: output 0 (0x0c) */
7805 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7806 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7807 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7808 /* Internal speakers: output 0 (0x0c) */
7809 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7810 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7811 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7812 /* Headphone: output 0 (0x0c) */
7813 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7814 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7815 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7816 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7817 /* Front Mic: input vref at 80% */
7818 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7819 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7823 /* Toggle speaker-output according to the hp-jack state */
7824 static void alc885_imac24_setup(struct hda_codec *codec)
7826 struct alc_spec *spec = codec->spec;
7828 spec->autocfg.hp_pins[0] = 0x14;
7829 spec->autocfg.speaker_pins[0] = 0x18;
7830 spec->autocfg.speaker_pins[1] = 0x1a;
7833 static void alc885_mbp3_setup(struct hda_codec *codec)
7835 struct alc_spec *spec = codec->spec;
7837 spec->autocfg.hp_pins[0] = 0x15;
7838 spec->autocfg.speaker_pins[0] = 0x14;
7841 static void alc885_mb5_automute(struct hda_codec *codec)
7843 unsigned int present;
7845 present = snd_hda_codec_read(codec, 0x14, 0,
7846 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7847 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7848 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7849 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7854 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7857 /* Headphone insertion or removal. */
7858 if ((res >> 26) == ALC880_HP_EVENT)
7859 alc885_mb5_automute(codec);
7862 static void alc885_imac91_automute(struct hda_codec *codec)
7864 unsigned int present;
7866 present = snd_hda_codec_read(codec, 0x14, 0,
7867 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7868 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7869 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7870 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7871 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7875 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7878 /* Headphone insertion or removal. */
7879 if ((res >> 26) == ALC880_HP_EVENT)
7880 alc885_imac91_automute(codec);
7883 static struct hda_verb alc882_targa_verbs[] = {
7884 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7885 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7890 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7891 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7892 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7894 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7898 /* toggle speaker-output according to the hp-jack state */
7899 static void alc882_targa_automute(struct hda_codec *codec)
7901 struct alc_spec *spec = codec->spec;
7902 alc_automute_amp(codec);
7903 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7904 spec->jack_present ? 1 : 3);
7907 static void alc882_targa_setup(struct hda_codec *codec)
7909 struct alc_spec *spec = codec->spec;
7911 spec->autocfg.hp_pins[0] = 0x14;
7912 spec->autocfg.speaker_pins[0] = 0x1b;
7915 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7917 if ((res >> 26) == ALC880_HP_EVENT)
7918 alc882_targa_automute(codec);
7921 static struct hda_verb alc882_asus_a7j_verbs[] = {
7922 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7923 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7926 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7927 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7929 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7930 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7931 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7933 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7934 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7935 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7939 static struct hda_verb alc882_asus_a7m_verbs[] = {
7940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7944 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7945 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7947 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7948 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7949 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7951 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7952 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7953 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7957 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7959 unsigned int gpiostate, gpiomask, gpiodir;
7961 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7962 AC_VERB_GET_GPIO_DATA, 0);
7965 gpiostate |= (1 << pin);
7967 gpiostate &= ~(1 << pin);
7969 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7970 AC_VERB_GET_GPIO_MASK, 0);
7971 gpiomask |= (1 << pin);
7973 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7974 AC_VERB_GET_GPIO_DIRECTION, 0);
7975 gpiodir |= (1 << pin);
7978 snd_hda_codec_write(codec, codec->afg, 0,
7979 AC_VERB_SET_GPIO_MASK, gpiomask);
7980 snd_hda_codec_write(codec, codec->afg, 0,
7981 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7985 snd_hda_codec_write(codec, codec->afg, 0,
7986 AC_VERB_SET_GPIO_DATA, gpiostate);
7989 /* set up GPIO at initialization */
7990 static void alc885_macpro_init_hook(struct hda_codec *codec)
7992 alc882_gpio_mute(codec, 0, 0);
7993 alc882_gpio_mute(codec, 1, 0);
7996 /* set up GPIO and update auto-muting at initialization */
7997 static void alc885_imac24_init_hook(struct hda_codec *codec)
7999 alc885_macpro_init_hook(codec);
8000 alc_automute_amp(codec);
8004 * generic initialization of ADC, input mixers and output mixers
8006 static struct hda_verb alc883_auto_init_verbs[] = {
8008 * Unmute ADC0-2 and set the default input to mic-in
8010 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8011 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8012 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8013 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8015 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
8017 * Note: PASD motherboards uses the Line In 2 as the input for
8018 * front panel mic (mic 2)
8020 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8028 * Set up output mixers (0x0c - 0x0f)
8030 /* set vol=0 to output mixers */
8031 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8032 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8035 /* set up input amps for analog loopback */
8036 /* Amp Indices: DAC = 0, mixer = 1 */
8037 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8038 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8039 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8040 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8041 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8042 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8043 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8044 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8045 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8046 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8048 /* FIXME: use matrix-type input source selection */
8049 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8051 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8052 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8053 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8054 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8056 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8057 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8058 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8059 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8064 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8065 static struct hda_verb alc889A_mb31_ch2_init[] = {
8066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8068 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8069 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8073 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8074 static struct hda_verb alc889A_mb31_ch4_init[] = {
8075 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8076 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8077 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8078 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8082 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8083 static struct hda_verb alc889A_mb31_ch5_init[] = {
8084 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8085 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8087 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8091 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8092 static struct hda_verb alc889A_mb31_ch6_init[] = {
8093 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8094 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8095 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8096 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8100 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8101 { 2, alc889A_mb31_ch2_init },
8102 { 4, alc889A_mb31_ch4_init },
8103 { 5, alc889A_mb31_ch5_init },
8104 { 6, alc889A_mb31_ch6_init },
8107 static struct hda_verb alc883_medion_eapd_verbs[] = {
8108 /* eanable EAPD on medion laptop */
8109 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8110 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8114 #define alc883_base_mixer alc882_base_mixer
8116 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8117 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8118 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8119 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8120 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8121 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8122 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8123 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8124 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8126 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8128 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8129 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8133 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8134 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8135 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8136 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8139 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8140 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8141 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8143 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8147 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8148 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8149 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8151 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8153 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8155 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8157 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8161 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8162 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8165 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8166 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8167 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8168 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8171 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8178 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8180 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8181 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8183 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8185 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8186 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8188 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8189 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8197 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8201 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8202 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8203 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8204 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8205 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8206 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8211 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8212 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8213 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8217 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8221 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8225 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8227 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8229 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8230 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8232 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8233 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8234 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8236 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8238 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8239 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8244 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8245 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8249 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8250 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8251 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8252 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8253 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8254 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8256 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8257 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8258 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8260 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8263 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8268 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8272 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8273 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8274 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8276 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8277 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8278 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8279 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8280 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8281 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8282 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8283 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8284 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8293 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8296 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8297 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8298 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8299 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8300 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8301 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8302 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8305 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8309 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8310 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8311 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8313 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8314 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8318 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8323 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8324 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8326 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8330 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8331 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8332 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8334 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8335 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8338 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8339 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8343 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8345 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8346 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8347 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8348 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8351 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8352 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8356 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8357 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8358 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8360 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8361 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8363 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8368 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8370 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8371 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8372 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8375 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8376 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8383 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8384 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8385 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8386 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8387 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8388 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8389 0x0d, 1, 0x0, HDA_OUTPUT),
8390 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8391 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8392 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8393 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8394 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8395 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8396 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8398 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8401 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8402 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8403 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8404 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8408 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8410 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8411 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8412 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8413 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8414 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8416 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8417 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8418 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8419 /* Output switches */
8420 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8421 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8422 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8424 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8425 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8434 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8435 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8436 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8437 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8439 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8444 static struct hda_bind_ctls alc883_bind_cap_vol = {
8445 .ops = &snd_hda_bind_vol,
8447 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8448 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8453 static struct hda_bind_ctls alc883_bind_cap_switch = {
8454 .ops = &snd_hda_bind_sw,
8456 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8457 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8462 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8463 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8464 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8465 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8466 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8467 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8469 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8470 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8474 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8475 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8476 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8478 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8479 /* .name = "Capture Source", */
8480 .name = "Input Source",
8482 .info = alc_mux_enum_info,
8483 .get = alc_mux_enum_get,
8484 .put = alc_mux_enum_put,
8489 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8491 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8492 .name = "Channel Mode",
8493 .info = alc_ch_mode_info,
8494 .get = alc_ch_mode_get,
8495 .put = alc_ch_mode_put,
8500 /* toggle speaker-output according to the hp-jack state */
8501 static void alc883_mitac_setup(struct hda_codec *codec)
8503 struct alc_spec *spec = codec->spec;
8505 spec->autocfg.hp_pins[0] = 0x15;
8506 spec->autocfg.speaker_pins[0] = 0x14;
8507 spec->autocfg.speaker_pins[1] = 0x17;
8510 /* auto-toggle front mic */
8512 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8514 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8516 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8520 static struct hda_verb alc883_mitac_verbs[] = {
8522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8525 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8526 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8528 /* enable unsolicited event */
8529 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8530 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8535 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8537 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8538 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8540 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8542 /* enable unsolicited event */
8544 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8545 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8551 static struct hda_verb alc883_clevo_m720_verbs[] = {
8553 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8554 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8556 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8557 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8559 /* enable unsolicited event */
8560 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8561 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8566 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8568 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8569 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8571 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8574 /* enable unsolicited event */
8575 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8580 static struct hda_verb alc883_targa_verbs[] = {
8581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8582 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8585 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8587 /* Connect Line-Out side jack (SPDIF) to Side */
8588 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8589 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8590 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8591 /* Connect Mic jack to CLFE */
8592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8594 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8595 /* Connect Line-in jack to Surround */
8596 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8597 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8598 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8599 /* Connect HP out jack to Front */
8600 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8601 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8602 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8604 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8609 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8610 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8611 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8612 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8616 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8619 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8620 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8624 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8627 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8628 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8629 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8633 static struct hda_verb alc883_haier_w66_verbs[] = {
8634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8635 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8637 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8639 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8640 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8641 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8642 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8646 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8647 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8648 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8649 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8650 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8652 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8653 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8654 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8658 static struct hda_verb alc888_6st_dell_verbs[] = {
8659 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8663 static struct hda_verb alc883_vaiott_verbs[] = {
8665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8668 /* enable unsolicited event */
8669 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8674 static void alc888_3st_hp_setup(struct hda_codec *codec)
8676 struct alc_spec *spec = codec->spec;
8678 spec->autocfg.hp_pins[0] = 0x1b;
8679 spec->autocfg.speaker_pins[0] = 0x14;
8680 spec->autocfg.speaker_pins[1] = 0x16;
8681 spec->autocfg.speaker_pins[2] = 0x18;
8684 static struct hda_verb alc888_3st_hp_verbs[] = {
8685 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8686 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8687 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8688 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8695 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8696 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8697 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8698 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8699 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8706 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8707 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8708 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8709 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8710 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8711 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8718 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8719 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8720 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8721 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8722 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8723 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8724 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8728 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8729 { 2, alc888_3st_hp_2ch_init },
8730 { 4, alc888_3st_hp_4ch_init },
8731 { 6, alc888_3st_hp_6ch_init },
8734 /* toggle front-jack and RCA according to the hp-jack state */
8735 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8737 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8739 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8740 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8741 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8742 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8745 /* toggle RCA according to the front-jack state */
8746 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8748 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8750 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8751 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8754 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8757 if ((res >> 26) == ALC880_HP_EVENT)
8758 alc888_lenovo_ms7195_front_automute(codec);
8759 if ((res >> 26) == ALC880_FRONT_EVENT)
8760 alc888_lenovo_ms7195_rca_automute(codec);
8763 static struct hda_verb alc883_medion_md2_verbs[] = {
8764 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8765 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8767 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8769 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8773 /* toggle speaker-output according to the hp-jack state */
8774 static void alc883_medion_md2_setup(struct hda_codec *codec)
8776 struct alc_spec *spec = codec->spec;
8778 spec->autocfg.hp_pins[0] = 0x14;
8779 spec->autocfg.speaker_pins[0] = 0x15;
8782 /* toggle speaker-output according to the hp-jack state */
8783 #define alc883_targa_init_hook alc882_targa_init_hook
8784 #define alc883_targa_unsol_event alc882_targa_unsol_event
8786 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8788 unsigned int present;
8790 present = snd_hda_jack_detect(codec, 0x18);
8791 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8792 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8795 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8799 spec->autocfg.hp_pins[0] = 0x15;
8800 spec->autocfg.speaker_pins[0] = 0x14;
8803 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8805 alc_automute_amp(codec);
8806 alc883_clevo_m720_mic_automute(codec);
8809 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8812 switch (res >> 26) {
8813 case ALC880_MIC_EVENT:
8814 alc883_clevo_m720_mic_automute(codec);
8817 alc_automute_amp_unsol_event(codec, res);
8822 /* toggle speaker-output according to the hp-jack state */
8823 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8825 struct alc_spec *spec = codec->spec;
8827 spec->autocfg.hp_pins[0] = 0x14;
8828 spec->autocfg.speaker_pins[0] = 0x15;
8831 static void alc883_haier_w66_setup(struct hda_codec *codec)
8833 struct alc_spec *spec = codec->spec;
8835 spec->autocfg.hp_pins[0] = 0x1b;
8836 spec->autocfg.speaker_pins[0] = 0x14;
8839 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8841 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8843 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8844 HDA_AMP_MUTE, bits);
8847 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8849 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8851 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8852 HDA_AMP_MUTE, bits);
8853 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8854 HDA_AMP_MUTE, bits);
8857 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8860 if ((res >> 26) == ALC880_HP_EVENT)
8861 alc883_lenovo_101e_all_automute(codec);
8862 if ((res >> 26) == ALC880_FRONT_EVENT)
8863 alc883_lenovo_101e_ispeaker_automute(codec);
8866 /* toggle speaker-output according to the hp-jack state */
8867 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8869 struct alc_spec *spec = codec->spec;
8871 spec->autocfg.hp_pins[0] = 0x14;
8872 spec->autocfg.speaker_pins[0] = 0x15;
8873 spec->autocfg.speaker_pins[1] = 0x16;
8876 static struct hda_verb alc883_acer_eapd_verbs[] = {
8877 /* HP Pin: output 0 (0x0c) */
8878 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8879 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8880 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8881 /* Front Pin: output 0 (0x0c) */
8882 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8883 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8884 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8885 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8886 /* eanable EAPD on medion laptop */
8887 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8888 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8889 /* enable unsolicited event */
8890 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8894 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8896 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8897 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8901 static void alc888_6st_dell_setup(struct hda_codec *codec)
8903 struct alc_spec *spec = codec->spec;
8905 spec->autocfg.hp_pins[0] = 0x1b;
8906 spec->autocfg.speaker_pins[0] = 0x14;
8907 spec->autocfg.speaker_pins[1] = 0x15;
8908 spec->autocfg.speaker_pins[2] = 0x16;
8909 spec->autocfg.speaker_pins[3] = 0x17;
8912 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8914 struct alc_spec *spec = codec->spec;
8916 spec->autocfg.hp_pins[0] = 0x1b;
8917 spec->autocfg.speaker_pins[0] = 0x14;
8918 spec->autocfg.speaker_pins[1] = 0x15;
8919 spec->autocfg.speaker_pins[2] = 0x16;
8920 spec->autocfg.speaker_pins[3] = 0x17;
8921 spec->autocfg.speaker_pins[4] = 0x1a;
8924 static void alc883_vaiott_setup(struct hda_codec *codec)
8926 struct alc_spec *spec = codec->spec;
8928 spec->autocfg.hp_pins[0] = 0x15;
8929 spec->autocfg.speaker_pins[0] = 0x14;
8930 spec->autocfg.speaker_pins[1] = 0x17;
8933 static struct hda_verb alc888_asus_m90v_verbs[] = {
8934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8937 /* enable unsolicited event */
8938 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8939 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8943 static void alc883_mode2_setup(struct hda_codec *codec)
8945 struct alc_spec *spec = codec->spec;
8947 spec->autocfg.hp_pins[0] = 0x1b;
8948 spec->autocfg.speaker_pins[0] = 0x14;
8949 spec->autocfg.speaker_pins[1] = 0x15;
8950 spec->autocfg.speaker_pins[2] = 0x16;
8951 spec->ext_mic.pin = 0x18;
8952 spec->int_mic.pin = 0x19;
8953 spec->ext_mic.mux_idx = 0;
8954 spec->int_mic.mux_idx = 1;
8958 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8959 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8960 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8961 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8964 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8965 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8966 /* enable unsolicited event */
8967 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8971 static void alc883_eee1601_inithook(struct hda_codec *codec)
8973 struct alc_spec *spec = codec->spec;
8975 spec->autocfg.hp_pins[0] = 0x14;
8976 spec->autocfg.speaker_pins[0] = 0x1b;
8977 alc_automute_pin(codec);
8980 static struct hda_verb alc889A_mb31_verbs[] = {
8981 /* Init rear pin (used as headphone output) */
8982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8983 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8985 /* Init line pin (used as output in 4ch and 6ch mode) */
8986 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8987 /* Init line 2 pin (used as headphone out by default) */
8988 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8989 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8993 /* Mute speakers according to the headphone jack state */
8994 static void alc889A_mb31_automute(struct hda_codec *codec)
8996 unsigned int present;
8998 /* Mute only in 2ch or 4ch mode */
8999 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9001 present = snd_hda_jack_detect(codec, 0x15);
9002 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9003 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9004 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9005 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9009 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9011 if ((res >> 26) == ALC880_HP_EVENT)
9012 alc889A_mb31_automute(codec);
9016 #ifdef CONFIG_SND_HDA_POWER_SAVE
9017 #define alc882_loopbacks alc880_loopbacks
9020 /* pcm configuration: identical with ALC880 */
9021 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9022 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9023 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9024 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9026 static hda_nid_t alc883_slave_dig_outs[] = {
9027 ALC1200_DIGOUT_NID, 0,
9030 static hda_nid_t alc1200_slave_dig_outs[] = {
9031 ALC883_DIGOUT_NID, 0,
9035 * configuration and preset
9037 static const char *alc882_models[ALC882_MODEL_LAST] = {
9038 [ALC882_3ST_DIG] = "3stack-dig",
9039 [ALC882_6ST_DIG] = "6stack-dig",
9040 [ALC882_ARIMA] = "arima",
9041 [ALC882_W2JC] = "w2jc",
9042 [ALC882_TARGA] = "targa",
9043 [ALC882_ASUS_A7J] = "asus-a7j",
9044 [ALC882_ASUS_A7M] = "asus-a7m",
9045 [ALC885_MACPRO] = "macpro",
9046 [ALC885_MB5] = "mb5",
9047 [ALC885_MBP3] = "mbp3",
9048 [ALC885_IMAC24] = "imac24",
9049 [ALC885_IMAC91] = "imac91",
9050 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9051 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9052 [ALC883_3ST_6ch] = "3stack-6ch",
9053 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9054 [ALC883_TARGA_DIG] = "targa-dig",
9055 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9056 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9057 [ALC883_ACER] = "acer",
9058 [ALC883_ACER_ASPIRE] = "acer-aspire",
9059 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9060 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9061 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9062 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9063 [ALC883_MEDION] = "medion",
9064 [ALC883_MEDION_MD2] = "medion-md2",
9065 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9066 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9067 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9068 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9069 [ALC888_LENOVO_SKY] = "lenovo-sky",
9070 [ALC883_HAIER_W66] = "haier-w66",
9071 [ALC888_3ST_HP] = "3stack-hp",
9072 [ALC888_6ST_DELL] = "6stack-dell",
9073 [ALC883_MITAC] = "mitac",
9074 [ALC883_CLEVO_M540R] = "clevo-m540r",
9075 [ALC883_CLEVO_M720] = "clevo-m720",
9076 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9077 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9078 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9079 [ALC889A_INTEL] = "intel-alc889a",
9080 [ALC889_INTEL] = "intel-x58",
9081 [ALC1200_ASUS_P5Q] = "asus-p5q",
9082 [ALC889A_MB31] = "mb31",
9083 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9084 [ALC882_AUTO] = "auto",
9087 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9088 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9090 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9091 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9092 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9093 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9094 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9095 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9096 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9097 ALC888_ACER_ASPIRE_4930G),
9098 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9099 ALC888_ACER_ASPIRE_4930G),
9100 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9101 ALC888_ACER_ASPIRE_8930G),
9102 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9103 ALC888_ACER_ASPIRE_8930G),
9104 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9105 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9106 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9107 ALC888_ACER_ASPIRE_6530G),
9108 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9109 ALC888_ACER_ASPIRE_6530G),
9110 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9111 ALC888_ACER_ASPIRE_7730G),
9112 /* default Acer -- disabled as it causes more problems.
9113 * model=auto should work fine now
9115 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9117 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9119 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9120 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9121 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9122 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9123 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9124 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9126 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9127 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9128 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9129 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9130 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9131 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9132 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9133 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9134 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9135 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9136 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9138 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9139 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9140 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9141 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9142 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9143 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9144 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9145 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9146 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9148 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9149 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9150 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9151 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9152 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9153 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9154 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9155 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9156 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9157 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9158 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9159 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9160 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9161 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9162 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9163 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9164 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9165 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9166 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9167 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9168 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9169 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9170 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9171 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9172 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9173 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9174 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9175 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9176 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9178 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9179 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9180 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9181 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9182 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9183 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9184 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9185 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9186 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9187 ALC883_FUJITSU_PI2515),
9188 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9189 ALC888_FUJITSU_XA3530),
9190 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9191 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9192 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9193 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9194 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9195 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9196 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9197 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9198 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9200 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9201 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9202 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9203 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9204 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9205 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9206 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9211 /* codec SSID table for Intel Mac */
9212 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9213 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9214 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9215 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9216 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9217 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9218 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9219 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9220 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9221 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9222 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9223 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9224 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9225 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9226 * so apparently no perfect solution yet
9228 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9229 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9233 static struct alc_config_preset alc882_presets[] = {
9234 [ALC882_3ST_DIG] = {
9235 .mixers = { alc882_base_mixer },
9236 .init_verbs = { alc882_base_init_verbs,
9237 alc882_adc1_init_verbs },
9238 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9239 .dac_nids = alc882_dac_nids,
9240 .dig_out_nid = ALC882_DIGOUT_NID,
9241 .dig_in_nid = ALC882_DIGIN_NID,
9242 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9243 .channel_mode = alc882_ch_modes,
9245 .input_mux = &alc882_capture_source,
9247 [ALC882_6ST_DIG] = {
9248 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9249 .init_verbs = { alc882_base_init_verbs,
9250 alc882_adc1_init_verbs },
9251 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9252 .dac_nids = alc882_dac_nids,
9253 .dig_out_nid = ALC882_DIGOUT_NID,
9254 .dig_in_nid = ALC882_DIGIN_NID,
9255 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9256 .channel_mode = alc882_sixstack_modes,
9257 .input_mux = &alc882_capture_source,
9260 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9261 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9262 alc882_eapd_verbs },
9263 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9264 .dac_nids = alc882_dac_nids,
9265 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9266 .channel_mode = alc882_sixstack_modes,
9267 .input_mux = &alc882_capture_source,
9270 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9271 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9272 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9273 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9274 .dac_nids = alc882_dac_nids,
9275 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9276 .channel_mode = alc880_threestack_modes,
9278 .input_mux = &alc882_capture_source,
9279 .dig_out_nid = ALC882_DIGOUT_NID,
9282 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9283 .init_verbs = { alc885_mbp3_init_verbs,
9284 alc880_gpio1_init_verbs },
9286 .dac_nids = alc882_dac_nids,
9288 .channel_mode = alc885_mbp_4ch_modes,
9289 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9290 .input_mux = &alc882_capture_source,
9291 .dig_out_nid = ALC882_DIGOUT_NID,
9292 .dig_in_nid = ALC882_DIGIN_NID,
9293 .unsol_event = alc_automute_amp_unsol_event,
9294 .setup = alc885_mbp3_setup,
9295 .init_hook = alc_automute_amp,
9298 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9299 .init_verbs = { alc885_mb5_init_verbs,
9300 alc880_gpio1_init_verbs },
9301 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9302 .dac_nids = alc882_dac_nids,
9303 .channel_mode = alc885_mb5_6ch_modes,
9304 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9305 .input_mux = &mb5_capture_source,
9306 .dig_out_nid = ALC882_DIGOUT_NID,
9307 .dig_in_nid = ALC882_DIGIN_NID,
9308 .unsol_event = alc885_mb5_unsol_event,
9309 .init_hook = alc885_mb5_automute,
9312 .mixers = { alc882_macpro_mixer },
9313 .init_verbs = { alc882_macpro_init_verbs },
9314 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9315 .dac_nids = alc882_dac_nids,
9316 .dig_out_nid = ALC882_DIGOUT_NID,
9317 .dig_in_nid = ALC882_DIGIN_NID,
9318 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9319 .channel_mode = alc882_ch_modes,
9320 .input_mux = &alc882_capture_source,
9321 .init_hook = alc885_macpro_init_hook,
9324 .mixers = { alc885_imac24_mixer },
9325 .init_verbs = { alc885_imac24_init_verbs },
9326 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9327 .dac_nids = alc882_dac_nids,
9328 .dig_out_nid = ALC882_DIGOUT_NID,
9329 .dig_in_nid = ALC882_DIGIN_NID,
9330 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9331 .channel_mode = alc882_ch_modes,
9332 .input_mux = &alc882_capture_source,
9333 .unsol_event = alc_automute_amp_unsol_event,
9334 .setup = alc885_imac24_setup,
9335 .init_hook = alc885_imac24_init_hook,
9338 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9339 .init_verbs = { alc885_imac91_init_verbs,
9340 alc880_gpio1_init_verbs },
9341 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9342 .dac_nids = alc882_dac_nids,
9343 .channel_mode = alc885_mbp_4ch_modes,
9344 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9345 .input_mux = &alc882_capture_source,
9346 .dig_out_nid = ALC882_DIGOUT_NID,
9347 .dig_in_nid = ALC882_DIGIN_NID,
9348 .unsol_event = alc885_imac91_unsol_event,
9349 .init_hook = alc885_imac91_automute,
9352 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9353 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9354 alc880_gpio3_init_verbs, alc882_targa_verbs},
9355 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9356 .dac_nids = alc882_dac_nids,
9357 .dig_out_nid = ALC882_DIGOUT_NID,
9358 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9359 .adc_nids = alc882_adc_nids,
9360 .capsrc_nids = alc882_capsrc_nids,
9361 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9362 .channel_mode = alc882_3ST_6ch_modes,
9364 .input_mux = &alc882_capture_source,
9365 .unsol_event = alc882_targa_unsol_event,
9366 .setup = alc882_targa_setup,
9367 .init_hook = alc882_targa_automute,
9369 [ALC882_ASUS_A7J] = {
9370 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9371 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9372 alc882_asus_a7j_verbs},
9373 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9374 .dac_nids = alc882_dac_nids,
9375 .dig_out_nid = ALC882_DIGOUT_NID,
9376 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9377 .adc_nids = alc882_adc_nids,
9378 .capsrc_nids = alc882_capsrc_nids,
9379 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9380 .channel_mode = alc882_3ST_6ch_modes,
9382 .input_mux = &alc882_capture_source,
9384 [ALC882_ASUS_A7M] = {
9385 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9386 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9387 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9388 alc882_asus_a7m_verbs },
9389 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9390 .dac_nids = alc882_dac_nids,
9391 .dig_out_nid = ALC882_DIGOUT_NID,
9392 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9393 .channel_mode = alc880_threestack_modes,
9395 .input_mux = &alc882_capture_source,
9397 [ALC883_3ST_2ch_DIG] = {
9398 .mixers = { alc883_3ST_2ch_mixer },
9399 .init_verbs = { alc883_init_verbs },
9400 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9401 .dac_nids = alc883_dac_nids,
9402 .dig_out_nid = ALC883_DIGOUT_NID,
9403 .dig_in_nid = ALC883_DIGIN_NID,
9404 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9405 .channel_mode = alc883_3ST_2ch_modes,
9406 .input_mux = &alc883_capture_source,
9408 [ALC883_3ST_6ch_DIG] = {
9409 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9410 .init_verbs = { alc883_init_verbs },
9411 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9412 .dac_nids = alc883_dac_nids,
9413 .dig_out_nid = ALC883_DIGOUT_NID,
9414 .dig_in_nid = ALC883_DIGIN_NID,
9415 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9416 .channel_mode = alc883_3ST_6ch_modes,
9418 .input_mux = &alc883_capture_source,
9420 [ALC883_3ST_6ch] = {
9421 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9422 .init_verbs = { alc883_init_verbs },
9423 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9424 .dac_nids = alc883_dac_nids,
9425 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9426 .channel_mode = alc883_3ST_6ch_modes,
9428 .input_mux = &alc883_capture_source,
9430 [ALC883_3ST_6ch_INTEL] = {
9431 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9432 .init_verbs = { alc883_init_verbs },
9433 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9434 .dac_nids = alc883_dac_nids,
9435 .dig_out_nid = ALC883_DIGOUT_NID,
9436 .dig_in_nid = ALC883_DIGIN_NID,
9437 .slave_dig_outs = alc883_slave_dig_outs,
9438 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9439 .channel_mode = alc883_3ST_6ch_intel_modes,
9441 .input_mux = &alc883_3stack_6ch_intel,
9444 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9445 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9446 alc_hp15_unsol_verbs },
9447 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9448 .dac_nids = alc883_dac_nids,
9449 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9450 .adc_nids = alc889_adc_nids,
9451 .dig_out_nid = ALC883_DIGOUT_NID,
9452 .dig_in_nid = ALC883_DIGIN_NID,
9453 .slave_dig_outs = alc883_slave_dig_outs,
9454 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9455 .channel_mode = alc889_8ch_intel_modes,
9456 .capsrc_nids = alc889_capsrc_nids,
9457 .input_mux = &alc889_capture_source,
9458 .setup = alc889_automute_setup,
9459 .init_hook = alc_automute_amp,
9460 .unsol_event = alc_automute_amp_unsol_event,
9464 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9465 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9466 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9467 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9468 .dac_nids = alc883_dac_nids,
9469 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9470 .adc_nids = alc889_adc_nids,
9471 .dig_out_nid = ALC883_DIGOUT_NID,
9472 .dig_in_nid = ALC883_DIGIN_NID,
9473 .slave_dig_outs = alc883_slave_dig_outs,
9474 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9475 .channel_mode = alc889_8ch_intel_modes,
9476 .capsrc_nids = alc889_capsrc_nids,
9477 .input_mux = &alc889_capture_source,
9478 .setup = alc889_automute_setup,
9479 .init_hook = alc889_intel_init_hook,
9480 .unsol_event = alc_automute_amp_unsol_event,
9483 [ALC883_6ST_DIG] = {
9484 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9485 .init_verbs = { alc883_init_verbs },
9486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9487 .dac_nids = alc883_dac_nids,
9488 .dig_out_nid = ALC883_DIGOUT_NID,
9489 .dig_in_nid = ALC883_DIGIN_NID,
9490 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9491 .channel_mode = alc883_sixstack_modes,
9492 .input_mux = &alc883_capture_source,
9494 [ALC883_TARGA_DIG] = {
9495 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9496 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9497 alc883_targa_verbs},
9498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9499 .dac_nids = alc883_dac_nids,
9500 .dig_out_nid = ALC883_DIGOUT_NID,
9501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9502 .channel_mode = alc883_3ST_6ch_modes,
9504 .input_mux = &alc883_capture_source,
9505 .unsol_event = alc883_targa_unsol_event,
9506 .setup = alc882_targa_setup,
9507 .init_hook = alc882_targa_automute,
9509 [ALC883_TARGA_2ch_DIG] = {
9510 .mixers = { alc883_targa_2ch_mixer},
9511 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9512 alc883_targa_verbs},
9513 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9514 .dac_nids = alc883_dac_nids,
9515 .adc_nids = alc883_adc_nids_alt,
9516 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9517 .capsrc_nids = alc883_capsrc_nids,
9518 .dig_out_nid = ALC883_DIGOUT_NID,
9519 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9520 .channel_mode = alc883_3ST_2ch_modes,
9521 .input_mux = &alc883_capture_source,
9522 .unsol_event = alc883_targa_unsol_event,
9523 .setup = alc882_targa_setup,
9524 .init_hook = alc882_targa_automute,
9526 [ALC883_TARGA_8ch_DIG] = {
9527 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9528 alc883_chmode_mixer },
9529 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9530 alc883_targa_verbs },
9531 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9532 .dac_nids = alc883_dac_nids,
9533 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9534 .adc_nids = alc883_adc_nids_rev,
9535 .capsrc_nids = alc883_capsrc_nids_rev,
9536 .dig_out_nid = ALC883_DIGOUT_NID,
9537 .dig_in_nid = ALC883_DIGIN_NID,
9538 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9539 .channel_mode = alc883_4ST_8ch_modes,
9541 .input_mux = &alc883_capture_source,
9542 .unsol_event = alc883_targa_unsol_event,
9543 .setup = alc882_targa_setup,
9544 .init_hook = alc882_targa_automute,
9547 .mixers = { alc883_base_mixer },
9548 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9549 * and the headphone jack. Turn this on and rely on the
9550 * standard mute methods whenever the user wants to turn
9551 * these outputs off.
9553 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9554 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9555 .dac_nids = alc883_dac_nids,
9556 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9557 .channel_mode = alc883_3ST_2ch_modes,
9558 .input_mux = &alc883_capture_source,
9560 [ALC883_ACER_ASPIRE] = {
9561 .mixers = { alc883_acer_aspire_mixer },
9562 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9563 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9564 .dac_nids = alc883_dac_nids,
9565 .dig_out_nid = ALC883_DIGOUT_NID,
9566 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9567 .channel_mode = alc883_3ST_2ch_modes,
9568 .input_mux = &alc883_capture_source,
9569 .unsol_event = alc_automute_amp_unsol_event,
9570 .setup = alc883_acer_aspire_setup,
9571 .init_hook = alc_automute_amp,
9573 [ALC888_ACER_ASPIRE_4930G] = {
9574 .mixers = { alc888_base_mixer,
9575 alc883_chmode_mixer },
9576 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9577 alc888_acer_aspire_4930g_verbs },
9578 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9579 .dac_nids = alc883_dac_nids,
9580 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9581 .adc_nids = alc883_adc_nids_rev,
9582 .capsrc_nids = alc883_capsrc_nids_rev,
9583 .dig_out_nid = ALC883_DIGOUT_NID,
9584 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9585 .channel_mode = alc883_3ST_6ch_modes,
9588 ARRAY_SIZE(alc888_2_capture_sources),
9589 .input_mux = alc888_2_capture_sources,
9590 .unsol_event = alc_automute_amp_unsol_event,
9591 .setup = alc888_acer_aspire_4930g_setup,
9592 .init_hook = alc_automute_amp,
9594 [ALC888_ACER_ASPIRE_6530G] = {
9595 .mixers = { alc888_acer_aspire_6530_mixer },
9596 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9597 alc888_acer_aspire_6530g_verbs },
9598 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9599 .dac_nids = alc883_dac_nids,
9600 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9601 .adc_nids = alc883_adc_nids_rev,
9602 .capsrc_nids = alc883_capsrc_nids_rev,
9603 .dig_out_nid = ALC883_DIGOUT_NID,
9604 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9605 .channel_mode = alc883_3ST_2ch_modes,
9607 ARRAY_SIZE(alc888_2_capture_sources),
9608 .input_mux = alc888_acer_aspire_6530_sources,
9609 .unsol_event = alc_automute_amp_unsol_event,
9610 .setup = alc888_acer_aspire_6530g_setup,
9611 .init_hook = alc_automute_amp,
9613 [ALC888_ACER_ASPIRE_8930G] = {
9614 .mixers = { alc889_acer_aspire_8930g_mixer,
9615 alc883_chmode_mixer },
9616 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9617 alc889_acer_aspire_8930g_verbs,
9619 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9620 .dac_nids = alc883_dac_nids,
9621 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9622 .adc_nids = alc889_adc_nids,
9623 .capsrc_nids = alc889_capsrc_nids,
9624 .dig_out_nid = ALC883_DIGOUT_NID,
9625 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9626 .channel_mode = alc883_3ST_6ch_modes,
9628 .const_channel_count = 6,
9630 ARRAY_SIZE(alc889_capture_sources),
9631 .input_mux = alc889_capture_sources,
9632 .unsol_event = alc_automute_amp_unsol_event,
9633 .setup = alc889_acer_aspire_8930g_setup,
9634 .init_hook = alc_automute_amp,
9635 #ifdef CONFIG_SND_HDA_POWER_SAVE
9636 .power_hook = alc_power_eapd,
9639 [ALC888_ACER_ASPIRE_7730G] = {
9640 .mixers = { alc883_3ST_6ch_mixer,
9641 alc883_chmode_mixer },
9642 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9643 alc888_acer_aspire_7730G_verbs },
9644 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9645 .dac_nids = alc883_dac_nids,
9646 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9647 .adc_nids = alc883_adc_nids_rev,
9648 .capsrc_nids = alc883_capsrc_nids_rev,
9649 .dig_out_nid = ALC883_DIGOUT_NID,
9650 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9651 .channel_mode = alc883_3ST_6ch_modes,
9653 .const_channel_count = 6,
9654 .input_mux = &alc883_capture_source,
9655 .unsol_event = alc_automute_amp_unsol_event,
9656 .setup = alc888_acer_aspire_6530g_setup,
9657 .init_hook = alc_automute_amp,
9660 .mixers = { alc883_fivestack_mixer,
9661 alc883_chmode_mixer },
9662 .init_verbs = { alc883_init_verbs,
9663 alc883_medion_eapd_verbs },
9664 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9665 .dac_nids = alc883_dac_nids,
9666 .adc_nids = alc883_adc_nids_alt,
9667 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9668 .capsrc_nids = alc883_capsrc_nids,
9669 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9670 .channel_mode = alc883_sixstack_modes,
9671 .input_mux = &alc883_capture_source,
9673 [ALC883_MEDION_MD2] = {
9674 .mixers = { alc883_medion_md2_mixer},
9675 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9676 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9677 .dac_nids = alc883_dac_nids,
9678 .dig_out_nid = ALC883_DIGOUT_NID,
9679 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9680 .channel_mode = alc883_3ST_2ch_modes,
9681 .input_mux = &alc883_capture_source,
9682 .unsol_event = alc_automute_amp_unsol_event,
9683 .setup = alc883_medion_md2_setup,
9684 .init_hook = alc_automute_amp,
9686 [ALC883_LAPTOP_EAPD] = {
9687 .mixers = { alc883_base_mixer },
9688 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9690 .dac_nids = alc883_dac_nids,
9691 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9692 .channel_mode = alc883_3ST_2ch_modes,
9693 .input_mux = &alc883_capture_source,
9695 [ALC883_CLEVO_M540R] = {
9696 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9697 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9698 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9699 .dac_nids = alc883_dac_nids,
9700 .dig_out_nid = ALC883_DIGOUT_NID,
9701 .dig_in_nid = ALC883_DIGIN_NID,
9702 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9703 .channel_mode = alc883_3ST_6ch_clevo_modes,
9705 .input_mux = &alc883_capture_source,
9706 /* This machine has the hardware HP auto-muting, thus
9707 * we need no software mute via unsol event
9710 [ALC883_CLEVO_M720] = {
9711 .mixers = { alc883_clevo_m720_mixer },
9712 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9714 .dac_nids = alc883_dac_nids,
9715 .dig_out_nid = ALC883_DIGOUT_NID,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9717 .channel_mode = alc883_3ST_2ch_modes,
9718 .input_mux = &alc883_capture_source,
9719 .unsol_event = alc883_clevo_m720_unsol_event,
9720 .setup = alc883_clevo_m720_setup,
9721 .init_hook = alc883_clevo_m720_init_hook,
9723 [ALC883_LENOVO_101E_2ch] = {
9724 .mixers = { alc883_lenovo_101e_2ch_mixer},
9725 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9727 .dac_nids = alc883_dac_nids,
9728 .adc_nids = alc883_adc_nids_alt,
9729 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9730 .capsrc_nids = alc883_capsrc_nids,
9731 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9732 .channel_mode = alc883_3ST_2ch_modes,
9733 .input_mux = &alc883_lenovo_101e_capture_source,
9734 .unsol_event = alc883_lenovo_101e_unsol_event,
9735 .init_hook = alc883_lenovo_101e_all_automute,
9737 [ALC883_LENOVO_NB0763] = {
9738 .mixers = { alc883_lenovo_nb0763_mixer },
9739 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9741 .dac_nids = alc883_dac_nids,
9742 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9743 .channel_mode = alc883_3ST_2ch_modes,
9745 .input_mux = &alc883_lenovo_nb0763_capture_source,
9746 .unsol_event = alc_automute_amp_unsol_event,
9747 .setup = alc883_medion_md2_setup,
9748 .init_hook = alc_automute_amp,
9750 [ALC888_LENOVO_MS7195_DIG] = {
9751 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9752 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9753 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9754 .dac_nids = alc883_dac_nids,
9755 .dig_out_nid = ALC883_DIGOUT_NID,
9756 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9757 .channel_mode = alc883_3ST_6ch_modes,
9759 .input_mux = &alc883_capture_source,
9760 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9761 .init_hook = alc888_lenovo_ms7195_front_automute,
9763 [ALC883_HAIER_W66] = {
9764 .mixers = { alc883_targa_2ch_mixer},
9765 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9766 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9767 .dac_nids = alc883_dac_nids,
9768 .dig_out_nid = ALC883_DIGOUT_NID,
9769 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9770 .channel_mode = alc883_3ST_2ch_modes,
9771 .input_mux = &alc883_capture_source,
9772 .unsol_event = alc_automute_amp_unsol_event,
9773 .setup = alc883_haier_w66_setup,
9774 .init_hook = alc_automute_amp,
9777 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9778 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9780 .dac_nids = alc883_dac_nids,
9781 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9782 .channel_mode = alc888_3st_hp_modes,
9784 .input_mux = &alc883_capture_source,
9785 .unsol_event = alc_automute_amp_unsol_event,
9786 .setup = alc888_3st_hp_setup,
9787 .init_hook = alc_automute_amp,
9789 [ALC888_6ST_DELL] = {
9790 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9791 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9792 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9793 .dac_nids = alc883_dac_nids,
9794 .dig_out_nid = ALC883_DIGOUT_NID,
9795 .dig_in_nid = ALC883_DIGIN_NID,
9796 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9797 .channel_mode = alc883_sixstack_modes,
9798 .input_mux = &alc883_capture_source,
9799 .unsol_event = alc_automute_amp_unsol_event,
9800 .setup = alc888_6st_dell_setup,
9801 .init_hook = alc_automute_amp,
9804 .mixers = { alc883_mitac_mixer },
9805 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9806 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9807 .dac_nids = alc883_dac_nids,
9808 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9809 .channel_mode = alc883_3ST_2ch_modes,
9810 .input_mux = &alc883_capture_source,
9811 .unsol_event = alc_automute_amp_unsol_event,
9812 .setup = alc883_mitac_setup,
9813 .init_hook = alc_automute_amp,
9815 [ALC883_FUJITSU_PI2515] = {
9816 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9817 .init_verbs = { alc883_init_verbs,
9818 alc883_2ch_fujitsu_pi2515_verbs},
9819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9820 .dac_nids = alc883_dac_nids,
9821 .dig_out_nid = ALC883_DIGOUT_NID,
9822 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9823 .channel_mode = alc883_3ST_2ch_modes,
9824 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9825 .unsol_event = alc_automute_amp_unsol_event,
9826 .setup = alc883_2ch_fujitsu_pi2515_setup,
9827 .init_hook = alc_automute_amp,
9829 [ALC888_FUJITSU_XA3530] = {
9830 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9831 .init_verbs = { alc883_init_verbs,
9832 alc888_fujitsu_xa3530_verbs },
9833 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9834 .dac_nids = alc883_dac_nids,
9835 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9836 .adc_nids = alc883_adc_nids_rev,
9837 .capsrc_nids = alc883_capsrc_nids_rev,
9838 .dig_out_nid = ALC883_DIGOUT_NID,
9839 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9840 .channel_mode = alc888_4ST_8ch_intel_modes,
9842 ARRAY_SIZE(alc888_2_capture_sources),
9843 .input_mux = alc888_2_capture_sources,
9844 .unsol_event = alc_automute_amp_unsol_event,
9845 .setup = alc888_fujitsu_xa3530_setup,
9846 .init_hook = alc_automute_amp,
9848 [ALC888_LENOVO_SKY] = {
9849 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9850 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9851 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9852 .dac_nids = alc883_dac_nids,
9853 .dig_out_nid = ALC883_DIGOUT_NID,
9854 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9855 .channel_mode = alc883_sixstack_modes,
9857 .input_mux = &alc883_lenovo_sky_capture_source,
9858 .unsol_event = alc_automute_amp_unsol_event,
9859 .setup = alc888_lenovo_sky_setup,
9860 .init_hook = alc_automute_amp,
9862 [ALC888_ASUS_M90V] = {
9863 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9864 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9865 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9866 .dac_nids = alc883_dac_nids,
9867 .dig_out_nid = ALC883_DIGOUT_NID,
9868 .dig_in_nid = ALC883_DIGIN_NID,
9869 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9870 .channel_mode = alc883_3ST_6ch_modes,
9872 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9873 .unsol_event = alc_sku_unsol_event,
9874 .setup = alc883_mode2_setup,
9875 .init_hook = alc_inithook,
9877 [ALC888_ASUS_EEE1601] = {
9878 .mixers = { alc883_asus_eee1601_mixer },
9879 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9880 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9881 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9882 .dac_nids = alc883_dac_nids,
9883 .dig_out_nid = ALC883_DIGOUT_NID,
9884 .dig_in_nid = ALC883_DIGIN_NID,
9885 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9886 .channel_mode = alc883_3ST_2ch_modes,
9888 .input_mux = &alc883_asus_eee1601_capture_source,
9889 .unsol_event = alc_sku_unsol_event,
9890 .init_hook = alc883_eee1601_inithook,
9892 [ALC1200_ASUS_P5Q] = {
9893 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9894 .init_verbs = { alc883_init_verbs },
9895 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9896 .dac_nids = alc883_dac_nids,
9897 .dig_out_nid = ALC1200_DIGOUT_NID,
9898 .dig_in_nid = ALC883_DIGIN_NID,
9899 .slave_dig_outs = alc1200_slave_dig_outs,
9900 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9901 .channel_mode = alc883_sixstack_modes,
9902 .input_mux = &alc883_capture_source,
9905 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9906 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9907 alc880_gpio1_init_verbs },
9908 .adc_nids = alc883_adc_nids,
9909 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9910 .capsrc_nids = alc883_capsrc_nids,
9911 .dac_nids = alc883_dac_nids,
9912 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9913 .channel_mode = alc889A_mb31_6ch_modes,
9914 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9915 .input_mux = &alc889A_mb31_capture_source,
9916 .dig_out_nid = ALC883_DIGOUT_NID,
9917 .unsol_event = alc889A_mb31_unsol_event,
9918 .init_hook = alc889A_mb31_automute,
9920 [ALC883_SONY_VAIO_TT] = {
9921 .mixers = { alc883_vaiott_mixer },
9922 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9923 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9924 .dac_nids = alc883_dac_nids,
9925 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9926 .channel_mode = alc883_3ST_2ch_modes,
9927 .input_mux = &alc883_capture_source,
9928 .unsol_event = alc_automute_amp_unsol_event,
9929 .setup = alc883_vaiott_setup,
9930 .init_hook = alc_automute_amp,
9939 PINFIX_ABIT_AW9D_MAX
9942 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9943 { 0x15, 0x01080104 }, /* side */
9944 { 0x16, 0x01011012 }, /* rear */
9945 { 0x17, 0x01016011 }, /* clfe */
9949 static const struct alc_fixup alc882_fixups[] = {
9950 [PINFIX_ABIT_AW9D_MAX] = {
9951 .pins = alc882_abit_aw9d_pinfix
9955 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9956 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9961 * BIOS auto configuration
9963 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9964 const struct auto_pin_cfg *cfg)
9966 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9969 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9970 hda_nid_t nid, int pin_type,
9974 struct alc_spec *spec = codec->spec;
9977 alc_set_pin_output(codec, nid, pin_type);
9978 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9981 idx = spec->multiout.dac_nids[dac_idx] - 2;
9982 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9986 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9988 struct alc_spec *spec = codec->spec;
9991 for (i = 0; i <= HDA_SIDE; i++) {
9992 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9993 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9995 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10000 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10002 struct alc_spec *spec = codec->spec;
10005 pin = spec->autocfg.hp_pins[0];
10006 if (pin) /* connect to front */
10008 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
10009 pin = spec->autocfg.speaker_pins[0];
10011 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
10014 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10016 struct alc_spec *spec = codec->spec;
10019 for (i = 0; i < AUTO_PIN_LAST; i++) {
10020 hda_nid_t nid = spec->autocfg.input_pins[i];
10023 alc_set_input_pin(codec, nid, i);
10024 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10025 snd_hda_codec_write(codec, nid, 0,
10026 AC_VERB_SET_AMP_GAIN_MUTE,
10031 static void alc882_auto_init_input_src(struct hda_codec *codec)
10033 struct alc_spec *spec = codec->spec;
10036 for (c = 0; c < spec->num_adc_nids; c++) {
10037 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10038 hda_nid_t nid = spec->capsrc_nids[c];
10039 unsigned int mux_idx;
10040 const struct hda_input_mux *imux;
10041 int conns, mute, idx, item;
10043 conns = snd_hda_get_connections(codec, nid, conn_list,
10044 ARRAY_SIZE(conn_list));
10047 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10048 imux = &spec->input_mux[mux_idx];
10049 for (idx = 0; idx < conns; idx++) {
10050 /* if the current connection is the selected one,
10051 * unmute it as default - otherwise mute it
10053 mute = AMP_IN_MUTE(idx);
10054 for (item = 0; item < imux->num_items; item++) {
10055 if (imux->items[item].index == idx) {
10056 if (spec->cur_mux[c] == item)
10057 mute = AMP_IN_UNMUTE(idx);
10061 /* check if we have a selector or mixer
10062 * we could check for the widget type instead, but
10063 * just check for Amp-In presence (in case of mixer
10064 * without amp-in there is something wrong, this
10065 * function shouldn't be used or capsrc nid is wrong)
10067 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10068 snd_hda_codec_write(codec, nid, 0,
10069 AC_VERB_SET_AMP_GAIN_MUTE,
10071 else if (mute != AMP_IN_MUTE(idx))
10072 snd_hda_codec_write(codec, nid, 0,
10073 AC_VERB_SET_CONNECT_SEL,
10079 /* add mic boosts if needed */
10080 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10082 struct alc_spec *spec = codec->spec;
10086 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10087 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10088 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10090 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10094 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10095 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10096 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10098 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10105 /* almost identical with ALC880 parser... */
10106 static int alc882_parse_auto_config(struct hda_codec *codec)
10108 struct alc_spec *spec = codec->spec;
10109 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10112 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10116 if (!spec->autocfg.line_outs)
10117 return 0; /* can't find valid BIOS pin config */
10119 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10122 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10125 err = alc880_auto_create_extra_out(spec,
10126 spec->autocfg.speaker_pins[0],
10130 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10134 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10138 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10140 /* check multiple SPDIF-out (for recent codecs) */
10141 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10143 err = snd_hda_get_connections(codec,
10144 spec->autocfg.dig_out_pins[i],
10149 spec->multiout.dig_out_nid = dig_nid;
10151 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10152 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10154 spec->slave_dig_outs[i - 1] = dig_nid;
10157 if (spec->autocfg.dig_in_pin)
10158 spec->dig_in_nid = ALC880_DIGIN_NID;
10160 if (spec->kctls.list)
10161 add_mixer(spec, spec->kctls.list);
10163 add_verb(spec, alc883_auto_init_verbs);
10164 /* if ADC 0x07 is available, initialize it, too */
10165 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10166 add_verb(spec, alc882_adc1_init_verbs);
10168 spec->num_mux_defs = 1;
10169 spec->input_mux = &spec->private_imux[0];
10171 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10173 err = alc_auto_add_mic_boost(codec);
10177 return 1; /* config found */
10180 /* additional initialization for auto-configuration model */
10181 static void alc882_auto_init(struct hda_codec *codec)
10183 struct alc_spec *spec = codec->spec;
10184 alc882_auto_init_multi_out(codec);
10185 alc882_auto_init_hp_out(codec);
10186 alc882_auto_init_analog_input(codec);
10187 alc882_auto_init_input_src(codec);
10188 if (spec->unsol_event)
10189 alc_inithook(codec);
10192 static int patch_alc882(struct hda_codec *codec)
10194 struct alc_spec *spec;
10195 int err, board_config;
10197 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10201 codec->spec = spec;
10203 switch (codec->vendor_id) {
10208 /* ALC883 and variants */
10209 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10213 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10217 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10218 board_config = snd_hda_check_board_codec_sid_config(codec,
10219 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10221 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10222 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10224 board_config = ALC882_AUTO;
10227 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10229 if (board_config == ALC882_AUTO) {
10230 /* automatic parse from the BIOS config */
10231 err = alc882_parse_auto_config(codec);
10237 "hda_codec: Cannot set up configuration "
10238 "from BIOS. Using base mode...\n");
10239 board_config = ALC882_3ST_DIG;
10243 err = snd_hda_attach_beep_device(codec, 0x1);
10249 if (board_config != ALC882_AUTO)
10250 setup_preset(codec, &alc882_presets[board_config]);
10252 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10253 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10254 /* FIXME: setup DAC5 */
10255 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10256 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10258 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10259 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10261 if (codec->vendor_id == 0x10ec0888)
10262 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10264 if (!spec->adc_nids && spec->input_mux) {
10266 spec->num_adc_nids = 0;
10267 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10268 const struct hda_input_mux *imux = spec->input_mux;
10270 hda_nid_t items[16];
10271 hda_nid_t nid = alc882_adc_nids[i];
10272 unsigned int wcap = get_wcaps(codec, nid);
10274 wcap = get_wcaps_type(wcap);
10275 if (wcap != AC_WID_AUD_IN)
10277 spec->private_adc_nids[spec->num_adc_nids] = nid;
10278 err = snd_hda_get_connections(codec, nid, &cap, 1);
10281 err = snd_hda_get_connections(codec, cap, items,
10282 ARRAY_SIZE(items));
10285 for (j = 0; j < imux->num_items; j++)
10286 if (imux->items[j].index >= err)
10288 if (j < imux->num_items)
10290 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10291 spec->num_adc_nids++;
10293 spec->adc_nids = spec->private_adc_nids;
10294 spec->capsrc_nids = spec->private_capsrc_nids;
10297 set_capture_mixer(codec);
10298 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10300 spec->vmaster_nid = 0x0c;
10302 codec->patch_ops = alc_patch_ops;
10303 if (board_config == ALC882_AUTO)
10304 spec->init_hook = alc882_auto_init;
10305 #ifdef CONFIG_SND_HDA_POWER_SAVE
10306 if (!spec->loopback.amplist)
10307 spec->loopback.amplist = alc882_loopbacks;
10309 codec->proc_widget_hook = print_realtek_coef;
10319 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10320 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10322 #define alc262_dac_nids alc260_dac_nids
10323 #define alc262_adc_nids alc882_adc_nids
10324 #define alc262_adc_nids_alt alc882_adc_nids_alt
10325 #define alc262_capsrc_nids alc882_capsrc_nids
10326 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10328 #define alc262_modes alc260_modes
10329 #define alc262_capture_source alc882_capture_source
10331 static hda_nid_t alc262_dmic_adc_nids[1] = {
10336 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10338 static struct snd_kcontrol_new alc262_base_mixer[] = {
10339 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10340 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10341 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10342 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10343 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10344 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10345 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10346 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10347 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10348 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10349 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10350 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10351 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10353 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10354 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10358 /* update HP, line and mono-out pins according to the master switch */
10359 static void alc262_hp_master_update(struct hda_codec *codec)
10361 struct alc_spec *spec = codec->spec;
10362 int val = spec->master_sw;
10364 /* HP & line-out */
10365 snd_hda_codec_write_cache(codec, 0x1b, 0,
10366 AC_VERB_SET_PIN_WIDGET_CONTROL,
10368 snd_hda_codec_write_cache(codec, 0x15, 0,
10369 AC_VERB_SET_PIN_WIDGET_CONTROL,
10371 /* mono (speaker) depending on the HP jack sense */
10372 val = val && !spec->jack_present;
10373 snd_hda_codec_write_cache(codec, 0x16, 0,
10374 AC_VERB_SET_PIN_WIDGET_CONTROL,
10375 val ? PIN_OUT : 0);
10378 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10380 struct alc_spec *spec = codec->spec;
10382 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10383 alc262_hp_master_update(codec);
10386 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10388 if ((res >> 26) != ALC880_HP_EVENT)
10390 alc262_hp_bpc_automute(codec);
10393 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10395 struct alc_spec *spec = codec->spec;
10397 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10398 alc262_hp_master_update(codec);
10401 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10404 if ((res >> 26) != ALC880_HP_EVENT)
10406 alc262_hp_wildwest_automute(codec);
10409 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10411 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10412 struct snd_ctl_elem_value *ucontrol)
10414 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10415 struct alc_spec *spec = codec->spec;
10416 int val = !!*ucontrol->value.integer.value;
10418 if (val == spec->master_sw)
10420 spec->master_sw = val;
10421 alc262_hp_master_update(codec);
10425 #define ALC262_HP_MASTER_SWITCH \
10427 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10428 .name = "Master Playback Switch", \
10429 .info = snd_ctl_boolean_mono_info, \
10430 .get = alc262_hp_master_sw_get, \
10431 .put = alc262_hp_master_sw_put, \
10434 .iface = NID_MAPPING, \
10435 .name = "Master Playback Switch", \
10436 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10440 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10441 ALC262_HP_MASTER_SWITCH,
10442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10443 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10445 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10447 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10449 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10450 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10451 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10452 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10453 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10454 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, 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("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10459 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10460 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10464 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10465 ALC262_HP_MASTER_SWITCH,
10466 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10467 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10468 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10469 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10470 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10472 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10474 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10475 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10476 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10477 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10478 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10479 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10480 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10484 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10485 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10486 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10487 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10491 /* mute/unmute internal speaker according to the hp jack and mute state */
10492 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10494 struct alc_spec *spec = codec->spec;
10496 spec->autocfg.hp_pins[0] = 0x15;
10497 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10500 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10501 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10502 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10503 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10504 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10505 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10506 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10507 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10511 static struct hda_verb alc262_hp_t5735_verbs[] = {
10512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10515 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10519 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10520 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10521 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10522 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10523 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10524 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10525 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10529 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10530 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10531 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10532 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10534 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10535 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10539 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10543 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10550 /* bind hp and internal speaker mute (with plug check) as master switch */
10551 static void alc262_hippo_master_update(struct hda_codec *codec)
10553 struct alc_spec *spec = codec->spec;
10554 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10555 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10556 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10560 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10561 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10562 HDA_AMP_MUTE, mute);
10563 /* mute internal speaker per jack sense */
10564 if (spec->jack_present)
10565 mute = HDA_AMP_MUTE;
10567 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10568 HDA_AMP_MUTE, mute);
10569 if (speaker_nid && speaker_nid != line_nid)
10570 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10571 HDA_AMP_MUTE, mute);
10574 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10576 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10577 struct snd_ctl_elem_value *ucontrol)
10579 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10580 struct alc_spec *spec = codec->spec;
10581 int val = !!*ucontrol->value.integer.value;
10583 if (val == spec->master_sw)
10585 spec->master_sw = val;
10586 alc262_hippo_master_update(codec);
10590 #define ALC262_HIPPO_MASTER_SWITCH \
10592 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10593 .name = "Master Playback Switch", \
10594 .info = snd_ctl_boolean_mono_info, \
10595 .get = alc262_hippo_master_sw_get, \
10596 .put = alc262_hippo_master_sw_put, \
10599 .iface = NID_MAPPING, \
10600 .name = "Master Playback Switch", \
10601 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10602 (SUBDEV_SPEAKER(0) << 16), \
10605 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10606 ALC262_HIPPO_MASTER_SWITCH,
10607 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10608 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10609 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10611 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10614 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10615 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10616 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10617 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10618 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10622 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10623 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10624 ALC262_HIPPO_MASTER_SWITCH,
10625 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10626 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10627 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10628 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10630 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10631 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10632 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10633 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10634 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10638 /* mute/unmute internal speaker according to the hp jack and mute state */
10639 static void alc262_hippo_automute(struct hda_codec *codec)
10641 struct alc_spec *spec = codec->spec;
10642 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10644 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10645 alc262_hippo_master_update(codec);
10648 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10650 if ((res >> 26) != ALC880_HP_EVENT)
10652 alc262_hippo_automute(codec);
10655 static void alc262_hippo_setup(struct hda_codec *codec)
10657 struct alc_spec *spec = codec->spec;
10659 spec->autocfg.hp_pins[0] = 0x15;
10660 spec->autocfg.speaker_pins[0] = 0x14;
10663 static void alc262_hippo1_setup(struct hda_codec *codec)
10665 struct alc_spec *spec = codec->spec;
10667 spec->autocfg.hp_pins[0] = 0x1b;
10668 spec->autocfg.speaker_pins[0] = 0x14;
10672 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10673 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10674 ALC262_HIPPO_MASTER_SWITCH,
10675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10676 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10677 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10678 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10682 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10683 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10684 ALC262_HIPPO_MASTER_SWITCH,
10685 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10686 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10687 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10688 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10689 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10693 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10694 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10695 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10696 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10697 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10698 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10699 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10700 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10701 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10702 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10703 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10704 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10705 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10709 static struct hda_verb alc262_tyan_verbs[] = {
10710 /* Headphone automute */
10711 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10712 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10713 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10715 /* P11 AUX_IN, white 4-pin connector */
10716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10717 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10718 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10719 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10724 /* unsolicited event for HP jack sensing */
10725 static void alc262_tyan_setup(struct hda_codec *codec)
10727 struct alc_spec *spec = codec->spec;
10729 spec->autocfg.hp_pins[0] = 0x1b;
10730 spec->autocfg.speaker_pins[0] = 0x15;
10734 #define alc262_capture_mixer alc882_capture_mixer
10735 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10738 * generic initialization of ADC, input mixers and output mixers
10740 static struct hda_verb alc262_init_verbs[] = {
10742 * Unmute ADC0-2 and set the default input to mic-in
10744 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10745 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10746 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10747 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10748 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10749 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10751 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10753 * Note: PASD motherboards uses the Line In 2 as the input for
10754 * front panel mic (mic 2)
10756 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10757 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10759 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10760 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10761 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10764 * Set up output mixers (0x0c - 0x0e)
10766 /* set vol=0 to output mixers */
10767 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10768 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10769 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10770 /* set up input amps for analog loopback */
10771 /* Amp Indices: DAC = 0, mixer = 1 */
10772 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10773 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10774 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10775 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10776 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10777 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10781 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10782 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10783 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10784 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10787 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10788 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10789 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10790 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10792 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10793 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10795 /* FIXME: use matrix-type input source selection */
10796 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10797 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10798 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10799 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10800 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10801 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10803 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10804 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10805 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10806 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10809 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10810 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10811 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10816 static struct hda_verb alc262_eapd_verbs[] = {
10817 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10818 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10822 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10823 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10824 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10825 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10827 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10832 static struct hda_verb alc262_sony_unsol_verbs[] = {
10833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10834 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10835 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10837 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10838 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10842 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10843 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10844 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10845 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10846 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10847 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10851 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10852 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10854 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10856 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10857 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10858 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10859 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10863 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10865 struct alc_spec *spec = codec->spec;
10867 spec->autocfg.hp_pins[0] = 0x15;
10868 spec->autocfg.speaker_pins[0] = 0x14;
10869 spec->ext_mic.pin = 0x18;
10870 spec->ext_mic.mux_idx = 0;
10871 spec->int_mic.pin = 0x12;
10872 spec->int_mic.mux_idx = 9;
10873 spec->auto_mic = 1;
10879 * 0x16 = internal speaker
10880 * 0x18 = external mic
10883 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10884 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10885 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10889 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10891 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10896 static struct hda_verb alc262_nec_verbs[] = {
10897 /* Unmute Speaker */
10898 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10901 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10902 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10904 /* External mic to headphone */
10905 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10906 /* External mic to speaker */
10907 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10913 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10914 * 0x1b = port replicator headphone out
10917 #define ALC_HP_EVENT 0x37
10919 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10920 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10921 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10922 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10923 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10927 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10928 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10929 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10933 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10934 /* Front Mic pin: input vref at 50% */
10935 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10936 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10940 static struct hda_input_mux alc262_fujitsu_capture_source = {
10944 { "Int Mic", 0x1 },
10949 static struct hda_input_mux alc262_HP_capture_source = {
10953 { "Front Mic", 0x1 },
10960 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10964 { "Front Mic", 0x2 },
10970 /* mute/unmute internal speaker according to the hp jacks and mute state */
10971 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10973 struct alc_spec *spec = codec->spec;
10976 if (force || !spec->sense_updated) {
10977 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10978 snd_hda_jack_detect(codec, 0x1b);
10979 spec->sense_updated = 1;
10981 /* unmute internal speaker only if both HPs are unplugged and
10982 * master switch is on
10984 if (spec->jack_present)
10985 mute = HDA_AMP_MUTE;
10987 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10988 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10989 HDA_AMP_MUTE, mute);
10992 /* unsolicited event for HP jack sensing */
10993 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10996 if ((res >> 26) != ALC_HP_EVENT)
10998 alc262_fujitsu_automute(codec, 1);
11001 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11003 alc262_fujitsu_automute(codec, 1);
11006 /* bind volumes of both NID 0x0c and 0x0d */
11007 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11008 .ops = &snd_hda_bind_vol,
11010 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11011 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11016 /* mute/unmute internal speaker according to the hp jack and mute state */
11017 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11019 struct alc_spec *spec = codec->spec;
11022 if (force || !spec->sense_updated) {
11023 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11024 spec->sense_updated = 1;
11026 if (spec->jack_present) {
11027 /* mute internal speaker */
11028 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11029 HDA_AMP_MUTE, HDA_AMP_MUTE);
11030 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11031 HDA_AMP_MUTE, HDA_AMP_MUTE);
11033 /* unmute internal speaker if necessary */
11034 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11035 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11036 HDA_AMP_MUTE, mute);
11037 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11038 HDA_AMP_MUTE, mute);
11042 /* unsolicited event for HP jack sensing */
11043 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11046 if ((res >> 26) != ALC_HP_EVENT)
11048 alc262_lenovo_3000_automute(codec, 1);
11051 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11052 int dir, int idx, long *valp)
11056 for (i = 0; i < 2; i++, valp++)
11057 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11059 *valp ? 0 : HDA_AMP_MUTE);
11063 /* bind hp and internal speaker mute (with plug check) */
11064 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11065 struct snd_ctl_elem_value *ucontrol)
11067 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11068 long *valp = ucontrol->value.integer.value;
11071 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11072 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11074 alc262_fujitsu_automute(codec, 0);
11078 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11079 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11081 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11082 .name = "Master Playback Switch",
11083 .subdevice = HDA_SUBDEV_AMP_FLAG,
11084 .info = snd_hda_mixer_amp_switch_info,
11085 .get = snd_hda_mixer_amp_switch_get,
11086 .put = alc262_fujitsu_master_sw_put,
11087 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11090 .iface = NID_MAPPING,
11091 .name = "Master Playback Switch",
11092 .private_value = 0x1b,
11094 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11095 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11096 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11098 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11099 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11100 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11101 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11105 /* bind hp and internal speaker mute (with plug check) */
11106 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11107 struct snd_ctl_elem_value *ucontrol)
11109 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11110 long *valp = ucontrol->value.integer.value;
11113 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11115 alc262_lenovo_3000_automute(codec, 0);
11119 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11120 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11123 .name = "Master Playback Switch",
11124 .subdevice = HDA_SUBDEV_AMP_FLAG,
11125 .info = snd_hda_mixer_amp_switch_info,
11126 .get = snd_hda_mixer_amp_switch_get,
11127 .put = alc262_lenovo_3000_master_sw_put,
11128 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11133 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11134 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11135 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11136 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11137 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11141 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11142 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11143 ALC262_HIPPO_MASTER_SWITCH,
11144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11146 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11149 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11153 /* additional init verbs for Benq laptops */
11154 static struct hda_verb alc262_EAPD_verbs[] = {
11155 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11156 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11160 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11162 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11164 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11165 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11169 /* Samsung Q1 Ultra Vista model setup */
11170 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11171 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11172 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11175 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11176 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11180 static struct hda_verb alc262_ultra_verbs[] = {
11182 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11183 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11184 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11188 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11194 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11195 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11197 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11198 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11199 /* ADC, choose mic */
11200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11201 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11202 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11203 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11204 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11205 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11206 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11207 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11208 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11209 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11213 /* mute/unmute internal speaker according to the hp jack and mute state */
11214 static void alc262_ultra_automute(struct hda_codec *codec)
11216 struct alc_spec *spec = codec->spec;
11220 /* auto-mute only when HP is used as HP */
11221 if (!spec->cur_mux[0]) {
11222 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11223 if (spec->jack_present)
11224 mute = HDA_AMP_MUTE;
11226 /* mute/unmute internal speaker */
11227 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11228 HDA_AMP_MUTE, mute);
11229 /* mute/unmute HP */
11230 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11231 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11234 /* unsolicited event for HP jack sensing */
11235 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11238 if ((res >> 26) != ALC880_HP_EVENT)
11240 alc262_ultra_automute(codec);
11243 static struct hda_input_mux alc262_ultra_capture_source = {
11247 { "Headphone", 0x7 },
11251 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11252 struct snd_ctl_elem_value *ucontrol)
11254 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11255 struct alc_spec *spec = codec->spec;
11258 ret = alc_mux_enum_put(kcontrol, ucontrol);
11261 /* reprogram the HP pin as mic or HP according to the input source */
11262 snd_hda_codec_write_cache(codec, 0x15, 0,
11263 AC_VERB_SET_PIN_WIDGET_CONTROL,
11264 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11265 alc262_ultra_automute(codec); /* mute/unmute HP */
11269 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11270 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11271 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11273 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11274 .name = "Capture Source",
11275 .info = alc_mux_enum_info,
11276 .get = alc_mux_enum_get,
11277 .put = alc262_ultra_mux_enum_put,
11280 .iface = NID_MAPPING,
11281 .name = "Capture Source",
11282 .private_value = 0x15,
11287 /* We use two mixers depending on the output pin; 0x16 is a mono output
11288 * and thus it's bound with a different mixer.
11289 * This function returns which mixer amp should be used.
11291 static int alc262_check_volbit(hda_nid_t nid)
11295 else if (nid == 0x16)
11301 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11302 const char *pfx, int *vbits)
11307 vbit = alc262_check_volbit(nid);
11310 if (*vbits & vbit) /* a volume control for this mixer already there */
11314 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11316 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11317 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11320 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11328 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11330 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11331 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11334 /* add playback controls from the parsed DAC table */
11335 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11336 const struct auto_pin_cfg *cfg)
11342 spec->multiout.num_dacs = 1; /* only use one dac */
11343 spec->multiout.dac_nids = spec->private_dac_nids;
11344 spec->multiout.dac_nids[0] = 2;
11346 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11348 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11352 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11355 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11358 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11362 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11363 alc262_check_volbit(cfg->speaker_pins[0]) |
11364 alc262_check_volbit(cfg->hp_pins[0]);
11365 if (vbits == 1 || vbits == 2)
11366 pfx = "Master"; /* only one mixer is used */
11367 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11372 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11375 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11379 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11386 #define alc262_auto_create_input_ctls \
11387 alc882_auto_create_input_ctls
11390 * generic initialization of ADC, input mixers and output mixers
11392 static struct hda_verb alc262_volume_init_verbs[] = {
11394 * Unmute ADC0-2 and set the default input to mic-in
11396 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11397 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11398 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11400 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11403 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11405 * Note: PASD motherboards uses the Line In 2 as the input for
11406 * front panel mic (mic 2)
11408 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11409 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11410 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11411 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11416 * Set up output mixers (0x0c - 0x0f)
11418 /* set vol=0 to output mixers */
11419 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11421 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11423 /* set up input amps for analog loopback */
11424 /* Amp Indices: DAC = 0, mixer = 1 */
11425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11432 /* FIXME: use matrix-type input source selection */
11433 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11434 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11445 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11446 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11453 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11455 * Unmute ADC0-2 and set the default input to mic-in
11457 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11459 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11461 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11464 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11466 * Note: PASD motherboards uses the Line In 2 as the input for
11467 * front panel mic (mic 2)
11469 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11470 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11471 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11472 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11473 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11474 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11475 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11476 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11479 * Set up output mixers (0x0c - 0x0e)
11481 /* set vol=0 to output mixers */
11482 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11483 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11484 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11486 /* set up input amps for analog loopback */
11487 /* Amp Indices: DAC = 0, mixer = 1 */
11488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11490 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11491 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11492 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11493 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11496 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11499 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11500 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11502 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11503 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11506 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11507 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11509 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11514 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11515 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11516 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11519 /* FIXME: use matrix-type input source selection */
11520 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11521 /* Input mixer1: only unmute Mic */
11522 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11532 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11534 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11535 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11536 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11542 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11543 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11544 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11552 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11557 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11559 * Unmute ADC0-2 and set the default input to mic-in
11561 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11562 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11563 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11564 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11565 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11566 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11568 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11570 * Note: PASD motherboards uses the Line In 2 as the input for front
11571 * panel mic (mic 2)
11573 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11574 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11575 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11576 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11577 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11578 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11579 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11580 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11583 * Set up output mixers (0x0c - 0x0e)
11585 /* set vol=0 to output mixers */
11586 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11587 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11590 /* set up input amps for analog loopback */
11591 /* Amp Indices: DAC = 0, mixer = 1 */
11592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11594 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11601 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11602 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11603 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11604 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11605 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11606 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11608 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11611 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11612 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11614 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11615 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11616 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11617 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11618 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11619 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11621 /* FIXME: use matrix-type input source selection */
11622 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11623 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11624 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11625 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11626 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11627 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11629 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11630 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11632 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11633 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11634 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11635 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11636 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11637 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11643 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11644 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11645 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11653 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11655 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11656 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11657 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11659 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11660 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11661 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11662 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11666 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11671 #ifdef CONFIG_SND_HDA_POWER_SAVE
11672 #define alc262_loopbacks alc880_loopbacks
11675 /* pcm configuration: identical with ALC880 */
11676 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11677 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11678 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11679 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11682 * BIOS auto configuration
11684 static int alc262_parse_auto_config(struct hda_codec *codec)
11686 struct alc_spec *spec = codec->spec;
11688 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11690 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11694 if (!spec->autocfg.line_outs) {
11695 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11696 spec->multiout.max_channels = 2;
11697 spec->no_analog = 1;
11700 return 0; /* can't find valid BIOS pin config */
11702 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11705 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11709 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11712 if (spec->autocfg.dig_outs) {
11713 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11714 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11716 if (spec->autocfg.dig_in_pin)
11717 spec->dig_in_nid = ALC262_DIGIN_NID;
11719 if (spec->kctls.list)
11720 add_mixer(spec, spec->kctls.list);
11722 add_verb(spec, alc262_volume_init_verbs);
11723 spec->num_mux_defs = 1;
11724 spec->input_mux = &spec->private_imux[0];
11726 err = alc_auto_add_mic_boost(codec);
11730 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11735 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11736 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11737 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11738 #define alc262_auto_init_input_src alc882_auto_init_input_src
11741 /* init callback for auto-configuration model -- overriding the default init */
11742 static void alc262_auto_init(struct hda_codec *codec)
11744 struct alc_spec *spec = codec->spec;
11745 alc262_auto_init_multi_out(codec);
11746 alc262_auto_init_hp_out(codec);
11747 alc262_auto_init_analog_input(codec);
11748 alc262_auto_init_input_src(codec);
11749 if (spec->unsol_event)
11750 alc_inithook(codec);
11754 * configuration and preset
11756 static const char *alc262_models[ALC262_MODEL_LAST] = {
11757 [ALC262_BASIC] = "basic",
11758 [ALC262_HIPPO] = "hippo",
11759 [ALC262_HIPPO_1] = "hippo_1",
11760 [ALC262_FUJITSU] = "fujitsu",
11761 [ALC262_HP_BPC] = "hp-bpc",
11762 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11763 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11764 [ALC262_HP_RP5700] = "hp-rp5700",
11765 [ALC262_BENQ_ED8] = "benq",
11766 [ALC262_BENQ_T31] = "benq-t31",
11767 [ALC262_SONY_ASSAMD] = "sony-assamd",
11768 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11769 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11770 [ALC262_ULTRA] = "ultra",
11771 [ALC262_LENOVO_3000] = "lenovo-3000",
11772 [ALC262_NEC] = "nec",
11773 [ALC262_TYAN] = "tyan",
11774 [ALC262_AUTO] = "auto",
11777 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11778 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11779 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11780 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11782 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11784 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11786 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11787 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11788 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11789 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11790 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11791 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11792 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11793 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11794 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11795 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11796 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11797 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11798 ALC262_HP_TC_T5735),
11799 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11800 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11801 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11802 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11803 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11804 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11805 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11806 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11807 #if 0 /* disable the quirk since model=auto works better in recent versions */
11808 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11809 ALC262_SONY_ASSAMD),
11811 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11812 ALC262_TOSHIBA_RX1),
11813 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11814 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11815 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11816 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11817 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11819 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11820 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11821 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11822 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11823 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11827 static struct alc_config_preset alc262_presets[] = {
11829 .mixers = { alc262_base_mixer },
11830 .init_verbs = { alc262_init_verbs },
11831 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11832 .dac_nids = alc262_dac_nids,
11834 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11835 .channel_mode = alc262_modes,
11836 .input_mux = &alc262_capture_source,
11839 .mixers = { alc262_hippo_mixer },
11840 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11841 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11842 .dac_nids = alc262_dac_nids,
11844 .dig_out_nid = ALC262_DIGOUT_NID,
11845 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11846 .channel_mode = alc262_modes,
11847 .input_mux = &alc262_capture_source,
11848 .unsol_event = alc262_hippo_unsol_event,
11849 .setup = alc262_hippo_setup,
11850 .init_hook = alc262_hippo_automute,
11852 [ALC262_HIPPO_1] = {
11853 .mixers = { alc262_hippo1_mixer },
11854 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11855 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11856 .dac_nids = alc262_dac_nids,
11858 .dig_out_nid = ALC262_DIGOUT_NID,
11859 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11860 .channel_mode = alc262_modes,
11861 .input_mux = &alc262_capture_source,
11862 .unsol_event = alc262_hippo_unsol_event,
11863 .setup = alc262_hippo1_setup,
11864 .init_hook = alc262_hippo_automute,
11866 [ALC262_FUJITSU] = {
11867 .mixers = { alc262_fujitsu_mixer },
11868 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11869 alc262_fujitsu_unsol_verbs },
11870 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11871 .dac_nids = alc262_dac_nids,
11873 .dig_out_nid = ALC262_DIGOUT_NID,
11874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11875 .channel_mode = alc262_modes,
11876 .input_mux = &alc262_fujitsu_capture_source,
11877 .unsol_event = alc262_fujitsu_unsol_event,
11878 .init_hook = alc262_fujitsu_init_hook,
11880 [ALC262_HP_BPC] = {
11881 .mixers = { alc262_HP_BPC_mixer },
11882 .init_verbs = { alc262_HP_BPC_init_verbs },
11883 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11884 .dac_nids = alc262_dac_nids,
11886 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11887 .channel_mode = alc262_modes,
11888 .input_mux = &alc262_HP_capture_source,
11889 .unsol_event = alc262_hp_bpc_unsol_event,
11890 .init_hook = alc262_hp_bpc_automute,
11892 [ALC262_HP_BPC_D7000_WF] = {
11893 .mixers = { alc262_HP_BPC_WildWest_mixer },
11894 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11895 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11896 .dac_nids = alc262_dac_nids,
11898 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11899 .channel_mode = alc262_modes,
11900 .input_mux = &alc262_HP_D7000_capture_source,
11901 .unsol_event = alc262_hp_wildwest_unsol_event,
11902 .init_hook = alc262_hp_wildwest_automute,
11904 [ALC262_HP_BPC_D7000_WL] = {
11905 .mixers = { alc262_HP_BPC_WildWest_mixer,
11906 alc262_HP_BPC_WildWest_option_mixer },
11907 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11908 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11909 .dac_nids = alc262_dac_nids,
11911 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11912 .channel_mode = alc262_modes,
11913 .input_mux = &alc262_HP_D7000_capture_source,
11914 .unsol_event = alc262_hp_wildwest_unsol_event,
11915 .init_hook = alc262_hp_wildwest_automute,
11917 [ALC262_HP_TC_T5735] = {
11918 .mixers = { alc262_hp_t5735_mixer },
11919 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11920 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11921 .dac_nids = alc262_dac_nids,
11923 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11924 .channel_mode = alc262_modes,
11925 .input_mux = &alc262_capture_source,
11926 .unsol_event = alc_automute_amp_unsol_event,
11927 .setup = alc262_hp_t5735_setup,
11928 .init_hook = alc_automute_amp,
11930 [ALC262_HP_RP5700] = {
11931 .mixers = { alc262_hp_rp5700_mixer },
11932 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11933 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11934 .dac_nids = alc262_dac_nids,
11935 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11936 .channel_mode = alc262_modes,
11937 .input_mux = &alc262_hp_rp5700_capture_source,
11939 [ALC262_BENQ_ED8] = {
11940 .mixers = { alc262_base_mixer },
11941 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11942 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11943 .dac_nids = alc262_dac_nids,
11945 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11946 .channel_mode = alc262_modes,
11947 .input_mux = &alc262_capture_source,
11949 [ALC262_SONY_ASSAMD] = {
11950 .mixers = { alc262_sony_mixer },
11951 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11952 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11953 .dac_nids = alc262_dac_nids,
11955 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11956 .channel_mode = alc262_modes,
11957 .input_mux = &alc262_capture_source,
11958 .unsol_event = alc262_hippo_unsol_event,
11959 .setup = alc262_hippo_setup,
11960 .init_hook = alc262_hippo_automute,
11962 [ALC262_BENQ_T31] = {
11963 .mixers = { alc262_benq_t31_mixer },
11964 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11965 alc_hp15_unsol_verbs },
11966 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11967 .dac_nids = alc262_dac_nids,
11969 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11970 .channel_mode = alc262_modes,
11971 .input_mux = &alc262_capture_source,
11972 .unsol_event = alc262_hippo_unsol_event,
11973 .setup = alc262_hippo_setup,
11974 .init_hook = alc262_hippo_automute,
11977 .mixers = { alc262_ultra_mixer },
11978 .cap_mixer = alc262_ultra_capture_mixer,
11979 .init_verbs = { alc262_ultra_verbs },
11980 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11981 .dac_nids = alc262_dac_nids,
11982 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11983 .channel_mode = alc262_modes,
11984 .input_mux = &alc262_ultra_capture_source,
11985 .adc_nids = alc262_adc_nids, /* ADC0 */
11986 .capsrc_nids = alc262_capsrc_nids,
11987 .num_adc_nids = 1, /* single ADC */
11988 .unsol_event = alc262_ultra_unsol_event,
11989 .init_hook = alc262_ultra_automute,
11991 [ALC262_LENOVO_3000] = {
11992 .mixers = { alc262_lenovo_3000_mixer },
11993 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11994 alc262_lenovo_3000_unsol_verbs,
11995 alc262_lenovo_3000_init_verbs },
11996 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11997 .dac_nids = alc262_dac_nids,
11999 .dig_out_nid = ALC262_DIGOUT_NID,
12000 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12001 .channel_mode = alc262_modes,
12002 .input_mux = &alc262_fujitsu_capture_source,
12003 .unsol_event = alc262_lenovo_3000_unsol_event,
12006 .mixers = { alc262_nec_mixer },
12007 .init_verbs = { alc262_nec_verbs },
12008 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12009 .dac_nids = alc262_dac_nids,
12011 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12012 .channel_mode = alc262_modes,
12013 .input_mux = &alc262_capture_source,
12015 [ALC262_TOSHIBA_S06] = {
12016 .mixers = { alc262_toshiba_s06_mixer },
12017 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12018 alc262_eapd_verbs },
12019 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12020 .capsrc_nids = alc262_dmic_capsrc_nids,
12021 .dac_nids = alc262_dac_nids,
12022 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12023 .num_adc_nids = 1, /* single ADC */
12024 .dig_out_nid = ALC262_DIGOUT_NID,
12025 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12026 .channel_mode = alc262_modes,
12027 .unsol_event = alc_sku_unsol_event,
12028 .setup = alc262_toshiba_s06_setup,
12029 .init_hook = alc_inithook,
12031 [ALC262_TOSHIBA_RX1] = {
12032 .mixers = { alc262_toshiba_rx1_mixer },
12033 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12034 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12035 .dac_nids = alc262_dac_nids,
12037 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12038 .channel_mode = alc262_modes,
12039 .input_mux = &alc262_capture_source,
12040 .unsol_event = alc262_hippo_unsol_event,
12041 .setup = alc262_hippo_setup,
12042 .init_hook = alc262_hippo_automute,
12045 .mixers = { alc262_tyan_mixer },
12046 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12047 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12048 .dac_nids = alc262_dac_nids,
12050 .dig_out_nid = ALC262_DIGOUT_NID,
12051 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12052 .channel_mode = alc262_modes,
12053 .input_mux = &alc262_capture_source,
12054 .unsol_event = alc_automute_amp_unsol_event,
12055 .setup = alc262_tyan_setup,
12056 .init_hook = alc_automute_amp,
12060 static int patch_alc262(struct hda_codec *codec)
12062 struct alc_spec *spec;
12066 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12070 codec->spec = spec;
12072 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12077 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12079 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12080 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12084 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12086 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12090 if (board_config < 0) {
12091 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12093 board_config = ALC262_AUTO;
12096 if (board_config == ALC262_AUTO) {
12097 /* automatic parse from the BIOS config */
12098 err = alc262_parse_auto_config(codec);
12104 "hda_codec: Cannot set up configuration "
12105 "from BIOS. Using base mode...\n");
12106 board_config = ALC262_BASIC;
12110 if (!spec->no_analog) {
12111 err = snd_hda_attach_beep_device(codec, 0x1);
12118 if (board_config != ALC262_AUTO)
12119 setup_preset(codec, &alc262_presets[board_config]);
12121 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12122 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12124 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12125 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12127 if (!spec->adc_nids && spec->input_mux) {
12129 /* check whether the digital-mic has to be supported */
12130 for (i = 0; i < spec->input_mux->num_items; i++) {
12131 if (spec->input_mux->items[i].index >= 9)
12134 if (i < spec->input_mux->num_items) {
12135 /* use only ADC0 */
12136 spec->adc_nids = alc262_dmic_adc_nids;
12137 spec->num_adc_nids = 1;
12138 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12140 /* all analog inputs */
12141 /* check whether NID 0x07 is valid */
12142 unsigned int wcap = get_wcaps(codec, 0x07);
12145 wcap = get_wcaps_type(wcap);
12146 if (wcap != AC_WID_AUD_IN) {
12147 spec->adc_nids = alc262_adc_nids_alt;
12148 spec->num_adc_nids =
12149 ARRAY_SIZE(alc262_adc_nids_alt);
12150 spec->capsrc_nids = alc262_capsrc_nids_alt;
12152 spec->adc_nids = alc262_adc_nids;
12153 spec->num_adc_nids =
12154 ARRAY_SIZE(alc262_adc_nids);
12155 spec->capsrc_nids = alc262_capsrc_nids;
12159 if (!spec->cap_mixer && !spec->no_analog)
12160 set_capture_mixer(codec);
12161 if (!spec->no_analog)
12162 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12164 spec->vmaster_nid = 0x0c;
12166 codec->patch_ops = alc_patch_ops;
12167 if (board_config == ALC262_AUTO)
12168 spec->init_hook = alc262_auto_init;
12169 #ifdef CONFIG_SND_HDA_POWER_SAVE
12170 if (!spec->loopback.amplist)
12171 spec->loopback.amplist = alc262_loopbacks;
12173 codec->proc_widget_hook = print_realtek_coef;
12179 * ALC268 channel source setting (2 channel)
12181 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12182 #define alc268_modes alc260_modes
12184 static hda_nid_t alc268_dac_nids[2] = {
12189 static hda_nid_t alc268_adc_nids[2] = {
12194 static hda_nid_t alc268_adc_nids_alt[1] = {
12199 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12201 static struct snd_kcontrol_new alc268_base_mixer[] = {
12202 /* output mixer control */
12203 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12204 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12205 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12207 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12208 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12209 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12213 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12214 /* output mixer control */
12215 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12216 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12217 ALC262_HIPPO_MASTER_SWITCH,
12218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12219 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12220 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12224 /* bind Beep switches of both NID 0x0f and 0x10 */
12225 static struct hda_bind_ctls alc268_bind_beep_sw = {
12226 .ops = &snd_hda_bind_sw,
12228 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12229 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12234 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12235 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12236 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12240 static struct hda_verb alc268_eapd_verbs[] = {
12241 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12242 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12246 /* Toshiba specific */
12247 static struct hda_verb alc268_toshiba_verbs[] = {
12248 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12252 /* Acer specific */
12253 /* bind volumes of both NID 0x02 and 0x03 */
12254 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12255 .ops = &snd_hda_bind_vol,
12257 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12258 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12263 /* mute/unmute internal speaker according to the hp jack and mute state */
12264 static void alc268_acer_automute(struct hda_codec *codec, int force)
12266 struct alc_spec *spec = codec->spec;
12269 if (force || !spec->sense_updated) {
12270 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12271 spec->sense_updated = 1;
12273 if (spec->jack_present)
12274 mute = HDA_AMP_MUTE; /* mute internal speaker */
12275 else /* unmute internal speaker if necessary */
12276 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12277 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12278 HDA_AMP_MUTE, mute);
12282 /* bind hp and internal speaker mute (with plug check) */
12283 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12284 struct snd_ctl_elem_value *ucontrol)
12286 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12287 long *valp = ucontrol->value.integer.value;
12290 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12292 alc268_acer_automute(codec, 0);
12296 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12297 /* output mixer control */
12298 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12301 .name = "Master Playback Switch",
12302 .subdevice = HDA_SUBDEV_AMP_FLAG,
12303 .info = snd_hda_mixer_amp_switch_info,
12304 .get = snd_hda_mixer_amp_switch_get,
12305 .put = alc268_acer_master_sw_put,
12306 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12308 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12312 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12313 /* output mixer control */
12314 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12316 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12317 .name = "Master Playback Switch",
12318 .subdevice = HDA_SUBDEV_AMP_FLAG,
12319 .info = snd_hda_mixer_amp_switch_info,
12320 .get = snd_hda_mixer_amp_switch_get,
12321 .put = alc268_acer_master_sw_put,
12322 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12324 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12325 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12326 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12330 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12331 /* output mixer control */
12332 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12335 .name = "Master Playback Switch",
12336 .subdevice = HDA_SUBDEV_AMP_FLAG,
12337 .info = snd_hda_mixer_amp_switch_info,
12338 .get = snd_hda_mixer_amp_switch_get,
12339 .put = alc268_acer_master_sw_put,
12340 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12342 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12343 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12347 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12348 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12351 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12352 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12353 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12357 static struct hda_verb alc268_acer_verbs[] = {
12358 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12359 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12360 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12361 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12364 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12368 /* unsolicited event for HP jack sensing */
12369 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12370 #define alc268_toshiba_setup alc262_hippo_setup
12371 #define alc268_toshiba_automute alc262_hippo_automute
12373 static void alc268_acer_unsol_event(struct hda_codec *codec,
12376 if ((res >> 26) != ALC880_HP_EVENT)
12378 alc268_acer_automute(codec, 1);
12381 static void alc268_acer_init_hook(struct hda_codec *codec)
12383 alc268_acer_automute(codec, 1);
12386 /* toggle speaker-output according to the hp-jack state */
12387 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12389 unsigned int present;
12390 unsigned char bits;
12392 present = snd_hda_jack_detect(codec, 0x15);
12393 bits = present ? AMP_IN_MUTE(0) : 0;
12394 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12395 AMP_IN_MUTE(0), bits);
12396 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12397 AMP_IN_MUTE(0), bits);
12400 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12403 switch (res >> 26) {
12404 case ALC880_HP_EVENT:
12405 alc268_aspire_one_speaker_automute(codec);
12407 case ALC880_MIC_EVENT:
12408 alc_mic_automute(codec);
12413 static void alc268_acer_lc_setup(struct hda_codec *codec)
12415 struct alc_spec *spec = codec->spec;
12416 spec->ext_mic.pin = 0x18;
12417 spec->ext_mic.mux_idx = 0;
12418 spec->int_mic.pin = 0x12;
12419 spec->int_mic.mux_idx = 6;
12420 spec->auto_mic = 1;
12423 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12425 alc268_aspire_one_speaker_automute(codec);
12426 alc_mic_automute(codec);
12429 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12430 /* output mixer control */
12431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12432 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12433 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12434 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12435 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12436 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12440 static struct hda_verb alc268_dell_verbs[] = {
12441 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12443 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12444 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12448 /* mute/unmute internal speaker according to the hp jack and mute state */
12449 static void alc268_dell_setup(struct hda_codec *codec)
12451 struct alc_spec *spec = codec->spec;
12453 spec->autocfg.hp_pins[0] = 0x15;
12454 spec->autocfg.speaker_pins[0] = 0x14;
12455 spec->ext_mic.pin = 0x18;
12456 spec->ext_mic.mux_idx = 0;
12457 spec->int_mic.pin = 0x19;
12458 spec->int_mic.mux_idx = 1;
12459 spec->auto_mic = 1;
12462 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12463 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12464 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12465 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12466 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12467 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12468 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12469 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12470 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12474 static struct hda_verb alc267_quanta_il1_verbs[] = {
12475 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12476 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12480 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12482 struct alc_spec *spec = codec->spec;
12483 spec->autocfg.hp_pins[0] = 0x15;
12484 spec->autocfg.speaker_pins[0] = 0x14;
12485 spec->ext_mic.pin = 0x18;
12486 spec->ext_mic.mux_idx = 0;
12487 spec->int_mic.pin = 0x19;
12488 spec->int_mic.mux_idx = 1;
12489 spec->auto_mic = 1;
12493 * generic initialization of ADC, input mixers and output mixers
12495 static struct hda_verb alc268_base_init_verbs[] = {
12496 /* Unmute DAC0-1 and set vol = 0 */
12497 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12498 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12501 * Set up output mixers (0x0c - 0x0e)
12503 /* set vol=0 to output mixers */
12504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12505 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12507 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12508 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12516 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12517 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12519 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12520 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12521 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12522 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12525 /* set PCBEEP vol = 0, mute connections */
12526 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12527 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12528 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12530 /* Unmute Selector 23h,24h and set the default input to mic-in */
12532 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12534 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12541 * generic initialization of ADC, input mixers and output mixers
12543 static struct hda_verb alc268_volume_init_verbs[] = {
12544 /* set output DAC */
12545 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12546 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12548 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12549 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12550 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12551 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12552 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12554 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12555 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12556 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12559 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12561 /* set PCBEEP vol = 0, mute connections */
12562 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12563 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12564 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12569 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12570 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12571 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12575 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12576 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12577 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12582 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12583 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12584 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12585 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12586 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12591 static struct hda_input_mux alc268_capture_source = {
12595 { "Front Mic", 0x1 },
12601 static struct hda_input_mux alc268_acer_capture_source = {
12605 { "Internal Mic", 0x1 },
12610 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12614 { "Internal Mic", 0x6 },
12619 #ifdef CONFIG_SND_DEBUG
12620 static struct snd_kcontrol_new alc268_test_mixer[] = {
12621 /* Volume widgets */
12622 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12623 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12624 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12625 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12626 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12627 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12628 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12629 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12630 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12631 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12632 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12633 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12634 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12635 /* The below appears problematic on some hardwares */
12636 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12637 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12638 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12639 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12640 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12642 /* Modes for retasking pin widgets */
12643 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12644 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12645 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12646 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12648 /* Controls for GPIO pins, assuming they are configured as outputs */
12649 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12650 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12651 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12652 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12654 /* Switches to allow the digital SPDIF output pin to be enabled.
12655 * The ALC268 does not have an SPDIF input.
12657 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12659 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12660 * this output to turn on an external amplifier.
12662 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12663 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12669 /* create input playback/capture controls for the given pin */
12670 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12671 const char *ctlname, int idx)
12688 if (spec->multiout.dac_nids[0] != dac &&
12689 spec->multiout.dac_nids[1] != dac) {
12690 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12691 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12695 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12699 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12700 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12702 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12703 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12709 /* add playback controls from the parsed DAC table */
12710 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12711 const struct auto_pin_cfg *cfg)
12716 spec->multiout.dac_nids = spec->private_dac_nids;
12718 nid = cfg->line_out_pins[0];
12721 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12725 err = alc268_new_analog_output(spec, nid, name, 0);
12730 nid = cfg->speaker_pins[0];
12732 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12733 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12737 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12741 nid = cfg->hp_pins[0];
12743 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12748 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12750 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12751 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12758 /* create playback/capture controls for input pins */
12759 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12760 const struct auto_pin_cfg *cfg)
12762 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12765 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12766 hda_nid_t nid, int pin_type)
12770 alc_set_pin_output(codec, nid, pin_type);
12771 if (nid == 0x14 || nid == 0x16)
12775 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12778 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12780 struct alc_spec *spec = codec->spec;
12781 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12783 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12784 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12788 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12790 struct alc_spec *spec = codec->spec;
12793 pin = spec->autocfg.hp_pins[0];
12795 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12796 pin = spec->autocfg.speaker_pins[0];
12798 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12801 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12803 struct alc_spec *spec = codec->spec;
12804 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12805 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12806 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12807 unsigned int dac_vol1, dac_vol2;
12809 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12810 snd_hda_codec_write(codec, speaker_nid, 0,
12811 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12812 /* mute mixer inputs from 0x1d */
12813 snd_hda_codec_write(codec, 0x0f, 0,
12814 AC_VERB_SET_AMP_GAIN_MUTE,
12816 snd_hda_codec_write(codec, 0x10, 0,
12817 AC_VERB_SET_AMP_GAIN_MUTE,
12820 /* unmute mixer inputs from 0x1d */
12821 snd_hda_codec_write(codec, 0x0f, 0,
12822 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12823 snd_hda_codec_write(codec, 0x10, 0,
12824 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12827 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12828 if (line_nid == 0x14)
12829 dac_vol2 = AMP_OUT_ZERO;
12830 else if (line_nid == 0x15)
12831 dac_vol1 = AMP_OUT_ZERO;
12832 if (hp_nid == 0x14)
12833 dac_vol2 = AMP_OUT_ZERO;
12834 else if (hp_nid == 0x15)
12835 dac_vol1 = AMP_OUT_ZERO;
12836 if (line_nid != 0x16 || hp_nid != 0x16 ||
12837 spec->autocfg.line_out_pins[1] != 0x16 ||
12838 spec->autocfg.line_out_pins[2] != 0x16)
12839 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12841 snd_hda_codec_write(codec, 0x02, 0,
12842 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12843 snd_hda_codec_write(codec, 0x03, 0,
12844 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12847 /* pcm configuration: identical with ALC880 */
12848 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12849 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12850 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12851 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12854 * BIOS auto configuration
12856 static int alc268_parse_auto_config(struct hda_codec *codec)
12858 struct alc_spec *spec = codec->spec;
12860 static hda_nid_t alc268_ignore[] = { 0 };
12862 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12866 if (!spec->autocfg.line_outs) {
12867 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12868 spec->multiout.max_channels = 2;
12869 spec->no_analog = 1;
12872 return 0; /* can't find valid BIOS pin config */
12874 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12877 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12881 spec->multiout.max_channels = 2;
12884 /* digital only support output */
12885 if (spec->autocfg.dig_outs) {
12886 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12887 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12889 if (spec->kctls.list)
12890 add_mixer(spec, spec->kctls.list);
12892 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12893 add_mixer(spec, alc268_beep_mixer);
12895 add_verb(spec, alc268_volume_init_verbs);
12896 spec->num_mux_defs = 2;
12897 spec->input_mux = &spec->private_imux[0];
12899 err = alc_auto_add_mic_boost(codec);
12903 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12908 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12910 /* init callback for auto-configuration model -- overriding the default init */
12911 static void alc268_auto_init(struct hda_codec *codec)
12913 struct alc_spec *spec = codec->spec;
12914 alc268_auto_init_multi_out(codec);
12915 alc268_auto_init_hp_out(codec);
12916 alc268_auto_init_mono_speaker_out(codec);
12917 alc268_auto_init_analog_input(codec);
12918 if (spec->unsol_event)
12919 alc_inithook(codec);
12923 * configuration and preset
12925 static const char *alc268_models[ALC268_MODEL_LAST] = {
12926 [ALC267_QUANTA_IL1] = "quanta-il1",
12927 [ALC268_3ST] = "3stack",
12928 [ALC268_TOSHIBA] = "toshiba",
12929 [ALC268_ACER] = "acer",
12930 [ALC268_ACER_DMIC] = "acer-dmic",
12931 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12932 [ALC268_DELL] = "dell",
12933 [ALC268_ZEPTO] = "zepto",
12934 #ifdef CONFIG_SND_DEBUG
12935 [ALC268_TEST] = "test",
12937 [ALC268_AUTO] = "auto",
12940 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12941 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12942 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12943 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12944 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12945 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12946 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12947 ALC268_ACER_ASPIRE_ONE),
12948 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12949 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12950 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12951 /* almost compatible with toshiba but with optional digital outs;
12952 * auto-probing seems working fine
12954 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12956 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12957 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12958 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12959 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12960 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12961 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12965 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12966 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12967 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12968 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12969 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12974 static struct alc_config_preset alc268_presets[] = {
12975 [ALC267_QUANTA_IL1] = {
12976 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12977 alc268_capture_nosrc_mixer },
12978 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12979 alc267_quanta_il1_verbs },
12980 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12981 .dac_nids = alc268_dac_nids,
12982 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12983 .adc_nids = alc268_adc_nids_alt,
12985 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12986 .channel_mode = alc268_modes,
12987 .unsol_event = alc_sku_unsol_event,
12988 .setup = alc267_quanta_il1_setup,
12989 .init_hook = alc_inithook,
12992 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12993 alc268_beep_mixer },
12994 .init_verbs = { alc268_base_init_verbs },
12995 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12996 .dac_nids = alc268_dac_nids,
12997 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12998 .adc_nids = alc268_adc_nids_alt,
12999 .capsrc_nids = alc268_capsrc_nids,
13001 .dig_out_nid = ALC268_DIGOUT_NID,
13002 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13003 .channel_mode = alc268_modes,
13004 .input_mux = &alc268_capture_source,
13006 [ALC268_TOSHIBA] = {
13007 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13008 alc268_beep_mixer },
13009 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13010 alc268_toshiba_verbs },
13011 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13012 .dac_nids = alc268_dac_nids,
13013 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13014 .adc_nids = alc268_adc_nids_alt,
13015 .capsrc_nids = alc268_capsrc_nids,
13017 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13018 .channel_mode = alc268_modes,
13019 .input_mux = &alc268_capture_source,
13020 .unsol_event = alc268_toshiba_unsol_event,
13021 .setup = alc268_toshiba_setup,
13022 .init_hook = alc268_toshiba_automute,
13025 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13026 alc268_beep_mixer },
13027 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13028 alc268_acer_verbs },
13029 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13030 .dac_nids = alc268_dac_nids,
13031 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13032 .adc_nids = alc268_adc_nids_alt,
13033 .capsrc_nids = alc268_capsrc_nids,
13035 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13036 .channel_mode = alc268_modes,
13037 .input_mux = &alc268_acer_capture_source,
13038 .unsol_event = alc268_acer_unsol_event,
13039 .init_hook = alc268_acer_init_hook,
13041 [ALC268_ACER_DMIC] = {
13042 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13043 alc268_beep_mixer },
13044 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13045 alc268_acer_verbs },
13046 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13047 .dac_nids = alc268_dac_nids,
13048 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13049 .adc_nids = alc268_adc_nids_alt,
13050 .capsrc_nids = alc268_capsrc_nids,
13052 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13053 .channel_mode = alc268_modes,
13054 .input_mux = &alc268_acer_dmic_capture_source,
13055 .unsol_event = alc268_acer_unsol_event,
13056 .init_hook = alc268_acer_init_hook,
13058 [ALC268_ACER_ASPIRE_ONE] = {
13059 .mixers = { alc268_acer_aspire_one_mixer,
13061 alc268_capture_nosrc_mixer },
13062 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13063 alc268_acer_aspire_one_verbs },
13064 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13065 .dac_nids = alc268_dac_nids,
13066 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13067 .adc_nids = alc268_adc_nids_alt,
13068 .capsrc_nids = alc268_capsrc_nids,
13070 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13071 .channel_mode = alc268_modes,
13072 .unsol_event = alc268_acer_lc_unsol_event,
13073 .setup = alc268_acer_lc_setup,
13074 .init_hook = alc268_acer_lc_init_hook,
13077 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13078 alc268_capture_nosrc_mixer },
13079 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13080 alc268_dell_verbs },
13081 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13082 .dac_nids = alc268_dac_nids,
13083 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13084 .adc_nids = alc268_adc_nids_alt,
13085 .capsrc_nids = alc268_capsrc_nids,
13087 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13088 .channel_mode = alc268_modes,
13089 .unsol_event = alc_sku_unsol_event,
13090 .setup = alc268_dell_setup,
13091 .init_hook = alc_inithook,
13094 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13095 alc268_beep_mixer },
13096 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13097 alc268_toshiba_verbs },
13098 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13099 .dac_nids = alc268_dac_nids,
13100 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13101 .adc_nids = alc268_adc_nids_alt,
13102 .capsrc_nids = alc268_capsrc_nids,
13104 .dig_out_nid = ALC268_DIGOUT_NID,
13105 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13106 .channel_mode = alc268_modes,
13107 .input_mux = &alc268_capture_source,
13108 .setup = alc268_toshiba_setup,
13109 .init_hook = alc268_toshiba_automute,
13111 #ifdef CONFIG_SND_DEBUG
13113 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13114 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13115 alc268_volume_init_verbs },
13116 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13117 .dac_nids = alc268_dac_nids,
13118 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13119 .adc_nids = alc268_adc_nids_alt,
13120 .capsrc_nids = alc268_capsrc_nids,
13122 .dig_out_nid = ALC268_DIGOUT_NID,
13123 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13124 .channel_mode = alc268_modes,
13125 .input_mux = &alc268_capture_source,
13130 static int patch_alc268(struct hda_codec *codec)
13132 struct alc_spec *spec;
13134 int i, has_beep, err;
13136 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13140 codec->spec = spec;
13142 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13146 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13147 board_config = snd_hda_check_board_codec_sid_config(codec,
13148 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13150 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13151 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13153 board_config = ALC268_AUTO;
13156 if (board_config == ALC268_AUTO) {
13157 /* automatic parse from the BIOS config */
13158 err = alc268_parse_auto_config(codec);
13164 "hda_codec: Cannot set up configuration "
13165 "from BIOS. Using base mode...\n");
13166 board_config = ALC268_3ST;
13170 if (board_config != ALC268_AUTO)
13171 setup_preset(codec, &alc268_presets[board_config]);
13173 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13174 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13175 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13177 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13180 for (i = 0; i < spec->num_mixers; i++) {
13181 if (spec->mixers[i] == alc268_beep_mixer) {
13188 err = snd_hda_attach_beep_device(codec, 0x1);
13193 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13194 /* override the amp caps for beep generator */
13195 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13196 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13197 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13198 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13199 (0 << AC_AMPCAP_MUTE_SHIFT));
13202 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13203 /* check whether NID 0x07 is valid */
13204 unsigned int wcap = get_wcaps(codec, 0x07);
13207 spec->capsrc_nids = alc268_capsrc_nids;
13209 wcap = get_wcaps_type(wcap);
13210 if (spec->auto_mic ||
13211 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13212 spec->adc_nids = alc268_adc_nids_alt;
13213 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13214 if (spec->auto_mic)
13215 fixup_automic_adc(codec);
13216 if (spec->auto_mic || spec->input_mux->num_items == 1)
13217 add_mixer(spec, alc268_capture_nosrc_mixer);
13219 add_mixer(spec, alc268_capture_alt_mixer);
13221 spec->adc_nids = alc268_adc_nids;
13222 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13223 add_mixer(spec, alc268_capture_mixer);
13225 /* set default input source */
13226 for (i = 0; i < spec->num_adc_nids; i++)
13227 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13228 0, AC_VERB_SET_CONNECT_SEL,
13229 i < spec->num_mux_defs ?
13230 spec->input_mux[i].items[0].index :
13231 spec->input_mux->items[0].index);
13234 spec->vmaster_nid = 0x02;
13236 codec->patch_ops = alc_patch_ops;
13237 if (board_config == ALC268_AUTO)
13238 spec->init_hook = alc268_auto_init;
13240 codec->proc_widget_hook = print_realtek_coef;
13246 * ALC269 channel source setting (2 channel)
13248 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13250 #define alc269_dac_nids alc260_dac_nids
13252 static hda_nid_t alc269_adc_nids[1] = {
13257 static hda_nid_t alc269_capsrc_nids[1] = {
13261 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13265 #define alc269_modes alc260_modes
13266 #define alc269_capture_source alc880_lg_lw_capture_source
13268 static struct snd_kcontrol_new alc269_base_mixer[] = {
13269 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13270 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13276 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13277 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13278 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13280 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13284 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13285 /* output mixer control */
13286 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13289 .name = "Master Playback Switch",
13290 .subdevice = HDA_SUBDEV_AMP_FLAG,
13291 .info = snd_hda_mixer_amp_switch_info,
13292 .get = snd_hda_mixer_amp_switch_get,
13293 .put = alc268_acer_master_sw_put,
13294 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13298 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13299 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13300 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13301 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13305 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13306 /* output mixer control */
13307 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13309 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13310 .name = "Master Playback Switch",
13311 .subdevice = HDA_SUBDEV_AMP_FLAG,
13312 .info = snd_hda_mixer_amp_switch_info,
13313 .get = snd_hda_mixer_amp_switch_get,
13314 .put = alc268_acer_master_sw_put,
13315 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13320 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13321 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13322 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13323 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13324 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13325 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13329 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13330 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13331 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13332 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13333 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13337 /* capture mixer elements */
13338 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13339 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13340 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13341 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13346 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13348 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13349 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13350 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13351 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13353 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13354 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13358 static struct hda_verb alc269_lifebook_verbs[] = {
13359 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13360 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13361 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13362 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13363 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13364 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13365 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13366 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13367 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13368 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13372 /* toggle speaker-output according to the hp-jack state */
13373 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13375 unsigned int present;
13376 unsigned char bits;
13378 present = snd_hda_jack_detect(codec, 0x15);
13379 bits = present ? AMP_IN_MUTE(0) : 0;
13380 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13381 AMP_IN_MUTE(0), bits);
13382 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13383 AMP_IN_MUTE(0), bits);
13385 snd_hda_codec_write(codec, 0x20, 0,
13386 AC_VERB_SET_COEF_INDEX, 0x0c);
13387 snd_hda_codec_write(codec, 0x20, 0,
13388 AC_VERB_SET_PROC_COEF, 0x680);
13390 snd_hda_codec_write(codec, 0x20, 0,
13391 AC_VERB_SET_COEF_INDEX, 0x0c);
13392 snd_hda_codec_write(codec, 0x20, 0,
13393 AC_VERB_SET_PROC_COEF, 0x480);
13396 /* toggle speaker-output according to the hp-jacks state */
13397 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13399 unsigned int present;
13400 unsigned char bits;
13402 /* Check laptop headphone socket */
13403 present = snd_hda_jack_detect(codec, 0x15);
13405 /* Check port replicator headphone socket */
13406 present |= snd_hda_jack_detect(codec, 0x1a);
13408 bits = present ? AMP_IN_MUTE(0) : 0;
13409 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13410 AMP_IN_MUTE(0), bits);
13411 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13412 AMP_IN_MUTE(0), bits);
13414 snd_hda_codec_write(codec, 0x20, 0,
13415 AC_VERB_SET_COEF_INDEX, 0x0c);
13416 snd_hda_codec_write(codec, 0x20, 0,
13417 AC_VERB_SET_PROC_COEF, 0x680);
13419 snd_hda_codec_write(codec, 0x20, 0,
13420 AC_VERB_SET_COEF_INDEX, 0x0c);
13421 snd_hda_codec_write(codec, 0x20, 0,
13422 AC_VERB_SET_PROC_COEF, 0x480);
13425 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13427 unsigned int present_laptop;
13428 unsigned int present_dock;
13430 present_laptop = snd_hda_jack_detect(codec, 0x18);
13431 present_dock = snd_hda_jack_detect(codec, 0x1b);
13433 /* Laptop mic port overrides dock mic port, design decision */
13435 snd_hda_codec_write(codec, 0x23, 0,
13436 AC_VERB_SET_CONNECT_SEL, 0x3);
13437 if (present_laptop)
13438 snd_hda_codec_write(codec, 0x23, 0,
13439 AC_VERB_SET_CONNECT_SEL, 0x0);
13440 if (!present_dock && !present_laptop)
13441 snd_hda_codec_write(codec, 0x23, 0,
13442 AC_VERB_SET_CONNECT_SEL, 0x1);
13445 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13448 switch (res >> 26) {
13449 case ALC880_HP_EVENT:
13450 alc269_quanta_fl1_speaker_automute(codec);
13452 case ALC880_MIC_EVENT:
13453 alc_mic_automute(codec);
13458 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13461 if ((res >> 26) == ALC880_HP_EVENT)
13462 alc269_lifebook_speaker_automute(codec);
13463 if ((res >> 26) == ALC880_MIC_EVENT)
13464 alc269_lifebook_mic_autoswitch(codec);
13467 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13469 struct alc_spec *spec = codec->spec;
13470 spec->ext_mic.pin = 0x18;
13471 spec->ext_mic.mux_idx = 0;
13472 spec->int_mic.pin = 0x19;
13473 spec->int_mic.mux_idx = 1;
13474 spec->auto_mic = 1;
13477 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13479 alc269_quanta_fl1_speaker_automute(codec);
13480 alc_mic_automute(codec);
13483 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13485 alc269_lifebook_speaker_automute(codec);
13486 alc269_lifebook_mic_autoswitch(codec);
13489 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13490 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13491 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13492 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13494 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13495 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13496 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13500 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13502 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13503 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13505 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13506 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13510 /* toggle speaker-output according to the hp-jack state */
13511 static void alc269_speaker_automute(struct hda_codec *codec)
13513 struct alc_spec *spec = codec->spec;
13514 unsigned int nid = spec->autocfg.hp_pins[0];
13515 unsigned int present;
13516 unsigned char bits;
13518 present = snd_hda_jack_detect(codec, nid);
13519 bits = present ? AMP_IN_MUTE(0) : 0;
13520 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13521 AMP_IN_MUTE(0), bits);
13522 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13523 AMP_IN_MUTE(0), bits);
13526 /* unsolicited event for HP jack sensing */
13527 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13530 switch (res >> 26) {
13531 case ALC880_HP_EVENT:
13532 alc269_speaker_automute(codec);
13534 case ALC880_MIC_EVENT:
13535 alc_mic_automute(codec);
13540 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13542 struct alc_spec *spec = codec->spec;
13543 spec->ext_mic.pin = 0x18;
13544 spec->ext_mic.mux_idx = 0;
13545 spec->int_mic.pin = 0x12;
13546 spec->int_mic.mux_idx = 5;
13547 spec->auto_mic = 1;
13550 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13552 struct alc_spec *spec = codec->spec;
13553 spec->ext_mic.pin = 0x18;
13554 spec->ext_mic.mux_idx = 0;
13555 spec->int_mic.pin = 0x19;
13556 spec->int_mic.mux_idx = 1;
13557 spec->auto_mic = 1;
13560 static void alc269_eeepc_inithook(struct hda_codec *codec)
13562 alc269_speaker_automute(codec);
13563 alc_mic_automute(codec);
13567 * generic initialization of ADC, input mixers and output mixers
13569 static struct hda_verb alc269_init_verbs[] = {
13571 * Unmute ADC0 and set the default input to mic-in
13573 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13575 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13576 * analog-loopback mixer widget
13577 * Note: PASD motherboards uses the Line In 2 as the input for
13578 * front panel mic (mic 2)
13580 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13581 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13582 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13583 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13584 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13585 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13588 * Set up output mixers (0x0c - 0x0e)
13590 /* set vol=0 to output mixers */
13591 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13592 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13594 /* set up input amps for analog loopback */
13595 /* Amp Indices: DAC = 0, mixer = 1 */
13596 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13597 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13598 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13599 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13600 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13601 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13604 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13605 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13606 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13608 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13609 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13611 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13613 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13614 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13615 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13616 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13617 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13619 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13622 /* FIXME: use matrix-type input source selection */
13623 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13624 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13625 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13626 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13627 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13628 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13631 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13632 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13636 #define alc269_auto_create_multi_out_ctls \
13637 alc268_auto_create_multi_out_ctls
13638 #define alc269_auto_create_input_ctls \
13639 alc268_auto_create_input_ctls
13641 #ifdef CONFIG_SND_HDA_POWER_SAVE
13642 #define alc269_loopbacks alc880_loopbacks
13645 /* pcm configuration: identical with ALC880 */
13646 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13647 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13648 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13649 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13651 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13655 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13656 /* NID is set in alc_build_pcms */
13658 .open = alc880_playback_pcm_open,
13659 .prepare = alc880_playback_pcm_prepare,
13660 .cleanup = alc880_playback_pcm_cleanup
13664 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13668 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13669 /* NID is set in alc_build_pcms */
13673 * BIOS auto configuration
13675 static int alc269_parse_auto_config(struct hda_codec *codec)
13677 struct alc_spec *spec = codec->spec;
13679 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13681 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13686 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13689 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13693 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13695 if (spec->autocfg.dig_outs)
13696 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13698 if (spec->kctls.list)
13699 add_mixer(spec, spec->kctls.list);
13701 add_verb(spec, alc269_init_verbs);
13702 spec->num_mux_defs = 1;
13703 spec->input_mux = &spec->private_imux[0];
13704 /* set default input source */
13705 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13706 0, AC_VERB_SET_CONNECT_SEL,
13707 spec->input_mux->items[0].index);
13709 err = alc_auto_add_mic_boost(codec);
13713 if (!spec->cap_mixer && !spec->no_analog)
13714 set_capture_mixer(codec);
13716 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13721 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13722 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13723 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13726 /* init callback for auto-configuration model -- overriding the default init */
13727 static void alc269_auto_init(struct hda_codec *codec)
13729 struct alc_spec *spec = codec->spec;
13730 alc269_auto_init_multi_out(codec);
13731 alc269_auto_init_hp_out(codec);
13732 alc269_auto_init_analog_input(codec);
13733 if (spec->unsol_event)
13734 alc_inithook(codec);
13738 * configuration and preset
13740 static const char *alc269_models[ALC269_MODEL_LAST] = {
13741 [ALC269_BASIC] = "basic",
13742 [ALC269_QUANTA_FL1] = "quanta",
13743 [ALC269_ASUS_AMIC] = "asus-amic",
13744 [ALC269_ASUS_DMIC] = "asus-dmic",
13745 [ALC269_FUJITSU] = "fujitsu",
13746 [ALC269_LIFEBOOK] = "lifebook",
13747 [ALC269_AUTO] = "auto",
13750 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13751 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13752 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13754 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13755 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13756 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13757 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13758 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13759 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13760 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13761 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13762 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13763 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13764 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13765 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13766 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13767 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13768 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13769 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13770 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13771 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13772 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13773 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13774 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13775 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13776 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13777 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13778 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13779 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13780 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13781 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13782 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13784 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13786 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13787 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13788 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13789 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13793 static struct alc_config_preset alc269_presets[] = {
13795 .mixers = { alc269_base_mixer },
13796 .init_verbs = { alc269_init_verbs },
13797 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13798 .dac_nids = alc269_dac_nids,
13800 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13801 .channel_mode = alc269_modes,
13802 .input_mux = &alc269_capture_source,
13804 [ALC269_QUANTA_FL1] = {
13805 .mixers = { alc269_quanta_fl1_mixer },
13806 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13807 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13808 .dac_nids = alc269_dac_nids,
13810 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13811 .channel_mode = alc269_modes,
13812 .input_mux = &alc269_capture_source,
13813 .unsol_event = alc269_quanta_fl1_unsol_event,
13814 .setup = alc269_quanta_fl1_setup,
13815 .init_hook = alc269_quanta_fl1_init_hook,
13817 [ALC269_ASUS_AMIC] = {
13818 .mixers = { alc269_eeepc_mixer },
13819 .cap_mixer = alc269_epc_capture_mixer,
13820 .init_verbs = { alc269_init_verbs,
13821 alc269_eeepc_amic_init_verbs },
13822 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13823 .dac_nids = alc269_dac_nids,
13825 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13826 .channel_mode = alc269_modes,
13827 .unsol_event = alc269_eeepc_unsol_event,
13828 .setup = alc269_eeepc_amic_setup,
13829 .init_hook = alc269_eeepc_inithook,
13831 [ALC269_ASUS_DMIC] = {
13832 .mixers = { alc269_eeepc_mixer },
13833 .cap_mixer = alc269_epc_capture_mixer,
13834 .init_verbs = { alc269_init_verbs,
13835 alc269_eeepc_dmic_init_verbs },
13836 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13837 .dac_nids = alc269_dac_nids,
13839 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13840 .channel_mode = alc269_modes,
13841 .unsol_event = alc269_eeepc_unsol_event,
13842 .setup = alc269_eeepc_dmic_setup,
13843 .init_hook = alc269_eeepc_inithook,
13845 [ALC269_FUJITSU] = {
13846 .mixers = { alc269_fujitsu_mixer },
13847 .cap_mixer = alc269_epc_capture_mixer,
13848 .init_verbs = { alc269_init_verbs,
13849 alc269_eeepc_dmic_init_verbs },
13850 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13851 .dac_nids = alc269_dac_nids,
13853 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13854 .channel_mode = alc269_modes,
13855 .unsol_event = alc269_eeepc_unsol_event,
13856 .setup = alc269_eeepc_dmic_setup,
13857 .init_hook = alc269_eeepc_inithook,
13859 [ALC269_LIFEBOOK] = {
13860 .mixers = { alc269_lifebook_mixer },
13861 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13862 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13863 .dac_nids = alc269_dac_nids,
13865 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13866 .channel_mode = alc269_modes,
13867 .input_mux = &alc269_capture_source,
13868 .unsol_event = alc269_lifebook_unsol_event,
13869 .init_hook = alc269_lifebook_init_hook,
13873 static int patch_alc269(struct hda_codec *codec)
13875 struct alc_spec *spec;
13879 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13883 codec->spec = spec;
13885 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13887 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13888 kfree(codec->chip_name);
13889 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13890 if (!codec->chip_name) {
13896 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13900 if (board_config < 0) {
13901 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13903 board_config = ALC269_AUTO;
13906 if (board_config == ALC269_AUTO) {
13907 /* automatic parse from the BIOS config */
13908 err = alc269_parse_auto_config(codec);
13914 "hda_codec: Cannot set up configuration "
13915 "from BIOS. Using base mode...\n");
13916 board_config = ALC269_BASIC;
13920 err = snd_hda_attach_beep_device(codec, 0x1);
13926 if (board_config != ALC269_AUTO)
13927 setup_preset(codec, &alc269_presets[board_config]);
13929 if (codec->subsystem_id == 0x17aa3bf8) {
13930 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13931 * fix the sample rate of analog I/O to 44.1kHz
13933 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13934 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13936 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13937 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13939 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13940 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13942 spec->adc_nids = alc269_adc_nids;
13943 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13944 spec->capsrc_nids = alc269_capsrc_nids;
13945 if (!spec->cap_mixer)
13946 set_capture_mixer(codec);
13947 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13949 spec->vmaster_nid = 0x02;
13951 codec->patch_ops = alc_patch_ops;
13952 if (board_config == ALC269_AUTO)
13953 spec->init_hook = alc269_auto_init;
13954 #ifdef CONFIG_SND_HDA_POWER_SAVE
13955 if (!spec->loopback.amplist)
13956 spec->loopback.amplist = alc269_loopbacks;
13958 codec->proc_widget_hook = print_realtek_coef;
13964 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13968 * set the path ways for 2 channel output
13969 * need to set the codec line out and mic 1 pin widgets to inputs
13971 static struct hda_verb alc861_threestack_ch2_init[] = {
13972 /* set pin widget 1Ah (line in) for input */
13973 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13974 /* set pin widget 18h (mic1/2) for input, for mic also enable
13977 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13979 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13981 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13982 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13988 * need to set the codec line out and mic 1 pin widgets to outputs
13990 static struct hda_verb alc861_threestack_ch6_init[] = {
13991 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13992 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13993 /* set pin widget 18h (mic1) for output (CLFE)*/
13994 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13996 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13997 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13999 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14001 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14002 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14007 static struct hda_channel_mode alc861_threestack_modes[2] = {
14008 { 2, alc861_threestack_ch2_init },
14009 { 6, alc861_threestack_ch6_init },
14011 /* Set mic1 as input and unmute the mixer */
14012 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
14013 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14014 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14017 /* Set mic1 as output and mute mixer */
14018 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
14019 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14020 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14024 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
14025 { 2, alc861_uniwill_m31_ch2_init },
14026 { 4, alc861_uniwill_m31_ch4_init },
14029 /* Set mic1 and line-in as input and unmute the mixer */
14030 static struct hda_verb alc861_asus_ch2_init[] = {
14031 /* set pin widget 1Ah (line in) for input */
14032 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14033 /* set pin widget 18h (mic1/2) for input, for mic also enable
14036 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14038 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14040 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14041 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14045 /* Set mic1 nad line-in as output and mute mixer */
14046 static struct hda_verb alc861_asus_ch6_init[] = {
14047 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14048 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14049 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14050 /* set pin widget 18h (mic1) for output (CLFE)*/
14051 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14052 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14053 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14054 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14056 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14058 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14059 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14064 static struct hda_channel_mode alc861_asus_modes[2] = {
14065 { 2, alc861_asus_ch2_init },
14066 { 6, alc861_asus_ch6_init },
14071 static struct snd_kcontrol_new alc861_base_mixer[] = {
14072 /* output mixer control */
14073 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14074 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14075 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14076 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14077 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14079 /*Input mixer control */
14080 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14081 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14082 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14083 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14084 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14085 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14087 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14094 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14095 /* output mixer control */
14096 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14097 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14098 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14099 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14100 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14102 /* Input mixer control */
14103 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14104 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14105 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14106 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14107 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14108 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14109 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14110 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14112 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14115 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14116 .name = "Channel Mode",
14117 .info = alc_ch_mode_info,
14118 .get = alc_ch_mode_get,
14119 .put = alc_ch_mode_put,
14120 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14125 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14126 /* output mixer control */
14127 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14129 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14134 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14135 /* output mixer control */
14136 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14137 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14138 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14139 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14140 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14142 /* Input mixer control */
14143 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14144 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14145 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14146 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14147 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14148 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14150 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14152 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14155 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14156 .name = "Channel Mode",
14157 .info = alc_ch_mode_info,
14158 .get = alc_ch_mode_get,
14159 .put = alc_ch_mode_put,
14160 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14165 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14166 /* output mixer control */
14167 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14168 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14169 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14170 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14171 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14173 /* Input mixer control */
14174 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14175 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14176 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14177 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14178 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14179 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14181 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14182 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14187 .name = "Channel Mode",
14188 .info = alc_ch_mode_info,
14189 .get = alc_ch_mode_get,
14190 .put = alc_ch_mode_put,
14191 .private_value = ARRAY_SIZE(alc861_asus_modes),
14196 /* additional mixer */
14197 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14198 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14199 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14204 * generic initialization of ADC, input mixers and output mixers
14206 static struct hda_verb alc861_base_init_verbs[] = {
14208 * Unmute ADC0 and set the default input to mic-in
14210 /* port-A for surround (rear panel) */
14211 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14212 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14213 /* port-B for mic-in (rear panel) with vref */
14214 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14215 /* port-C for line-in (rear panel) */
14216 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14217 /* port-D for Front */
14218 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14219 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14220 /* port-E for HP out (front panel) */
14221 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14222 /* route front PCM to HP */
14223 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14224 /* port-F for mic-in (front panel) with vref */
14225 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14226 /* port-G for CLFE (rear panel) */
14227 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14228 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14229 /* port-H for side (rear panel) */
14230 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14231 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14233 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14234 /* route front mic to ADC1*/
14235 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14238 /* Unmute DAC0~3 & spdif out*/
14239 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14240 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14241 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14242 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14243 {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)},
14272 static struct hda_verb alc861_threestack_init_verbs[] = {
14274 * Unmute ADC0 and set the default input to mic-in
14276 /* port-A for surround (rear panel) */
14277 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14278 /* port-B for mic-in (rear panel) with vref */
14279 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14280 /* port-C for line-in (rear panel) */
14281 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14282 /* port-D for Front */
14283 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14284 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14285 /* port-E for HP out (front panel) */
14286 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14287 /* route front PCM to HP */
14288 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14289 /* port-F for mic-in (front panel) with vref */
14290 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14291 /* port-G for CLFE (rear panel) */
14292 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14293 /* port-H for side (rear panel) */
14294 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14296 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14297 /* route front mic to ADC1*/
14298 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14300 /* Unmute DAC0~3 & spdif out*/
14301 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14302 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14303 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14304 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14307 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14308 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14309 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14310 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14311 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14313 /* Unmute Stereo Mixer 15 */
14314 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14315 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14319 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14320 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14321 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14322 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14323 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14324 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14326 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14327 /* hp used DAC 3 (Front) */
14328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14329 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14333 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14335 * Unmute ADC0 and set the default input to mic-in
14337 /* port-A for surround (rear panel) */
14338 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14339 /* port-B for mic-in (rear panel) with vref */
14340 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14341 /* port-C for line-in (rear panel) */
14342 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14343 /* port-D for Front */
14344 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14345 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14346 /* port-E for HP out (front panel) */
14347 /* this has to be set to VREF80 */
14348 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14349 /* route front PCM to HP */
14350 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14351 /* port-F for mic-in (front panel) with vref */
14352 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14353 /* port-G for CLFE (rear panel) */
14354 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14355 /* port-H for side (rear panel) */
14356 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14358 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14359 /* route front mic to ADC1*/
14360 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14362 /* Unmute DAC0~3 & spdif out*/
14363 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14364 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14365 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14366 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14367 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14369 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14370 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14371 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14372 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14373 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14375 /* Unmute Stereo Mixer 15 */
14376 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14377 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14378 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14379 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14381 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14382 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14383 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14384 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14385 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14386 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14387 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14388 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14389 /* hp used DAC 3 (Front) */
14390 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14391 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14395 static struct hda_verb alc861_asus_init_verbs[] = {
14397 * Unmute ADC0 and set the default input to mic-in
14399 /* port-A for surround (rear panel)
14400 * according to codec#0 this is the HP jack
14402 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14403 /* route front PCM to HP */
14404 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14405 /* port-B for mic-in (rear panel) with vref */
14406 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14407 /* port-C for line-in (rear panel) */
14408 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14409 /* port-D for Front */
14410 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14411 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14412 /* port-E for HP out (front panel) */
14413 /* this has to be set to VREF80 */
14414 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14415 /* route front PCM to HP */
14416 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14417 /* port-F for mic-in (front panel) with vref */
14418 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14419 /* port-G for CLFE (rear panel) */
14420 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14421 /* port-H for side (rear panel) */
14422 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14424 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14425 /* route front mic to ADC1*/
14426 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14427 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14428 /* Unmute DAC0~3 & spdif out*/
14429 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14430 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14431 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14432 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14433 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14434 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14435 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14436 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14437 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14438 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14440 /* Unmute Stereo Mixer 15 */
14441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14444 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14446 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14447 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14448 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14449 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14453 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14454 /* hp used DAC 3 (Front) */
14455 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14456 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14460 /* additional init verbs for ASUS laptops */
14461 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14462 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14463 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14468 * generic initialization of ADC, input mixers and output mixers
14470 static struct hda_verb alc861_auto_init_verbs[] = {
14472 * Unmute ADC0 and set the default input to mic-in
14474 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14475 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14477 /* Unmute DAC0~3 & spdif out*/
14478 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14479 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14480 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14481 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14482 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14484 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14485 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14486 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14487 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14488 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14490 /* Unmute Stereo Mixer 15 */
14491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14496 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14497 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14500 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14503 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14505 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14508 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14509 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14512 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14514 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14519 static struct hda_verb alc861_toshiba_init_verbs[] = {
14520 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14525 /* toggle speaker-output according to the hp-jack state */
14526 static void alc861_toshiba_automute(struct hda_codec *codec)
14528 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14530 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14531 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14532 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14533 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14536 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14539 if ((res >> 26) == ALC880_HP_EVENT)
14540 alc861_toshiba_automute(codec);
14543 /* pcm configuration: identical with ALC880 */
14544 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14545 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14546 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14547 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14550 #define ALC861_DIGOUT_NID 0x07
14552 static struct hda_channel_mode alc861_8ch_modes[1] = {
14556 static hda_nid_t alc861_dac_nids[4] = {
14557 /* front, surround, clfe, side */
14558 0x03, 0x06, 0x05, 0x04
14561 static hda_nid_t alc660_dac_nids[3] = {
14562 /* front, clfe, surround */
14566 static hda_nid_t alc861_adc_nids[1] = {
14571 static struct hda_input_mux alc861_capture_source = {
14575 { "Front Mic", 0x3 },
14582 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14584 struct alc_spec *spec = codec->spec;
14585 hda_nid_t mix, srcs[5];
14588 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14590 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14593 for (i = 0; i < num; i++) {
14595 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14596 if (type != AC_WID_AUD_OUT)
14598 for (j = 0; j < spec->multiout.num_dacs; j++)
14599 if (spec->multiout.dac_nids[j] == srcs[i])
14601 if (j >= spec->multiout.num_dacs)
14607 /* fill in the dac_nids table from the parsed pin configuration */
14608 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14609 const struct auto_pin_cfg *cfg)
14611 struct alc_spec *spec = codec->spec;
14613 hda_nid_t nid, dac;
14615 spec->multiout.dac_nids = spec->private_dac_nids;
14616 for (i = 0; i < cfg->line_outs; i++) {
14617 nid = cfg->line_out_pins[i];
14618 dac = alc861_look_for_dac(codec, nid);
14621 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14626 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14627 hda_nid_t nid, unsigned int chs)
14629 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14630 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14633 /* add playback controls from the parsed DAC table */
14634 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14635 const struct auto_pin_cfg *cfg)
14637 struct alc_spec *spec = codec->spec;
14638 static const char *chname[4] = {
14639 "Front", "Surround", NULL /*CLFE*/, "Side"
14644 if (cfg->line_outs == 1) {
14645 const char *pfx = NULL;
14648 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14651 nid = spec->multiout.dac_nids[0];
14652 return alc861_create_out_sw(codec, pfx, nid, 3);
14656 for (i = 0; i < cfg->line_outs; i++) {
14657 nid = spec->multiout.dac_nids[i];
14662 err = alc861_create_out_sw(codec, "Center", nid, 1);
14665 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14669 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14677 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14679 struct alc_spec *spec = codec->spec;
14686 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14687 nid = alc861_look_for_dac(codec, pin);
14689 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14692 spec->multiout.hp_nid = nid;
14698 /* create playback/capture controls for input pins */
14699 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14700 const struct auto_pin_cfg *cfg)
14702 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14705 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14707 int pin_type, hda_nid_t dac)
14709 hda_nid_t mix, srcs[5];
14712 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14714 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14716 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14718 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14721 for (i = 0; i < num; i++) {
14723 if (srcs[i] == dac || srcs[i] == 0x15)
14724 mute = AMP_IN_UNMUTE(i);
14726 mute = AMP_IN_MUTE(i);
14727 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14732 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14734 struct alc_spec *spec = codec->spec;
14737 for (i = 0; i < spec->autocfg.line_outs; i++) {
14738 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14739 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14741 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14742 spec->multiout.dac_nids[i]);
14746 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14748 struct alc_spec *spec = codec->spec;
14750 if (spec->autocfg.hp_outs)
14751 alc861_auto_set_output_and_unmute(codec,
14752 spec->autocfg.hp_pins[0],
14754 spec->multiout.hp_nid);
14755 if (spec->autocfg.speaker_outs)
14756 alc861_auto_set_output_and_unmute(codec,
14757 spec->autocfg.speaker_pins[0],
14759 spec->multiout.dac_nids[0]);
14762 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14764 struct alc_spec *spec = codec->spec;
14767 for (i = 0; i < AUTO_PIN_LAST; i++) {
14768 hda_nid_t nid = spec->autocfg.input_pins[i];
14769 if (nid >= 0x0c && nid <= 0x11)
14770 alc_set_input_pin(codec, nid, i);
14774 /* parse the BIOS configuration and set up the alc_spec */
14775 /* return 1 if successful, 0 if the proper config is not found,
14776 * or a negative error code
14778 static int alc861_parse_auto_config(struct hda_codec *codec)
14780 struct alc_spec *spec = codec->spec;
14782 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14784 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14788 if (!spec->autocfg.line_outs)
14789 return 0; /* can't find valid BIOS pin config */
14791 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14794 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14797 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14800 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14804 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14806 if (spec->autocfg.dig_outs)
14807 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14809 if (spec->kctls.list)
14810 add_mixer(spec, spec->kctls.list);
14812 add_verb(spec, alc861_auto_init_verbs);
14814 spec->num_mux_defs = 1;
14815 spec->input_mux = &spec->private_imux[0];
14817 spec->adc_nids = alc861_adc_nids;
14818 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14819 set_capture_mixer(codec);
14821 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14826 /* additional initialization for auto-configuration model */
14827 static void alc861_auto_init(struct hda_codec *codec)
14829 struct alc_spec *spec = codec->spec;
14830 alc861_auto_init_multi_out(codec);
14831 alc861_auto_init_hp_out(codec);
14832 alc861_auto_init_analog_input(codec);
14833 if (spec->unsol_event)
14834 alc_inithook(codec);
14837 #ifdef CONFIG_SND_HDA_POWER_SAVE
14838 static struct hda_amp_list alc861_loopbacks[] = {
14839 { 0x15, HDA_INPUT, 0 },
14840 { 0x15, HDA_INPUT, 1 },
14841 { 0x15, HDA_INPUT, 2 },
14842 { 0x15, HDA_INPUT, 3 },
14849 * configuration and preset
14851 static const char *alc861_models[ALC861_MODEL_LAST] = {
14852 [ALC861_3ST] = "3stack",
14853 [ALC660_3ST] = "3stack-660",
14854 [ALC861_3ST_DIG] = "3stack-dig",
14855 [ALC861_6ST_DIG] = "6stack-dig",
14856 [ALC861_UNIWILL_M31] = "uniwill-m31",
14857 [ALC861_TOSHIBA] = "toshiba",
14858 [ALC861_ASUS] = "asus",
14859 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14860 [ALC861_AUTO] = "auto",
14863 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14864 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14865 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14866 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14867 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14868 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14869 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14870 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14871 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14872 * Any other models that need this preset?
14874 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14875 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14876 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14877 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14878 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14879 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14880 /* FIXME: the below seems conflict */
14881 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14882 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14883 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14887 static struct alc_config_preset alc861_presets[] = {
14889 .mixers = { alc861_3ST_mixer },
14890 .init_verbs = { alc861_threestack_init_verbs },
14891 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14892 .dac_nids = alc861_dac_nids,
14893 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14894 .channel_mode = alc861_threestack_modes,
14896 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14897 .adc_nids = alc861_adc_nids,
14898 .input_mux = &alc861_capture_source,
14900 [ALC861_3ST_DIG] = {
14901 .mixers = { alc861_base_mixer },
14902 .init_verbs = { alc861_threestack_init_verbs },
14903 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14904 .dac_nids = alc861_dac_nids,
14905 .dig_out_nid = ALC861_DIGOUT_NID,
14906 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14907 .channel_mode = alc861_threestack_modes,
14909 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14910 .adc_nids = alc861_adc_nids,
14911 .input_mux = &alc861_capture_source,
14913 [ALC861_6ST_DIG] = {
14914 .mixers = { alc861_base_mixer },
14915 .init_verbs = { alc861_base_init_verbs },
14916 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14917 .dac_nids = alc861_dac_nids,
14918 .dig_out_nid = ALC861_DIGOUT_NID,
14919 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14920 .channel_mode = alc861_8ch_modes,
14921 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14922 .adc_nids = alc861_adc_nids,
14923 .input_mux = &alc861_capture_source,
14926 .mixers = { alc861_3ST_mixer },
14927 .init_verbs = { alc861_threestack_init_verbs },
14928 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14929 .dac_nids = alc660_dac_nids,
14930 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14931 .channel_mode = alc861_threestack_modes,
14933 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14934 .adc_nids = alc861_adc_nids,
14935 .input_mux = &alc861_capture_source,
14937 [ALC861_UNIWILL_M31] = {
14938 .mixers = { alc861_uniwill_m31_mixer },
14939 .init_verbs = { alc861_uniwill_m31_init_verbs },
14940 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14941 .dac_nids = alc861_dac_nids,
14942 .dig_out_nid = ALC861_DIGOUT_NID,
14943 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14944 .channel_mode = alc861_uniwill_m31_modes,
14946 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14947 .adc_nids = alc861_adc_nids,
14948 .input_mux = &alc861_capture_source,
14950 [ALC861_TOSHIBA] = {
14951 .mixers = { alc861_toshiba_mixer },
14952 .init_verbs = { alc861_base_init_verbs,
14953 alc861_toshiba_init_verbs },
14954 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14955 .dac_nids = alc861_dac_nids,
14956 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14957 .channel_mode = alc883_3ST_2ch_modes,
14958 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14959 .adc_nids = alc861_adc_nids,
14960 .input_mux = &alc861_capture_source,
14961 .unsol_event = alc861_toshiba_unsol_event,
14962 .init_hook = alc861_toshiba_automute,
14965 .mixers = { alc861_asus_mixer },
14966 .init_verbs = { alc861_asus_init_verbs },
14967 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14968 .dac_nids = alc861_dac_nids,
14969 .dig_out_nid = ALC861_DIGOUT_NID,
14970 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14971 .channel_mode = alc861_asus_modes,
14974 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14975 .adc_nids = alc861_adc_nids,
14976 .input_mux = &alc861_capture_source,
14978 [ALC861_ASUS_LAPTOP] = {
14979 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14980 .init_verbs = { alc861_asus_init_verbs,
14981 alc861_asus_laptop_init_verbs },
14982 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14983 .dac_nids = alc861_dac_nids,
14984 .dig_out_nid = ALC861_DIGOUT_NID,
14985 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14986 .channel_mode = alc883_3ST_2ch_modes,
14988 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14989 .adc_nids = alc861_adc_nids,
14990 .input_mux = &alc861_capture_source,
14994 /* Pin config fixes */
14996 PINFIX_FSC_AMILO_PI1505,
14999 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
15000 { 0x0b, 0x0221101f }, /* HP */
15001 { 0x0f, 0x90170310 }, /* speaker */
15005 static const struct alc_fixup alc861_fixups[] = {
15006 [PINFIX_FSC_AMILO_PI1505] = {
15007 .pins = alc861_fsc_amilo_pi1505_pinfix
15011 static struct snd_pci_quirk alc861_fixup_tbl[] = {
15012 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
15016 static int patch_alc861(struct hda_codec *codec)
15018 struct alc_spec *spec;
15022 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15026 codec->spec = spec;
15028 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15032 if (board_config < 0) {
15033 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15035 board_config = ALC861_AUTO;
15038 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15040 if (board_config == ALC861_AUTO) {
15041 /* automatic parse from the BIOS config */
15042 err = alc861_parse_auto_config(codec);
15048 "hda_codec: Cannot set up configuration "
15049 "from BIOS. Using base mode...\n");
15050 board_config = ALC861_3ST_DIG;
15054 err = snd_hda_attach_beep_device(codec, 0x23);
15060 if (board_config != ALC861_AUTO)
15061 setup_preset(codec, &alc861_presets[board_config]);
15063 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15064 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15066 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15067 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15069 if (!spec->cap_mixer)
15070 set_capture_mixer(codec);
15071 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15073 spec->vmaster_nid = 0x03;
15075 codec->patch_ops = alc_patch_ops;
15076 if (board_config == ALC861_AUTO) {
15077 spec->init_hook = alc861_auto_init;
15078 #ifdef CONFIG_SND_HDA_POWER_SAVE
15079 spec->power_hook = alc_power_eapd;
15082 #ifdef CONFIG_SND_HDA_POWER_SAVE
15083 if (!spec->loopback.amplist)
15084 spec->loopback.amplist = alc861_loopbacks;
15086 codec->proc_widget_hook = print_realtek_coef;
15092 * ALC861-VD support
15096 * In addition, an independent DAC
15098 #define ALC861VD_DIGOUT_NID 0x06
15100 static hda_nid_t alc861vd_dac_nids[4] = {
15101 /* front, surr, clfe, side surr */
15102 0x02, 0x03, 0x04, 0x05
15105 /* dac_nids for ALC660vd are in a different order - according to
15106 * Realtek's driver.
15107 * This should probably result in a different mixer for 6stack models
15108 * of ALC660vd codecs, but for now there is only 3stack mixer
15109 * - and it is the same as in 861vd.
15110 * adc_nids in ALC660vd are (is) the same as in 861vd
15112 static hda_nid_t alc660vd_dac_nids[3] = {
15113 /* front, rear, clfe, rear_surr */
15117 static hda_nid_t alc861vd_adc_nids[1] = {
15122 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15125 /* FIXME: should be a matrix-type input source selection */
15126 static struct hda_input_mux alc861vd_capture_source = {
15130 { "Front Mic", 0x1 },
15136 static struct hda_input_mux alc861vd_dallas_capture_source = {
15139 { "Ext Mic", 0x0 },
15140 { "Int Mic", 0x1 },
15144 static struct hda_input_mux alc861vd_hp_capture_source = {
15147 { "Front Mic", 0x0 },
15148 { "ATAPI Mic", 0x1 },
15155 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15162 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15163 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15164 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15165 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15166 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15173 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15174 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15175 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15176 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15177 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15181 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15182 { 6, alc861vd_6stack_ch6_init },
15183 { 8, alc861vd_6stack_ch8_init },
15186 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15188 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15189 .name = "Channel Mode",
15190 .info = alc_ch_mode_info,
15191 .get = alc_ch_mode_get,
15192 .put = alc_ch_mode_put,
15197 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15198 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15200 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15201 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15204 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15205 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15209 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15211 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15212 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15214 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15215 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15217 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15224 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15225 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15230 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15231 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15236 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15237 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15238 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15240 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15242 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15246 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15247 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15248 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15253 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15254 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15259 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15260 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15261 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15262 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15270 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15271 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15272 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15274 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15275 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15280 /* Pin assignment: Speaker=0x14, HP = 0x15,
15281 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15283 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15284 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15285 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15286 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15287 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15288 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15289 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15290 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15291 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15292 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15293 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15297 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15298 * Front Mic=0x18, ATAPI Mic = 0x19,
15300 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15301 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15302 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15303 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15304 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15305 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15306 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15307 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15308 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15314 * generic initialization of ADC, input mixers and output mixers
15316 static struct hda_verb alc861vd_volume_init_verbs[] = {
15318 * Unmute ADC0 and set the default input to mic-in
15320 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15321 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15323 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15324 * the analog-loopback mixer widget
15326 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15328 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15329 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15330 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15331 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15333 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15334 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15335 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15336 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15337 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15340 * Set up output mixers (0x02 - 0x05)
15342 /* set vol=0 to output mixers */
15343 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15344 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15345 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15346 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15348 /* set up input amps for analog loopback */
15349 /* Amp Indices: DAC = 0, mixer = 1 */
15350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15352 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15354 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15357 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15363 * 3-stack pin configuration:
15364 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15366 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15368 * Set pin mode and muting
15370 /* set front pin widgets 0x14 for output */
15371 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15372 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15373 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15375 /* Mic (rear) pin: input vref at 80% */
15376 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15377 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15378 /* Front Mic pin: input vref at 80% */
15379 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15380 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15381 /* Line In pin: input */
15382 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15383 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15384 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15385 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15386 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15387 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15388 /* CD pin widget for input */
15389 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15395 * 6-stack pin configuration:
15397 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15399 * Set pin mode and muting
15401 /* set front pin widgets 0x14 for output */
15402 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15403 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15404 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15406 /* Rear Pin: output 1 (0x0d) */
15407 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15409 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15410 /* CLFE Pin: output 2 (0x0e) */
15411 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15412 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15413 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15414 /* Side Pin: output 3 (0x0f) */
15415 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15416 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15417 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15419 /* Mic (rear) pin: input vref at 80% */
15420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15422 /* Front Mic pin: input vref at 80% */
15423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15425 /* Line In pin: input */
15426 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15427 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15428 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15430 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15431 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15432 /* CD pin widget for input */
15433 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15438 static struct hda_verb alc861vd_eapd_verbs[] = {
15439 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15443 static struct hda_verb alc660vd_eapd_verbs[] = {
15444 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15445 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15449 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15451 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15453 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15458 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15460 unsigned int present;
15461 unsigned char bits;
15463 present = snd_hda_jack_detect(codec, 0x18);
15464 bits = present ? HDA_AMP_MUTE : 0;
15466 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15467 HDA_AMP_MUTE, bits);
15470 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15472 struct alc_spec *spec = codec->spec;
15473 spec->autocfg.hp_pins[0] = 0x1b;
15474 spec->autocfg.speaker_pins[0] = 0x14;
15477 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15479 alc_automute_amp(codec);
15480 alc861vd_lenovo_mic_automute(codec);
15483 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15486 switch (res >> 26) {
15487 case ALC880_MIC_EVENT:
15488 alc861vd_lenovo_mic_automute(codec);
15491 alc_automute_amp_unsol_event(codec, res);
15496 static struct hda_verb alc861vd_dallas_verbs[] = {
15497 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15498 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15499 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15500 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15508 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15509 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15513 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15515 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15516 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15517 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15518 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15522 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15523 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15525 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15526 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15527 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15529 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15530 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15531 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15532 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15534 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15535 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15536 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15541 /* toggle speaker-output according to the hp-jack state */
15542 static void alc861vd_dallas_setup(struct hda_codec *codec)
15544 struct alc_spec *spec = codec->spec;
15546 spec->autocfg.hp_pins[0] = 0x15;
15547 spec->autocfg.speaker_pins[0] = 0x14;
15550 #ifdef CONFIG_SND_HDA_POWER_SAVE
15551 #define alc861vd_loopbacks alc880_loopbacks
15554 /* pcm configuration: identical with ALC880 */
15555 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15556 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15557 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15558 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15561 * configuration and preset
15563 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15564 [ALC660VD_3ST] = "3stack-660",
15565 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15566 [ALC660VD_ASUS_V1S] = "asus-v1s",
15567 [ALC861VD_3ST] = "3stack",
15568 [ALC861VD_3ST_DIG] = "3stack-digout",
15569 [ALC861VD_6ST_DIG] = "6stack-digout",
15570 [ALC861VD_LENOVO] = "lenovo",
15571 [ALC861VD_DALLAS] = "dallas",
15572 [ALC861VD_HP] = "hp",
15573 [ALC861VD_AUTO] = "auto",
15576 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15577 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15578 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15579 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15580 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15581 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15582 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15583 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15584 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15585 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15586 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15587 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15588 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15589 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15590 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15591 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15595 static struct alc_config_preset alc861vd_presets[] = {
15597 .mixers = { alc861vd_3st_mixer },
15598 .init_verbs = { alc861vd_volume_init_verbs,
15599 alc861vd_3stack_init_verbs },
15600 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15601 .dac_nids = alc660vd_dac_nids,
15602 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15603 .channel_mode = alc861vd_3stack_2ch_modes,
15604 .input_mux = &alc861vd_capture_source,
15606 [ALC660VD_3ST_DIG] = {
15607 .mixers = { alc861vd_3st_mixer },
15608 .init_verbs = { alc861vd_volume_init_verbs,
15609 alc861vd_3stack_init_verbs },
15610 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15611 .dac_nids = alc660vd_dac_nids,
15612 .dig_out_nid = ALC861VD_DIGOUT_NID,
15613 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15614 .channel_mode = alc861vd_3stack_2ch_modes,
15615 .input_mux = &alc861vd_capture_source,
15618 .mixers = { alc861vd_3st_mixer },
15619 .init_verbs = { alc861vd_volume_init_verbs,
15620 alc861vd_3stack_init_verbs },
15621 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15622 .dac_nids = alc861vd_dac_nids,
15623 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15624 .channel_mode = alc861vd_3stack_2ch_modes,
15625 .input_mux = &alc861vd_capture_source,
15627 [ALC861VD_3ST_DIG] = {
15628 .mixers = { alc861vd_3st_mixer },
15629 .init_verbs = { alc861vd_volume_init_verbs,
15630 alc861vd_3stack_init_verbs },
15631 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15632 .dac_nids = alc861vd_dac_nids,
15633 .dig_out_nid = ALC861VD_DIGOUT_NID,
15634 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15635 .channel_mode = alc861vd_3stack_2ch_modes,
15636 .input_mux = &alc861vd_capture_source,
15638 [ALC861VD_6ST_DIG] = {
15639 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15640 .init_verbs = { alc861vd_volume_init_verbs,
15641 alc861vd_6stack_init_verbs },
15642 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15643 .dac_nids = alc861vd_dac_nids,
15644 .dig_out_nid = ALC861VD_DIGOUT_NID,
15645 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15646 .channel_mode = alc861vd_6stack_modes,
15647 .input_mux = &alc861vd_capture_source,
15649 [ALC861VD_LENOVO] = {
15650 .mixers = { alc861vd_lenovo_mixer },
15651 .init_verbs = { alc861vd_volume_init_verbs,
15652 alc861vd_3stack_init_verbs,
15653 alc861vd_eapd_verbs,
15654 alc861vd_lenovo_unsol_verbs },
15655 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15656 .dac_nids = alc660vd_dac_nids,
15657 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15658 .channel_mode = alc861vd_3stack_2ch_modes,
15659 .input_mux = &alc861vd_capture_source,
15660 .unsol_event = alc861vd_lenovo_unsol_event,
15661 .setup = alc861vd_lenovo_setup,
15662 .init_hook = alc861vd_lenovo_init_hook,
15664 [ALC861VD_DALLAS] = {
15665 .mixers = { alc861vd_dallas_mixer },
15666 .init_verbs = { alc861vd_dallas_verbs },
15667 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15668 .dac_nids = alc861vd_dac_nids,
15669 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15670 .channel_mode = alc861vd_3stack_2ch_modes,
15671 .input_mux = &alc861vd_dallas_capture_source,
15672 .unsol_event = alc_automute_amp_unsol_event,
15673 .setup = alc861vd_dallas_setup,
15674 .init_hook = alc_automute_amp,
15677 .mixers = { alc861vd_hp_mixer },
15678 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15679 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15680 .dac_nids = alc861vd_dac_nids,
15681 .dig_out_nid = ALC861VD_DIGOUT_NID,
15682 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15683 .channel_mode = alc861vd_3stack_2ch_modes,
15684 .input_mux = &alc861vd_hp_capture_source,
15685 .unsol_event = alc_automute_amp_unsol_event,
15686 .setup = alc861vd_dallas_setup,
15687 .init_hook = alc_automute_amp,
15689 [ALC660VD_ASUS_V1S] = {
15690 .mixers = { alc861vd_lenovo_mixer },
15691 .init_verbs = { alc861vd_volume_init_verbs,
15692 alc861vd_3stack_init_verbs,
15693 alc861vd_eapd_verbs,
15694 alc861vd_lenovo_unsol_verbs },
15695 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15696 .dac_nids = alc660vd_dac_nids,
15697 .dig_out_nid = ALC861VD_DIGOUT_NID,
15698 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15699 .channel_mode = alc861vd_3stack_2ch_modes,
15700 .input_mux = &alc861vd_capture_source,
15701 .unsol_event = alc861vd_lenovo_unsol_event,
15702 .setup = alc861vd_lenovo_setup,
15703 .init_hook = alc861vd_lenovo_init_hook,
15708 * BIOS auto configuration
15710 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15711 const struct auto_pin_cfg *cfg)
15713 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15717 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15718 hda_nid_t nid, int pin_type, int dac_idx)
15720 alc_set_pin_output(codec, nid, pin_type);
15723 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15725 struct alc_spec *spec = codec->spec;
15728 for (i = 0; i <= HDA_SIDE; i++) {
15729 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15730 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15732 alc861vd_auto_set_output_and_unmute(codec, nid,
15738 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15740 struct alc_spec *spec = codec->spec;
15743 pin = spec->autocfg.hp_pins[0];
15744 if (pin) /* connect to front and use dac 0 */
15745 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15746 pin = spec->autocfg.speaker_pins[0];
15748 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15751 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15753 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15755 struct alc_spec *spec = codec->spec;
15758 for (i = 0; i < AUTO_PIN_LAST; i++) {
15759 hda_nid_t nid = spec->autocfg.input_pins[i];
15760 if (alc_is_input_pin(codec, nid)) {
15761 alc_set_input_pin(codec, nid, i);
15762 if (nid != ALC861VD_PIN_CD_NID &&
15763 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15764 snd_hda_codec_write(codec, nid, 0,
15765 AC_VERB_SET_AMP_GAIN_MUTE,
15771 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15773 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15774 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15776 /* add playback controls from the parsed DAC table */
15777 /* Based on ALC880 version. But ALC861VD has separate,
15778 * different NIDs for mute/unmute switch and volume control */
15779 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15780 const struct auto_pin_cfg *cfg)
15782 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15783 hda_nid_t nid_v, nid_s;
15786 for (i = 0; i < cfg->line_outs; i++) {
15787 if (!spec->multiout.dac_nids[i])
15789 nid_v = alc861vd_idx_to_mixer_vol(
15791 spec->multiout.dac_nids[i]));
15792 nid_s = alc861vd_idx_to_mixer_switch(
15794 spec->multiout.dac_nids[i]));
15798 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15800 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15804 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15806 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15810 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15812 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15816 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15818 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15824 if (cfg->line_outs == 1 &&
15825 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15832 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15833 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15837 if (cfg->line_outs == 1 &&
15838 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15840 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15841 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15850 /* add playback controls for speaker and HP outputs */
15851 /* Based on ALC880 version. But ALC861VD has separate,
15852 * different NIDs for mute/unmute switch and volume control */
15853 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15854 hda_nid_t pin, const char *pfx)
15856 hda_nid_t nid_v, nid_s;
15862 if (alc880_is_fixed_pin(pin)) {
15863 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15864 /* specify the DAC as the extra output */
15865 if (!spec->multiout.hp_nid)
15866 spec->multiout.hp_nid = nid_v;
15868 spec->multiout.extra_out_nid[0] = nid_v;
15869 /* control HP volume/switch on the output mixer amp */
15870 nid_v = alc861vd_idx_to_mixer_vol(
15871 alc880_fixed_pin_idx(pin));
15872 nid_s = alc861vd_idx_to_mixer_switch(
15873 alc880_fixed_pin_idx(pin));
15875 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15876 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15879 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15880 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15883 } else if (alc880_is_multi_pin(pin)) {
15884 /* set manual connection */
15885 /* we have only a switch on HP-out PIN */
15886 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15887 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15894 /* parse the BIOS configuration and set up the alc_spec
15895 * return 1 if successful, 0 if the proper config is not found,
15896 * or a negative error code
15897 * Based on ALC880 version - had to change it to override
15898 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15899 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15901 struct alc_spec *spec = codec->spec;
15903 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15905 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15909 if (!spec->autocfg.line_outs)
15910 return 0; /* can't find valid BIOS pin config */
15912 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15915 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15918 err = alc861vd_auto_create_extra_out(spec,
15919 spec->autocfg.speaker_pins[0],
15923 err = alc861vd_auto_create_extra_out(spec,
15924 spec->autocfg.hp_pins[0],
15928 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15932 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15934 if (spec->autocfg.dig_outs)
15935 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15937 if (spec->kctls.list)
15938 add_mixer(spec, spec->kctls.list);
15940 add_verb(spec, alc861vd_volume_init_verbs);
15942 spec->num_mux_defs = 1;
15943 spec->input_mux = &spec->private_imux[0];
15945 err = alc_auto_add_mic_boost(codec);
15949 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15954 /* additional initialization for auto-configuration model */
15955 static void alc861vd_auto_init(struct hda_codec *codec)
15957 struct alc_spec *spec = codec->spec;
15958 alc861vd_auto_init_multi_out(codec);
15959 alc861vd_auto_init_hp_out(codec);
15960 alc861vd_auto_init_analog_input(codec);
15961 alc861vd_auto_init_input_src(codec);
15962 if (spec->unsol_event)
15963 alc_inithook(codec);
15967 ALC660VD_FIX_ASUS_GPIO1
15971 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15972 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15973 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15974 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15978 static const struct alc_fixup alc861vd_fixups[] = {
15979 [ALC660VD_FIX_ASUS_GPIO1] = {
15980 .verbs = alc660vd_fix_asus_gpio1_verbs,
15984 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15985 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15989 static int patch_alc861vd(struct hda_codec *codec)
15991 struct alc_spec *spec;
15992 int err, board_config;
15994 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15998 codec->spec = spec;
16000 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
16004 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
16005 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16007 board_config = ALC861VD_AUTO;
16010 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
16012 if (board_config == ALC861VD_AUTO) {
16013 /* automatic parse from the BIOS config */
16014 err = alc861vd_parse_auto_config(codec);
16020 "hda_codec: Cannot set up configuration "
16021 "from BIOS. Using base mode...\n");
16022 board_config = ALC861VD_3ST;
16026 err = snd_hda_attach_beep_device(codec, 0x23);
16032 if (board_config != ALC861VD_AUTO)
16033 setup_preset(codec, &alc861vd_presets[board_config]);
16035 if (codec->vendor_id == 0x10ec0660) {
16036 /* always turn on EAPD */
16037 add_verb(spec, alc660vd_eapd_verbs);
16040 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16041 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16043 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16044 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16046 if (!spec->adc_nids) {
16047 spec->adc_nids = alc861vd_adc_nids;
16048 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16050 if (!spec->capsrc_nids)
16051 spec->capsrc_nids = alc861vd_capsrc_nids;
16053 set_capture_mixer(codec);
16054 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16056 spec->vmaster_nid = 0x02;
16058 codec->patch_ops = alc_patch_ops;
16060 if (board_config == ALC861VD_AUTO)
16061 spec->init_hook = alc861vd_auto_init;
16062 #ifdef CONFIG_SND_HDA_POWER_SAVE
16063 if (!spec->loopback.amplist)
16064 spec->loopback.amplist = alc861vd_loopbacks;
16066 codec->proc_widget_hook = print_realtek_coef;
16074 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16075 * configuration. Each pin widget can choose any input DACs and a mixer.
16076 * Each ADC is connected from a mixer of all inputs. This makes possible
16077 * 6-channel independent captures.
16079 * In addition, an independent DAC for the multi-playback (not used in this
16082 #define ALC662_DIGOUT_NID 0x06
16083 #define ALC662_DIGIN_NID 0x0a
16085 static hda_nid_t alc662_dac_nids[4] = {
16086 /* front, rear, clfe, rear_surr */
16090 static hda_nid_t alc272_dac_nids[2] = {
16094 static hda_nid_t alc662_adc_nids[2] = {
16099 static hda_nid_t alc272_adc_nids[1] = {
16104 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16105 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16109 /* FIXME: should be a matrix-type input source selection */
16110 static struct hda_input_mux alc662_capture_source = {
16114 { "Front Mic", 0x1 },
16120 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16128 static struct hda_input_mux alc663_capture_source = {
16132 { "Front Mic", 0x1 },
16137 #if 0 /* set to 1 for testing other input sources below */
16138 static struct hda_input_mux alc272_nc10_capture_source = {
16141 { "Autoselect Mic", 0x0 },
16142 { "Internal Mic", 0x1 },
16143 { "In-0x02", 0x2 },
16144 { "In-0x03", 0x3 },
16145 { "In-0x04", 0x4 },
16146 { "In-0x05", 0x5 },
16147 { "In-0x06", 0x6 },
16148 { "In-0x07", 0x7 },
16149 { "In-0x08", 0x8 },
16150 { "In-0x09", 0x9 },
16151 { "In-0x0a", 0x0a },
16152 { "In-0x0b", 0x0b },
16153 { "In-0x0c", 0x0c },
16154 { "In-0x0d", 0x0d },
16155 { "In-0x0e", 0x0e },
16156 { "In-0x0f", 0x0f },
16164 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16171 static struct hda_verb alc662_3ST_ch2_init[] = {
16172 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16173 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16174 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16175 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16182 static struct hda_verb alc662_3ST_ch6_init[] = {
16183 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16184 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16185 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16186 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16187 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16188 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16192 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16193 { 2, alc662_3ST_ch2_init },
16194 { 6, alc662_3ST_ch6_init },
16200 static struct hda_verb alc662_sixstack_ch6_init[] = {
16201 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16202 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16203 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16210 static struct hda_verb alc662_sixstack_ch8_init[] = {
16211 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16212 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16213 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16217 static struct hda_channel_mode alc662_5stack_modes[2] = {
16218 { 2, alc662_sixstack_ch6_init },
16219 { 6, alc662_sixstack_ch8_init },
16222 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16223 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16226 static struct snd_kcontrol_new alc662_base_mixer[] = {
16227 /* output mixer control */
16228 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16229 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16230 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16231 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16232 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16233 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16234 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16235 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16236 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16238 /*Input mixer control */
16239 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16240 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16241 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16242 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16243 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16244 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16246 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16250 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16251 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16252 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16253 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16254 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16255 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16257 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16260 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16265 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16266 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16267 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16268 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16269 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16270 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16271 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16272 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16273 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16281 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16282 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16286 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16287 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16288 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16289 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16290 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16291 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16299 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16300 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16301 ALC262_HIPPO_MASTER_SWITCH,
16303 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16304 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16305 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16307 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16308 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16309 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16313 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16314 ALC262_HIPPO_MASTER_SWITCH,
16315 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16316 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16317 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16319 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16320 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16321 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16323 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16327 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16328 .ops = &snd_hda_bind_vol,
16330 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16331 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16336 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16337 .ops = &snd_hda_bind_sw,
16339 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16340 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16345 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16346 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16347 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16353 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16354 .ops = &snd_hda_bind_sw,
16356 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16357 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16358 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16363 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16364 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16365 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16367 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16368 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16369 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16374 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16375 .ops = &snd_hda_bind_sw,
16377 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16378 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16379 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16384 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16385 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16386 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16387 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16388 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16389 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16390 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16394 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16395 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16396 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16397 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16400 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16401 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16405 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16406 .ops = &snd_hda_bind_vol,
16408 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16409 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16414 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16415 .ops = &snd_hda_bind_sw,
16417 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16418 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16423 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16424 HDA_BIND_VOL("Master Playback Volume",
16425 &alc663_asus_two_bind_master_vol),
16426 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16427 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16429 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16430 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16434 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16435 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16436 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16437 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16438 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16439 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16440 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16444 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16445 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16446 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16447 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16448 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16449 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16451 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16452 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16453 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16454 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16458 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16460 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16461 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16463 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16464 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16465 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16466 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16467 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16468 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16472 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16473 .ops = &snd_hda_bind_sw,
16475 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16476 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16477 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16478 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16479 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16484 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16485 .ops = &snd_hda_bind_sw,
16487 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16488 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16493 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16494 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16495 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16496 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16497 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16498 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16499 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16500 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16501 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16502 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16506 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16507 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16508 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16509 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16510 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16511 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16512 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16513 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16518 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16520 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16521 .name = "Channel Mode",
16522 .info = alc_ch_mode_info,
16523 .get = alc_ch_mode_get,
16524 .put = alc_ch_mode_put,
16529 static struct hda_verb alc662_init_verbs[] = {
16530 /* ADC: mute amp left and right */
16531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16532 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16533 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16535 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16536 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16537 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16538 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16539 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16548 /* Front Pin: output 0 (0x0c) */
16549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16550 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16552 /* Rear Pin: output 1 (0x0d) */
16553 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16554 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16556 /* CLFE Pin: output 2 (0x0e) */
16557 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16558 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16560 /* Mic (rear) pin: input vref at 80% */
16561 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16562 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16563 /* Front Mic pin: input vref at 80% */
16564 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16566 /* Line In pin: input */
16567 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16568 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16569 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16571 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16572 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16573 /* CD pin widget for input */
16574 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16576 /* FIXME: use matrix-type input source selection */
16577 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16582 /* always trun on EAPD */
16583 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16584 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16589 static struct hda_verb alc662_sue_init_verbs[] = {
16590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16591 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16595 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16596 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16597 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16601 /* Set Unsolicited Event*/
16602 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16603 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16604 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16609 * generic initialization of ADC, input mixers and output mixers
16611 static struct hda_verb alc662_auto_init_verbs[] = {
16613 * Unmute ADC and set the default input to mic-in
16615 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16616 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16618 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16620 * Note: PASD motherboards uses the Line In 2 as the input for front
16621 * panel mic (mic 2)
16623 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16631 * Set up output mixers (0x0c - 0x0f)
16633 /* set vol=0 to output mixers */
16634 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16635 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16636 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16638 /* set up input amps for analog loopback */
16639 /* Amp Indices: DAC = 0, mixer = 1 */
16640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16648 /* FIXME: use matrix-type input source selection */
16649 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16652 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16656 /* additional verbs for ALC663 */
16657 static struct hda_verb alc663_auto_init_verbs[] = {
16658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16659 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16663 static struct hda_verb alc663_m51va_init_verbs[] = {
16664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16665 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16666 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16667 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16668 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16671 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16672 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16676 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16677 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16678 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16679 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16680 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16682 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16683 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16687 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16688 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16689 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16690 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16691 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16693 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16694 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16695 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16699 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16703 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16705 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16706 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16710 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16711 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16712 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16713 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16714 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16715 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16716 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16717 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16720 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16721 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16722 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16726 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16729 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16730 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16731 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16736 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16737 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16742 static struct hda_verb alc663_g71v_init_verbs[] = {
16743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16744 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16745 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16747 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16748 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16749 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16751 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16752 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16753 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16757 static struct hda_verb alc663_g50v_init_verbs[] = {
16758 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16759 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16760 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16762 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16763 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16767 static struct hda_verb alc662_ecs_init_verbs[] = {
16768 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16769 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16770 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16771 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16775 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16776 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16777 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16779 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16780 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16781 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16782 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16783 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16784 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16785 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16786 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16790 static struct hda_verb alc272_dell_init_verbs[] = {
16791 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16792 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16795 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16796 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16797 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16798 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16799 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16800 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16801 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16805 static struct hda_verb alc663_mode7_init_verbs[] = {
16806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16807 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16808 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16809 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16810 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16811 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16812 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16813 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16814 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16815 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16818 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16819 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16820 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16824 static struct hda_verb alc663_mode8_init_verbs[] = {
16825 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16826 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16827 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16828 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16829 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16830 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16831 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16832 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16833 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16834 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16835 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16836 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16837 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16838 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16839 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16840 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16844 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16845 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16846 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16850 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16851 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16852 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16856 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16858 unsigned int present;
16859 unsigned char bits;
16861 present = snd_hda_jack_detect(codec, 0x14);
16862 bits = present ? HDA_AMP_MUTE : 0;
16864 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16865 HDA_AMP_MUTE, bits);
16868 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16870 unsigned int present;
16871 unsigned char bits;
16873 present = snd_hda_jack_detect(codec, 0x1b);
16874 bits = present ? HDA_AMP_MUTE : 0;
16876 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16877 HDA_AMP_MUTE, bits);
16878 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16879 HDA_AMP_MUTE, bits);
16882 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16885 if ((res >> 26) == ALC880_HP_EVENT)
16886 alc662_lenovo_101e_all_automute(codec);
16887 if ((res >> 26) == ALC880_FRONT_EVENT)
16888 alc662_lenovo_101e_ispeaker_automute(codec);
16891 /* unsolicited event for HP jack sensing */
16892 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16895 if ((res >> 26) == ALC880_MIC_EVENT)
16896 alc_mic_automute(codec);
16898 alc262_hippo_unsol_event(codec, res);
16901 static void alc662_eeepc_setup(struct hda_codec *codec)
16903 struct alc_spec *spec = codec->spec;
16905 alc262_hippo1_setup(codec);
16906 spec->ext_mic.pin = 0x18;
16907 spec->ext_mic.mux_idx = 0;
16908 spec->int_mic.pin = 0x19;
16909 spec->int_mic.mux_idx = 1;
16910 spec->auto_mic = 1;
16913 static void alc662_eeepc_inithook(struct hda_codec *codec)
16915 alc262_hippo_automute(codec);
16916 alc_mic_automute(codec);
16919 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16921 struct alc_spec *spec = codec->spec;
16923 spec->autocfg.hp_pins[0] = 0x14;
16924 spec->autocfg.speaker_pins[0] = 0x1b;
16927 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16929 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16931 unsigned int present;
16932 unsigned char bits;
16934 present = snd_hda_jack_detect(codec, 0x21);
16935 bits = present ? HDA_AMP_MUTE : 0;
16936 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16937 AMP_IN_MUTE(0), bits);
16938 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16939 AMP_IN_MUTE(0), bits);
16942 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16944 unsigned int present;
16945 unsigned char bits;
16947 present = snd_hda_jack_detect(codec, 0x21);
16948 bits = present ? HDA_AMP_MUTE : 0;
16949 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16950 AMP_IN_MUTE(0), bits);
16951 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16952 AMP_IN_MUTE(0), bits);
16953 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16954 AMP_IN_MUTE(0), bits);
16955 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16956 AMP_IN_MUTE(0), bits);
16959 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16961 unsigned int present;
16962 unsigned char bits;
16964 present = snd_hda_jack_detect(codec, 0x15);
16965 bits = present ? HDA_AMP_MUTE : 0;
16966 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16967 AMP_IN_MUTE(0), bits);
16968 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16969 AMP_IN_MUTE(0), bits);
16970 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16971 AMP_IN_MUTE(0), bits);
16972 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16973 AMP_IN_MUTE(0), bits);
16976 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16978 unsigned int present;
16979 unsigned char bits;
16981 present = snd_hda_jack_detect(codec, 0x1b);
16982 bits = present ? 0 : PIN_OUT;
16983 snd_hda_codec_write(codec, 0x14, 0,
16984 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16987 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16989 unsigned int present1, present2;
16991 present1 = snd_hda_jack_detect(codec, 0x21);
16992 present2 = snd_hda_jack_detect(codec, 0x15);
16994 if (present1 || present2) {
16995 snd_hda_codec_write_cache(codec, 0x14, 0,
16996 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16998 snd_hda_codec_write_cache(codec, 0x14, 0,
16999 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17003 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
17005 unsigned int present1, present2;
17007 present1 = snd_hda_jack_detect(codec, 0x1b);
17008 present2 = snd_hda_jack_detect(codec, 0x15);
17010 if (present1 || present2) {
17011 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17012 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17013 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17014 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
17016 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
17017 AMP_IN_MUTE(0), 0);
17018 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
17019 AMP_IN_MUTE(0), 0);
17023 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
17025 unsigned int present1, present2;
17027 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17028 AC_VERB_GET_PIN_SENSE, 0)
17029 & AC_PINSENSE_PRESENCE;
17030 present2 = snd_hda_codec_read(codec, 0x21, 0,
17031 AC_VERB_GET_PIN_SENSE, 0)
17032 & AC_PINSENSE_PRESENCE;
17034 if (present1 || present2) {
17035 snd_hda_codec_write_cache(codec, 0x14, 0,
17036 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17037 snd_hda_codec_write_cache(codec, 0x17, 0,
17038 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17040 snd_hda_codec_write_cache(codec, 0x14, 0,
17041 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17042 snd_hda_codec_write_cache(codec, 0x17, 0,
17043 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17047 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17049 unsigned int present1, present2;
17051 present1 = snd_hda_codec_read(codec, 0x21, 0,
17052 AC_VERB_GET_PIN_SENSE, 0)
17053 & AC_PINSENSE_PRESENCE;
17054 present2 = snd_hda_codec_read(codec, 0x15, 0,
17055 AC_VERB_GET_PIN_SENSE, 0)
17056 & AC_PINSENSE_PRESENCE;
17058 if (present1 || present2) {
17059 snd_hda_codec_write_cache(codec, 0x14, 0,
17060 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17061 snd_hda_codec_write_cache(codec, 0x17, 0,
17062 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17064 snd_hda_codec_write_cache(codec, 0x14, 0,
17065 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17066 snd_hda_codec_write_cache(codec, 0x17, 0,
17067 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17071 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17074 switch (res >> 26) {
17075 case ALC880_HP_EVENT:
17076 alc663_m51va_speaker_automute(codec);
17078 case ALC880_MIC_EVENT:
17079 alc_mic_automute(codec);
17084 static void alc663_m51va_setup(struct hda_codec *codec)
17086 struct alc_spec *spec = codec->spec;
17087 spec->ext_mic.pin = 0x18;
17088 spec->ext_mic.mux_idx = 0;
17089 spec->int_mic.pin = 0x12;
17090 spec->int_mic.mux_idx = 9;
17091 spec->auto_mic = 1;
17094 static void alc663_m51va_inithook(struct hda_codec *codec)
17096 alc663_m51va_speaker_automute(codec);
17097 alc_mic_automute(codec);
17100 /* ***************** Mode1 ******************************/
17101 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17103 static void alc663_mode1_setup(struct hda_codec *codec)
17105 struct alc_spec *spec = codec->spec;
17106 spec->ext_mic.pin = 0x18;
17107 spec->ext_mic.mux_idx = 0;
17108 spec->int_mic.pin = 0x19;
17109 spec->int_mic.mux_idx = 1;
17110 spec->auto_mic = 1;
17113 #define alc663_mode1_inithook alc663_m51va_inithook
17115 /* ***************** Mode2 ******************************/
17116 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17119 switch (res >> 26) {
17120 case ALC880_HP_EVENT:
17121 alc662_f5z_speaker_automute(codec);
17123 case ALC880_MIC_EVENT:
17124 alc_mic_automute(codec);
17129 #define alc662_mode2_setup alc663_mode1_setup
17131 static void alc662_mode2_inithook(struct hda_codec *codec)
17133 alc662_f5z_speaker_automute(codec);
17134 alc_mic_automute(codec);
17136 /* ***************** Mode3 ******************************/
17137 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17140 switch (res >> 26) {
17141 case ALC880_HP_EVENT:
17142 alc663_two_hp_m1_speaker_automute(codec);
17144 case ALC880_MIC_EVENT:
17145 alc_mic_automute(codec);
17150 #define alc663_mode3_setup alc663_mode1_setup
17152 static void alc663_mode3_inithook(struct hda_codec *codec)
17154 alc663_two_hp_m1_speaker_automute(codec);
17155 alc_mic_automute(codec);
17157 /* ***************** Mode4 ******************************/
17158 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17161 switch (res >> 26) {
17162 case ALC880_HP_EVENT:
17163 alc663_21jd_two_speaker_automute(codec);
17165 case ALC880_MIC_EVENT:
17166 alc_mic_automute(codec);
17171 #define alc663_mode4_setup alc663_mode1_setup
17173 static void alc663_mode4_inithook(struct hda_codec *codec)
17175 alc663_21jd_two_speaker_automute(codec);
17176 alc_mic_automute(codec);
17178 /* ***************** Mode5 ******************************/
17179 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17182 switch (res >> 26) {
17183 case ALC880_HP_EVENT:
17184 alc663_15jd_two_speaker_automute(codec);
17186 case ALC880_MIC_EVENT:
17187 alc_mic_automute(codec);
17192 #define alc663_mode5_setup alc663_mode1_setup
17194 static void alc663_mode5_inithook(struct hda_codec *codec)
17196 alc663_15jd_two_speaker_automute(codec);
17197 alc_mic_automute(codec);
17199 /* ***************** Mode6 ******************************/
17200 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17203 switch (res >> 26) {
17204 case ALC880_HP_EVENT:
17205 alc663_two_hp_m2_speaker_automute(codec);
17207 case ALC880_MIC_EVENT:
17208 alc_mic_automute(codec);
17213 #define alc663_mode6_setup alc663_mode1_setup
17215 static void alc663_mode6_inithook(struct hda_codec *codec)
17217 alc663_two_hp_m2_speaker_automute(codec);
17218 alc_mic_automute(codec);
17221 /* ***************** Mode7 ******************************/
17222 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17225 switch (res >> 26) {
17226 case ALC880_HP_EVENT:
17227 alc663_two_hp_m7_speaker_automute(codec);
17229 case ALC880_MIC_EVENT:
17230 alc_mic_automute(codec);
17235 #define alc663_mode7_setup alc663_mode1_setup
17237 static void alc663_mode7_inithook(struct hda_codec *codec)
17239 alc663_two_hp_m7_speaker_automute(codec);
17240 alc_mic_automute(codec);
17243 /* ***************** Mode8 ******************************/
17244 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17247 switch (res >> 26) {
17248 case ALC880_HP_EVENT:
17249 alc663_two_hp_m8_speaker_automute(codec);
17251 case ALC880_MIC_EVENT:
17252 alc_mic_automute(codec);
17257 #define alc663_mode8_setup alc663_m51va_setup
17259 static void alc663_mode8_inithook(struct hda_codec *codec)
17261 alc663_two_hp_m8_speaker_automute(codec);
17262 alc_mic_automute(codec);
17265 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17267 unsigned int present;
17268 unsigned char bits;
17270 present = snd_hda_jack_detect(codec, 0x21);
17271 bits = present ? HDA_AMP_MUTE : 0;
17272 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17273 HDA_AMP_MUTE, bits);
17274 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17275 HDA_AMP_MUTE, bits);
17278 static void alc663_g71v_front_automute(struct hda_codec *codec)
17280 unsigned int present;
17281 unsigned char bits;
17283 present = snd_hda_jack_detect(codec, 0x15);
17284 bits = present ? HDA_AMP_MUTE : 0;
17285 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17286 HDA_AMP_MUTE, bits);
17289 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17292 switch (res >> 26) {
17293 case ALC880_HP_EVENT:
17294 alc663_g71v_hp_automute(codec);
17296 case ALC880_FRONT_EVENT:
17297 alc663_g71v_front_automute(codec);
17299 case ALC880_MIC_EVENT:
17300 alc_mic_automute(codec);
17305 #define alc663_g71v_setup alc663_m51va_setup
17307 static void alc663_g71v_inithook(struct hda_codec *codec)
17309 alc663_g71v_front_automute(codec);
17310 alc663_g71v_hp_automute(codec);
17311 alc_mic_automute(codec);
17314 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17317 switch (res >> 26) {
17318 case ALC880_HP_EVENT:
17319 alc663_m51va_speaker_automute(codec);
17321 case ALC880_MIC_EVENT:
17322 alc_mic_automute(codec);
17327 #define alc663_g50v_setup alc663_m51va_setup
17329 static void alc663_g50v_inithook(struct hda_codec *codec)
17331 alc663_m51va_speaker_automute(codec);
17332 alc_mic_automute(codec);
17335 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17336 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17337 ALC262_HIPPO_MASTER_SWITCH,
17339 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17340 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17341 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17343 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17344 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17345 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17349 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17350 /* Master Playback automatically created from Speaker and Headphone */
17351 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17352 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17353 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17354 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17356 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17357 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17358 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17360 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17361 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17362 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17366 #ifdef CONFIG_SND_HDA_POWER_SAVE
17367 #define alc662_loopbacks alc880_loopbacks
17371 /* pcm configuration: identical with ALC880 */
17372 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17373 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17374 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17375 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17378 * configuration and preset
17380 static const char *alc662_models[ALC662_MODEL_LAST] = {
17381 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17382 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17383 [ALC662_3ST_6ch] = "3stack-6ch",
17384 [ALC662_5ST_DIG] = "6stack-dig",
17385 [ALC662_LENOVO_101E] = "lenovo-101e",
17386 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17387 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17388 [ALC662_ECS] = "ecs",
17389 [ALC663_ASUS_M51VA] = "m51va",
17390 [ALC663_ASUS_G71V] = "g71v",
17391 [ALC663_ASUS_H13] = "h13",
17392 [ALC663_ASUS_G50V] = "g50v",
17393 [ALC663_ASUS_MODE1] = "asus-mode1",
17394 [ALC662_ASUS_MODE2] = "asus-mode2",
17395 [ALC663_ASUS_MODE3] = "asus-mode3",
17396 [ALC663_ASUS_MODE4] = "asus-mode4",
17397 [ALC663_ASUS_MODE5] = "asus-mode5",
17398 [ALC663_ASUS_MODE6] = "asus-mode6",
17399 [ALC663_ASUS_MODE7] = "asus-mode7",
17400 [ALC663_ASUS_MODE8] = "asus-mode8",
17401 [ALC272_DELL] = "dell",
17402 [ALC272_DELL_ZM1] = "dell-zm1",
17403 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17404 [ALC662_AUTO] = "auto",
17407 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17408 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17409 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17410 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17411 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17412 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17413 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17414 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17415 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17416 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17417 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17418 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17419 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17420 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17421 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17422 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17423 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17424 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17425 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17426 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17427 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17428 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17429 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17430 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17431 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17432 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17433 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17434 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17435 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17436 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17437 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17438 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17439 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17440 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17441 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17442 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17443 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17444 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17445 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17446 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17447 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17448 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17449 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17450 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17451 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17452 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17453 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17454 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17455 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17456 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17457 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17458 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17459 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17460 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17461 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17462 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17463 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17464 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17465 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17466 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17467 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17468 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17469 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17470 ALC662_3ST_6ch_DIG),
17471 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17472 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17473 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17474 ALC662_3ST_6ch_DIG),
17475 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17476 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17477 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17478 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17479 ALC662_3ST_6ch_DIG),
17480 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17482 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17486 static struct alc_config_preset alc662_presets[] = {
17487 [ALC662_3ST_2ch_DIG] = {
17488 .mixers = { alc662_3ST_2ch_mixer },
17489 .init_verbs = { alc662_init_verbs },
17490 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17491 .dac_nids = alc662_dac_nids,
17492 .dig_out_nid = ALC662_DIGOUT_NID,
17493 .dig_in_nid = ALC662_DIGIN_NID,
17494 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17495 .channel_mode = alc662_3ST_2ch_modes,
17496 .input_mux = &alc662_capture_source,
17498 [ALC662_3ST_6ch_DIG] = {
17499 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17500 .init_verbs = { alc662_init_verbs },
17501 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17502 .dac_nids = alc662_dac_nids,
17503 .dig_out_nid = ALC662_DIGOUT_NID,
17504 .dig_in_nid = ALC662_DIGIN_NID,
17505 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17506 .channel_mode = alc662_3ST_6ch_modes,
17508 .input_mux = &alc662_capture_source,
17510 [ALC662_3ST_6ch] = {
17511 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17512 .init_verbs = { alc662_init_verbs },
17513 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17514 .dac_nids = alc662_dac_nids,
17515 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17516 .channel_mode = alc662_3ST_6ch_modes,
17518 .input_mux = &alc662_capture_source,
17520 [ALC662_5ST_DIG] = {
17521 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17522 .init_verbs = { alc662_init_verbs },
17523 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17524 .dac_nids = alc662_dac_nids,
17525 .dig_out_nid = ALC662_DIGOUT_NID,
17526 .dig_in_nid = ALC662_DIGIN_NID,
17527 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17528 .channel_mode = alc662_5stack_modes,
17529 .input_mux = &alc662_capture_source,
17531 [ALC662_LENOVO_101E] = {
17532 .mixers = { alc662_lenovo_101e_mixer },
17533 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17534 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17535 .dac_nids = alc662_dac_nids,
17536 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17537 .channel_mode = alc662_3ST_2ch_modes,
17538 .input_mux = &alc662_lenovo_101e_capture_source,
17539 .unsol_event = alc662_lenovo_101e_unsol_event,
17540 .init_hook = alc662_lenovo_101e_all_automute,
17542 [ALC662_ASUS_EEEPC_P701] = {
17543 .mixers = { alc662_eeepc_p701_mixer },
17544 .init_verbs = { alc662_init_verbs,
17545 alc662_eeepc_sue_init_verbs },
17546 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17547 .dac_nids = alc662_dac_nids,
17548 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17549 .channel_mode = alc662_3ST_2ch_modes,
17550 .unsol_event = alc662_eeepc_unsol_event,
17551 .setup = alc662_eeepc_setup,
17552 .init_hook = alc662_eeepc_inithook,
17554 [ALC662_ASUS_EEEPC_EP20] = {
17555 .mixers = { alc662_eeepc_ep20_mixer,
17556 alc662_chmode_mixer },
17557 .init_verbs = { alc662_init_verbs,
17558 alc662_eeepc_ep20_sue_init_verbs },
17559 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17560 .dac_nids = alc662_dac_nids,
17561 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17562 .channel_mode = alc662_3ST_6ch_modes,
17563 .input_mux = &alc662_lenovo_101e_capture_source,
17564 .unsol_event = alc662_eeepc_unsol_event,
17565 .setup = alc662_eeepc_ep20_setup,
17566 .init_hook = alc662_eeepc_ep20_inithook,
17569 .mixers = { alc662_ecs_mixer },
17570 .init_verbs = { alc662_init_verbs,
17571 alc662_ecs_init_verbs },
17572 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17573 .dac_nids = alc662_dac_nids,
17574 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17575 .channel_mode = alc662_3ST_2ch_modes,
17576 .unsol_event = alc662_eeepc_unsol_event,
17577 .setup = alc662_eeepc_setup,
17578 .init_hook = alc662_eeepc_inithook,
17580 [ALC663_ASUS_M51VA] = {
17581 .mixers = { alc663_m51va_mixer },
17582 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17583 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17584 .dac_nids = alc662_dac_nids,
17585 .dig_out_nid = ALC662_DIGOUT_NID,
17586 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17587 .channel_mode = alc662_3ST_2ch_modes,
17588 .unsol_event = alc663_m51va_unsol_event,
17589 .setup = alc663_m51va_setup,
17590 .init_hook = alc663_m51va_inithook,
17592 [ALC663_ASUS_G71V] = {
17593 .mixers = { alc663_g71v_mixer },
17594 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17595 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17596 .dac_nids = alc662_dac_nids,
17597 .dig_out_nid = ALC662_DIGOUT_NID,
17598 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17599 .channel_mode = alc662_3ST_2ch_modes,
17600 .unsol_event = alc663_g71v_unsol_event,
17601 .setup = alc663_g71v_setup,
17602 .init_hook = alc663_g71v_inithook,
17604 [ALC663_ASUS_H13] = {
17605 .mixers = { alc663_m51va_mixer },
17606 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17607 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17608 .dac_nids = alc662_dac_nids,
17609 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17610 .channel_mode = alc662_3ST_2ch_modes,
17611 .unsol_event = alc663_m51va_unsol_event,
17612 .init_hook = alc663_m51va_inithook,
17614 [ALC663_ASUS_G50V] = {
17615 .mixers = { alc663_g50v_mixer },
17616 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17617 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17618 .dac_nids = alc662_dac_nids,
17619 .dig_out_nid = ALC662_DIGOUT_NID,
17620 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17621 .channel_mode = alc662_3ST_6ch_modes,
17622 .input_mux = &alc663_capture_source,
17623 .unsol_event = alc663_g50v_unsol_event,
17624 .setup = alc663_g50v_setup,
17625 .init_hook = alc663_g50v_inithook,
17627 [ALC663_ASUS_MODE1] = {
17628 .mixers = { alc663_m51va_mixer },
17629 .cap_mixer = alc662_auto_capture_mixer,
17630 .init_verbs = { alc662_init_verbs,
17631 alc663_21jd_amic_init_verbs },
17632 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17634 .dac_nids = alc662_dac_nids,
17635 .dig_out_nid = ALC662_DIGOUT_NID,
17636 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17637 .channel_mode = alc662_3ST_2ch_modes,
17638 .unsol_event = alc663_mode1_unsol_event,
17639 .setup = alc663_mode1_setup,
17640 .init_hook = alc663_mode1_inithook,
17642 [ALC662_ASUS_MODE2] = {
17643 .mixers = { alc662_1bjd_mixer },
17644 .cap_mixer = alc662_auto_capture_mixer,
17645 .init_verbs = { alc662_init_verbs,
17646 alc662_1bjd_amic_init_verbs },
17647 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17648 .dac_nids = alc662_dac_nids,
17649 .dig_out_nid = ALC662_DIGOUT_NID,
17650 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17651 .channel_mode = alc662_3ST_2ch_modes,
17652 .unsol_event = alc662_mode2_unsol_event,
17653 .setup = alc662_mode2_setup,
17654 .init_hook = alc662_mode2_inithook,
17656 [ALC663_ASUS_MODE3] = {
17657 .mixers = { alc663_two_hp_m1_mixer },
17658 .cap_mixer = alc662_auto_capture_mixer,
17659 .init_verbs = { alc662_init_verbs,
17660 alc663_two_hp_amic_m1_init_verbs },
17661 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17663 .dac_nids = alc662_dac_nids,
17664 .dig_out_nid = ALC662_DIGOUT_NID,
17665 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17666 .channel_mode = alc662_3ST_2ch_modes,
17667 .unsol_event = alc663_mode3_unsol_event,
17668 .setup = alc663_mode3_setup,
17669 .init_hook = alc663_mode3_inithook,
17671 [ALC663_ASUS_MODE4] = {
17672 .mixers = { alc663_asus_21jd_clfe_mixer },
17673 .cap_mixer = alc662_auto_capture_mixer,
17674 .init_verbs = { alc662_init_verbs,
17675 alc663_21jd_amic_init_verbs},
17676 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17678 .dac_nids = alc662_dac_nids,
17679 .dig_out_nid = ALC662_DIGOUT_NID,
17680 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17681 .channel_mode = alc662_3ST_2ch_modes,
17682 .unsol_event = alc663_mode4_unsol_event,
17683 .setup = alc663_mode4_setup,
17684 .init_hook = alc663_mode4_inithook,
17686 [ALC663_ASUS_MODE5] = {
17687 .mixers = { alc663_asus_15jd_clfe_mixer },
17688 .cap_mixer = alc662_auto_capture_mixer,
17689 .init_verbs = { alc662_init_verbs,
17690 alc663_15jd_amic_init_verbs },
17691 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17693 .dac_nids = alc662_dac_nids,
17694 .dig_out_nid = ALC662_DIGOUT_NID,
17695 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17696 .channel_mode = alc662_3ST_2ch_modes,
17697 .unsol_event = alc663_mode5_unsol_event,
17698 .setup = alc663_mode5_setup,
17699 .init_hook = alc663_mode5_inithook,
17701 [ALC663_ASUS_MODE6] = {
17702 .mixers = { alc663_two_hp_m2_mixer },
17703 .cap_mixer = alc662_auto_capture_mixer,
17704 .init_verbs = { alc662_init_verbs,
17705 alc663_two_hp_amic_m2_init_verbs },
17706 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17708 .dac_nids = alc662_dac_nids,
17709 .dig_out_nid = ALC662_DIGOUT_NID,
17710 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17711 .channel_mode = alc662_3ST_2ch_modes,
17712 .unsol_event = alc663_mode6_unsol_event,
17713 .setup = alc663_mode6_setup,
17714 .init_hook = alc663_mode6_inithook,
17716 [ALC663_ASUS_MODE7] = {
17717 .mixers = { alc663_mode7_mixer },
17718 .cap_mixer = alc662_auto_capture_mixer,
17719 .init_verbs = { alc662_init_verbs,
17720 alc663_mode7_init_verbs },
17721 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17723 .dac_nids = alc662_dac_nids,
17724 .dig_out_nid = ALC662_DIGOUT_NID,
17725 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17726 .channel_mode = alc662_3ST_2ch_modes,
17727 .unsol_event = alc663_mode7_unsol_event,
17728 .setup = alc663_mode7_setup,
17729 .init_hook = alc663_mode7_inithook,
17731 [ALC663_ASUS_MODE8] = {
17732 .mixers = { alc663_mode8_mixer },
17733 .cap_mixer = alc662_auto_capture_mixer,
17734 .init_verbs = { alc662_init_verbs,
17735 alc663_mode8_init_verbs },
17736 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17738 .dac_nids = alc662_dac_nids,
17739 .dig_out_nid = ALC662_DIGOUT_NID,
17740 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17741 .channel_mode = alc662_3ST_2ch_modes,
17742 .unsol_event = alc663_mode8_unsol_event,
17743 .setup = alc663_mode8_setup,
17744 .init_hook = alc663_mode8_inithook,
17747 .mixers = { alc663_m51va_mixer },
17748 .cap_mixer = alc272_auto_capture_mixer,
17749 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17750 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17751 .dac_nids = alc662_dac_nids,
17752 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17753 .adc_nids = alc272_adc_nids,
17754 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17755 .capsrc_nids = alc272_capsrc_nids,
17756 .channel_mode = alc662_3ST_2ch_modes,
17757 .unsol_event = alc663_m51va_unsol_event,
17758 .setup = alc663_m51va_setup,
17759 .init_hook = alc663_m51va_inithook,
17761 [ALC272_DELL_ZM1] = {
17762 .mixers = { alc663_m51va_mixer },
17763 .cap_mixer = alc662_auto_capture_mixer,
17764 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17765 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17766 .dac_nids = alc662_dac_nids,
17767 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17768 .adc_nids = alc662_adc_nids,
17770 .capsrc_nids = alc662_capsrc_nids,
17771 .channel_mode = alc662_3ST_2ch_modes,
17772 .unsol_event = alc663_m51va_unsol_event,
17773 .setup = alc663_m51va_setup,
17774 .init_hook = alc663_m51va_inithook,
17776 [ALC272_SAMSUNG_NC10] = {
17777 .mixers = { alc272_nc10_mixer },
17778 .init_verbs = { alc662_init_verbs,
17779 alc663_21jd_amic_init_verbs },
17780 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17781 .dac_nids = alc272_dac_nids,
17782 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17783 .channel_mode = alc662_3ST_2ch_modes,
17784 /*.input_mux = &alc272_nc10_capture_source,*/
17785 .unsol_event = alc663_mode4_unsol_event,
17786 .setup = alc663_mode4_setup,
17787 .init_hook = alc663_mode4_inithook,
17793 * BIOS auto configuration
17796 /* convert from MIX nid to DAC */
17797 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17801 else if (nid >= 0x0c && nid <= 0x0e)
17802 return nid - 0x0c + 0x02;
17807 /* get MIX nid connected to the given pin targeted to DAC */
17808 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17814 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17815 for (i = 0; i < num; i++) {
17816 if (alc662_mix_to_dac(mix[i]) == dac)
17822 /* look for an empty DAC slot */
17823 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17825 struct alc_spec *spec = codec->spec;
17829 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17832 for (i = 0; i < num; i++) {
17833 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17836 for (j = 0; j < spec->multiout.num_dacs; j++)
17837 if (spec->multiout.dac_nids[j] == nid)
17839 if (j >= spec->multiout.num_dacs)
17845 /* fill in the dac_nids table from the parsed pin configuration */
17846 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17847 const struct auto_pin_cfg *cfg)
17849 struct alc_spec *spec = codec->spec;
17853 spec->multiout.dac_nids = spec->private_dac_nids;
17854 for (i = 0; i < cfg->line_outs; i++) {
17855 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17858 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17863 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17864 hda_nid_t nid, unsigned int chs)
17866 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17867 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17870 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17871 hda_nid_t nid, unsigned int chs)
17873 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17874 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17877 #define alc662_add_stereo_vol(spec, pfx, nid) \
17878 alc662_add_vol_ctl(spec, pfx, nid, 3)
17879 #define alc662_add_stereo_sw(spec, pfx, nid) \
17880 alc662_add_sw_ctl(spec, pfx, nid, 3)
17882 /* add playback controls from the parsed DAC table */
17883 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17884 const struct auto_pin_cfg *cfg)
17886 struct alc_spec *spec = codec->spec;
17887 static const char *chname[4] = {
17888 "Front", "Surround", NULL /*CLFE*/, "Side"
17890 hda_nid_t nid, mix;
17893 for (i = 0; i < cfg->line_outs; i++) {
17894 nid = spec->multiout.dac_nids[i];
17897 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17902 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17905 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17908 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17911 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17916 if (cfg->line_outs == 1 &&
17917 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17924 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17927 if (cfg->line_outs == 1 &&
17928 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17930 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17938 /* add playback controls for speaker and HP outputs */
17939 /* return DAC nid if any new DAC is assigned */
17940 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17943 struct alc_spec *spec = codec->spec;
17944 hda_nid_t nid, mix;
17949 nid = alc662_look_for_dac(codec, pin);
17951 /* the corresponding DAC is already occupied */
17952 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17953 return 0; /* no way */
17954 /* create a switch only */
17955 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17956 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17959 mix = alc662_dac_to_mix(codec, pin, nid);
17962 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17965 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17971 /* create playback/capture controls for input pins */
17972 #define alc662_auto_create_input_ctls \
17973 alc882_auto_create_input_ctls
17975 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17976 hda_nid_t nid, int pin_type,
17982 alc_set_pin_output(codec, nid, pin_type);
17983 /* need the manual connection? */
17984 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17987 for (i = 0; i < num; i++) {
17988 if (alc662_mix_to_dac(srcs[i]) != dac)
17990 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17995 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17997 struct alc_spec *spec = codec->spec;
17998 int pin_type = get_pin_type(spec->autocfg.line_out_type);
18001 for (i = 0; i <= HDA_SIDE; i++) {
18002 hda_nid_t nid = spec->autocfg.line_out_pins[i];
18004 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
18005 spec->multiout.dac_nids[i]);
18009 static void alc662_auto_init_hp_out(struct hda_codec *codec)
18011 struct alc_spec *spec = codec->spec;
18014 pin = spec->autocfg.hp_pins[0];
18016 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
18017 spec->multiout.hp_nid);
18018 pin = spec->autocfg.speaker_pins[0];
18020 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
18021 spec->multiout.extra_out_nid[0]);
18024 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
18026 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18028 struct alc_spec *spec = codec->spec;
18031 for (i = 0; i < AUTO_PIN_LAST; i++) {
18032 hda_nid_t nid = spec->autocfg.input_pins[i];
18033 if (alc_is_input_pin(codec, nid)) {
18034 alc_set_input_pin(codec, nid, i);
18035 if (nid != ALC662_PIN_CD_NID &&
18036 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18037 snd_hda_codec_write(codec, nid, 0,
18038 AC_VERB_SET_AMP_GAIN_MUTE,
18044 #define alc662_auto_init_input_src alc882_auto_init_input_src
18046 static int alc662_parse_auto_config(struct hda_codec *codec)
18048 struct alc_spec *spec = codec->spec;
18050 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18052 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18056 if (!spec->autocfg.line_outs)
18057 return 0; /* can't find valid BIOS pin config */
18059 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18062 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18065 err = alc662_auto_create_extra_out(codec,
18066 spec->autocfg.speaker_pins[0],
18071 spec->multiout.extra_out_nid[0] = err;
18072 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18077 spec->multiout.hp_nid = err;
18078 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18082 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18084 if (spec->autocfg.dig_outs)
18085 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18087 if (spec->kctls.list)
18088 add_mixer(spec, spec->kctls.list);
18090 spec->num_mux_defs = 1;
18091 spec->input_mux = &spec->private_imux[0];
18093 add_verb(spec, alc662_auto_init_verbs);
18094 if (codec->vendor_id == 0x10ec0663)
18095 add_verb(spec, alc663_auto_init_verbs);
18097 err = alc_auto_add_mic_boost(codec);
18101 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18106 /* additional initialization for auto-configuration model */
18107 static void alc662_auto_init(struct hda_codec *codec)
18109 struct alc_spec *spec = codec->spec;
18110 alc662_auto_init_multi_out(codec);
18111 alc662_auto_init_hp_out(codec);
18112 alc662_auto_init_analog_input(codec);
18113 alc662_auto_init_input_src(codec);
18114 if (spec->unsol_event)
18115 alc_inithook(codec);
18118 static int patch_alc662(struct hda_codec *codec)
18120 struct alc_spec *spec;
18121 int err, board_config;
18123 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18127 codec->spec = spec;
18129 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18131 if (alc_read_coef_idx(codec, 0)==0x8020){
18132 kfree(codec->chip_name);
18133 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18134 if (!codec->chip_name) {
18140 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18143 if (board_config < 0) {
18144 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18146 board_config = ALC662_AUTO;
18149 if (board_config == ALC662_AUTO) {
18150 /* automatic parse from the BIOS config */
18151 err = alc662_parse_auto_config(codec);
18157 "hda_codec: Cannot set up configuration "
18158 "from BIOS. Using base mode...\n");
18159 board_config = ALC662_3ST_2ch_DIG;
18163 err = snd_hda_attach_beep_device(codec, 0x1);
18169 if (board_config != ALC662_AUTO)
18170 setup_preset(codec, &alc662_presets[board_config]);
18172 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18173 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18175 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18176 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18178 if (!spec->adc_nids) {
18179 spec->adc_nids = alc662_adc_nids;
18180 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18182 if (!spec->capsrc_nids)
18183 spec->capsrc_nids = alc662_capsrc_nids;
18185 if (!spec->cap_mixer)
18186 set_capture_mixer(codec);
18187 if (codec->vendor_id == 0x10ec0662)
18188 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18190 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18192 spec->vmaster_nid = 0x02;
18194 codec->patch_ops = alc_patch_ops;
18195 if (board_config == ALC662_AUTO)
18196 spec->init_hook = alc662_auto_init;
18197 #ifdef CONFIG_SND_HDA_POWER_SAVE
18198 if (!spec->loopback.amplist)
18199 spec->loopback.amplist = alc662_loopbacks;
18201 codec->proc_widget_hook = print_realtek_coef;
18206 static int patch_alc888(struct hda_codec *codec)
18208 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18209 kfree(codec->chip_name);
18210 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18211 if (!codec->chip_name) {
18215 return patch_alc662(codec);
18217 return patch_alc882(codec);
18223 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18224 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18225 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18226 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18227 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18228 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18229 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18230 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18231 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18232 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18233 .patch = patch_alc861 },
18234 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18235 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18236 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18237 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18238 .patch = patch_alc882 },
18239 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18240 .patch = patch_alc662 },
18241 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18242 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18243 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18244 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18245 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18246 .patch = patch_alc882 },
18247 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18248 .patch = patch_alc882 },
18249 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18250 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18251 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18252 .patch = patch_alc882 },
18253 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18254 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18255 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18256 {} /* terminator */
18259 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18261 MODULE_LICENSE("GPL");
18262 MODULE_DESCRIPTION("Realtek HD-audio codec");
18264 static struct hda_codec_preset_list realtek_list = {
18265 .preset = snd_hda_preset_realtek,
18266 .owner = THIS_MODULE,
18269 static int __init patch_realtek_init(void)
18271 return snd_hda_add_codec_preset(&realtek_list);
18274 static void __exit patch_realtek_exit(void)
18276 snd_hda_delete_codec_preset(&realtek_list);
18279 module_init(patch_realtek_init)
18280 module_exit(patch_realtek_exit)