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;
845 * set up from the preset table
847 static void setup_preset(struct hda_codec *codec,
848 const struct alc_config_preset *preset)
850 struct alc_spec *spec = codec->spec;
853 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
854 add_mixer(spec, preset->mixers[i]);
855 spec->cap_mixer = preset->cap_mixer;
856 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
858 add_verb(spec, preset->init_verbs[i]);
860 spec->channel_mode = preset->channel_mode;
861 spec->num_channel_mode = preset->num_channel_mode;
862 spec->need_dac_fix = preset->need_dac_fix;
863 spec->const_channel_count = preset->const_channel_count;
865 if (preset->const_channel_count)
866 spec->multiout.max_channels = preset->const_channel_count;
868 spec->multiout.max_channels = spec->channel_mode[0].channels;
869 spec->ext_channel_count = spec->channel_mode[0].channels;
871 spec->multiout.num_dacs = preset->num_dacs;
872 spec->multiout.dac_nids = preset->dac_nids;
873 spec->multiout.dig_out_nid = preset->dig_out_nid;
874 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
875 spec->multiout.hp_nid = preset->hp_nid;
877 spec->num_mux_defs = preset->num_mux_defs;
878 if (!spec->num_mux_defs)
879 spec->num_mux_defs = 1;
880 spec->input_mux = preset->input_mux;
882 spec->num_adc_nids = preset->num_adc_nids;
883 spec->adc_nids = preset->adc_nids;
884 spec->capsrc_nids = preset->capsrc_nids;
885 spec->dig_in_nid = preset->dig_in_nid;
887 spec->unsol_event = preset->unsol_event;
888 spec->init_hook = preset->init_hook;
889 #ifdef CONFIG_SND_HDA_POWER_SAVE
890 spec->power_hook = preset->power_hook;
891 spec->loopback.amplist = preset->loopbacks;
895 preset->setup(codec);
898 /* Enable GPIO mask and set output */
899 static struct hda_verb alc_gpio1_init_verbs[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
902 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
906 static struct hda_verb alc_gpio2_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
913 static struct hda_verb alc_gpio3_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
921 * Fix hardware PLL issue
922 * On some codecs, the analog PLL gating control must be off while
923 * the default value is 1.
925 static void alc_fix_pll(struct hda_codec *codec)
927 struct alc_spec *spec = codec->spec;
932 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
934 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
935 AC_VERB_GET_PROC_COEF, 0);
936 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
939 val & ~(1 << spec->pll_coef_bit));
942 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
943 unsigned int coef_idx, unsigned int coef_bit)
945 struct alc_spec *spec = codec->spec;
947 spec->pll_coef_idx = coef_idx;
948 spec->pll_coef_bit = coef_bit;
952 static void alc_automute_pin(struct hda_codec *codec)
954 struct alc_spec *spec = codec->spec;
955 unsigned int nid = spec->autocfg.hp_pins[0];
960 spec->jack_present = snd_hda_jack_detect(codec, nid);
961 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
962 nid = spec->autocfg.speaker_pins[i];
965 snd_hda_codec_write(codec, nid, 0,
966 AC_VERB_SET_PIN_WIDGET_CONTROL,
967 spec->jack_present ? 0 : PIN_OUT);
971 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
974 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
977 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
978 for (i = 0; i < nums; i++)
984 static void alc_mic_automute(struct hda_codec *codec)
986 struct alc_spec *spec = codec->spec;
987 struct alc_mic_route *dead, *alive;
988 unsigned int present, type;
993 if (!spec->int_mic.pin || !spec->ext_mic.pin)
995 if (snd_BUG_ON(!spec->adc_nids))
998 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1000 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1002 alive = &spec->ext_mic;
1003 dead = &spec->int_mic;
1005 alive = &spec->int_mic;
1006 dead = &spec->ext_mic;
1009 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1010 if (type == AC_WID_AUD_MIX) {
1011 /* Matrix-mixer style (e.g. ALC882) */
1012 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1015 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1017 HDA_AMP_MUTE, HDA_AMP_MUTE);
1019 /* MUX style (e.g. ALC880) */
1020 snd_hda_codec_write_cache(codec, cap_nid, 0,
1021 AC_VERB_SET_CONNECT_SEL,
1025 /* FIXME: analog mixer */
1028 /* unsolicited event for HP jack sensing */
1029 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1031 if (codec->vendor_id == 0x10ec0880)
1036 case ALC880_HP_EVENT:
1037 alc_automute_pin(codec);
1039 case ALC880_MIC_EVENT:
1040 alc_mic_automute(codec);
1045 static void alc_inithook(struct hda_codec *codec)
1047 alc_automute_pin(codec);
1048 alc_mic_automute(codec);
1051 /* additional initialization for ALC888 variants */
1052 static void alc888_coef_init(struct hda_codec *codec)
1056 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1057 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1058 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1059 if ((tmp & 0xf0) == 0x20)
1061 snd_hda_codec_read(codec, 0x20, 0,
1062 AC_VERB_SET_PROC_COEF, 0x830);
1065 snd_hda_codec_read(codec, 0x20, 0,
1066 AC_VERB_SET_PROC_COEF, 0x3030);
1069 static void alc889_coef_init(struct hda_codec *codec)
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1074 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1079 /* turn on/off EAPD control (only if available) */
1080 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1082 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1084 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1085 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1089 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1094 case ALC_INIT_GPIO1:
1095 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1097 case ALC_INIT_GPIO2:
1098 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1100 case ALC_INIT_GPIO3:
1101 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1103 case ALC_INIT_DEFAULT:
1104 switch (codec->vendor_id) {
1106 set_eapd(codec, 0x0f, 1);
1107 set_eapd(codec, 0x10, 1);
1120 set_eapd(codec, 0x14, 1);
1121 set_eapd(codec, 0x15, 1);
1124 switch (codec->vendor_id) {
1126 snd_hda_codec_write(codec, 0x1a, 0,
1127 AC_VERB_SET_COEF_INDEX, 7);
1128 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1129 AC_VERB_GET_PROC_COEF, 0);
1130 snd_hda_codec_write(codec, 0x1a, 0,
1131 AC_VERB_SET_COEF_INDEX, 7);
1132 snd_hda_codec_write(codec, 0x1a, 0,
1133 AC_VERB_SET_PROC_COEF,
1143 alc889_coef_init(codec);
1146 alc888_coef_init(codec);
1148 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1151 snd_hda_codec_write(codec, 0x20, 0,
1152 AC_VERB_SET_COEF_INDEX, 7);
1153 tmp = snd_hda_codec_read(codec, 0x20, 0,
1154 AC_VERB_GET_PROC_COEF, 0);
1155 snd_hda_codec_write(codec, 0x20, 0,
1156 AC_VERB_SET_COEF_INDEX, 7);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_PROC_COEF,
1167 static void alc_init_auto_hp(struct hda_codec *codec)
1169 struct alc_spec *spec = codec->spec;
1171 if (!spec->autocfg.hp_pins[0])
1174 if (!spec->autocfg.speaker_pins[0]) {
1175 if (spec->autocfg.line_out_pins[0] &&
1176 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1177 spec->autocfg.speaker_pins[0] =
1178 spec->autocfg.line_out_pins[0];
1183 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1184 spec->autocfg.hp_pins[0]);
1185 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1186 AC_VERB_SET_UNSOLICITED_ENABLE,
1187 AC_USRSP_EN | ALC880_HP_EVENT);
1188 spec->unsol_event = alc_sku_unsol_event;
1191 static void alc_init_auto_mic(struct hda_codec *codec)
1193 struct alc_spec *spec = codec->spec;
1194 struct auto_pin_cfg *cfg = &spec->autocfg;
1195 hda_nid_t fixed, ext;
1198 /* there must be only two mic inputs exclusively */
1199 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1200 if (cfg->input_pins[i])
1204 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1205 hda_nid_t nid = cfg->input_pins[i];
1206 unsigned int defcfg;
1209 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1210 switch (get_defcfg_connect(defcfg)) {
1211 case AC_JACK_PORT_FIXED:
1213 return; /* already occupied */
1216 case AC_JACK_PORT_COMPLEX:
1218 return; /* already occupied */
1222 return; /* invalid entry */
1227 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1228 return; /* no unsol support */
1229 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1231 spec->ext_mic.pin = ext;
1232 spec->int_mic.pin = fixed;
1233 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1234 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1236 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1237 AC_VERB_SET_UNSOLICITED_ENABLE,
1238 AC_USRSP_EN | ALC880_MIC_EVENT);
1239 spec->unsol_event = alc_sku_unsol_event;
1242 /* check subsystem ID and set up device-specific initialization;
1243 * return 1 if initialized, 0 if invalid SSID
1245 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1246 * 31 ~ 16 : Manufacture ID
1248 * 7 ~ 0 : Assembly ID
1249 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1251 static int alc_subsystem_id(struct hda_codec *codec,
1252 hda_nid_t porta, hda_nid_t porte,
1255 unsigned int ass, tmp, i;
1257 struct alc_spec *spec = codec->spec;
1259 ass = codec->subsystem_id & 0xffff;
1260 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1263 /* invalid SSID, check the special NID pin defcfg instead */
1265 * 31~30 : port connectivity
1268 * 19~16 : Check sum (15:1)
1273 if (codec->vendor_id == 0x10ec0260)
1275 ass = snd_hda_codec_get_pincfg(codec, nid);
1276 snd_printd("realtek: No valid SSID, "
1277 "checking pincfg 0x%08x for NID 0x%x\n",
1279 if (!(ass & 1) && !(ass & 0x100000))
1281 if ((ass >> 30) != 1) /* no physical connection */
1286 for (i = 1; i < 16; i++) {
1290 if (((ass >> 16) & 0xf) != tmp)
1293 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1294 ass & 0xffff, codec->vendor_id);
1298 * 2 : 0 --> Desktop, 1 --> Laptop
1299 * 3~5 : External Amplifier control
1302 tmp = (ass & 0x38) >> 3; /* external Amp control */
1305 spec->init_amp = ALC_INIT_GPIO1;
1308 spec->init_amp = ALC_INIT_GPIO2;
1311 spec->init_amp = ALC_INIT_GPIO3;
1314 spec->init_amp = ALC_INIT_DEFAULT;
1318 /* is laptop or Desktop and enable the function "Mute internal speaker
1319 * when the external headphone out jack is plugged"
1321 if (!(ass & 0x8000))
1324 * 10~8 : Jack location
1325 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1327 * 15 : 1 --> enable the function "Mute internal speaker
1328 * when the external headphone out jack is plugged"
1330 if (!spec->autocfg.hp_pins[0]) {
1332 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1341 for (i = 0; i < spec->autocfg.line_outs; i++)
1342 if (spec->autocfg.line_out_pins[i] == nid)
1344 spec->autocfg.hp_pins[0] = nid;
1347 alc_init_auto_hp(codec);
1348 alc_init_auto_mic(codec);
1352 static void alc_ssid_check(struct hda_codec *codec,
1353 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1355 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1356 struct alc_spec *spec = codec->spec;
1357 snd_printd("realtek: "
1358 "Enable default setup for auto mode as fallback\n");
1359 spec->init_amp = ALC_INIT_DEFAULT;
1360 alc_init_auto_hp(codec);
1361 alc_init_auto_mic(codec);
1366 * Fix-up pin default configurations and add default verbs
1375 const struct alc_pincfg *pins;
1376 const struct hda_verb *verbs;
1379 static void alc_pick_fixup(struct hda_codec *codec,
1380 const struct snd_pci_quirk *quirk,
1381 const struct alc_fixup *fix)
1383 const struct alc_pincfg *cfg;
1385 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1389 fix += quirk->value;
1392 for (; cfg->nid; cfg++)
1393 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1396 add_verb(codec->spec, fix->verbs);
1399 static int alc_read_coef_idx(struct hda_codec *codec,
1400 unsigned int coef_idx)
1403 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1405 val = snd_hda_codec_read(codec, 0x20, 0,
1406 AC_VERB_GET_PROC_COEF, 0);
1417 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1418 /* Mic-in jack as mic in */
1419 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1420 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1421 /* Line-in jack as Line in */
1422 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1423 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1424 /* Line-Out as Front */
1425 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1432 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1433 /* Mic-in jack as mic in */
1434 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1435 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1436 /* Line-in jack as Surround */
1437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1438 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1439 /* Line-Out as Front */
1440 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1447 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1448 /* Mic-in jack as CLFE */
1449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1451 /* Line-in jack as Surround */
1452 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1455 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1462 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1463 /* Mic-in jack as CLFE */
1464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1466 /* Line-in jack as Surround */
1467 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-Out as Side */
1470 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1474 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1475 { 2, alc888_4ST_ch2_intel_init },
1476 { 4, alc888_4ST_ch4_intel_init },
1477 { 6, alc888_4ST_ch6_intel_init },
1478 { 8, alc888_4ST_ch8_intel_init },
1482 * ALC888 Fujitsu Siemens Amillo xa3530
1485 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1486 /* Front Mic: set to PIN_IN (empty by default) */
1487 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1488 /* Connect Internal HP to Front */
1489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1491 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1492 /* Connect Bass HP to Front */
1493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1496 /* Connect Line-Out side jack (SPDIF) to Side */
1497 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1499 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1500 /* Connect Mic jack to CLFE */
1501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1504 /* Connect Line-in jack to Surround */
1505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1507 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1508 /* Connect HP out jack to Front */
1509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1511 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1512 /* Enable unsolicited event for HP jack and Line-out jack */
1513 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1514 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1518 static void alc_automute_amp(struct hda_codec *codec)
1520 struct alc_spec *spec = codec->spec;
1525 spec->jack_present = 0;
1526 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1527 nid = spec->autocfg.hp_pins[i];
1530 if (snd_hda_jack_detect(codec, nid)) {
1531 spec->jack_present = 1;
1536 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1537 /* Toggle internal speakers muting */
1538 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1539 nid = spec->autocfg.speaker_pins[i];
1542 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1543 HDA_AMP_MUTE, mute);
1547 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1550 if (codec->vendor_id == 0x10ec0880)
1554 if (res == ALC880_HP_EVENT)
1555 alc_automute_amp(codec);
1558 static void alc889_automute_setup(struct hda_codec *codec)
1560 struct alc_spec *spec = codec->spec;
1562 spec->autocfg.hp_pins[0] = 0x15;
1563 spec->autocfg.speaker_pins[0] = 0x14;
1564 spec->autocfg.speaker_pins[1] = 0x16;
1565 spec->autocfg.speaker_pins[2] = 0x17;
1566 spec->autocfg.speaker_pins[3] = 0x19;
1567 spec->autocfg.speaker_pins[4] = 0x1a;
1570 static void alc889_intel_init_hook(struct hda_codec *codec)
1572 alc889_coef_init(codec);
1573 alc_automute_amp(codec);
1576 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1578 struct alc_spec *spec = codec->spec;
1580 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1581 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1582 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1583 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1587 * ALC888 Acer Aspire 4930G model
1590 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1591 /* Front Mic: set to PIN_IN (empty by default) */
1592 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1593 /* Unselect Front Mic by default in input mixer 3 */
1594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1595 /* Enable unsolicited event for HP jack */
1596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1597 /* Connect Internal HP to front */
1598 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1599 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1600 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1601 /* Connect HP out to front */
1602 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1603 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1609 * ALC888 Acer Aspire 6530G model
1612 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1613 /* Bias voltage on for external mic port */
1614 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1615 /* Front Mic: set to PIN_IN (empty by default) */
1616 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1617 /* Unselect Front Mic by default in input mixer 3 */
1618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1619 /* Enable unsolicited event for HP jack */
1620 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1621 /* Enable speaker output */
1622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1624 /* Enable headphone output */
1625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1632 * ALC889 Acer Aspire 8930G model
1635 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1636 /* Front Mic: set to PIN_IN (empty by default) */
1637 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1638 /* Unselect Front Mic by default in input mixer 3 */
1639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1640 /* Enable unsolicited event for HP jack */
1641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1642 /* Connect Internal Front to Front */
1643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1645 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1646 /* Connect Internal Rear to Rear */
1647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1648 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1649 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1650 /* Connect Internal CLFE to CLFE */
1651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1652 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1653 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1654 /* Connect HP out to Front */
1655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1656 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1658 /* Enable all DACs */
1659 /* DAC DISABLE/MUTE 1? */
1660 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1661 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1662 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1663 /* DAC DISABLE/MUTE 2? */
1664 /* some bit here disables the other DACs. Init=0x4900 */
1665 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1666 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1669 * which makes the stereo useless. However, either the mic or the ALC889
1670 * makes the signal become a difference/sum signal instead of standard
1671 * stereo, which is annoying. So instead we flip this bit which makes the
1672 * codec replicate the sum signal to both channels, turning it into a
1675 /* DMIC_CONTROL? Init value = 0x0001 */
1676 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1677 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1681 static struct hda_input_mux alc888_2_capture_sources[2] = {
1682 /* Front mic only available on one ADC */
1689 { "Front Mic", 0xb },
1702 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1703 /* Interal mic only available on one ADC */
1710 { "Input Mix", 0xa },
1720 { "Input Mix", 0xa },
1725 static struct hda_input_mux alc889_capture_sources[3] = {
1726 /* Digital mic only available on first "ADC" */
1733 { "Front Mic", 0xb },
1734 { "Input Mix", 0xa },
1743 { "Input Mix", 0xa },
1752 { "Input Mix", 0xa },
1757 static struct snd_kcontrol_new alc888_base_mixer[] = {
1758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1761 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1766 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1767 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1768 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1779 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1781 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1783 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1784 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1786 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1788 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1798 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1800 struct alc_spec *spec = codec->spec;
1802 spec->autocfg.hp_pins[0] = 0x15;
1803 spec->autocfg.speaker_pins[0] = 0x14;
1804 spec->autocfg.speaker_pins[1] = 0x16;
1805 spec->autocfg.speaker_pins[2] = 0x17;
1808 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1810 struct alc_spec *spec = codec->spec;
1812 spec->autocfg.hp_pins[0] = 0x15;
1813 spec->autocfg.speaker_pins[0] = 0x14;
1814 spec->autocfg.speaker_pins[1] = 0x16;
1815 spec->autocfg.speaker_pins[2] = 0x17;
1818 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1820 struct alc_spec *spec = codec->spec;
1822 spec->autocfg.hp_pins[0] = 0x15;
1823 spec->autocfg.speaker_pins[0] = 0x14;
1824 spec->autocfg.speaker_pins[1] = 0x16;
1825 spec->autocfg.speaker_pins[2] = 0x1b;
1829 * ALC880 3-stack model
1831 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1832 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1833 * F-Mic = 0x1b, HP = 0x19
1836 static hda_nid_t alc880_dac_nids[4] = {
1837 /* front, rear, clfe, rear_surr */
1838 0x02, 0x05, 0x04, 0x03
1841 static hda_nid_t alc880_adc_nids[3] = {
1846 /* The datasheet says the node 0x07 is connected from inputs,
1847 * but it shows zero connection in the real implementation on some devices.
1848 * Note: this is a 915GAV bug, fixed on 915GLV
1850 static hda_nid_t alc880_adc_nids_alt[2] = {
1855 #define ALC880_DIGOUT_NID 0x06
1856 #define ALC880_DIGIN_NID 0x0a
1858 static struct hda_input_mux alc880_capture_source = {
1862 { "Front Mic", 0x3 },
1868 /* channel source setting (2/6 channel selection for 3-stack) */
1870 static struct hda_verb alc880_threestack_ch2_init[] = {
1871 /* set line-in to input, mute it */
1872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1874 /* set mic-in to input vref 80%, mute it */
1875 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1876 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1881 static struct hda_verb alc880_threestack_ch6_init[] = {
1882 /* set line-in to output, unmute it */
1883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1885 /* set mic-in to output, unmute it */
1886 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1887 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1891 static struct hda_channel_mode alc880_threestack_modes[2] = {
1892 { 2, alc880_threestack_ch2_init },
1893 { 6, alc880_threestack_ch6_init },
1896 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1898 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1899 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1900 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1903 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1904 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1905 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1906 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1916 .name = "Channel Mode",
1917 .info = alc_ch_mode_info,
1918 .get = alc_ch_mode_get,
1919 .put = alc_ch_mode_put,
1924 /* capture mixer elements */
1925 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1926 struct snd_ctl_elem_info *uinfo)
1928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1929 struct alc_spec *spec = codec->spec;
1932 mutex_lock(&codec->control_mutex);
1933 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1935 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1936 mutex_unlock(&codec->control_mutex);
1940 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1941 unsigned int size, unsigned int __user *tlv)
1943 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1944 struct alc_spec *spec = codec->spec;
1947 mutex_lock(&codec->control_mutex);
1948 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1950 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1951 mutex_unlock(&codec->control_mutex);
1955 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1956 struct snd_ctl_elem_value *ucontrol);
1958 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1959 struct snd_ctl_elem_value *ucontrol,
1962 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1963 struct alc_spec *spec = codec->spec;
1964 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1967 mutex_lock(&codec->control_mutex);
1968 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1970 err = func(kcontrol, ucontrol);
1971 mutex_unlock(&codec->control_mutex);
1975 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol)
1978 return alc_cap_getput_caller(kcontrol, ucontrol,
1979 snd_hda_mixer_amp_volume_get);
1982 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1983 struct snd_ctl_elem_value *ucontrol)
1985 return alc_cap_getput_caller(kcontrol, ucontrol,
1986 snd_hda_mixer_amp_volume_put);
1989 /* capture mixer elements */
1990 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1992 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1993 struct snd_ctl_elem_value *ucontrol)
1995 return alc_cap_getput_caller(kcontrol, ucontrol,
1996 snd_hda_mixer_amp_switch_get);
1999 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2000 struct snd_ctl_elem_value *ucontrol)
2002 return alc_cap_getput_caller(kcontrol, ucontrol,
2003 snd_hda_mixer_amp_switch_put);
2006 #define _DEFINE_CAPMIX(num) \
2008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2009 .name = "Capture Switch", \
2010 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2012 .info = alc_cap_sw_info, \
2013 .get = alc_cap_sw_get, \
2014 .put = alc_cap_sw_put, \
2017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2018 .name = "Capture Volume", \
2019 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2020 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2021 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2023 .info = alc_cap_vol_info, \
2024 .get = alc_cap_vol_get, \
2025 .put = alc_cap_vol_put, \
2026 .tlv = { .c = alc_cap_vol_tlv }, \
2029 #define _DEFINE_CAPSRC(num) \
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2032 /* .name = "Capture Source", */ \
2033 .name = "Input Source", \
2035 .info = alc_mux_enum_info, \
2036 .get = alc_mux_enum_get, \
2037 .put = alc_mux_enum_put, \
2040 #define DEFINE_CAPMIX(num) \
2041 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2042 _DEFINE_CAPMIX(num), \
2043 _DEFINE_CAPSRC(num), \
2047 #define DEFINE_CAPMIX_NOSRC(num) \
2048 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2049 _DEFINE_CAPMIX(num), \
2053 /* up to three ADCs */
2057 DEFINE_CAPMIX_NOSRC(1);
2058 DEFINE_CAPMIX_NOSRC(2);
2059 DEFINE_CAPMIX_NOSRC(3);
2062 * ALC880 5-stack model
2064 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2066 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2067 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2070 /* additional mixers to alc880_three_stack_mixer */
2071 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2072 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2073 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2077 /* channel source setting (6/8 channel selection for 5-stack) */
2079 static struct hda_verb alc880_fivestack_ch6_init[] = {
2080 /* set line-in to input, mute it */
2081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2087 static struct hda_verb alc880_fivestack_ch8_init[] = {
2088 /* set line-in to output, unmute it */
2089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2094 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2095 { 6, alc880_fivestack_ch6_init },
2096 { 8, alc880_fivestack_ch8_init },
2101 * ALC880 6-stack model
2103 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2104 * Side = 0x05 (0x0f)
2105 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2106 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2109 static hda_nid_t alc880_6st_dac_nids[4] = {
2110 /* front, rear, clfe, rear_surr */
2111 0x02, 0x03, 0x04, 0x05
2114 static struct hda_input_mux alc880_6stack_capture_source = {
2118 { "Front Mic", 0x1 },
2124 /* fixed 8-channels */
2125 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2129 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2138 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2139 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2150 .name = "Channel Mode",
2151 .info = alc_ch_mode_info,
2152 .get = alc_ch_mode_get,
2153 .put = alc_ch_mode_put,
2162 * W810 has rear IO for:
2165 * Center/LFE (DAC 04)
2168 * The system also has a pair of internal speakers, and a headphone jack.
2169 * These are both connected to Line2 on the codec, hence to DAC 02.
2171 * There is a variable resistor to control the speaker or headphone
2172 * volume. This is a hardware-only device without a software API.
2174 * Plugging headphones in will disable the internal speakers. This is
2175 * implemented in hardware, not via the driver using jack sense. In
2176 * a similar fashion, plugging into the rear socket marked "front" will
2177 * disable both the speakers and headphones.
2179 * For input, there's a microphone jack, and an "audio in" jack.
2180 * These may not do anything useful with this driver yet, because I
2181 * haven't setup any initialization verbs for these yet...
2184 static hda_nid_t alc880_w810_dac_nids[3] = {
2185 /* front, rear/surround, clfe */
2189 /* fixed 6 channels */
2190 static struct hda_channel_mode alc880_w810_modes[1] = {
2194 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2195 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2199 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2200 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2201 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2202 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2203 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2212 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2213 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2217 static hda_nid_t alc880_z71v_dac_nids[1] = {
2220 #define ALC880_Z71V_HP_DAC 0x03
2222 /* fixed 2 channels */
2223 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2227 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2229 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2231 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2241 * ALC880 F1734 model
2243 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2244 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2247 static hda_nid_t alc880_f1734_dac_nids[1] = {
2250 #define ALC880_F1734_HP_DAC 0x02
2252 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2254 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2255 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2256 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2264 static struct hda_input_mux alc880_f1734_capture_source = {
2276 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2277 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2278 * Mic = 0x18, Line = 0x1a
2281 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2282 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2284 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2285 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2286 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2287 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2288 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2289 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2290 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2291 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2292 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2296 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2301 .name = "Channel Mode",
2302 .info = alc_ch_mode_info,
2303 .get = alc_ch_mode_get,
2304 .put = alc_ch_mode_put,
2310 * ALC880 ASUS W1V model
2312 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2313 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2314 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2317 /* additional mixers to alc880_asus_mixer */
2318 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2319 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2320 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2325 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2327 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2330 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2334 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2339 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2341 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
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("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2358 .name = "Channel Mode",
2359 .info = alc_ch_mode_info,
2360 .get = alc_ch_mode_get,
2361 .put = alc_ch_mode_put,
2366 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2367 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2368 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2370 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2372 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2374 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2376 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2380 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2381 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2382 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2384 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2391 * virtual master controls
2395 * slave controls for virtual master
2397 static const char *alc_slave_vols[] = {
2398 "Front Playback Volume",
2399 "Surround Playback Volume",
2400 "Center Playback Volume",
2401 "LFE Playback Volume",
2402 "Side Playback Volume",
2403 "Headphone Playback Volume",
2404 "Speaker Playback Volume",
2405 "Mono Playback Volume",
2406 "Line-Out Playback Volume",
2407 "PCM Playback Volume",
2411 static const char *alc_slave_sws[] = {
2412 "Front Playback Switch",
2413 "Surround Playback Switch",
2414 "Center Playback Switch",
2415 "LFE Playback Switch",
2416 "Side Playback Switch",
2417 "Headphone Playback Switch",
2418 "Speaker Playback Switch",
2419 "Mono Playback Switch",
2420 "IEC958 Playback Switch",
2421 "Line-Out Playback Switch",
2422 "PCM Playback Switch",
2427 * build control elements
2430 #define NID_MAPPING (-1)
2432 #define SUBDEV_SPEAKER_ (0 << 6)
2433 #define SUBDEV_HP_ (1 << 6)
2434 #define SUBDEV_LINE_ (2 << 6)
2435 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2436 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2437 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2439 static void alc_free_kctls(struct hda_codec *codec);
2441 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2442 /* additional beep mixers; the actual parameters are overwritten at build */
2443 static struct snd_kcontrol_new alc_beep_mixer[] = {
2444 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2445 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2450 static int alc_build_controls(struct hda_codec *codec)
2452 struct alc_spec *spec = codec->spec;
2453 struct snd_kcontrol *kctl;
2454 struct snd_kcontrol_new *knew;
2459 for (i = 0; i < spec->num_mixers; i++) {
2460 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2464 if (spec->cap_mixer) {
2465 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2469 if (spec->multiout.dig_out_nid) {
2470 err = snd_hda_create_spdif_out_ctls(codec,
2471 spec->multiout.dig_out_nid);
2474 if (!spec->no_analog) {
2475 err = snd_hda_create_spdif_share_sw(codec,
2479 spec->multiout.share_spdif = 1;
2482 if (spec->dig_in_nid) {
2483 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2488 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2489 /* create beep controls if needed */
2490 if (spec->beep_amp) {
2491 struct snd_kcontrol_new *knew;
2492 for (knew = alc_beep_mixer; knew->name; knew++) {
2493 struct snd_kcontrol *kctl;
2494 kctl = snd_ctl_new1(knew, codec);
2497 kctl->private_value = spec->beep_amp;
2498 err = snd_hda_ctl_add(codec, 0, kctl);
2505 /* if we have no master control, let's create it */
2506 if (!spec->no_analog &&
2507 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2508 unsigned int vmaster_tlv[4];
2509 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2510 HDA_OUTPUT, vmaster_tlv);
2511 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2512 vmaster_tlv, alc_slave_vols);
2516 if (!spec->no_analog &&
2517 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2518 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2519 NULL, alc_slave_sws);
2524 alc_free_kctls(codec); /* no longer needed */
2526 /* assign Capture Source enums to NID */
2527 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2529 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2530 for (i = 0; kctl && i < kctl->count; i++) {
2531 hda_nid_t *nids = spec->capsrc_nids;
2533 nids = spec->adc_nids;
2534 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2538 if (spec->cap_mixer) {
2539 const char *kname = kctl ? kctl->id.name : NULL;
2540 for (knew = spec->cap_mixer; knew->name; knew++) {
2541 if (kname && strcmp(knew->name, kname) == 0)
2543 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2544 for (i = 0; kctl && i < kctl->count; i++) {
2545 err = snd_hda_add_nid(codec, kctl, i,
2553 /* other nid->control mapping */
2554 for (i = 0; i < spec->num_mixers; i++) {
2555 for (knew = spec->mixers[i]; knew->name; knew++) {
2556 if (knew->iface != NID_MAPPING)
2558 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2561 u = knew->subdevice;
2562 for (j = 0; j < 4; j++, u >>= 8) {
2567 case SUBDEV_SPEAKER_:
2568 nid = spec->autocfg.speaker_pins[nid];
2571 nid = spec->autocfg.line_out_pins[nid];
2574 nid = spec->autocfg.hp_pins[nid];
2579 err = snd_hda_add_nid(codec, kctl, 0, nid);
2583 u = knew->private_value;
2584 for (j = 0; j < 4; j++, u >>= 8) {
2588 err = snd_hda_add_nid(codec, kctl, 0, nid);
2599 * initialize the codec volumes, etc
2603 * generic initialization of ADC, input mixers and output mixers
2605 static struct hda_verb alc880_volume_init_verbs[] = {
2607 * Unmute ADC0-2 and set the default input to mic-in
2609 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2611 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2613 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2616 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2618 * Note: PASD motherboards uses the Line In 2 as the input for front
2621 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2631 * Set up output mixers (0x0c - 0x0f)
2633 /* set vol=0 to output mixers */
2634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2638 /* set up input amps for analog loopback */
2639 /* Amp Indices: DAC = 0, mixer = 1 */
2640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2653 * 3-stack pin configuration:
2654 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2656 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2658 * preset connection lists of input pins
2659 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2661 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2662 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2663 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2666 * Set pin mode and muting
2668 /* set front pin widgets 0x14 for output */
2669 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2670 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2671 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2674 /* Mic2 (as headphone out) for HP output */
2675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 /* Line In pin widget for input */
2678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2680 /* Line2 (as front mic) pin widget for input and vref at 80% */
2681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2683 /* CD pin widget for input */
2684 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2690 * 5-stack pin configuration:
2691 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2692 * line-in/side = 0x1a, f-mic = 0x1b
2694 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2696 * preset connection lists of input pins
2697 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2699 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2700 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2703 * Set pin mode and muting
2705 /* set pin widgets 0x14-0x17 for output */
2706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2709 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 /* unmute pins for output (no gain on this amp) */
2711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2714 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2716 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2719 /* Mic2 (as headphone out) for HP output */
2720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2722 /* Line In pin widget for input */
2723 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2724 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2725 /* Line2 (as front mic) pin widget for input and vref at 80% */
2726 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2727 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 /* CD pin widget for input */
2729 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2735 * W810 pin configuration:
2736 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2738 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2739 /* hphone/speaker input selector: front DAC */
2740 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2756 * Z71V pin configuration:
2757 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2759 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2774 * 6-stack pin configuration:
2775 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2776 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2778 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2779 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2792 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2797 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2804 * Uniwill pin configuration:
2805 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2808 static struct hda_verb alc880_uniwill_init_verbs[] = {
2809 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2817 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2826 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2827 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2832 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2833 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2834 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2836 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2837 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2844 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2846 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2847 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2854 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2856 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2857 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2858 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2859 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2860 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2862 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2864 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2869 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2870 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2875 static struct hda_verb alc880_beep_init_verbs[] = {
2876 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2880 /* auto-toggle front mic */
2881 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2883 unsigned int present;
2886 present = snd_hda_jack_detect(codec, 0x18);
2887 bits = present ? HDA_AMP_MUTE : 0;
2888 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2891 static void alc880_uniwill_setup(struct hda_codec *codec)
2893 struct alc_spec *spec = codec->spec;
2895 spec->autocfg.hp_pins[0] = 0x14;
2896 spec->autocfg.speaker_pins[0] = 0x15;
2897 spec->autocfg.speaker_pins[0] = 0x16;
2900 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2902 alc_automute_amp(codec);
2903 alc880_uniwill_mic_automute(codec);
2906 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2909 /* Looks like the unsol event is incompatible with the standard
2910 * definition. 4bit tag is placed at 28 bit!
2912 switch (res >> 28) {
2913 case ALC880_MIC_EVENT:
2914 alc880_uniwill_mic_automute(codec);
2917 alc_automute_amp_unsol_event(codec, res);
2922 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2924 struct alc_spec *spec = codec->spec;
2926 spec->autocfg.hp_pins[0] = 0x14;
2927 spec->autocfg.speaker_pins[0] = 0x15;
2930 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2932 unsigned int present;
2934 present = snd_hda_codec_read(codec, 0x21, 0,
2935 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2936 present &= HDA_AMP_VOLMASK;
2937 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2938 HDA_AMP_VOLMASK, present);
2939 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2940 HDA_AMP_VOLMASK, present);
2943 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2946 /* Looks like the unsol event is incompatible with the standard
2947 * definition. 4bit tag is placed at 28 bit!
2949 if ((res >> 28) == ALC880_DCVOL_EVENT)
2950 alc880_uniwill_p53_dcvol_automute(codec);
2952 alc_automute_amp_unsol_event(codec, res);
2956 * F1734 pin configuration:
2957 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2959 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2960 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2961 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2962 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2963 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2964 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2979 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2981 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2982 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2988 * ASUS pin configuration:
2989 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2991 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2992 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2993 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2994 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2995 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3003 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3006 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3008 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3010 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3014 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3019 /* Enable GPIO mask and set output */
3020 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3021 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3022 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3024 /* Clevo m520g init */
3025 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3026 /* headphone output */
3027 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3032 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3033 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3036 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3037 /* Mic1 (rear panel) */
3038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3040 /* Mic2 (front panel) */
3041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3042 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3044 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3045 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3046 /* change to EAPD mode */
3047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3048 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3053 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3054 /* change to EAPD mode */
3055 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3056 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3058 /* Headphone output */
3059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3062 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3064 /* Line In pin widget for input */
3065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3066 /* CD pin widget for input */
3067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3068 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3071 /* change to EAPD mode */
3072 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3073 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3079 * LG m1 express dual
3082 * Rear Line-In/Out (blue): 0x14
3083 * Build-in Mic-In: 0x15
3085 * HP-Out (green): 0x1b
3086 * Mic-In/Out (red): 0x19
3090 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3091 static hda_nid_t alc880_lg_dac_nids[3] = {
3095 /* seems analog CD is not working */
3096 static struct hda_input_mux alc880_lg_capture_source = {
3101 { "Internal Mic", 0x6 },
3105 /* 2,4,6 channel modes */
3106 static struct hda_verb alc880_lg_ch2_init[] = {
3107 /* set line-in and mic-in to input */
3108 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3109 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3113 static struct hda_verb alc880_lg_ch4_init[] = {
3114 /* set line-in to out and mic-in to input */
3115 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3116 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3120 static struct hda_verb alc880_lg_ch6_init[] = {
3121 /* set line-in and mic-in to output */
3122 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3123 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3127 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3128 { 2, alc880_lg_ch2_init },
3129 { 4, alc880_lg_ch4_init },
3130 { 6, alc880_lg_ch6_init },
3133 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3135 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3136 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3137 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3146 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3147 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3150 .name = "Channel Mode",
3151 .info = alc_ch_mode_info,
3152 .get = alc_ch_mode_get,
3153 .put = alc_ch_mode_put,
3158 static struct hda_verb alc880_lg_init_verbs[] = {
3159 /* set capture source to mic-in */
3160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3163 /* mute all amp mixer inputs */
3164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3167 /* line-in to input */
3168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3169 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3174 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3175 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3176 /* mic-in to input */
3177 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3181 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3185 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3189 /* toggle speaker-output according to the hp-jack state */
3190 static void alc880_lg_setup(struct hda_codec *codec)
3192 struct alc_spec *spec = codec->spec;
3194 spec->autocfg.hp_pins[0] = 0x1b;
3195 spec->autocfg.speaker_pins[0] = 0x17;
3204 * Built-in Mic-In: 0x19
3210 static struct hda_input_mux alc880_lg_lw_capture_source = {
3214 { "Internal Mic", 0x1 },
3219 #define alc880_lg_lw_modes alc880_threestack_modes
3221 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3225 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3235 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3238 .name = "Channel Mode",
3239 .info = alc_ch_mode_info,
3240 .get = alc_ch_mode_get,
3241 .put = alc_ch_mode_put,
3246 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3247 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3248 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3249 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3251 /* set capture source to mic-in */
3252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3261 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 /* mic-in to input */
3263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3273 /* toggle speaker-output according to the hp-jack state */
3274 static void alc880_lg_lw_setup(struct hda_codec *codec)
3276 struct alc_spec *spec = codec->spec;
3278 spec->autocfg.hp_pins[0] = 0x1b;
3279 spec->autocfg.speaker_pins[0] = 0x14;
3282 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3283 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3284 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3287 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3288 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3292 static struct hda_input_mux alc880_medion_rim_capture_source = {
3296 { "Internal Mic", 0x1 },
3300 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3301 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3304 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3306 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3309 /* Mic2 (as headphone out) for HP output */
3310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3312 /* Internal Speaker */
3313 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3314 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3316 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3317 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3319 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3323 /* toggle speaker-output according to the hp-jack state */
3324 static void alc880_medion_rim_automute(struct hda_codec *codec)
3326 struct alc_spec *spec = codec->spec;
3327 alc_automute_amp(codec);
3329 if (spec->jack_present)
3330 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3332 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3335 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3338 /* Looks like the unsol event is incompatible with the standard
3339 * definition. 4bit tag is placed at 28 bit!
3341 if ((res >> 28) == ALC880_HP_EVENT)
3342 alc880_medion_rim_automute(codec);
3345 static void alc880_medion_rim_setup(struct hda_codec *codec)
3347 struct alc_spec *spec = codec->spec;
3349 spec->autocfg.hp_pins[0] = 0x14;
3350 spec->autocfg.speaker_pins[0] = 0x1b;
3353 #ifdef CONFIG_SND_HDA_POWER_SAVE
3354 static struct hda_amp_list alc880_loopbacks[] = {
3355 { 0x0b, HDA_INPUT, 0 },
3356 { 0x0b, HDA_INPUT, 1 },
3357 { 0x0b, HDA_INPUT, 2 },
3358 { 0x0b, HDA_INPUT, 3 },
3359 { 0x0b, HDA_INPUT, 4 },
3363 static struct hda_amp_list alc880_lg_loopbacks[] = {
3364 { 0x0b, HDA_INPUT, 1 },
3365 { 0x0b, HDA_INPUT, 6 },
3366 { 0x0b, HDA_INPUT, 7 },
3375 static int alc_init(struct hda_codec *codec)
3377 struct alc_spec *spec = codec->spec;
3381 alc_auto_init_amp(codec, spec->init_amp);
3383 for (i = 0; i < spec->num_init_verbs; i++)
3384 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3386 if (spec->init_hook)
3387 spec->init_hook(codec);
3392 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3394 struct alc_spec *spec = codec->spec;
3396 if (spec->unsol_event)
3397 spec->unsol_event(codec, res);
3400 #ifdef CONFIG_SND_HDA_POWER_SAVE
3401 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3403 struct alc_spec *spec = codec->spec;
3404 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3409 * Analog playback callbacks
3411 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3412 struct hda_codec *codec,
3413 struct snd_pcm_substream *substream)
3415 struct alc_spec *spec = codec->spec;
3416 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3420 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3421 struct hda_codec *codec,
3422 unsigned int stream_tag,
3423 unsigned int format,
3424 struct snd_pcm_substream *substream)
3426 struct alc_spec *spec = codec->spec;
3427 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3428 stream_tag, format, substream);
3431 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3432 struct hda_codec *codec,
3433 struct snd_pcm_substream *substream)
3435 struct alc_spec *spec = codec->spec;
3436 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3442 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3443 struct hda_codec *codec,
3444 struct snd_pcm_substream *substream)
3446 struct alc_spec *spec = codec->spec;
3447 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3450 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3451 struct hda_codec *codec,
3452 unsigned int stream_tag,
3453 unsigned int format,
3454 struct snd_pcm_substream *substream)
3456 struct alc_spec *spec = codec->spec;
3457 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3458 stream_tag, format, substream);
3461 static int alc880_dig_playback_pcm_cleanup(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_cleanup(codec, &spec->multiout);
3469 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3470 struct hda_codec *codec,
3471 struct snd_pcm_substream *substream)
3473 struct alc_spec *spec = codec->spec;
3474 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3480 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3481 struct hda_codec *codec,
3482 unsigned int stream_tag,
3483 unsigned int format,
3484 struct snd_pcm_substream *substream)
3486 struct alc_spec *spec = codec->spec;
3488 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3489 stream_tag, 0, format);
3493 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3494 struct hda_codec *codec,
3495 struct snd_pcm_substream *substream)
3497 struct alc_spec *spec = codec->spec;
3499 snd_hda_codec_cleanup_stream(codec,
3500 spec->adc_nids[substream->number + 1]);
3507 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3511 /* NID is set in alc_build_pcms */
3513 .open = alc880_playback_pcm_open,
3514 .prepare = alc880_playback_pcm_prepare,
3515 .cleanup = alc880_playback_pcm_cleanup
3519 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3523 /* NID is set in alc_build_pcms */
3526 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3530 /* NID is set in alc_build_pcms */
3533 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3534 .substreams = 2, /* can be overridden */
3537 /* NID is set in alc_build_pcms */
3539 .prepare = alc880_alt_capture_pcm_prepare,
3540 .cleanup = alc880_alt_capture_pcm_cleanup
3544 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3548 /* NID is set in alc_build_pcms */
3550 .open = alc880_dig_playback_pcm_open,
3551 .close = alc880_dig_playback_pcm_close,
3552 .prepare = alc880_dig_playback_pcm_prepare,
3553 .cleanup = alc880_dig_playback_pcm_cleanup
3557 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3561 /* NID is set in alc_build_pcms */
3564 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3565 static struct hda_pcm_stream alc_pcm_null_stream = {
3571 static int alc_build_pcms(struct hda_codec *codec)
3573 struct alc_spec *spec = codec->spec;
3574 struct hda_pcm *info = spec->pcm_rec;
3577 codec->num_pcms = 1;
3578 codec->pcm_info = info;
3580 if (spec->no_analog)
3583 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3584 "%s Analog", codec->chip_name);
3585 info->name = spec->stream_name_analog;
3587 if (spec->stream_analog_playback) {
3588 if (snd_BUG_ON(!spec->multiout.dac_nids))
3590 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3591 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3593 if (spec->stream_analog_capture) {
3594 if (snd_BUG_ON(!spec->adc_nids))
3596 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3597 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3600 if (spec->channel_mode) {
3601 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3602 for (i = 0; i < spec->num_channel_mode; i++) {
3603 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3604 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3610 /* SPDIF for stream index #1 */
3611 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3612 snprintf(spec->stream_name_digital,
3613 sizeof(spec->stream_name_digital),
3614 "%s Digital", codec->chip_name);
3615 codec->num_pcms = 2;
3616 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3617 info = spec->pcm_rec + 1;
3618 info->name = spec->stream_name_digital;
3619 if (spec->dig_out_type)
3620 info->pcm_type = spec->dig_out_type;
3622 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3623 if (spec->multiout.dig_out_nid &&
3624 spec->stream_digital_playback) {
3625 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3626 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3628 if (spec->dig_in_nid &&
3629 spec->stream_digital_capture) {
3630 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3631 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3633 /* FIXME: do we need this for all Realtek codec models? */
3634 codec->spdif_status_reset = 1;
3637 if (spec->no_analog)
3640 /* If the use of more than one ADC is requested for the current
3641 * model, configure a second analog capture-only PCM.
3643 /* Additional Analaog capture for index #2 */
3644 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3645 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3646 codec->num_pcms = 3;
3647 info = spec->pcm_rec + 2;
3648 info->name = spec->stream_name_analog;
3649 if (spec->alt_dac_nid) {
3650 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3651 *spec->stream_analog_alt_playback;
3652 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3655 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3656 alc_pcm_null_stream;
3657 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3659 if (spec->num_adc_nids > 1) {
3660 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3661 *spec->stream_analog_alt_capture;
3662 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3664 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3665 spec->num_adc_nids - 1;
3667 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3668 alc_pcm_null_stream;
3669 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3676 static inline void alc_shutup(struct hda_codec *codec)
3678 snd_hda_shutup_pins(codec);
3681 static void alc_free_kctls(struct hda_codec *codec)
3683 struct alc_spec *spec = codec->spec;
3685 if (spec->kctls.list) {
3686 struct snd_kcontrol_new *kctl = spec->kctls.list;
3688 for (i = 0; i < spec->kctls.used; i++)
3689 kfree(kctl[i].name);
3691 snd_array_free(&spec->kctls);
3694 static void alc_free(struct hda_codec *codec)
3696 struct alc_spec *spec = codec->spec;
3702 alc_free_kctls(codec);
3704 snd_hda_detach_beep_device(codec);
3707 #ifdef CONFIG_SND_HDA_POWER_SAVE
3708 static void alc_power_eapd(struct hda_codec *codec)
3710 /* We currently only handle front, HP */
3711 switch (codec->vendor_id) {
3713 set_eapd(codec, 0x0f, 0);
3714 set_eapd(codec, 0x10, 0);
3727 set_eapd(codec, 0x14, 0);
3728 set_eapd(codec, 0x15, 0);
3733 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3735 struct alc_spec *spec = codec->spec;
3737 if (spec && spec->power_hook)
3738 spec->power_hook(codec);
3743 #ifdef SND_HDA_NEEDS_RESUME
3744 static int alc_resume(struct hda_codec *codec)
3746 codec->patch_ops.init(codec);
3747 snd_hda_codec_resume_amp(codec);
3748 snd_hda_codec_resume_cache(codec);
3755 static struct hda_codec_ops alc_patch_ops = {
3756 .build_controls = alc_build_controls,
3757 .build_pcms = alc_build_pcms,
3760 .unsol_event = alc_unsol_event,
3761 #ifdef SND_HDA_NEEDS_RESUME
3762 .resume = alc_resume,
3764 #ifdef CONFIG_SND_HDA_POWER_SAVE
3765 .suspend = alc_suspend,
3766 .check_power_status = alc_check_power_status,
3768 .reboot_notify = alc_shutup,
3773 * Test configuration for debugging
3775 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3778 #ifdef CONFIG_SND_DEBUG
3779 static hda_nid_t alc880_test_dac_nids[4] = {
3780 0x02, 0x03, 0x04, 0x05
3783 static struct hda_input_mux alc880_test_capture_source = {
3792 { "Surround", 0x6 },
3796 static struct hda_channel_mode alc880_test_modes[4] = {
3803 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3804 struct snd_ctl_elem_info *uinfo)
3806 static char *texts[] = {
3807 "N/A", "Line Out", "HP Out",
3808 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3810 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3812 uinfo->value.enumerated.items = 8;
3813 if (uinfo->value.enumerated.item >= 8)
3814 uinfo->value.enumerated.item = 7;
3815 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3819 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3820 struct snd_ctl_elem_value *ucontrol)
3822 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3823 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3824 unsigned int pin_ctl, item = 0;
3826 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3827 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3828 if (pin_ctl & AC_PINCTL_OUT_EN) {
3829 if (pin_ctl & AC_PINCTL_HP_EN)
3833 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3834 switch (pin_ctl & AC_PINCTL_VREFEN) {
3835 case AC_PINCTL_VREF_HIZ: item = 3; break;
3836 case AC_PINCTL_VREF_50: item = 4; break;
3837 case AC_PINCTL_VREF_GRD: item = 5; break;
3838 case AC_PINCTL_VREF_80: item = 6; break;
3839 case AC_PINCTL_VREF_100: item = 7; break;
3842 ucontrol->value.enumerated.item[0] = item;
3846 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3847 struct snd_ctl_elem_value *ucontrol)
3849 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3850 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3851 static unsigned int ctls[] = {
3852 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3853 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3854 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3855 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3856 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3857 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3859 unsigned int old_ctl, new_ctl;
3861 old_ctl = snd_hda_codec_read(codec, nid, 0,
3862 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3863 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3864 if (old_ctl != new_ctl) {
3866 snd_hda_codec_write_cache(codec, nid, 0,
3867 AC_VERB_SET_PIN_WIDGET_CONTROL,
3869 val = ucontrol->value.enumerated.item[0] >= 3 ?
3871 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3878 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3879 struct snd_ctl_elem_info *uinfo)
3881 static char *texts[] = {
3882 "Front", "Surround", "CLFE", "Side"
3884 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3886 uinfo->value.enumerated.items = 4;
3887 if (uinfo->value.enumerated.item >= 4)
3888 uinfo->value.enumerated.item = 3;
3889 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3893 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3894 struct snd_ctl_elem_value *ucontrol)
3896 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3897 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3900 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3901 ucontrol->value.enumerated.item[0] = sel & 3;
3905 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3906 struct snd_ctl_elem_value *ucontrol)
3908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3909 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3912 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3913 if (ucontrol->value.enumerated.item[0] != sel) {
3914 sel = ucontrol->value.enumerated.item[0] & 3;
3915 snd_hda_codec_write_cache(codec, nid, 0,
3916 AC_VERB_SET_CONNECT_SEL, sel);
3922 #define PIN_CTL_TEST(xname,nid) { \
3923 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3925 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3926 .info = alc_test_pin_ctl_info, \
3927 .get = alc_test_pin_ctl_get, \
3928 .put = alc_test_pin_ctl_put, \
3929 .private_value = nid \
3932 #define PIN_SRC_TEST(xname,nid) { \
3933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3935 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3936 .info = alc_test_pin_src_info, \
3937 .get = alc_test_pin_src_get, \
3938 .put = alc_test_pin_src_put, \
3939 .private_value = nid \
3942 static struct snd_kcontrol_new alc880_test_mixer[] = {
3943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3944 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3945 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3946 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3947 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3948 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3949 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3950 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3951 PIN_CTL_TEST("Front Pin Mode", 0x14),
3952 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3953 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3954 PIN_CTL_TEST("Side Pin Mode", 0x17),
3955 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3956 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3957 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3958 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3959 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3960 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3961 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3962 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3963 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3964 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3965 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3966 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3967 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3968 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3969 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3970 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3974 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3975 .name = "Channel Mode",
3976 .info = alc_ch_mode_info,
3977 .get = alc_ch_mode_get,
3978 .put = alc_ch_mode_put,
3983 static struct hda_verb alc880_test_init_verbs[] = {
3984 /* Unmute inputs of 0x0c - 0x0f */
3985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3989 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3991 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3993 /* Vol output for 0x0c-0x0f */
3994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3995 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3996 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3997 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3998 /* Set output pins 0x14-0x17 */
3999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4002 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4003 /* Unmute output pins 0x14-0x17 */
4004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4008 /* Set input pins 0x18-0x1c */
4009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4013 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4014 /* Mute input pins 0x18-0x1b */
4015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4021 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4023 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4025 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4026 /* Analog input/passthru */
4027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4039 static const char *alc880_models[ALC880_MODEL_LAST] = {
4040 [ALC880_3ST] = "3stack",
4041 [ALC880_TCL_S700] = "tcl",
4042 [ALC880_3ST_DIG] = "3stack-digout",
4043 [ALC880_CLEVO] = "clevo",
4044 [ALC880_5ST] = "5stack",
4045 [ALC880_5ST_DIG] = "5stack-digout",
4046 [ALC880_W810] = "w810",
4047 [ALC880_Z71V] = "z71v",
4048 [ALC880_6ST] = "6stack",
4049 [ALC880_6ST_DIG] = "6stack-digout",
4050 [ALC880_ASUS] = "asus",
4051 [ALC880_ASUS_W1V] = "asus-w1v",
4052 [ALC880_ASUS_DIG] = "asus-dig",
4053 [ALC880_ASUS_DIG2] = "asus-dig2",
4054 [ALC880_UNIWILL_DIG] = "uniwill",
4055 [ALC880_UNIWILL_P53] = "uniwill-p53",
4056 [ALC880_FUJITSU] = "fujitsu",
4057 [ALC880_F1734] = "F1734",
4059 [ALC880_LG_LW] = "lg-lw",
4060 [ALC880_MEDION_RIM] = "medion",
4061 #ifdef CONFIG_SND_DEBUG
4062 [ALC880_TEST] = "test",
4064 [ALC880_AUTO] = "auto",
4067 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4068 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4069 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4070 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4071 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4072 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4073 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4074 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4075 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4076 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4077 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4078 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4079 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4080 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4081 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4082 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4086 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4087 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4088 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4089 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4090 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4091 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4092 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4093 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4094 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4095 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4096 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4097 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4098 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4099 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4100 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4101 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4102 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4104 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4105 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4106 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4107 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4108 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4109 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4110 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4111 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4112 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4113 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4114 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4115 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4116 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4117 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4118 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4119 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4120 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4121 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4122 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4123 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4124 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4125 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4126 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4128 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4130 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4132 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4133 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4135 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4137 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4138 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4139 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4144 * ALC880 codec presets
4146 static struct alc_config_preset alc880_presets[] = {
4148 .mixers = { alc880_three_stack_mixer },
4149 .init_verbs = { alc880_volume_init_verbs,
4150 alc880_pin_3stack_init_verbs },
4151 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4152 .dac_nids = alc880_dac_nids,
4153 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4154 .channel_mode = alc880_threestack_modes,
4156 .input_mux = &alc880_capture_source,
4158 [ALC880_3ST_DIG] = {
4159 .mixers = { alc880_three_stack_mixer },
4160 .init_verbs = { alc880_volume_init_verbs,
4161 alc880_pin_3stack_init_verbs },
4162 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4163 .dac_nids = alc880_dac_nids,
4164 .dig_out_nid = ALC880_DIGOUT_NID,
4165 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4166 .channel_mode = alc880_threestack_modes,
4168 .input_mux = &alc880_capture_source,
4170 [ALC880_TCL_S700] = {
4171 .mixers = { alc880_tcl_s700_mixer },
4172 .init_verbs = { alc880_volume_init_verbs,
4173 alc880_pin_tcl_S700_init_verbs,
4174 alc880_gpio2_init_verbs },
4175 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4176 .dac_nids = alc880_dac_nids,
4177 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4178 .num_adc_nids = 1, /* single ADC */
4180 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4181 .channel_mode = alc880_2_jack_modes,
4182 .input_mux = &alc880_capture_source,
4185 .mixers = { alc880_three_stack_mixer,
4186 alc880_five_stack_mixer},
4187 .init_verbs = { alc880_volume_init_verbs,
4188 alc880_pin_5stack_init_verbs },
4189 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4190 .dac_nids = alc880_dac_nids,
4191 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4192 .channel_mode = alc880_fivestack_modes,
4193 .input_mux = &alc880_capture_source,
4195 [ALC880_5ST_DIG] = {
4196 .mixers = { alc880_three_stack_mixer,
4197 alc880_five_stack_mixer },
4198 .init_verbs = { alc880_volume_init_verbs,
4199 alc880_pin_5stack_init_verbs },
4200 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4201 .dac_nids = alc880_dac_nids,
4202 .dig_out_nid = ALC880_DIGOUT_NID,
4203 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4204 .channel_mode = alc880_fivestack_modes,
4205 .input_mux = &alc880_capture_source,
4208 .mixers = { alc880_six_stack_mixer },
4209 .init_verbs = { alc880_volume_init_verbs,
4210 alc880_pin_6stack_init_verbs },
4211 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4212 .dac_nids = alc880_6st_dac_nids,
4213 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4214 .channel_mode = alc880_sixstack_modes,
4215 .input_mux = &alc880_6stack_capture_source,
4217 [ALC880_6ST_DIG] = {
4218 .mixers = { alc880_six_stack_mixer },
4219 .init_verbs = { alc880_volume_init_verbs,
4220 alc880_pin_6stack_init_verbs },
4221 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4222 .dac_nids = alc880_6st_dac_nids,
4223 .dig_out_nid = ALC880_DIGOUT_NID,
4224 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4225 .channel_mode = alc880_sixstack_modes,
4226 .input_mux = &alc880_6stack_capture_source,
4229 .mixers = { alc880_w810_base_mixer },
4230 .init_verbs = { alc880_volume_init_verbs,
4231 alc880_pin_w810_init_verbs,
4232 alc880_gpio2_init_verbs },
4233 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4234 .dac_nids = alc880_w810_dac_nids,
4235 .dig_out_nid = ALC880_DIGOUT_NID,
4236 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4237 .channel_mode = alc880_w810_modes,
4238 .input_mux = &alc880_capture_source,
4241 .mixers = { alc880_z71v_mixer },
4242 .init_verbs = { alc880_volume_init_verbs,
4243 alc880_pin_z71v_init_verbs },
4244 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4245 .dac_nids = alc880_z71v_dac_nids,
4246 .dig_out_nid = ALC880_DIGOUT_NID,
4248 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4249 .channel_mode = alc880_2_jack_modes,
4250 .input_mux = &alc880_capture_source,
4253 .mixers = { alc880_f1734_mixer },
4254 .init_verbs = { alc880_volume_init_verbs,
4255 alc880_pin_f1734_init_verbs },
4256 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4257 .dac_nids = alc880_f1734_dac_nids,
4259 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4260 .channel_mode = alc880_2_jack_modes,
4261 .input_mux = &alc880_f1734_capture_source,
4262 .unsol_event = alc880_uniwill_p53_unsol_event,
4263 .setup = alc880_uniwill_p53_setup,
4264 .init_hook = alc_automute_amp,
4267 .mixers = { alc880_asus_mixer },
4268 .init_verbs = { alc880_volume_init_verbs,
4269 alc880_pin_asus_init_verbs,
4270 alc880_gpio1_init_verbs },
4271 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4272 .dac_nids = alc880_asus_dac_nids,
4273 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4274 .channel_mode = alc880_asus_modes,
4276 .input_mux = &alc880_capture_source,
4278 [ALC880_ASUS_DIG] = {
4279 .mixers = { alc880_asus_mixer },
4280 .init_verbs = { alc880_volume_init_verbs,
4281 alc880_pin_asus_init_verbs,
4282 alc880_gpio1_init_verbs },
4283 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4284 .dac_nids = alc880_asus_dac_nids,
4285 .dig_out_nid = ALC880_DIGOUT_NID,
4286 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4287 .channel_mode = alc880_asus_modes,
4289 .input_mux = &alc880_capture_source,
4291 [ALC880_ASUS_DIG2] = {
4292 .mixers = { alc880_asus_mixer },
4293 .init_verbs = { alc880_volume_init_verbs,
4294 alc880_pin_asus_init_verbs,
4295 alc880_gpio2_init_verbs }, /* use GPIO2 */
4296 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4297 .dac_nids = alc880_asus_dac_nids,
4298 .dig_out_nid = ALC880_DIGOUT_NID,
4299 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4300 .channel_mode = alc880_asus_modes,
4302 .input_mux = &alc880_capture_source,
4304 [ALC880_ASUS_W1V] = {
4305 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4306 .init_verbs = { alc880_volume_init_verbs,
4307 alc880_pin_asus_init_verbs,
4308 alc880_gpio1_init_verbs },
4309 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4310 .dac_nids = alc880_asus_dac_nids,
4311 .dig_out_nid = ALC880_DIGOUT_NID,
4312 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4313 .channel_mode = alc880_asus_modes,
4315 .input_mux = &alc880_capture_source,
4317 [ALC880_UNIWILL_DIG] = {
4318 .mixers = { alc880_asus_mixer },
4319 .init_verbs = { alc880_volume_init_verbs,
4320 alc880_pin_asus_init_verbs },
4321 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4322 .dac_nids = alc880_asus_dac_nids,
4323 .dig_out_nid = ALC880_DIGOUT_NID,
4324 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4325 .channel_mode = alc880_asus_modes,
4327 .input_mux = &alc880_capture_source,
4329 [ALC880_UNIWILL] = {
4330 .mixers = { alc880_uniwill_mixer },
4331 .init_verbs = { alc880_volume_init_verbs,
4332 alc880_uniwill_init_verbs },
4333 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4334 .dac_nids = alc880_asus_dac_nids,
4335 .dig_out_nid = ALC880_DIGOUT_NID,
4336 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4337 .channel_mode = alc880_threestack_modes,
4339 .input_mux = &alc880_capture_source,
4340 .unsol_event = alc880_uniwill_unsol_event,
4341 .setup = alc880_uniwill_setup,
4342 .init_hook = alc880_uniwill_init_hook,
4344 [ALC880_UNIWILL_P53] = {
4345 .mixers = { alc880_uniwill_p53_mixer },
4346 .init_verbs = { alc880_volume_init_verbs,
4347 alc880_uniwill_p53_init_verbs },
4348 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4349 .dac_nids = alc880_asus_dac_nids,
4350 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4351 .channel_mode = alc880_threestack_modes,
4352 .input_mux = &alc880_capture_source,
4353 .unsol_event = alc880_uniwill_p53_unsol_event,
4354 .setup = alc880_uniwill_p53_setup,
4355 .init_hook = alc_automute_amp,
4357 [ALC880_FUJITSU] = {
4358 .mixers = { alc880_fujitsu_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_uniwill_p53_init_verbs,
4361 alc880_beep_init_verbs },
4362 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4363 .dac_nids = alc880_dac_nids,
4364 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4366 .channel_mode = alc880_2_jack_modes,
4367 .input_mux = &alc880_capture_source,
4368 .unsol_event = alc880_uniwill_p53_unsol_event,
4369 .setup = alc880_uniwill_p53_setup,
4370 .init_hook = alc_automute_amp,
4373 .mixers = { alc880_three_stack_mixer },
4374 .init_verbs = { alc880_volume_init_verbs,
4375 alc880_pin_clevo_init_verbs },
4376 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4377 .dac_nids = alc880_dac_nids,
4379 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4380 .channel_mode = alc880_threestack_modes,
4382 .input_mux = &alc880_capture_source,
4385 .mixers = { alc880_lg_mixer },
4386 .init_verbs = { alc880_volume_init_verbs,
4387 alc880_lg_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4389 .dac_nids = alc880_lg_dac_nids,
4390 .dig_out_nid = ALC880_DIGOUT_NID,
4391 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4392 .channel_mode = alc880_lg_ch_modes,
4394 .input_mux = &alc880_lg_capture_source,
4395 .unsol_event = alc_automute_amp_unsol_event,
4396 .setup = alc880_lg_setup,
4397 .init_hook = alc_automute_amp,
4398 #ifdef CONFIG_SND_HDA_POWER_SAVE
4399 .loopbacks = alc880_lg_loopbacks,
4403 .mixers = { alc880_lg_lw_mixer },
4404 .init_verbs = { alc880_volume_init_verbs,
4405 alc880_lg_lw_init_verbs },
4406 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4407 .dac_nids = alc880_dac_nids,
4408 .dig_out_nid = ALC880_DIGOUT_NID,
4409 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4410 .channel_mode = alc880_lg_lw_modes,
4411 .input_mux = &alc880_lg_lw_capture_source,
4412 .unsol_event = alc_automute_amp_unsol_event,
4413 .setup = alc880_lg_lw_setup,
4414 .init_hook = alc_automute_amp,
4416 [ALC880_MEDION_RIM] = {
4417 .mixers = { alc880_medion_rim_mixer },
4418 .init_verbs = { alc880_volume_init_verbs,
4419 alc880_medion_rim_init_verbs,
4420 alc_gpio2_init_verbs },
4421 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4422 .dac_nids = alc880_dac_nids,
4423 .dig_out_nid = ALC880_DIGOUT_NID,
4424 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4425 .channel_mode = alc880_2_jack_modes,
4426 .input_mux = &alc880_medion_rim_capture_source,
4427 .unsol_event = alc880_medion_rim_unsol_event,
4428 .setup = alc880_medion_rim_setup,
4429 .init_hook = alc880_medion_rim_automute,
4431 #ifdef CONFIG_SND_DEBUG
4433 .mixers = { alc880_test_mixer },
4434 .init_verbs = { alc880_test_init_verbs },
4435 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4436 .dac_nids = alc880_test_dac_nids,
4437 .dig_out_nid = ALC880_DIGOUT_NID,
4438 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4439 .channel_mode = alc880_test_modes,
4440 .input_mux = &alc880_test_capture_source,
4446 * Automatic parse of I/O pins from the BIOS configuration
4451 ALC_CTL_WIDGET_MUTE,
4454 static struct snd_kcontrol_new alc880_control_templates[] = {
4455 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4456 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4457 HDA_BIND_MUTE(NULL, 0, 0, 0),
4460 /* add dynamic controls */
4461 static int add_control(struct alc_spec *spec, int type, const char *name,
4464 struct snd_kcontrol_new *knew;
4466 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4467 knew = snd_array_new(&spec->kctls);
4470 *knew = alc880_control_templates[type];
4471 knew->name = kstrdup(name, GFP_KERNEL);
4474 if (get_amp_nid_(val))
4475 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4476 knew->private_value = val;
4480 static int add_control_with_pfx(struct alc_spec *spec, int type,
4481 const char *pfx, const char *dir,
4482 const char *sfx, unsigned long val)
4485 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4486 return add_control(spec, type, name, val);
4489 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4490 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4491 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4492 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4494 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4495 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4496 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4497 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4498 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4499 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4500 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4501 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4502 #define ALC880_PIN_CD_NID 0x1c
4504 /* fill in the dac_nids table from the parsed pin configuration */
4505 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4506 const struct auto_pin_cfg *cfg)
4512 memset(assigned, 0, sizeof(assigned));
4513 spec->multiout.dac_nids = spec->private_dac_nids;
4515 /* check the pins hardwired to audio widget */
4516 for (i = 0; i < cfg->line_outs; i++) {
4517 nid = cfg->line_out_pins[i];
4518 if (alc880_is_fixed_pin(nid)) {
4519 int idx = alc880_fixed_pin_idx(nid);
4520 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4524 /* left pins can be connect to any audio widget */
4525 for (i = 0; i < cfg->line_outs; i++) {
4526 nid = cfg->line_out_pins[i];
4527 if (alc880_is_fixed_pin(nid))
4529 /* search for an empty channel */
4530 for (j = 0; j < cfg->line_outs; j++) {
4532 spec->multiout.dac_nids[i] =
4533 alc880_idx_to_dac(j);
4539 spec->multiout.num_dacs = cfg->line_outs;
4543 /* add playback controls from the parsed DAC table */
4544 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4545 const struct auto_pin_cfg *cfg)
4547 static const char *chname[4] = {
4548 "Front", "Surround", NULL /*CLFE*/, "Side"
4553 for (i = 0; i < cfg->line_outs; i++) {
4554 if (!spec->multiout.dac_nids[i])
4556 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4559 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4561 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4567 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4571 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4573 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4577 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4579 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4585 if (cfg->line_outs == 1 &&
4586 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4590 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4591 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4595 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4596 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4605 /* add playback controls for speaker and HP outputs */
4606 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4615 if (alc880_is_fixed_pin(pin)) {
4616 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4617 /* specify the DAC as the extra output */
4618 if (!spec->multiout.hp_nid)
4619 spec->multiout.hp_nid = nid;
4621 spec->multiout.extra_out_nid[0] = nid;
4622 /* control HP volume/switch on the output mixer amp */
4623 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4624 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4625 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4628 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4629 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4632 } else if (alc880_is_multi_pin(pin)) {
4633 /* set manual connection */
4634 /* we have only a switch on HP-out PIN */
4635 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4636 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4643 /* create input playback/capture controls for the given pin */
4644 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4645 const char *ctlname,
4646 int idx, hda_nid_t mix_nid)
4650 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4651 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4654 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4655 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4661 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4663 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4664 return (pincap & AC_PINCAP_IN) != 0;
4667 /* create playback/capture controls for input pins */
4668 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4669 const struct auto_pin_cfg *cfg,
4671 hda_nid_t cap1, hda_nid_t cap2)
4673 struct alc_spec *spec = codec->spec;
4674 struct hda_input_mux *imux = &spec->private_imux[0];
4677 for (i = 0; i < AUTO_PIN_LAST; i++) {
4680 pin = cfg->input_pins[i];
4681 if (!alc_is_input_pin(codec, pin))
4685 idx = get_connection_index(codec, mixer, pin);
4687 err = new_analog_input(spec, pin,
4688 auto_pin_cfg_labels[i],
4697 idx = get_connection_index(codec, cap1, pin);
4698 if (idx < 0 && cap2)
4699 idx = get_connection_index(codec, cap2, pin);
4701 imux->items[imux->num_items].label =
4702 auto_pin_cfg_labels[i];
4703 imux->items[imux->num_items].index = idx;
4710 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4711 const struct auto_pin_cfg *cfg)
4713 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4716 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4717 unsigned int pin_type)
4719 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4722 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4726 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4727 hda_nid_t nid, int pin_type,
4730 alc_set_pin_output(codec, nid, pin_type);
4731 /* need the manual connection? */
4732 if (alc880_is_multi_pin(nid)) {
4733 struct alc_spec *spec = codec->spec;
4734 int idx = alc880_multi_pin_idx(nid);
4735 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4736 AC_VERB_SET_CONNECT_SEL,
4737 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4741 static int get_pin_type(int line_out_type)
4743 if (line_out_type == AUTO_PIN_HP_OUT)
4749 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4751 struct alc_spec *spec = codec->spec;
4754 for (i = 0; i < spec->autocfg.line_outs; i++) {
4755 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4756 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4757 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4761 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4763 struct alc_spec *spec = codec->spec;
4766 pin = spec->autocfg.speaker_pins[0];
4767 if (pin) /* connect to front */
4768 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4769 pin = spec->autocfg.hp_pins[0];
4770 if (pin) /* connect to front */
4771 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4774 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4776 struct alc_spec *spec = codec->spec;
4779 for (i = 0; i < AUTO_PIN_LAST; i++) {
4780 hda_nid_t nid = spec->autocfg.input_pins[i];
4781 if (alc_is_input_pin(codec, nid)) {
4782 alc_set_input_pin(codec, nid, i);
4783 if (nid != ALC880_PIN_CD_NID &&
4784 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4785 snd_hda_codec_write(codec, nid, 0,
4786 AC_VERB_SET_AMP_GAIN_MUTE,
4792 /* parse the BIOS configuration and set up the alc_spec */
4793 /* return 1 if successful, 0 if the proper config is not found,
4794 * or a negative error code
4796 static int alc880_parse_auto_config(struct hda_codec *codec)
4798 struct alc_spec *spec = codec->spec;
4800 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4802 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4806 if (!spec->autocfg.line_outs)
4807 return 0; /* can't find valid BIOS pin config */
4809 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4812 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4815 err = alc880_auto_create_extra_out(spec,
4816 spec->autocfg.speaker_pins[0],
4820 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4824 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4828 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4830 /* check multiple SPDIF-out (for recent codecs) */
4831 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4833 err = snd_hda_get_connections(codec,
4834 spec->autocfg.dig_out_pins[i],
4839 spec->multiout.dig_out_nid = dig_nid;
4841 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4842 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4844 spec->slave_dig_outs[i - 1] = dig_nid;
4847 if (spec->autocfg.dig_in_pin)
4848 spec->dig_in_nid = ALC880_DIGIN_NID;
4850 if (spec->kctls.list)
4851 add_mixer(spec, spec->kctls.list);
4853 add_verb(spec, alc880_volume_init_verbs);
4855 spec->num_mux_defs = 1;
4856 spec->input_mux = &spec->private_imux[0];
4858 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4863 /* additional initialization for auto-configuration model */
4864 static void alc880_auto_init(struct hda_codec *codec)
4866 struct alc_spec *spec = codec->spec;
4867 alc880_auto_init_multi_out(codec);
4868 alc880_auto_init_extra_out(codec);
4869 alc880_auto_init_analog_input(codec);
4870 if (spec->unsol_event)
4871 alc_inithook(codec);
4874 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4875 * one of two digital mic pins, e.g. on ALC272
4877 static void fixup_automic_adc(struct hda_codec *codec)
4879 struct alc_spec *spec = codec->spec;
4882 for (i = 0; i < spec->num_adc_nids; i++) {
4883 hda_nid_t cap = spec->capsrc_nids ?
4884 spec->capsrc_nids[i] : spec->adc_nids[i];
4887 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4890 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4893 spec->int_mic.mux_idx = iidx;
4894 spec->ext_mic.mux_idx = eidx;
4895 if (spec->capsrc_nids)
4896 spec->capsrc_nids += i;
4897 spec->adc_nids += i;
4898 spec->num_adc_nids = 1;
4901 snd_printd(KERN_INFO "hda_codec: %s: "
4902 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4903 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4904 spec->auto_mic = 0; /* disable auto-mic to be sure */
4907 /* choose the ADC/MUX containing the input pin and initialize the setup */
4908 static void fixup_single_adc(struct hda_codec *codec)
4910 struct alc_spec *spec = codec->spec;
4914 /* search for the input pin; there must be only one */
4915 for (i = 0; i < AUTO_PIN_LAST; i++) {
4916 if (spec->autocfg.input_pins[i]) {
4917 pin = spec->autocfg.input_pins[i];
4924 /* set the default connection to that pin */
4925 for (i = 0; i < spec->num_adc_nids; i++) {
4926 hda_nid_t cap = spec->capsrc_nids ?
4927 spec->capsrc_nids[i] : spec->adc_nids[i];
4930 idx = get_connection_index(codec, cap, pin);
4933 /* use only this ADC */
4934 if (spec->capsrc_nids)
4935 spec->capsrc_nids += i;
4936 spec->adc_nids += i;
4937 spec->num_adc_nids = 1;
4938 /* select or unmute this route */
4939 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4940 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4943 snd_hda_codec_write_cache(codec, cap, 0,
4944 AC_VERB_SET_CONNECT_SEL, idx);
4950 static void set_capture_mixer(struct hda_codec *codec)
4952 struct alc_spec *spec = codec->spec;
4953 static struct snd_kcontrol_new *caps[2][3] = {
4954 { alc_capture_mixer_nosrc1,
4955 alc_capture_mixer_nosrc2,
4956 alc_capture_mixer_nosrc3 },
4957 { alc_capture_mixer1,
4959 alc_capture_mixer3 },
4961 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4964 fixup_automic_adc(codec);
4965 else if (spec->input_mux) {
4966 if (spec->input_mux->num_items > 1)
4968 else if (spec->input_mux->num_items == 1)
4969 fixup_single_adc(codec);
4971 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4975 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4976 #define set_beep_amp(spec, nid, idx, dir) \
4977 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4979 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4983 * OK, here we have finally the patch for ALC880
4986 static int patch_alc880(struct hda_codec *codec)
4988 struct alc_spec *spec;
4992 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4998 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5001 if (board_config < 0) {
5002 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5004 board_config = ALC880_AUTO;
5007 if (board_config == ALC880_AUTO) {
5008 /* automatic parse from the BIOS config */
5009 err = alc880_parse_auto_config(codec);
5015 "hda_codec: Cannot set up configuration "
5016 "from BIOS. Using 3-stack mode...\n");
5017 board_config = ALC880_3ST;
5021 err = snd_hda_attach_beep_device(codec, 0x1);
5027 if (board_config != ALC880_AUTO)
5028 setup_preset(codec, &alc880_presets[board_config]);
5030 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5031 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5032 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5034 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5035 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5037 if (!spec->adc_nids && spec->input_mux) {
5038 /* check whether NID 0x07 is valid */
5039 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5041 wcap = get_wcaps_type(wcap);
5042 if (wcap != AC_WID_AUD_IN) {
5043 spec->adc_nids = alc880_adc_nids_alt;
5044 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5046 spec->adc_nids = alc880_adc_nids;
5047 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5050 set_capture_mixer(codec);
5051 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5053 spec->vmaster_nid = 0x0c;
5055 codec->patch_ops = alc_patch_ops;
5056 if (board_config == ALC880_AUTO)
5057 spec->init_hook = alc880_auto_init;
5058 #ifdef CONFIG_SND_HDA_POWER_SAVE
5059 if (!spec->loopback.amplist)
5060 spec->loopback.amplist = alc880_loopbacks;
5071 static hda_nid_t alc260_dac_nids[1] = {
5076 static hda_nid_t alc260_adc_nids[1] = {
5081 static hda_nid_t alc260_adc_nids_alt[1] = {
5086 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5087 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5089 static hda_nid_t alc260_dual_adc_nids[2] = {
5094 #define ALC260_DIGOUT_NID 0x03
5095 #define ALC260_DIGIN_NID 0x06
5097 static struct hda_input_mux alc260_capture_source = {
5101 { "Front Mic", 0x1 },
5107 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5108 * headphone jack and the internal CD lines since these are the only pins at
5109 * which audio can appear. For flexibility, also allow the option of
5110 * recording the mixer output on the second ADC (ADC0 doesn't have a
5111 * connection to the mixer output).
5113 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5117 { "Mic/Line", 0x0 },
5119 { "Headphone", 0x2 },
5125 { "Mic/Line", 0x0 },
5127 { "Headphone", 0x2 },
5134 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5135 * the Fujitsu S702x, but jacks are marked differently.
5137 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5144 { "Headphone", 0x5 },
5153 { "Headphone", 0x6 },
5159 /* Maxdata Favorit 100XS */
5160 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5164 { "Line/Mic", 0x0 },
5171 { "Line/Mic", 0x0 },
5179 * This is just place-holder, so there's something for alc_build_pcms to look
5180 * at when it calculates the maximum number of channels. ALC260 has no mixer
5181 * element which allows changing the channel mode, so the verb list is
5184 static struct hda_channel_mode alc260_modes[1] = {
5189 /* Mixer combinations
5191 * basic: base_output + input + pc_beep + capture
5192 * HP: base_output + input + capture_alt
5193 * HP_3013: hp_3013 + input + capture
5194 * fujitsu: fujitsu + capture
5195 * acer: acer + capture
5198 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5199 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5200 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5202 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5203 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5204 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5208 static struct snd_kcontrol_new alc260_input_mixer[] = {
5209 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5210 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5211 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5212 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5214 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5216 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5220 /* update HP, line and mono out pins according to the master switch */
5221 static void alc260_hp_master_update(struct hda_codec *codec,
5222 hda_nid_t hp, hda_nid_t line,
5225 struct alc_spec *spec = codec->spec;
5226 unsigned int val = spec->master_sw ? PIN_HP : 0;
5227 /* change HP and line-out pins */
5228 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5230 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5232 /* mono (speaker) depending on the HP jack sense */
5233 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5234 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5238 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5239 struct snd_ctl_elem_value *ucontrol)
5241 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5242 struct alc_spec *spec = codec->spec;
5243 *ucontrol->value.integer.value = spec->master_sw;
5247 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5248 struct snd_ctl_elem_value *ucontrol)
5250 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5251 struct alc_spec *spec = codec->spec;
5252 int val = !!*ucontrol->value.integer.value;
5253 hda_nid_t hp, line, mono;
5255 if (val == spec->master_sw)
5257 spec->master_sw = val;
5258 hp = (kcontrol->private_value >> 16) & 0xff;
5259 line = (kcontrol->private_value >> 8) & 0xff;
5260 mono = kcontrol->private_value & 0xff;
5261 alc260_hp_master_update(codec, hp, line, mono);
5265 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5268 .name = "Master Playback Switch",
5269 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5270 .info = snd_ctl_boolean_mono_info,
5271 .get = alc260_hp_master_sw_get,
5272 .put = alc260_hp_master_sw_put,
5273 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5275 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5276 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5279 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5281 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5285 static struct hda_verb alc260_hp_unsol_verbs[] = {
5286 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5290 static void alc260_hp_automute(struct hda_codec *codec)
5292 struct alc_spec *spec = codec->spec;
5294 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5295 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5298 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5300 if ((res >> 26) == ALC880_HP_EVENT)
5301 alc260_hp_automute(codec);
5304 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5306 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5307 .name = "Master Playback Switch",
5308 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5309 .info = snd_ctl_boolean_mono_info,
5310 .get = alc260_hp_master_sw_get,
5311 .put = alc260_hp_master_sw_put,
5312 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5314 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5315 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5316 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5317 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5320 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5321 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5325 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5326 .ops = &snd_hda_bind_vol,
5328 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5329 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5330 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5335 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5336 .ops = &snd_hda_bind_sw,
5338 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5339 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5344 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5345 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5346 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5347 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5352 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5357 static void alc260_hp_3013_automute(struct hda_codec *codec)
5359 struct alc_spec *spec = codec->spec;
5361 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5362 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5365 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5368 if ((res >> 26) == ALC880_HP_EVENT)
5369 alc260_hp_3013_automute(codec);
5372 static void alc260_hp_3012_automute(struct hda_codec *codec)
5374 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5376 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5378 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5380 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5384 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5387 if ((res >> 26) == ALC880_HP_EVENT)
5388 alc260_hp_3012_automute(codec);
5391 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5392 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5394 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5396 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5397 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5398 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5399 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5400 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5401 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5402 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5404 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5408 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5409 * versions of the ALC260 don't act on requests to enable mic bias from NID
5410 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5411 * datasheet doesn't mention this restriction. At this stage it's not clear
5412 * whether this behaviour is intentional or is a hardware bug in chip
5413 * revisions available in early 2006. Therefore for now allow the
5414 * "Headphone Jack Mode" control to span all choices, but if it turns out
5415 * that the lack of mic bias for this NID is intentional we could change the
5416 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5418 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5419 * don't appear to make the mic bias available from the "line" jack, even
5420 * though the NID used for this jack (0x14) can supply it. The theory is
5421 * that perhaps Acer have included blocking capacitors between the ALC260
5422 * and the output jack. If this turns out to be the case for all such
5423 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5424 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5426 * The C20x Tablet series have a mono internal speaker which is controlled
5427 * via the chip's Mono sum widget and pin complex, so include the necessary
5428 * controls for such models. On models without a "mono speaker" the control
5429 * won't do anything.
5431 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5432 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5433 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5434 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5435 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5437 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5439 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5440 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5441 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5442 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5443 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5444 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5445 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5446 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5450 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5452 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5453 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5454 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5455 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5456 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5457 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5458 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5462 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5463 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5465 static struct snd_kcontrol_new alc260_will_mixer[] = {
5466 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5467 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5469 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5470 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5471 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5472 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5473 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5474 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5475 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5479 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5480 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5482 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5483 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5484 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5486 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5487 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5488 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5489 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5490 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5491 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5492 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5497 * initialization verbs
5499 static struct hda_verb alc260_init_verbs[] = {
5500 /* Line In pin widget for input */
5501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5502 /* CD pin widget for input */
5503 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5504 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5505 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5506 /* Mic2 (front panel) pin widget for input and vref at 80% */
5507 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5508 /* LINE-2 is used for line-out in rear */
5509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5510 /* select line-out */
5511 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5515 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5517 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 /* mute capture amp left and right */
5519 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5520 /* set connection select to line in (default select for this ADC) */
5521 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5522 /* mute capture amp left and right */
5523 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5524 /* set connection select to line in (default select for this ADC) */
5525 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5526 /* set vol=0 Line-Out mixer amp left and right */
5527 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5528 /* unmute pin widget amp left and right (no gain on this amp) */
5529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5530 /* set vol=0 HP mixer amp left and right */
5531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5532 /* unmute pin widget amp left and right (no gain on this amp) */
5533 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5534 /* set vol=0 Mono mixer amp left and right */
5535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5536 /* unmute pin widget amp left and right (no gain on this amp) */
5537 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5538 /* unmute LINE-2 out pin */
5539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5540 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5543 /* mute analog inputs */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5549 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5550 /* mute Front out path */
5551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5553 /* mute Headphone out path */
5554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5556 /* mute Mono out path */
5557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5562 #if 0 /* should be identical with alc260_init_verbs? */
5563 static struct hda_verb alc260_hp_init_verbs[] = {
5564 /* Headphone and output */
5565 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5567 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5568 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5569 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5570 /* Mic2 (front panel) pin widget for input and vref at 80% */
5571 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5572 /* Line In pin widget for input */
5573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5574 /* Line-2 pin widget for output */
5575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5576 /* CD pin widget for input */
5577 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5578 /* unmute amp left and right */
5579 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5580 /* set connection select to line in (default select for this ADC) */
5581 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5582 /* unmute Line-Out mixer amp left and right (volume = 0) */
5583 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5584 /* mute pin widget amp left and right (no gain on this amp) */
5585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5586 /* unmute HP mixer amp left and right (volume = 0) */
5587 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5588 /* mute pin widget amp left and right (no gain on this amp) */
5589 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5590 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5593 /* mute analog inputs */
5594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5599 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5600 /* Unmute Front out path */
5601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5603 /* Unmute Headphone out path */
5604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5606 /* Unmute Mono out path */
5607 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5608 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5613 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5614 /* Line out and output */
5615 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5617 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5618 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5620 /* Mic2 (front panel) pin widget for input and vref at 80% */
5621 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5622 /* Line In pin widget for input */
5623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5624 /* Headphone pin widget for output */
5625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5626 /* CD pin widget for input */
5627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5628 /* unmute amp left and right */
5629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5630 /* set connection select to line in (default select for this ADC) */
5631 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5632 /* unmute Line-Out mixer amp left and right (volume = 0) */
5633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5634 /* mute pin widget amp left and right (no gain on this amp) */
5635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5636 /* unmute HP mixer amp left and right (volume = 0) */
5637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5638 /* mute pin widget amp left and right (no gain on this amp) */
5639 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5640 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5643 /* mute analog inputs */
5644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5649 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5650 /* Unmute Front out path */
5651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5653 /* Unmute Headphone out path */
5654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5656 /* Unmute Mono out path */
5657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5658 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5662 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5663 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5664 * audio = 0x16, internal speaker = 0x10.
5666 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5667 /* Disable all GPIOs */
5668 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5669 /* Internal speaker is connected to headphone pin */
5670 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5671 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5673 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5674 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5675 /* Ensure all other unused pins are disabled and muted. */
5676 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5678 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5679 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5680 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5681 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 /* Disable digital (SPDIF) pins */
5686 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5687 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5689 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5690 * when acting as an output.
5692 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5694 /* Start with output sum widgets muted and their output gains at min */
5695 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5696 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5698 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5701 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5705 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5706 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5707 /* Unmute Line1 pin widget output buffer since it starts as an output.
5708 * If the pin mode is changed by the user the pin mode control will
5709 * take care of enabling the pin's input/output buffers as needed.
5710 * Therefore there's no need to enable the input buffer at this
5713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5714 /* Unmute input buffer of pin widget used for Line-in (no equiv
5717 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5719 /* Mute capture amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 /* Set ADC connection select to match default mixer setting - line
5724 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5726 /* Do the same for the second ADC: mute capture input amp and
5727 * set ADC connection to line in (on mic1 pin)
5729 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5730 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 /* Mute all inputs to mixer widget (even unconnected ones) */
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5745 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5746 * similar laptops (adapted from Fujitsu init verbs).
5748 static struct hda_verb alc260_acer_init_verbs[] = {
5749 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5750 * the headphone jack. Turn this on and rely on the standard mute
5751 * methods whenever the user wants to turn these outputs off.
5753 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5754 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5755 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5756 /* Internal speaker/Headphone jack is connected to Line-out pin */
5757 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5758 /* Internal microphone/Mic jack is connected to Mic1 pin */
5759 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5760 /* Line In jack is connected to Line1 pin */
5761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5762 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5763 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5764 /* Ensure all other unused pins are disabled and muted. */
5765 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5766 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5768 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 /* Disable digital (SPDIF) pins */
5772 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5773 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5775 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5776 * bus when acting as outputs.
5778 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5779 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5781 /* Start with output sum widgets muted and their output gains at min */
5782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5788 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5792 /* Unmute Line-out pin widget amp left and right
5793 * (no equiv mixer ctrl)
5795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5796 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5797 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5798 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5799 * inputs. If the pin mode is changed by the user the pin mode control
5800 * will take care of enabling the pin's input/output buffers as needed.
5801 * Therefore there's no need to enable the input buffer at this
5804 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5807 /* Mute capture amp left and right */
5808 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 /* Set ADC connection select to match default mixer setting - mic
5812 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5814 /* Do similar with the second ADC: mute capture input amp and
5815 * set ADC connection to mic to match ALSA's default state.
5817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5818 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5820 /* Mute all inputs to mixer widget (even unconnected ones) */
5821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5833 /* Initialisation sequence for Maxdata Favorit 100XS
5834 * (adapted from Acer init verbs).
5836 static struct hda_verb alc260_favorit100_init_verbs[] = {
5837 /* GPIO 0 enables the output jack.
5838 * Turn this on and rely on the standard mute
5839 * methods whenever the user wants to turn these outputs off.
5841 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5842 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5843 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5844 /* Line/Mic input jack is connected to Mic1 pin */
5845 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5846 /* Ensure all other unused pins are disabled and muted. */
5847 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5848 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5849 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5850 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5851 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5852 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5857 /* Disable digital (SPDIF) pins */
5858 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5859 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5861 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5862 * bus when acting as outputs.
5864 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5865 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5867 /* Start with output sum widgets muted and their output gains at min */
5868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5873 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5874 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5876 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5878 /* Unmute Line-out pin widget amp left and right
5879 * (no equiv mixer ctrl)
5881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5882 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5883 * inputs. If the pin mode is changed by the user the pin mode control
5884 * will take care of enabling the pin's input/output buffers as needed.
5885 * Therefore there's no need to enable the input buffer at this
5888 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5890 /* Mute capture amp left and right */
5891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5892 /* Set ADC connection select to match default mixer setting - mic
5895 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5897 /* Do similar with the second ADC: mute capture input amp and
5898 * set ADC connection to mic to match ALSA's default state.
5900 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5901 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5903 /* Mute all inputs to mixer widget (even unconnected ones) */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5916 static struct hda_verb alc260_will_verbs[] = {
5917 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5918 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5919 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5920 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5921 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5922 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5926 static struct hda_verb alc260_replacer_672v_verbs[] = {
5927 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5928 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5929 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5931 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5932 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5933 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5935 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5939 /* toggle speaker-output according to the hp-jack state */
5940 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5942 unsigned int present;
5944 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5945 present = snd_hda_jack_detect(codec, 0x0f);
5947 snd_hda_codec_write_cache(codec, 0x01, 0,
5948 AC_VERB_SET_GPIO_DATA, 1);
5949 snd_hda_codec_write_cache(codec, 0x0f, 0,
5950 AC_VERB_SET_PIN_WIDGET_CONTROL,
5953 snd_hda_codec_write_cache(codec, 0x01, 0,
5954 AC_VERB_SET_GPIO_DATA, 0);
5955 snd_hda_codec_write_cache(codec, 0x0f, 0,
5956 AC_VERB_SET_PIN_WIDGET_CONTROL,
5961 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5964 if ((res >> 26) == ALC880_HP_EVENT)
5965 alc260_replacer_672v_automute(codec);
5968 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5969 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5971 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5972 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5973 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5975 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5976 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5977 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5982 /* Test configuration for debugging, modelled after the ALC880 test
5985 #ifdef CONFIG_SND_DEBUG
5986 static hda_nid_t alc260_test_dac_nids[1] = {
5989 static hda_nid_t alc260_test_adc_nids[2] = {
5992 /* For testing the ALC260, each input MUX needs its own definition since
5993 * the signal assignments are different. This assumes that the first ADC
5996 static struct hda_input_mux alc260_test_capture_sources[2] = {
6000 { "MIC1 pin", 0x0 },
6001 { "MIC2 pin", 0x1 },
6002 { "LINE1 pin", 0x2 },
6003 { "LINE2 pin", 0x3 },
6005 { "LINE-OUT pin", 0x5 },
6006 { "HP-OUT pin", 0x6 },
6012 { "MIC1 pin", 0x0 },
6013 { "MIC2 pin", 0x1 },
6014 { "LINE1 pin", 0x2 },
6015 { "LINE2 pin", 0x3 },
6018 { "LINE-OUT pin", 0x6 },
6019 { "HP-OUT pin", 0x7 },
6023 static struct snd_kcontrol_new alc260_test_mixer[] = {
6024 /* Output driver widgets */
6025 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6026 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6027 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6028 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6029 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6030 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6032 /* Modes for retasking pin widgets
6033 * Note: the ALC260 doesn't seem to act on requests to enable mic
6034 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6035 * mention this restriction. At this stage it's not clear whether
6036 * this behaviour is intentional or is a hardware bug in chip
6037 * revisions available at least up until early 2006. Therefore for
6038 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6039 * choices, but if it turns out that the lack of mic bias for these
6040 * NIDs is intentional we could change their modes from
6041 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6043 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6044 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6045 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6046 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6047 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6048 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6050 /* Loopback mixer controls */
6051 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6052 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6053 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6054 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6055 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6056 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6057 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6058 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6059 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6060 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6061 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6062 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6063 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6064 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6066 /* Controls for GPIO pins, assuming they are configured as outputs */
6067 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6068 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6069 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6070 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6072 /* Switches to allow the digital IO pins to be enabled. The datasheet
6073 * is ambigious as to which NID is which; testing on laptops which
6074 * make this output available should provide clarification.
6076 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6077 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6079 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6080 * this output to turn on an external amplifier.
6082 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6083 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6087 static struct hda_verb alc260_test_init_verbs[] = {
6088 /* Enable all GPIOs as outputs with an initial value of 0 */
6089 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6090 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6091 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6093 /* Enable retasking pins as output, initially without power amp */
6094 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6095 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6098 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6101 /* Disable digital (SPDIF) pins initially, but users can enable
6102 * them via a mixer switch. In the case of SPDIF-out, this initverb
6103 * payload also sets the generation to 0, output to be in "consumer"
6104 * PCM format, copyright asserted, no pre-emphasis and no validity
6107 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6108 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6110 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6111 * OUT1 sum bus when acting as an output.
6113 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6114 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6115 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6116 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6118 /* Start with output sum widgets muted and their output gains at min */
6119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6122 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6126 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6127 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6129 /* Unmute retasking pin widget output buffers since the default
6130 * state appears to be output. As the pin mode is changed by the
6131 * user the pin mode control will take care of enabling the pin's
6132 * input/output buffers as needed.
6134 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6135 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6138 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6139 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6140 /* Also unmute the mono-out pin widget */
6141 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6143 /* Mute capture amp left and right */
6144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6145 /* Set ADC connection select to match default mixer setting (mic1
6148 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6150 /* Do the same for the second ADC: mute capture input amp and
6151 * set ADC connection to mic1 pin
6153 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6154 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6156 /* Mute all inputs to mixer widget (even unconnected ones) */
6157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6170 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6171 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6173 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6174 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6177 * for BIOS auto-configuration
6180 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6181 const char *pfx, int *vol_bits)
6184 unsigned long vol_val, sw_val;
6187 if (nid >= 0x0f && nid < 0x11) {
6188 nid_vol = nid - 0x7;
6189 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6190 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6191 } else if (nid == 0x11) {
6192 nid_vol = nid - 0x7;
6193 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6194 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6195 } else if (nid >= 0x12 && nid <= 0x15) {
6197 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6198 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6202 if (!(*vol_bits & (1 << nid_vol))) {
6203 /* first control for the volume widget */
6204 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6207 *vol_bits |= (1 << nid_vol);
6209 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6215 /* add playback controls from the parsed DAC table */
6216 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6217 const struct auto_pin_cfg *cfg)
6223 spec->multiout.num_dacs = 1;
6224 spec->multiout.dac_nids = spec->private_dac_nids;
6225 spec->multiout.dac_nids[0] = 0x02;
6227 nid = cfg->line_out_pins[0];
6230 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6232 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6236 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6241 nid = cfg->speaker_pins[0];
6243 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6248 nid = cfg->hp_pins[0];
6250 err = alc260_add_playback_controls(spec, nid, "Headphone",
6258 /* create playback/capture controls for input pins */
6259 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6260 const struct auto_pin_cfg *cfg)
6262 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6265 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6266 hda_nid_t nid, int pin_type,
6269 alc_set_pin_output(codec, nid, pin_type);
6270 /* need the manual connection? */
6272 int idx = nid - 0x12;
6273 snd_hda_codec_write(codec, idx + 0x0b, 0,
6274 AC_VERB_SET_CONNECT_SEL, sel_idx);
6278 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6280 struct alc_spec *spec = codec->spec;
6283 nid = spec->autocfg.line_out_pins[0];
6285 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6286 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6289 nid = spec->autocfg.speaker_pins[0];
6291 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6293 nid = spec->autocfg.hp_pins[0];
6295 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6298 #define ALC260_PIN_CD_NID 0x16
6299 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6301 struct alc_spec *spec = codec->spec;
6304 for (i = 0; i < AUTO_PIN_LAST; i++) {
6305 hda_nid_t nid = spec->autocfg.input_pins[i];
6307 alc_set_input_pin(codec, nid, i);
6308 if (nid != ALC260_PIN_CD_NID &&
6309 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6310 snd_hda_codec_write(codec, nid, 0,
6311 AC_VERB_SET_AMP_GAIN_MUTE,
6318 * generic initialization of ADC, input mixers and output mixers
6320 static struct hda_verb alc260_volume_init_verbs[] = {
6322 * Unmute ADC0-1 and set the default input to mic-in
6324 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6325 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6326 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6329 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6331 * Note: PASD motherboards uses the Line In 2 as the input for
6332 * front panel mic (mic 2)
6334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6335 /* mute analog inputs */
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6343 * Set up output mixers (0x08 - 0x0a)
6345 /* set vol=0 to output mixers */
6346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6347 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6348 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6349 /* set up input amps for analog loopback */
6350 /* Amp Indices: DAC = 0, mixer = 1 */
6351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6353 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6354 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6355 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6356 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6361 static int alc260_parse_auto_config(struct hda_codec *codec)
6363 struct alc_spec *spec = codec->spec;
6365 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6367 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6371 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6374 if (!spec->kctls.list)
6375 return 0; /* can't find valid BIOS pin config */
6376 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6380 spec->multiout.max_channels = 2;
6382 if (spec->autocfg.dig_outs)
6383 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6384 if (spec->kctls.list)
6385 add_mixer(spec, spec->kctls.list);
6387 add_verb(spec, alc260_volume_init_verbs);
6389 spec->num_mux_defs = 1;
6390 spec->input_mux = &spec->private_imux[0];
6392 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6397 /* additional initialization for auto-configuration model */
6398 static void alc260_auto_init(struct hda_codec *codec)
6400 struct alc_spec *spec = codec->spec;
6401 alc260_auto_init_multi_out(codec);
6402 alc260_auto_init_analog_input(codec);
6403 if (spec->unsol_event)
6404 alc_inithook(codec);
6407 #ifdef CONFIG_SND_HDA_POWER_SAVE
6408 static struct hda_amp_list alc260_loopbacks[] = {
6409 { 0x07, HDA_INPUT, 0 },
6410 { 0x07, HDA_INPUT, 1 },
6411 { 0x07, HDA_INPUT, 2 },
6412 { 0x07, HDA_INPUT, 3 },
6413 { 0x07, HDA_INPUT, 4 },
6419 * ALC260 configurations
6421 static const char *alc260_models[ALC260_MODEL_LAST] = {
6422 [ALC260_BASIC] = "basic",
6424 [ALC260_HP_3013] = "hp-3013",
6425 [ALC260_HP_DC7600] = "hp-dc7600",
6426 [ALC260_FUJITSU_S702X] = "fujitsu",
6427 [ALC260_ACER] = "acer",
6428 [ALC260_WILL] = "will",
6429 [ALC260_REPLACER_672V] = "replacer",
6430 [ALC260_FAVORIT100] = "favorit100",
6431 #ifdef CONFIG_SND_DEBUG
6432 [ALC260_TEST] = "test",
6434 [ALC260_AUTO] = "auto",
6437 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6438 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6439 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6440 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6441 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6442 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6443 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6444 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6445 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6446 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6447 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6448 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6449 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6450 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6451 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6452 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6453 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6454 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6455 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6456 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6457 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6461 static struct alc_config_preset alc260_presets[] = {
6463 .mixers = { alc260_base_output_mixer,
6464 alc260_input_mixer },
6465 .init_verbs = { alc260_init_verbs },
6466 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6467 .dac_nids = alc260_dac_nids,
6468 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6469 .adc_nids = alc260_adc_nids,
6470 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6471 .channel_mode = alc260_modes,
6472 .input_mux = &alc260_capture_source,
6475 .mixers = { alc260_hp_output_mixer,
6476 alc260_input_mixer },
6477 .init_verbs = { alc260_init_verbs,
6478 alc260_hp_unsol_verbs },
6479 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6480 .dac_nids = alc260_dac_nids,
6481 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6482 .adc_nids = alc260_adc_nids_alt,
6483 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6484 .channel_mode = alc260_modes,
6485 .input_mux = &alc260_capture_source,
6486 .unsol_event = alc260_hp_unsol_event,
6487 .init_hook = alc260_hp_automute,
6489 [ALC260_HP_DC7600] = {
6490 .mixers = { alc260_hp_dc7600_mixer,
6491 alc260_input_mixer },
6492 .init_verbs = { alc260_init_verbs,
6493 alc260_hp_dc7600_verbs },
6494 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6495 .dac_nids = alc260_dac_nids,
6496 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6497 .adc_nids = alc260_adc_nids_alt,
6498 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6499 .channel_mode = alc260_modes,
6500 .input_mux = &alc260_capture_source,
6501 .unsol_event = alc260_hp_3012_unsol_event,
6502 .init_hook = alc260_hp_3012_automute,
6504 [ALC260_HP_3013] = {
6505 .mixers = { alc260_hp_3013_mixer,
6506 alc260_input_mixer },
6507 .init_verbs = { alc260_hp_3013_init_verbs,
6508 alc260_hp_3013_unsol_verbs },
6509 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6510 .dac_nids = alc260_dac_nids,
6511 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6512 .adc_nids = alc260_adc_nids_alt,
6513 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6514 .channel_mode = alc260_modes,
6515 .input_mux = &alc260_capture_source,
6516 .unsol_event = alc260_hp_3013_unsol_event,
6517 .init_hook = alc260_hp_3013_automute,
6519 [ALC260_FUJITSU_S702X] = {
6520 .mixers = { alc260_fujitsu_mixer },
6521 .init_verbs = { alc260_fujitsu_init_verbs },
6522 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6523 .dac_nids = alc260_dac_nids,
6524 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6525 .adc_nids = alc260_dual_adc_nids,
6526 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6527 .channel_mode = alc260_modes,
6528 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6529 .input_mux = alc260_fujitsu_capture_sources,
6532 .mixers = { alc260_acer_mixer },
6533 .init_verbs = { alc260_acer_init_verbs },
6534 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6535 .dac_nids = alc260_dac_nids,
6536 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6537 .adc_nids = alc260_dual_adc_nids,
6538 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6539 .channel_mode = alc260_modes,
6540 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6541 .input_mux = alc260_acer_capture_sources,
6543 [ALC260_FAVORIT100] = {
6544 .mixers = { alc260_favorit100_mixer },
6545 .init_verbs = { alc260_favorit100_init_verbs },
6546 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6547 .dac_nids = alc260_dac_nids,
6548 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6549 .adc_nids = alc260_dual_adc_nids,
6550 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6551 .channel_mode = alc260_modes,
6552 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6553 .input_mux = alc260_favorit100_capture_sources,
6556 .mixers = { alc260_will_mixer },
6557 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6558 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6559 .dac_nids = alc260_dac_nids,
6560 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6561 .adc_nids = alc260_adc_nids,
6562 .dig_out_nid = ALC260_DIGOUT_NID,
6563 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6564 .channel_mode = alc260_modes,
6565 .input_mux = &alc260_capture_source,
6567 [ALC260_REPLACER_672V] = {
6568 .mixers = { alc260_replacer_672v_mixer },
6569 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6570 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6571 .dac_nids = alc260_dac_nids,
6572 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6573 .adc_nids = alc260_adc_nids,
6574 .dig_out_nid = ALC260_DIGOUT_NID,
6575 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6576 .channel_mode = alc260_modes,
6577 .input_mux = &alc260_capture_source,
6578 .unsol_event = alc260_replacer_672v_unsol_event,
6579 .init_hook = alc260_replacer_672v_automute,
6581 #ifdef CONFIG_SND_DEBUG
6583 .mixers = { alc260_test_mixer },
6584 .init_verbs = { alc260_test_init_verbs },
6585 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6586 .dac_nids = alc260_test_dac_nids,
6587 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6588 .adc_nids = alc260_test_adc_nids,
6589 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6590 .channel_mode = alc260_modes,
6591 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6592 .input_mux = alc260_test_capture_sources,
6597 static int patch_alc260(struct hda_codec *codec)
6599 struct alc_spec *spec;
6600 int err, board_config;
6602 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6608 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6611 if (board_config < 0) {
6612 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6614 board_config = ALC260_AUTO;
6617 if (board_config == ALC260_AUTO) {
6618 /* automatic parse from the BIOS config */
6619 err = alc260_parse_auto_config(codec);
6625 "hda_codec: Cannot set up configuration "
6626 "from BIOS. Using base mode...\n");
6627 board_config = ALC260_BASIC;
6631 err = snd_hda_attach_beep_device(codec, 0x1);
6637 if (board_config != ALC260_AUTO)
6638 setup_preset(codec, &alc260_presets[board_config]);
6640 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6641 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6643 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6644 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6646 if (!spec->adc_nids && spec->input_mux) {
6647 /* check whether NID 0x04 is valid */
6648 unsigned int wcap = get_wcaps(codec, 0x04);
6649 wcap = get_wcaps_type(wcap);
6651 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6652 spec->adc_nids = alc260_adc_nids_alt;
6653 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6655 spec->adc_nids = alc260_adc_nids;
6656 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6659 set_capture_mixer(codec);
6660 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6662 spec->vmaster_nid = 0x08;
6664 codec->patch_ops = alc_patch_ops;
6665 if (board_config == ALC260_AUTO)
6666 spec->init_hook = alc260_auto_init;
6667 #ifdef CONFIG_SND_HDA_POWER_SAVE
6668 if (!spec->loopback.amplist)
6669 spec->loopback.amplist = alc260_loopbacks;
6677 * ALC882/883/885/888/889 support
6679 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6680 * configuration. Each pin widget can choose any input DACs and a mixer.
6681 * Each ADC is connected from a mixer of all inputs. This makes possible
6682 * 6-channel independent captures.
6684 * In addition, an independent DAC for the multi-playback (not used in this
6687 #define ALC882_DIGOUT_NID 0x06
6688 #define ALC882_DIGIN_NID 0x0a
6689 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6690 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6691 #define ALC1200_DIGOUT_NID 0x10
6694 static struct hda_channel_mode alc882_ch_modes[1] = {
6699 static hda_nid_t alc882_dac_nids[4] = {
6700 /* front, rear, clfe, rear_surr */
6701 0x02, 0x03, 0x04, 0x05
6703 #define alc883_dac_nids alc882_dac_nids
6706 #define alc882_adc_nids alc880_adc_nids
6707 #define alc882_adc_nids_alt alc880_adc_nids_alt
6708 #define alc883_adc_nids alc882_adc_nids_alt
6709 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6710 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6711 #define alc889_adc_nids alc880_adc_nids
6713 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6714 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6715 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6716 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6717 #define alc889_capsrc_nids alc882_capsrc_nids
6720 /* FIXME: should be a matrix-type input source selection */
6722 static struct hda_input_mux alc882_capture_source = {
6726 { "Front Mic", 0x1 },
6732 #define alc883_capture_source alc882_capture_source
6734 static struct hda_input_mux alc889_capture_source = {
6737 { "Front Mic", 0x0 },
6743 static struct hda_input_mux mb5_capture_source = {
6752 static struct hda_input_mux alc883_3stack_6ch_intel = {
6756 { "Front Mic", 0x0 },
6762 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6770 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6780 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6788 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6792 { "Front Mic", 0x1 },
6797 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6805 static struct hda_input_mux alc889A_mb31_capture_source = {
6809 /* Front Mic (0x01) unused */
6811 /* Line 2 (0x03) unused */
6812 /* CD (0x04) unused? */
6819 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6826 static struct hda_verb alc882_3ST_ch2_init[] = {
6827 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6828 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6829 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6830 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6837 static struct hda_verb alc882_3ST_ch4_init[] = {
6838 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6839 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6842 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6849 static struct hda_verb alc882_3ST_ch6_init[] = {
6850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6852 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6855 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6859 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6860 { 2, alc882_3ST_ch2_init },
6861 { 4, alc882_3ST_ch4_init },
6862 { 6, alc882_3ST_ch6_init },
6865 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6870 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6871 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6872 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6873 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6882 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6883 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6884 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6885 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6895 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6896 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6899 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6902 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6906 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6907 { 2, alc883_3ST_ch2_clevo_init },
6908 { 4, alc883_3ST_ch4_clevo_init },
6909 { 6, alc883_3ST_ch6_clevo_init },
6916 static struct hda_verb alc882_sixstack_ch6_init[] = {
6917 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6918 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6919 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6920 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6927 static struct hda_verb alc882_sixstack_ch8_init[] = {
6928 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6929 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6930 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6931 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6935 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6936 { 6, alc882_sixstack_ch6_init },
6937 { 8, alc882_sixstack_ch8_init },
6941 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6947 static struct hda_verb alc885_mbp_ch2_init[] = {
6948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6949 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6950 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6957 static struct hda_verb alc885_mbp_ch4_init[] = {
6958 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6960 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6961 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6962 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6966 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6967 { 2, alc885_mbp_ch2_init },
6968 { 4, alc885_mbp_ch4_init },
6973 * Speakers/Woofer/HP = Front
6976 static struct hda_verb alc885_mb5_ch2_init[] = {
6977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6984 * Speakers/HP = Front
6988 static struct hda_verb alc885_mb5_ch6_init[] = {
6989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6991 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6995 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6996 { 2, alc885_mb5_ch2_init },
6997 { 6, alc885_mb5_ch6_init },
7004 static struct hda_verb alc883_4ST_ch2_init[] = {
7005 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7006 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7007 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7008 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7009 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7010 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7017 static struct hda_verb alc883_4ST_ch4_init[] = {
7018 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7020 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7021 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7022 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7023 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7024 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7031 static struct hda_verb alc883_4ST_ch6_init[] = {
7032 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7033 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7034 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7036 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7037 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7038 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7039 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7046 static struct hda_verb alc883_4ST_ch8_init[] = {
7047 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7048 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7049 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7050 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7052 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7055 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7059 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7060 { 2, alc883_4ST_ch2_init },
7061 { 4, alc883_4ST_ch4_init },
7062 { 6, alc883_4ST_ch6_init },
7063 { 8, alc883_4ST_ch8_init },
7070 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7071 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7072 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7073 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7074 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7081 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7082 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7083 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7084 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7085 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7086 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7093 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7095 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7096 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7099 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7103 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7104 { 2, alc883_3ST_ch2_intel_init },
7105 { 4, alc883_3ST_ch4_intel_init },
7106 { 6, alc883_3ST_ch6_intel_init },
7112 static struct hda_verb alc889_ch2_intel_init[] = {
7113 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7114 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7115 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7116 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7117 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7118 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7125 static struct hda_verb alc889_ch6_intel_init[] = {
7126 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7127 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7128 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7129 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7138 static struct hda_verb alc889_ch8_intel_init[] = {
7139 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7140 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7141 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7142 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7143 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7144 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7145 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7149 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7150 { 2, alc889_ch2_intel_init },
7151 { 6, alc889_ch6_intel_init },
7152 { 8, alc889_ch8_intel_init },
7158 static struct hda_verb alc883_sixstack_ch6_init[] = {
7159 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7160 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7161 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7169 static struct hda_verb alc883_sixstack_ch8_init[] = {
7170 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7171 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7172 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7173 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7177 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7178 { 6, alc883_sixstack_ch6_init },
7179 { 8, alc883_sixstack_ch8_init },
7183 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7184 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7186 static struct snd_kcontrol_new alc882_base_mixer[] = {
7187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7195 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7196 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7211 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7212 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7213 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7215 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7218 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7220 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7226 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7228 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7230 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7232 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7234 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7236 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7238 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7239 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7240 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7244 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7245 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7246 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7247 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7248 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7250 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7252 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7258 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7271 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7281 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7282 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7283 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7288 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7289 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7291 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7293 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7295 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 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("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7301 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7308 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7310 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7317 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7322 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7324 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7325 .name = "Channel Mode",
7326 .info = alc_ch_mode_info,
7327 .get = alc_ch_mode_get,
7328 .put = alc_ch_mode_put,
7333 static struct hda_verb alc882_base_init_verbs[] = {
7334 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7337 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7340 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7341 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7343 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7344 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7345 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7349 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7351 /* mute analog input loopbacks */
7352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7354 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7355 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7356 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7358 /* Front Pin: output 0 (0x0c) */
7359 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7360 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7361 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7362 /* Rear Pin: output 1 (0x0d) */
7363 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7365 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7366 /* CLFE Pin: output 2 (0x0e) */
7367 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7368 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7369 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7370 /* Side Pin: output 3 (0x0f) */
7371 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7372 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7373 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7374 /* Mic (rear) pin: input vref at 80% */
7375 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7377 /* Front Mic pin: input vref at 80% */
7378 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7379 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7380 /* Line In pin: input */
7381 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7382 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7383 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7384 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7385 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7386 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7387 /* CD pin widget for input */
7388 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7390 /* FIXME: use matrix-type input source selection */
7391 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7398 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7399 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7402 /* ADC2: mute amp left and right */
7403 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7404 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7405 /* ADC3: mute amp left and right */
7406 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7412 static struct hda_verb alc882_adc1_init_verbs[] = {
7413 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7417 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7418 /* ADC1: mute amp left and right */
7419 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7420 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7424 static struct hda_verb alc882_eapd_verbs[] = {
7425 /* change to EAPD mode */
7426 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7427 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7431 static struct hda_verb alc889_eapd_verbs[] = {
7432 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7433 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7437 static struct hda_verb alc_hp15_unsol_verbs[] = {
7438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7443 static struct hda_verb alc885_init_verbs[] = {
7444 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7451 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7453 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7454 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7455 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7457 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7458 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7459 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7461 /* mute analog input loopbacks */
7462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7466 /* Front HP Pin: output 0 (0x0c) */
7467 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7469 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7470 /* Front Pin: output 0 (0x0c) */
7471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7472 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7473 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7474 /* Rear Pin: output 1 (0x0d) */
7475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7477 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7478 /* CLFE Pin: output 2 (0x0e) */
7479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7480 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7481 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7482 /* Side Pin: output 3 (0x0f) */
7483 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7484 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7485 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7486 /* Mic (rear) pin: input vref at 80% */
7487 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7488 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7489 /* Front Mic pin: input vref at 80% */
7490 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7491 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7492 /* Line In pin: input */
7493 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7494 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7496 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7502 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7509 /* ADC2: mute amp left and right */
7510 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7511 /* ADC3: mute amp left and right */
7512 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7517 static struct hda_verb alc885_init_input_verbs[] = {
7518 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7519 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7520 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7525 /* Unmute Selector 24h and set the default input to front mic */
7526 static struct hda_verb alc889_init_input_verbs[] = {
7527 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7533 #define alc883_init_verbs alc882_base_init_verbs
7536 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7537 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7538 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7539 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7540 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7541 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7542 /* FIXME: this looks suspicious...
7543 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7544 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7549 static struct hda_verb alc882_macpro_init_verbs[] = {
7550 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7551 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7554 /* Front Pin: output 0 (0x0c) */
7555 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7557 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7558 /* Front Mic pin: input vref at 80% */
7559 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7560 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7561 /* Speaker: output */
7562 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7563 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7564 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7565 /* Headphone output (output 0 - 0x0c) */
7566 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7567 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7568 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7570 /* FIXME: use matrix-type input source selection */
7571 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7572 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7578 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7579 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7580 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7581 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7583 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7584 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7585 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7586 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7587 /* ADC1: mute amp left and right */
7588 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7589 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7590 /* ADC2: mute amp left and right */
7591 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7592 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7593 /* ADC3: mute amp left and right */
7594 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7595 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7601 static struct hda_verb alc885_mb5_init_verbs[] = {
7603 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7604 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7606 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7609 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7610 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7611 /* Surround mixer */
7612 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7613 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7614 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7616 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7618 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7620 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7621 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7622 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7623 /* Front Pin (0x0c) */
7624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7626 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7627 /* LFE Pin (0x0e) */
7628 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7630 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7633 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7634 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7635 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7636 /* Front Mic pin: input vref at 80% */
7637 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7638 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7640 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7641 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7643 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7644 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7645 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7646 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7650 /* Macbook Pro rev3 */
7651 static struct hda_verb alc885_mbp3_init_verbs[] = {
7652 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7653 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7657 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7658 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7659 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7661 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7664 /* Front Pin: output 0 (0x0c) */
7665 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7666 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7667 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7668 /* HP Pin: output 0 (0x0e) */
7669 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7670 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7671 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7673 /* Mic (rear) pin: input vref at 80% */
7674 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7675 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7676 /* Front Mic pin: input vref at 80% */
7677 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7678 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7679 /* Line In pin: use output 1 when in LineOut mode */
7680 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7682 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7684 /* FIXME: use matrix-type input source selection */
7685 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7686 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7687 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7688 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7689 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7690 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7692 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7693 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7694 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7695 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7697 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7698 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7699 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7700 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7701 /* ADC1: mute amp left and right */
7702 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7703 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7704 /* ADC2: mute amp left and right */
7705 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7706 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7707 /* ADC3: mute amp left and right */
7708 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7709 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7715 static struct hda_verb alc885_imac91_init_verbs[] = {
7716 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7717 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7718 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7719 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7721 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7722 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7723 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7724 /* HP Pin: output 0 (0x0c) */
7725 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7726 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7727 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7729 /* Internal Speakers: output 0 (0x0d) */
7730 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7732 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7733 /* Mic (rear) pin: input vref at 80% */
7734 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7735 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7736 /* Front Mic pin: input vref at 80% */
7737 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7738 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7739 /* Line In pin: use output 1 when in LineOut mode */
7740 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7742 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7744 /* FIXME: use matrix-type input source selection */
7745 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7746 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7747 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7748 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7749 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7750 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7752 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7753 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7754 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7755 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7761 /* ADC1: mute amp left and right */
7762 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7763 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7764 /* ADC2: mute amp left and right */
7765 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7766 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7767 /* ADC3: mute amp left and right */
7768 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7769 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7774 /* iMac 24 mixer. */
7775 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7776 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7777 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7781 /* iMac 24 init verbs. */
7782 static struct hda_verb alc885_imac24_init_verbs[] = {
7783 /* Internal speakers: output 0 (0x0c) */
7784 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7785 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7786 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7787 /* Internal speakers: output 0 (0x0c) */
7788 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7789 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7790 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7791 /* Headphone: output 0 (0x0c) */
7792 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7793 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7794 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7795 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7796 /* Front Mic: input vref at 80% */
7797 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7798 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7802 /* Toggle speaker-output according to the hp-jack state */
7803 static void alc885_imac24_setup(struct hda_codec *codec)
7805 struct alc_spec *spec = codec->spec;
7807 spec->autocfg.hp_pins[0] = 0x14;
7808 spec->autocfg.speaker_pins[0] = 0x18;
7809 spec->autocfg.speaker_pins[1] = 0x1a;
7812 static void alc885_mbp3_setup(struct hda_codec *codec)
7814 struct alc_spec *spec = codec->spec;
7816 spec->autocfg.hp_pins[0] = 0x15;
7817 spec->autocfg.speaker_pins[0] = 0x14;
7820 static void alc885_mb5_automute(struct hda_codec *codec)
7822 unsigned int present;
7824 present = snd_hda_codec_read(codec, 0x14, 0,
7825 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7826 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7827 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7828 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7829 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7833 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7836 /* Headphone insertion or removal. */
7837 if ((res >> 26) == ALC880_HP_EVENT)
7838 alc885_mb5_automute(codec);
7841 static void alc885_imac91_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, 0x15, 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_imac91_unsol_event(struct hda_codec *codec,
7857 /* Headphone insertion or removal. */
7858 if ((res >> 26) == ALC880_HP_EVENT)
7859 alc885_imac91_automute(codec);
7862 static struct hda_verb alc882_targa_verbs[] = {
7863 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7864 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7866 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7869 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7870 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7871 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7873 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7877 /* toggle speaker-output according to the hp-jack state */
7878 static void alc882_targa_automute(struct hda_codec *codec)
7880 struct alc_spec *spec = codec->spec;
7881 alc_automute_amp(codec);
7882 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7883 spec->jack_present ? 1 : 3);
7886 static void alc882_targa_setup(struct hda_codec *codec)
7888 struct alc_spec *spec = codec->spec;
7890 spec->autocfg.hp_pins[0] = 0x14;
7891 spec->autocfg.speaker_pins[0] = 0x1b;
7894 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7896 if ((res >> 26) == ALC880_HP_EVENT)
7897 alc882_targa_automute(codec);
7900 static struct hda_verb alc882_asus_a7j_verbs[] = {
7901 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7902 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7905 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7906 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7908 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7909 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7910 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7912 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7913 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7914 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7918 static struct hda_verb alc882_asus_a7m_verbs[] = {
7919 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7920 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7922 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7923 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7924 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7926 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7927 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7928 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7930 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7931 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7932 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7936 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7938 unsigned int gpiostate, gpiomask, gpiodir;
7940 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7941 AC_VERB_GET_GPIO_DATA, 0);
7944 gpiostate |= (1 << pin);
7946 gpiostate &= ~(1 << pin);
7948 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7949 AC_VERB_GET_GPIO_MASK, 0);
7950 gpiomask |= (1 << pin);
7952 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7953 AC_VERB_GET_GPIO_DIRECTION, 0);
7954 gpiodir |= (1 << pin);
7957 snd_hda_codec_write(codec, codec->afg, 0,
7958 AC_VERB_SET_GPIO_MASK, gpiomask);
7959 snd_hda_codec_write(codec, codec->afg, 0,
7960 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7964 snd_hda_codec_write(codec, codec->afg, 0,
7965 AC_VERB_SET_GPIO_DATA, gpiostate);
7968 /* set up GPIO at initialization */
7969 static void alc885_macpro_init_hook(struct hda_codec *codec)
7971 alc882_gpio_mute(codec, 0, 0);
7972 alc882_gpio_mute(codec, 1, 0);
7975 /* set up GPIO and update auto-muting at initialization */
7976 static void alc885_imac24_init_hook(struct hda_codec *codec)
7978 alc885_macpro_init_hook(codec);
7979 alc_automute_amp(codec);
7983 * generic initialization of ADC, input mixers and output mixers
7985 static struct hda_verb alc883_auto_init_verbs[] = {
7987 * Unmute ADC0-2 and set the default input to mic-in
7989 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7990 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7991 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7992 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7994 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7996 * Note: PASD motherboards uses the Line In 2 as the input for
7997 * front panel mic (mic 2)
7999 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
8000 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8001 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8002 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8003 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8004 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8007 * Set up output mixers (0x0c - 0x0f)
8009 /* set vol=0 to output mixers */
8010 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8011 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8012 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8013 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8014 /* set up input amps for analog loopback */
8015 /* Amp Indices: DAC = 0, mixer = 1 */
8016 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8018 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8019 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8020 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8021 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8022 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8023 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8024 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8025 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8027 /* FIXME: use matrix-type input source selection */
8028 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8030 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8031 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8032 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8033 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8035 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
8036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
8037 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
8038 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
8043 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8044 static struct hda_verb alc889A_mb31_ch2_init[] = {
8045 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8046 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8047 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8048 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8052 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8053 static struct hda_verb alc889A_mb31_ch4_init[] = {
8054 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8055 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8056 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8057 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8061 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8062 static struct hda_verb alc889A_mb31_ch5_init[] = {
8063 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8064 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8066 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8070 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8071 static struct hda_verb alc889A_mb31_ch6_init[] = {
8072 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8073 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8074 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8075 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8079 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8080 { 2, alc889A_mb31_ch2_init },
8081 { 4, alc889A_mb31_ch4_init },
8082 { 5, alc889A_mb31_ch5_init },
8083 { 6, alc889A_mb31_ch6_init },
8086 static struct hda_verb alc883_medion_eapd_verbs[] = {
8087 /* eanable EAPD on medion laptop */
8088 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8089 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8093 #define alc883_base_mixer alc882_base_mixer
8095 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8098 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8099 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8100 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8102 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8105 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8107 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8108 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8112 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8114 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8115 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8116 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8117 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8122 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8126 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8127 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8128 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8130 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8132 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8134 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8135 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8136 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8140 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8141 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8142 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8144 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8145 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8146 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8147 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8150 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8152 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8153 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8157 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8166 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8167 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8168 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8170 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8176 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8180 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8183 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8184 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8185 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8187 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8188 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8189 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8191 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8192 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8199 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8204 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8215 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8218 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8228 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8230 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8232 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8233 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8234 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8235 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8236 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8238 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8239 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8247 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8251 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8252 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8253 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8256 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8257 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8258 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8259 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8260 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8261 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8262 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8263 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8272 static struct snd_kcontrol_new alc883_targa_2ch_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("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8280 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8281 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8284 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8288 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8289 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8290 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8292 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8293 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8297 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8298 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8299 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8300 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8301 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8302 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8305 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8309 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8310 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8311 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8312 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8315 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8316 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8317 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8318 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8322 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8323 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8324 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8325 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8326 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8327 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8331 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8335 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8337 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8342 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8343 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8347 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8348 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8349 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8350 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8351 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8352 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8353 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8354 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8355 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8362 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8363 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8364 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8365 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8366 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8367 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8368 0x0d, 1, 0x0, HDA_OUTPUT),
8369 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8370 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8371 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8372 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8373 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8374 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8375 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8382 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8387 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8389 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8390 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8391 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8392 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8393 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8395 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8396 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8397 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8398 /* Output switches */
8399 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8400 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8401 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8403 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8404 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8406 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8407 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8408 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8409 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8413 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8414 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8415 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8416 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8418 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8423 static struct hda_bind_ctls alc883_bind_cap_vol = {
8424 .ops = &snd_hda_bind_vol,
8426 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8427 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8432 static struct hda_bind_ctls alc883_bind_cap_switch = {
8433 .ops = &snd_hda_bind_sw,
8435 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8436 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8441 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8442 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8443 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8444 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8448 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8449 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8453 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8454 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8455 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8457 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8458 /* .name = "Capture Source", */
8459 .name = "Input Source",
8461 .info = alc_mux_enum_info,
8462 .get = alc_mux_enum_get,
8463 .put = alc_mux_enum_put,
8468 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8470 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8471 .name = "Channel Mode",
8472 .info = alc_ch_mode_info,
8473 .get = alc_ch_mode_get,
8474 .put = alc_ch_mode_put,
8479 /* toggle speaker-output according to the hp-jack state */
8480 static void alc883_mitac_setup(struct hda_codec *codec)
8482 struct alc_spec *spec = codec->spec;
8484 spec->autocfg.hp_pins[0] = 0x15;
8485 spec->autocfg.speaker_pins[0] = 0x14;
8486 spec->autocfg.speaker_pins[1] = 0x17;
8489 /* auto-toggle front mic */
8491 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8493 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8495 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8499 static struct hda_verb alc883_mitac_verbs[] = {
8501 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8502 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8504 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8505 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8507 /* enable unsolicited event */
8508 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8509 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8514 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8517 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8519 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8521 /* enable unsolicited event */
8523 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8524 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8530 static struct hda_verb alc883_clevo_m720_verbs[] = {
8532 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8533 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8535 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8536 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8538 /* enable unsolicited event */
8539 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8540 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8545 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8547 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8550 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8551 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8553 /* enable unsolicited event */
8554 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8559 static struct hda_verb alc883_targa_verbs[] = {
8560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8564 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8566 /* Connect Line-Out side jack (SPDIF) to Side */
8567 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8568 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8569 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8570 /* Connect Mic jack to CLFE */
8571 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8572 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8573 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8574 /* Connect Line-in jack to Surround */
8575 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8576 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8577 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8578 /* Connect HP out jack to Front */
8579 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8580 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8581 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8583 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8588 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8589 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8590 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8591 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8595 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8596 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8598 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8599 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8603 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8606 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8607 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8608 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8612 static struct hda_verb alc883_haier_w66_verbs[] = {
8613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8614 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8618 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8619 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8620 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8625 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8627 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8632 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8633 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8637 static struct hda_verb alc888_6st_dell_verbs[] = {
8638 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8642 static struct hda_verb alc883_vaiott_verbs[] = {
8644 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8645 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8647 /* enable unsolicited event */
8648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8653 static void alc888_3st_hp_setup(struct hda_codec *codec)
8655 struct alc_spec *spec = codec->spec;
8657 spec->autocfg.hp_pins[0] = 0x1b;
8658 spec->autocfg.speaker_pins[0] = 0x14;
8659 spec->autocfg.speaker_pins[1] = 0x16;
8660 spec->autocfg.speaker_pins[2] = 0x18;
8663 static struct hda_verb alc888_3st_hp_verbs[] = {
8664 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8665 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8666 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8667 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8674 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8675 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8676 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8677 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8678 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8685 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8686 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8687 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8688 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8689 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8690 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8697 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8698 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8699 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8700 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8701 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8702 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8703 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8707 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8708 { 2, alc888_3st_hp_2ch_init },
8709 { 4, alc888_3st_hp_4ch_init },
8710 { 6, alc888_3st_hp_6ch_init },
8713 /* toggle front-jack and RCA according to the hp-jack state */
8714 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8716 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8718 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8719 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8720 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8721 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8724 /* toggle RCA according to the front-jack state */
8725 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8727 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8729 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8730 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8733 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8736 if ((res >> 26) == ALC880_HP_EVENT)
8737 alc888_lenovo_ms7195_front_automute(codec);
8738 if ((res >> 26) == ALC880_FRONT_EVENT)
8739 alc888_lenovo_ms7195_rca_automute(codec);
8742 static struct hda_verb alc883_medion_md2_verbs[] = {
8743 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8746 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8748 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8752 /* toggle speaker-output according to the hp-jack state */
8753 static void alc883_medion_md2_setup(struct hda_codec *codec)
8755 struct alc_spec *spec = codec->spec;
8757 spec->autocfg.hp_pins[0] = 0x14;
8758 spec->autocfg.speaker_pins[0] = 0x15;
8761 /* toggle speaker-output according to the hp-jack state */
8762 #define alc883_targa_init_hook alc882_targa_init_hook
8763 #define alc883_targa_unsol_event alc882_targa_unsol_event
8765 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8767 unsigned int present;
8769 present = snd_hda_jack_detect(codec, 0x18);
8770 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8774 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8776 struct alc_spec *spec = codec->spec;
8778 spec->autocfg.hp_pins[0] = 0x15;
8779 spec->autocfg.speaker_pins[0] = 0x14;
8782 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8784 alc_automute_amp(codec);
8785 alc883_clevo_m720_mic_automute(codec);
8788 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8791 switch (res >> 26) {
8792 case ALC880_MIC_EVENT:
8793 alc883_clevo_m720_mic_automute(codec);
8796 alc_automute_amp_unsol_event(codec, res);
8801 /* toggle speaker-output according to the hp-jack state */
8802 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8804 struct alc_spec *spec = codec->spec;
8806 spec->autocfg.hp_pins[0] = 0x14;
8807 spec->autocfg.speaker_pins[0] = 0x15;
8810 static void alc883_haier_w66_setup(struct hda_codec *codec)
8812 struct alc_spec *spec = codec->spec;
8814 spec->autocfg.hp_pins[0] = 0x1b;
8815 spec->autocfg.speaker_pins[0] = 0x14;
8818 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8820 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8822 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8823 HDA_AMP_MUTE, bits);
8826 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8828 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8830 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8831 HDA_AMP_MUTE, bits);
8832 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8833 HDA_AMP_MUTE, bits);
8836 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8839 if ((res >> 26) == ALC880_HP_EVENT)
8840 alc883_lenovo_101e_all_automute(codec);
8841 if ((res >> 26) == ALC880_FRONT_EVENT)
8842 alc883_lenovo_101e_ispeaker_automute(codec);
8845 /* toggle speaker-output according to the hp-jack state */
8846 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8848 struct alc_spec *spec = codec->spec;
8850 spec->autocfg.hp_pins[0] = 0x14;
8851 spec->autocfg.speaker_pins[0] = 0x15;
8852 spec->autocfg.speaker_pins[1] = 0x16;
8855 static struct hda_verb alc883_acer_eapd_verbs[] = {
8856 /* HP Pin: output 0 (0x0c) */
8857 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8858 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8859 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8860 /* Front Pin: output 0 (0x0c) */
8861 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8862 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8863 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8864 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8865 /* eanable EAPD on medion laptop */
8866 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8867 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8868 /* enable unsolicited event */
8869 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8873 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8874 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8875 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8876 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8880 static void alc888_6st_dell_setup(struct hda_codec *codec)
8882 struct alc_spec *spec = codec->spec;
8884 spec->autocfg.hp_pins[0] = 0x1b;
8885 spec->autocfg.speaker_pins[0] = 0x14;
8886 spec->autocfg.speaker_pins[1] = 0x15;
8887 spec->autocfg.speaker_pins[2] = 0x16;
8888 spec->autocfg.speaker_pins[3] = 0x17;
8891 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8893 struct alc_spec *spec = codec->spec;
8895 spec->autocfg.hp_pins[0] = 0x1b;
8896 spec->autocfg.speaker_pins[0] = 0x14;
8897 spec->autocfg.speaker_pins[1] = 0x15;
8898 spec->autocfg.speaker_pins[2] = 0x16;
8899 spec->autocfg.speaker_pins[3] = 0x17;
8900 spec->autocfg.speaker_pins[4] = 0x1a;
8903 static void alc883_vaiott_setup(struct hda_codec *codec)
8905 struct alc_spec *spec = codec->spec;
8907 spec->autocfg.hp_pins[0] = 0x15;
8908 spec->autocfg.speaker_pins[0] = 0x14;
8909 spec->autocfg.speaker_pins[1] = 0x17;
8912 static struct hda_verb alc888_asus_m90v_verbs[] = {
8913 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8914 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8915 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8916 /* enable unsolicited event */
8917 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8918 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8922 static void alc883_mode2_setup(struct hda_codec *codec)
8924 struct alc_spec *spec = codec->spec;
8926 spec->autocfg.hp_pins[0] = 0x1b;
8927 spec->autocfg.speaker_pins[0] = 0x14;
8928 spec->autocfg.speaker_pins[1] = 0x15;
8929 spec->autocfg.speaker_pins[2] = 0x16;
8930 spec->ext_mic.pin = 0x18;
8931 spec->int_mic.pin = 0x19;
8932 spec->ext_mic.mux_idx = 0;
8933 spec->int_mic.mux_idx = 1;
8937 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8938 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8939 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8940 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8941 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8942 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8943 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8944 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8945 /* enable unsolicited event */
8946 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8950 static void alc883_eee1601_inithook(struct hda_codec *codec)
8952 struct alc_spec *spec = codec->spec;
8954 spec->autocfg.hp_pins[0] = 0x14;
8955 spec->autocfg.speaker_pins[0] = 0x1b;
8956 alc_automute_pin(codec);
8959 static struct hda_verb alc889A_mb31_verbs[] = {
8960 /* Init rear pin (used as headphone output) */
8961 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8962 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8963 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8964 /* Init line pin (used as output in 4ch and 6ch mode) */
8965 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8966 /* Init line 2 pin (used as headphone out by default) */
8967 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8968 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8972 /* Mute speakers according to the headphone jack state */
8973 static void alc889A_mb31_automute(struct hda_codec *codec)
8975 unsigned int present;
8977 /* Mute only in 2ch or 4ch mode */
8978 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8980 present = snd_hda_jack_detect(codec, 0x15);
8981 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8982 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8983 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8984 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8988 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8990 if ((res >> 26) == ALC880_HP_EVENT)
8991 alc889A_mb31_automute(codec);
8995 #ifdef CONFIG_SND_HDA_POWER_SAVE
8996 #define alc882_loopbacks alc880_loopbacks
8999 /* pcm configuration: identical with ALC880 */
9000 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9001 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9002 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9003 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9005 static hda_nid_t alc883_slave_dig_outs[] = {
9006 ALC1200_DIGOUT_NID, 0,
9009 static hda_nid_t alc1200_slave_dig_outs[] = {
9010 ALC883_DIGOUT_NID, 0,
9014 * configuration and preset
9016 static const char *alc882_models[ALC882_MODEL_LAST] = {
9017 [ALC882_3ST_DIG] = "3stack-dig",
9018 [ALC882_6ST_DIG] = "6stack-dig",
9019 [ALC882_ARIMA] = "arima",
9020 [ALC882_W2JC] = "w2jc",
9021 [ALC882_TARGA] = "targa",
9022 [ALC882_ASUS_A7J] = "asus-a7j",
9023 [ALC882_ASUS_A7M] = "asus-a7m",
9024 [ALC885_MACPRO] = "macpro",
9025 [ALC885_MB5] = "mb5",
9026 [ALC885_MBP3] = "mbp3",
9027 [ALC885_IMAC24] = "imac24",
9028 [ALC885_IMAC91] = "imac91",
9029 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9030 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9031 [ALC883_3ST_6ch] = "3stack-6ch",
9032 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9033 [ALC883_TARGA_DIG] = "targa-dig",
9034 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9035 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9036 [ALC883_ACER] = "acer",
9037 [ALC883_ACER_ASPIRE] = "acer-aspire",
9038 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9039 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9040 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9041 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9042 [ALC883_MEDION] = "medion",
9043 [ALC883_MEDION_MD2] = "medion-md2",
9044 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9045 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9046 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9047 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9048 [ALC888_LENOVO_SKY] = "lenovo-sky",
9049 [ALC883_HAIER_W66] = "haier-w66",
9050 [ALC888_3ST_HP] = "3stack-hp",
9051 [ALC888_6ST_DELL] = "6stack-dell",
9052 [ALC883_MITAC] = "mitac",
9053 [ALC883_CLEVO_M540R] = "clevo-m540r",
9054 [ALC883_CLEVO_M720] = "clevo-m720",
9055 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9056 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9057 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9058 [ALC889A_INTEL] = "intel-alc889a",
9059 [ALC889_INTEL] = "intel-x58",
9060 [ALC1200_ASUS_P5Q] = "asus-p5q",
9061 [ALC889A_MB31] = "mb31",
9062 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9063 [ALC882_AUTO] = "auto",
9066 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9067 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9069 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9070 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9071 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9072 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9073 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9074 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9075 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9076 ALC888_ACER_ASPIRE_4930G),
9077 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9078 ALC888_ACER_ASPIRE_4930G),
9079 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9080 ALC888_ACER_ASPIRE_8930G),
9081 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9082 ALC888_ACER_ASPIRE_8930G),
9083 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9084 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9085 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9086 ALC888_ACER_ASPIRE_6530G),
9087 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9088 ALC888_ACER_ASPIRE_6530G),
9089 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9090 ALC888_ACER_ASPIRE_7730G),
9091 /* default Acer -- disabled as it causes more problems.
9092 * model=auto should work fine now
9094 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9096 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9098 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9099 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9100 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9101 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9102 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9103 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9105 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9106 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9107 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9108 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9109 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9110 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9111 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9112 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9113 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9114 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9115 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9117 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9118 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9119 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9120 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9121 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9122 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9123 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9124 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9125 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9127 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9128 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9129 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9130 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9131 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9132 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9133 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9134 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9135 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9136 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9137 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9138 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9139 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9140 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9141 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9142 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9143 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9144 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9145 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9146 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9147 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9148 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9149 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9150 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9151 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9152 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9153 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9154 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9155 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9157 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9158 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9159 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9160 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9161 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9162 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9163 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9164 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9165 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9166 ALC883_FUJITSU_PI2515),
9167 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9168 ALC888_FUJITSU_XA3530),
9169 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9170 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9171 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9172 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9173 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9174 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9175 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9176 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9177 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9179 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9180 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9181 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9182 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9183 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9184 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9185 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9190 /* codec SSID table for Intel Mac */
9191 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9192 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9193 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9194 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9195 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9196 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9197 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9198 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9199 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9200 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9201 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9202 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9203 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9204 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9205 * so apparently no perfect solution yet
9207 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9208 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9212 static struct alc_config_preset alc882_presets[] = {
9213 [ALC882_3ST_DIG] = {
9214 .mixers = { alc882_base_mixer },
9215 .init_verbs = { alc882_base_init_verbs,
9216 alc882_adc1_init_verbs },
9217 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9218 .dac_nids = alc882_dac_nids,
9219 .dig_out_nid = ALC882_DIGOUT_NID,
9220 .dig_in_nid = ALC882_DIGIN_NID,
9221 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9222 .channel_mode = alc882_ch_modes,
9224 .input_mux = &alc882_capture_source,
9226 [ALC882_6ST_DIG] = {
9227 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9228 .init_verbs = { alc882_base_init_verbs,
9229 alc882_adc1_init_verbs },
9230 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9231 .dac_nids = alc882_dac_nids,
9232 .dig_out_nid = ALC882_DIGOUT_NID,
9233 .dig_in_nid = ALC882_DIGIN_NID,
9234 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9235 .channel_mode = alc882_sixstack_modes,
9236 .input_mux = &alc882_capture_source,
9239 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9240 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9241 alc882_eapd_verbs },
9242 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9243 .dac_nids = alc882_dac_nids,
9244 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9245 .channel_mode = alc882_sixstack_modes,
9246 .input_mux = &alc882_capture_source,
9249 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9250 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9251 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9252 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9253 .dac_nids = alc882_dac_nids,
9254 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9255 .channel_mode = alc880_threestack_modes,
9257 .input_mux = &alc882_capture_source,
9258 .dig_out_nid = ALC882_DIGOUT_NID,
9261 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9262 .init_verbs = { alc885_mbp3_init_verbs,
9263 alc880_gpio1_init_verbs },
9265 .dac_nids = alc882_dac_nids,
9267 .channel_mode = alc885_mbp_4ch_modes,
9268 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9269 .input_mux = &alc882_capture_source,
9270 .dig_out_nid = ALC882_DIGOUT_NID,
9271 .dig_in_nid = ALC882_DIGIN_NID,
9272 .unsol_event = alc_automute_amp_unsol_event,
9273 .setup = alc885_mbp3_setup,
9274 .init_hook = alc_automute_amp,
9277 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9278 .init_verbs = { alc885_mb5_init_verbs,
9279 alc880_gpio1_init_verbs },
9280 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9281 .dac_nids = alc882_dac_nids,
9282 .channel_mode = alc885_mb5_6ch_modes,
9283 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9284 .input_mux = &mb5_capture_source,
9285 .dig_out_nid = ALC882_DIGOUT_NID,
9286 .dig_in_nid = ALC882_DIGIN_NID,
9287 .unsol_event = alc885_mb5_unsol_event,
9288 .init_hook = alc885_mb5_automute,
9291 .mixers = { alc882_macpro_mixer },
9292 .init_verbs = { alc882_macpro_init_verbs },
9293 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9294 .dac_nids = alc882_dac_nids,
9295 .dig_out_nid = ALC882_DIGOUT_NID,
9296 .dig_in_nid = ALC882_DIGIN_NID,
9297 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9298 .channel_mode = alc882_ch_modes,
9299 .input_mux = &alc882_capture_source,
9300 .init_hook = alc885_macpro_init_hook,
9303 .mixers = { alc885_imac24_mixer },
9304 .init_verbs = { alc885_imac24_init_verbs },
9305 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9306 .dac_nids = alc882_dac_nids,
9307 .dig_out_nid = ALC882_DIGOUT_NID,
9308 .dig_in_nid = ALC882_DIGIN_NID,
9309 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9310 .channel_mode = alc882_ch_modes,
9311 .input_mux = &alc882_capture_source,
9312 .unsol_event = alc_automute_amp_unsol_event,
9313 .setup = alc885_imac24_setup,
9314 .init_hook = alc885_imac24_init_hook,
9317 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9318 .init_verbs = { alc885_imac91_init_verbs,
9319 alc880_gpio1_init_verbs },
9320 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9321 .dac_nids = alc882_dac_nids,
9322 .channel_mode = alc885_mbp_4ch_modes,
9323 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9324 .input_mux = &alc882_capture_source,
9325 .dig_out_nid = ALC882_DIGOUT_NID,
9326 .dig_in_nid = ALC882_DIGIN_NID,
9327 .unsol_event = alc885_imac91_unsol_event,
9328 .init_hook = alc885_imac91_automute,
9331 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9332 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9333 alc880_gpio3_init_verbs, alc882_targa_verbs},
9334 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9335 .dac_nids = alc882_dac_nids,
9336 .dig_out_nid = ALC882_DIGOUT_NID,
9337 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9338 .adc_nids = alc882_adc_nids,
9339 .capsrc_nids = alc882_capsrc_nids,
9340 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9341 .channel_mode = alc882_3ST_6ch_modes,
9343 .input_mux = &alc882_capture_source,
9344 .unsol_event = alc882_targa_unsol_event,
9345 .setup = alc882_targa_setup,
9346 .init_hook = alc882_targa_automute,
9348 [ALC882_ASUS_A7J] = {
9349 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9350 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9351 alc882_asus_a7j_verbs},
9352 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9353 .dac_nids = alc882_dac_nids,
9354 .dig_out_nid = ALC882_DIGOUT_NID,
9355 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9356 .adc_nids = alc882_adc_nids,
9357 .capsrc_nids = alc882_capsrc_nids,
9358 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9359 .channel_mode = alc882_3ST_6ch_modes,
9361 .input_mux = &alc882_capture_source,
9363 [ALC882_ASUS_A7M] = {
9364 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9365 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9366 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9367 alc882_asus_a7m_verbs },
9368 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9369 .dac_nids = alc882_dac_nids,
9370 .dig_out_nid = ALC882_DIGOUT_NID,
9371 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9372 .channel_mode = alc880_threestack_modes,
9374 .input_mux = &alc882_capture_source,
9376 [ALC883_3ST_2ch_DIG] = {
9377 .mixers = { alc883_3ST_2ch_mixer },
9378 .init_verbs = { alc883_init_verbs },
9379 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9380 .dac_nids = alc883_dac_nids,
9381 .dig_out_nid = ALC883_DIGOUT_NID,
9382 .dig_in_nid = ALC883_DIGIN_NID,
9383 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9384 .channel_mode = alc883_3ST_2ch_modes,
9385 .input_mux = &alc883_capture_source,
9387 [ALC883_3ST_6ch_DIG] = {
9388 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9389 .init_verbs = { alc883_init_verbs },
9390 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9391 .dac_nids = alc883_dac_nids,
9392 .dig_out_nid = ALC883_DIGOUT_NID,
9393 .dig_in_nid = ALC883_DIGIN_NID,
9394 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9395 .channel_mode = alc883_3ST_6ch_modes,
9397 .input_mux = &alc883_capture_source,
9399 [ALC883_3ST_6ch] = {
9400 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs },
9402 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9403 .dac_nids = alc883_dac_nids,
9404 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9405 .channel_mode = alc883_3ST_6ch_modes,
9407 .input_mux = &alc883_capture_source,
9409 [ALC883_3ST_6ch_INTEL] = {
9410 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9411 .init_verbs = { alc883_init_verbs },
9412 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9413 .dac_nids = alc883_dac_nids,
9414 .dig_out_nid = ALC883_DIGOUT_NID,
9415 .dig_in_nid = ALC883_DIGIN_NID,
9416 .slave_dig_outs = alc883_slave_dig_outs,
9417 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9418 .channel_mode = alc883_3ST_6ch_intel_modes,
9420 .input_mux = &alc883_3stack_6ch_intel,
9423 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9424 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9425 alc_hp15_unsol_verbs },
9426 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9427 .dac_nids = alc883_dac_nids,
9428 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9429 .adc_nids = alc889_adc_nids,
9430 .dig_out_nid = ALC883_DIGOUT_NID,
9431 .dig_in_nid = ALC883_DIGIN_NID,
9432 .slave_dig_outs = alc883_slave_dig_outs,
9433 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9434 .channel_mode = alc889_8ch_intel_modes,
9435 .capsrc_nids = alc889_capsrc_nids,
9436 .input_mux = &alc889_capture_source,
9437 .setup = alc889_automute_setup,
9438 .init_hook = alc_automute_amp,
9439 .unsol_event = alc_automute_amp_unsol_event,
9443 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9444 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9445 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9446 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9447 .dac_nids = alc883_dac_nids,
9448 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9449 .adc_nids = alc889_adc_nids,
9450 .dig_out_nid = ALC883_DIGOUT_NID,
9451 .dig_in_nid = ALC883_DIGIN_NID,
9452 .slave_dig_outs = alc883_slave_dig_outs,
9453 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9454 .channel_mode = alc889_8ch_intel_modes,
9455 .capsrc_nids = alc889_capsrc_nids,
9456 .input_mux = &alc889_capture_source,
9457 .setup = alc889_automute_setup,
9458 .init_hook = alc889_intel_init_hook,
9459 .unsol_event = alc_automute_amp_unsol_event,
9462 [ALC883_6ST_DIG] = {
9463 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9464 .init_verbs = { alc883_init_verbs },
9465 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9466 .dac_nids = alc883_dac_nids,
9467 .dig_out_nid = ALC883_DIGOUT_NID,
9468 .dig_in_nid = ALC883_DIGIN_NID,
9469 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9470 .channel_mode = alc883_sixstack_modes,
9471 .input_mux = &alc883_capture_source,
9473 [ALC883_TARGA_DIG] = {
9474 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9475 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9476 alc883_targa_verbs},
9477 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9478 .dac_nids = alc883_dac_nids,
9479 .dig_out_nid = ALC883_DIGOUT_NID,
9480 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9481 .channel_mode = alc883_3ST_6ch_modes,
9483 .input_mux = &alc883_capture_source,
9484 .unsol_event = alc883_targa_unsol_event,
9485 .setup = alc882_targa_setup,
9486 .init_hook = alc882_targa_automute,
9488 [ALC883_TARGA_2ch_DIG] = {
9489 .mixers = { alc883_targa_2ch_mixer},
9490 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9491 alc883_targa_verbs},
9492 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9493 .dac_nids = alc883_dac_nids,
9494 .adc_nids = alc883_adc_nids_alt,
9495 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9496 .capsrc_nids = alc883_capsrc_nids,
9497 .dig_out_nid = ALC883_DIGOUT_NID,
9498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9499 .channel_mode = alc883_3ST_2ch_modes,
9500 .input_mux = &alc883_capture_source,
9501 .unsol_event = alc883_targa_unsol_event,
9502 .setup = alc882_targa_setup,
9503 .init_hook = alc882_targa_automute,
9505 [ALC883_TARGA_8ch_DIG] = {
9506 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9507 alc883_chmode_mixer },
9508 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9509 alc883_targa_verbs },
9510 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9511 .dac_nids = alc883_dac_nids,
9512 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9513 .adc_nids = alc883_adc_nids_rev,
9514 .capsrc_nids = alc883_capsrc_nids_rev,
9515 .dig_out_nid = ALC883_DIGOUT_NID,
9516 .dig_in_nid = ALC883_DIGIN_NID,
9517 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9518 .channel_mode = alc883_4ST_8ch_modes,
9520 .input_mux = &alc883_capture_source,
9521 .unsol_event = alc883_targa_unsol_event,
9522 .setup = alc882_targa_setup,
9523 .init_hook = alc882_targa_automute,
9526 .mixers = { alc883_base_mixer },
9527 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9528 * and the headphone jack. Turn this on and rely on the
9529 * standard mute methods whenever the user wants to turn
9530 * these outputs off.
9532 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9534 .dac_nids = alc883_dac_nids,
9535 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9536 .channel_mode = alc883_3ST_2ch_modes,
9537 .input_mux = &alc883_capture_source,
9539 [ALC883_ACER_ASPIRE] = {
9540 .mixers = { alc883_acer_aspire_mixer },
9541 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9542 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9543 .dac_nids = alc883_dac_nids,
9544 .dig_out_nid = ALC883_DIGOUT_NID,
9545 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9546 .channel_mode = alc883_3ST_2ch_modes,
9547 .input_mux = &alc883_capture_source,
9548 .unsol_event = alc_automute_amp_unsol_event,
9549 .setup = alc883_acer_aspire_setup,
9550 .init_hook = alc_automute_amp,
9552 [ALC888_ACER_ASPIRE_4930G] = {
9553 .mixers = { alc888_base_mixer,
9554 alc883_chmode_mixer },
9555 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9556 alc888_acer_aspire_4930g_verbs },
9557 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9558 .dac_nids = alc883_dac_nids,
9559 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9560 .adc_nids = alc883_adc_nids_rev,
9561 .capsrc_nids = alc883_capsrc_nids_rev,
9562 .dig_out_nid = ALC883_DIGOUT_NID,
9563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9564 .channel_mode = alc883_3ST_6ch_modes,
9567 ARRAY_SIZE(alc888_2_capture_sources),
9568 .input_mux = alc888_2_capture_sources,
9569 .unsol_event = alc_automute_amp_unsol_event,
9570 .setup = alc888_acer_aspire_4930g_setup,
9571 .init_hook = alc_automute_amp,
9573 [ALC888_ACER_ASPIRE_6530G] = {
9574 .mixers = { alc888_acer_aspire_6530_mixer },
9575 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9576 alc888_acer_aspire_6530g_verbs },
9577 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9578 .dac_nids = alc883_dac_nids,
9579 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9580 .adc_nids = alc883_adc_nids_rev,
9581 .capsrc_nids = alc883_capsrc_nids_rev,
9582 .dig_out_nid = ALC883_DIGOUT_NID,
9583 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9584 .channel_mode = alc883_3ST_2ch_modes,
9586 ARRAY_SIZE(alc888_2_capture_sources),
9587 .input_mux = alc888_acer_aspire_6530_sources,
9588 .unsol_event = alc_automute_amp_unsol_event,
9589 .setup = alc888_acer_aspire_6530g_setup,
9590 .init_hook = alc_automute_amp,
9592 [ALC888_ACER_ASPIRE_8930G] = {
9593 .mixers = { alc889_acer_aspire_8930g_mixer,
9594 alc883_chmode_mixer },
9595 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9596 alc889_acer_aspire_8930g_verbs,
9598 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9599 .dac_nids = alc883_dac_nids,
9600 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9601 .adc_nids = alc889_adc_nids,
9602 .capsrc_nids = alc889_capsrc_nids,
9603 .dig_out_nid = ALC883_DIGOUT_NID,
9604 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9605 .channel_mode = alc883_3ST_6ch_modes,
9607 .const_channel_count = 6,
9609 ARRAY_SIZE(alc889_capture_sources),
9610 .input_mux = alc889_capture_sources,
9611 .unsol_event = alc_automute_amp_unsol_event,
9612 .setup = alc889_acer_aspire_8930g_setup,
9613 .init_hook = alc_automute_amp,
9614 #ifdef CONFIG_SND_HDA_POWER_SAVE
9615 .power_hook = alc_power_eapd,
9618 [ALC888_ACER_ASPIRE_7730G] = {
9619 .mixers = { alc883_3ST_6ch_mixer,
9620 alc883_chmode_mixer },
9621 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9622 alc888_acer_aspire_7730G_verbs },
9623 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9624 .dac_nids = alc883_dac_nids,
9625 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9626 .adc_nids = alc883_adc_nids_rev,
9627 .capsrc_nids = alc883_capsrc_nids_rev,
9628 .dig_out_nid = ALC883_DIGOUT_NID,
9629 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9630 .channel_mode = alc883_3ST_6ch_modes,
9632 .const_channel_count = 6,
9633 .input_mux = &alc883_capture_source,
9634 .unsol_event = alc_automute_amp_unsol_event,
9635 .setup = alc888_acer_aspire_6530g_setup,
9636 .init_hook = alc_automute_amp,
9639 .mixers = { alc883_fivestack_mixer,
9640 alc883_chmode_mixer },
9641 .init_verbs = { alc883_init_verbs,
9642 alc883_medion_eapd_verbs },
9643 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9644 .dac_nids = alc883_dac_nids,
9645 .adc_nids = alc883_adc_nids_alt,
9646 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9647 .capsrc_nids = alc883_capsrc_nids,
9648 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9649 .channel_mode = alc883_sixstack_modes,
9650 .input_mux = &alc883_capture_source,
9652 [ALC883_MEDION_MD2] = {
9653 .mixers = { alc883_medion_md2_mixer},
9654 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9656 .dac_nids = alc883_dac_nids,
9657 .dig_out_nid = ALC883_DIGOUT_NID,
9658 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9659 .channel_mode = alc883_3ST_2ch_modes,
9660 .input_mux = &alc883_capture_source,
9661 .unsol_event = alc_automute_amp_unsol_event,
9662 .setup = alc883_medion_md2_setup,
9663 .init_hook = alc_automute_amp,
9665 [ALC883_LAPTOP_EAPD] = {
9666 .mixers = { alc883_base_mixer },
9667 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9668 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9669 .dac_nids = alc883_dac_nids,
9670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9671 .channel_mode = alc883_3ST_2ch_modes,
9672 .input_mux = &alc883_capture_source,
9674 [ALC883_CLEVO_M540R] = {
9675 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9676 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9677 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9678 .dac_nids = alc883_dac_nids,
9679 .dig_out_nid = ALC883_DIGOUT_NID,
9680 .dig_in_nid = ALC883_DIGIN_NID,
9681 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9682 .channel_mode = alc883_3ST_6ch_clevo_modes,
9684 .input_mux = &alc883_capture_source,
9685 /* This machine has the hardware HP auto-muting, thus
9686 * we need no software mute via unsol event
9689 [ALC883_CLEVO_M720] = {
9690 .mixers = { alc883_clevo_m720_mixer },
9691 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9692 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9693 .dac_nids = alc883_dac_nids,
9694 .dig_out_nid = ALC883_DIGOUT_NID,
9695 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9696 .channel_mode = alc883_3ST_2ch_modes,
9697 .input_mux = &alc883_capture_source,
9698 .unsol_event = alc883_clevo_m720_unsol_event,
9699 .setup = alc883_clevo_m720_setup,
9700 .init_hook = alc883_clevo_m720_init_hook,
9702 [ALC883_LENOVO_101E_2ch] = {
9703 .mixers = { alc883_lenovo_101e_2ch_mixer},
9704 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9705 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9706 .dac_nids = alc883_dac_nids,
9707 .adc_nids = alc883_adc_nids_alt,
9708 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9709 .capsrc_nids = alc883_capsrc_nids,
9710 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9711 .channel_mode = alc883_3ST_2ch_modes,
9712 .input_mux = &alc883_lenovo_101e_capture_source,
9713 .unsol_event = alc883_lenovo_101e_unsol_event,
9714 .init_hook = alc883_lenovo_101e_all_automute,
9716 [ALC883_LENOVO_NB0763] = {
9717 .mixers = { alc883_lenovo_nb0763_mixer },
9718 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9719 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9720 .dac_nids = alc883_dac_nids,
9721 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9722 .channel_mode = alc883_3ST_2ch_modes,
9724 .input_mux = &alc883_lenovo_nb0763_capture_source,
9725 .unsol_event = alc_automute_amp_unsol_event,
9726 .setup = alc883_medion_md2_setup,
9727 .init_hook = alc_automute_amp,
9729 [ALC888_LENOVO_MS7195_DIG] = {
9730 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9731 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9733 .dac_nids = alc883_dac_nids,
9734 .dig_out_nid = ALC883_DIGOUT_NID,
9735 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9736 .channel_mode = alc883_3ST_6ch_modes,
9738 .input_mux = &alc883_capture_source,
9739 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9740 .init_hook = alc888_lenovo_ms7195_front_automute,
9742 [ALC883_HAIER_W66] = {
9743 .mixers = { alc883_targa_2ch_mixer},
9744 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9745 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9746 .dac_nids = alc883_dac_nids,
9747 .dig_out_nid = ALC883_DIGOUT_NID,
9748 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9749 .channel_mode = alc883_3ST_2ch_modes,
9750 .input_mux = &alc883_capture_source,
9751 .unsol_event = alc_automute_amp_unsol_event,
9752 .setup = alc883_haier_w66_setup,
9753 .init_hook = alc_automute_amp,
9756 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9757 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9761 .channel_mode = alc888_3st_hp_modes,
9763 .input_mux = &alc883_capture_source,
9764 .unsol_event = alc_automute_amp_unsol_event,
9765 .setup = alc888_3st_hp_setup,
9766 .init_hook = alc_automute_amp,
9768 [ALC888_6ST_DELL] = {
9769 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9770 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9771 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9772 .dac_nids = alc883_dac_nids,
9773 .dig_out_nid = ALC883_DIGOUT_NID,
9774 .dig_in_nid = ALC883_DIGIN_NID,
9775 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9776 .channel_mode = alc883_sixstack_modes,
9777 .input_mux = &alc883_capture_source,
9778 .unsol_event = alc_automute_amp_unsol_event,
9779 .setup = alc888_6st_dell_setup,
9780 .init_hook = alc_automute_amp,
9783 .mixers = { alc883_mitac_mixer },
9784 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9785 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9786 .dac_nids = alc883_dac_nids,
9787 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9788 .channel_mode = alc883_3ST_2ch_modes,
9789 .input_mux = &alc883_capture_source,
9790 .unsol_event = alc_automute_amp_unsol_event,
9791 .setup = alc883_mitac_setup,
9792 .init_hook = alc_automute_amp,
9794 [ALC883_FUJITSU_PI2515] = {
9795 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9796 .init_verbs = { alc883_init_verbs,
9797 alc883_2ch_fujitsu_pi2515_verbs},
9798 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9799 .dac_nids = alc883_dac_nids,
9800 .dig_out_nid = ALC883_DIGOUT_NID,
9801 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9802 .channel_mode = alc883_3ST_2ch_modes,
9803 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9804 .unsol_event = alc_automute_amp_unsol_event,
9805 .setup = alc883_2ch_fujitsu_pi2515_setup,
9806 .init_hook = alc_automute_amp,
9808 [ALC888_FUJITSU_XA3530] = {
9809 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9810 .init_verbs = { alc883_init_verbs,
9811 alc888_fujitsu_xa3530_verbs },
9812 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9813 .dac_nids = alc883_dac_nids,
9814 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9815 .adc_nids = alc883_adc_nids_rev,
9816 .capsrc_nids = alc883_capsrc_nids_rev,
9817 .dig_out_nid = ALC883_DIGOUT_NID,
9818 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9819 .channel_mode = alc888_4ST_8ch_intel_modes,
9821 ARRAY_SIZE(alc888_2_capture_sources),
9822 .input_mux = alc888_2_capture_sources,
9823 .unsol_event = alc_automute_amp_unsol_event,
9824 .setup = alc888_fujitsu_xa3530_setup,
9825 .init_hook = alc_automute_amp,
9827 [ALC888_LENOVO_SKY] = {
9828 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9829 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9830 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9831 .dac_nids = alc883_dac_nids,
9832 .dig_out_nid = ALC883_DIGOUT_NID,
9833 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9834 .channel_mode = alc883_sixstack_modes,
9836 .input_mux = &alc883_lenovo_sky_capture_source,
9837 .unsol_event = alc_automute_amp_unsol_event,
9838 .setup = alc888_lenovo_sky_setup,
9839 .init_hook = alc_automute_amp,
9841 [ALC888_ASUS_M90V] = {
9842 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9843 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9844 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9845 .dac_nids = alc883_dac_nids,
9846 .dig_out_nid = ALC883_DIGOUT_NID,
9847 .dig_in_nid = ALC883_DIGIN_NID,
9848 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9849 .channel_mode = alc883_3ST_6ch_modes,
9851 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9852 .unsol_event = alc_sku_unsol_event,
9853 .setup = alc883_mode2_setup,
9854 .init_hook = alc_inithook,
9856 [ALC888_ASUS_EEE1601] = {
9857 .mixers = { alc883_asus_eee1601_mixer },
9858 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9859 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9860 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9861 .dac_nids = alc883_dac_nids,
9862 .dig_out_nid = ALC883_DIGOUT_NID,
9863 .dig_in_nid = ALC883_DIGIN_NID,
9864 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9865 .channel_mode = alc883_3ST_2ch_modes,
9867 .input_mux = &alc883_asus_eee1601_capture_source,
9868 .unsol_event = alc_sku_unsol_event,
9869 .init_hook = alc883_eee1601_inithook,
9871 [ALC1200_ASUS_P5Q] = {
9872 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9873 .init_verbs = { alc883_init_verbs },
9874 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9875 .dac_nids = alc883_dac_nids,
9876 .dig_out_nid = ALC1200_DIGOUT_NID,
9877 .dig_in_nid = ALC883_DIGIN_NID,
9878 .slave_dig_outs = alc1200_slave_dig_outs,
9879 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9880 .channel_mode = alc883_sixstack_modes,
9881 .input_mux = &alc883_capture_source,
9884 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9885 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9886 alc880_gpio1_init_verbs },
9887 .adc_nids = alc883_adc_nids,
9888 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9889 .capsrc_nids = alc883_capsrc_nids,
9890 .dac_nids = alc883_dac_nids,
9891 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9892 .channel_mode = alc889A_mb31_6ch_modes,
9893 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9894 .input_mux = &alc889A_mb31_capture_source,
9895 .dig_out_nid = ALC883_DIGOUT_NID,
9896 .unsol_event = alc889A_mb31_unsol_event,
9897 .init_hook = alc889A_mb31_automute,
9899 [ALC883_SONY_VAIO_TT] = {
9900 .mixers = { alc883_vaiott_mixer },
9901 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9902 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9903 .dac_nids = alc883_dac_nids,
9904 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9905 .channel_mode = alc883_3ST_2ch_modes,
9906 .input_mux = &alc883_capture_source,
9907 .unsol_event = alc_automute_amp_unsol_event,
9908 .setup = alc883_vaiott_setup,
9909 .init_hook = alc_automute_amp,
9918 PINFIX_ABIT_AW9D_MAX
9921 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9922 { 0x15, 0x01080104 }, /* side */
9923 { 0x16, 0x01011012 }, /* rear */
9924 { 0x17, 0x01016011 }, /* clfe */
9928 static const struct alc_fixup alc882_fixups[] = {
9929 [PINFIX_ABIT_AW9D_MAX] = {
9930 .pins = alc882_abit_aw9d_pinfix
9934 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9935 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9940 * BIOS auto configuration
9942 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9943 const struct auto_pin_cfg *cfg)
9945 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9948 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9949 hda_nid_t nid, int pin_type,
9953 struct alc_spec *spec = codec->spec;
9956 alc_set_pin_output(codec, nid, pin_type);
9957 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9960 idx = spec->multiout.dac_nids[dac_idx] - 2;
9961 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9965 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9967 struct alc_spec *spec = codec->spec;
9970 for (i = 0; i <= HDA_SIDE; i++) {
9971 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9972 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9974 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9979 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9981 struct alc_spec *spec = codec->spec;
9984 pin = spec->autocfg.hp_pins[0];
9985 if (pin) /* connect to front */
9987 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9988 pin = spec->autocfg.speaker_pins[0];
9990 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9993 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9995 struct alc_spec *spec = codec->spec;
9998 for (i = 0; i < AUTO_PIN_LAST; i++) {
9999 hda_nid_t nid = spec->autocfg.input_pins[i];
10002 alc_set_input_pin(codec, nid, i);
10003 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10004 snd_hda_codec_write(codec, nid, 0,
10005 AC_VERB_SET_AMP_GAIN_MUTE,
10010 static void alc882_auto_init_input_src(struct hda_codec *codec)
10012 struct alc_spec *spec = codec->spec;
10015 for (c = 0; c < spec->num_adc_nids; c++) {
10016 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10017 hda_nid_t nid = spec->capsrc_nids[c];
10018 unsigned int mux_idx;
10019 const struct hda_input_mux *imux;
10020 int conns, mute, idx, item;
10022 conns = snd_hda_get_connections(codec, nid, conn_list,
10023 ARRAY_SIZE(conn_list));
10026 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10027 imux = &spec->input_mux[mux_idx];
10028 for (idx = 0; idx < conns; idx++) {
10029 /* if the current connection is the selected one,
10030 * unmute it as default - otherwise mute it
10032 mute = AMP_IN_MUTE(idx);
10033 for (item = 0; item < imux->num_items; item++) {
10034 if (imux->items[item].index == idx) {
10035 if (spec->cur_mux[c] == item)
10036 mute = AMP_IN_UNMUTE(idx);
10040 /* check if we have a selector or mixer
10041 * we could check for the widget type instead, but
10042 * just check for Amp-In presence (in case of mixer
10043 * without amp-in there is something wrong, this
10044 * function shouldn't be used or capsrc nid is wrong)
10046 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10047 snd_hda_codec_write(codec, nid, 0,
10048 AC_VERB_SET_AMP_GAIN_MUTE,
10050 else if (mute != AMP_IN_MUTE(idx))
10051 snd_hda_codec_write(codec, nid, 0,
10052 AC_VERB_SET_CONNECT_SEL,
10058 /* add mic boosts if needed */
10059 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10061 struct alc_spec *spec = codec->spec;
10065 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10066 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10067 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10069 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10073 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10074 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10075 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10077 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10084 /* almost identical with ALC880 parser... */
10085 static int alc882_parse_auto_config(struct hda_codec *codec)
10087 struct alc_spec *spec = codec->spec;
10088 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10091 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10095 if (!spec->autocfg.line_outs)
10096 return 0; /* can't find valid BIOS pin config */
10098 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10101 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10104 err = alc880_auto_create_extra_out(spec,
10105 spec->autocfg.speaker_pins[0],
10109 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10113 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10117 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10119 /* check multiple SPDIF-out (for recent codecs) */
10120 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10122 err = snd_hda_get_connections(codec,
10123 spec->autocfg.dig_out_pins[i],
10128 spec->multiout.dig_out_nid = dig_nid;
10130 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10131 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10133 spec->slave_dig_outs[i - 1] = dig_nid;
10136 if (spec->autocfg.dig_in_pin)
10137 spec->dig_in_nid = ALC880_DIGIN_NID;
10139 if (spec->kctls.list)
10140 add_mixer(spec, spec->kctls.list);
10142 add_verb(spec, alc883_auto_init_verbs);
10143 /* if ADC 0x07 is available, initialize it, too */
10144 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10145 add_verb(spec, alc882_adc1_init_verbs);
10147 spec->num_mux_defs = 1;
10148 spec->input_mux = &spec->private_imux[0];
10150 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10152 err = alc_auto_add_mic_boost(codec);
10156 return 1; /* config found */
10159 /* additional initialization for auto-configuration model */
10160 static void alc882_auto_init(struct hda_codec *codec)
10162 struct alc_spec *spec = codec->spec;
10163 alc882_auto_init_multi_out(codec);
10164 alc882_auto_init_hp_out(codec);
10165 alc882_auto_init_analog_input(codec);
10166 alc882_auto_init_input_src(codec);
10167 if (spec->unsol_event)
10168 alc_inithook(codec);
10171 static int patch_alc882(struct hda_codec *codec)
10173 struct alc_spec *spec;
10174 int err, board_config;
10176 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10180 codec->spec = spec;
10182 switch (codec->vendor_id) {
10187 /* ALC883 and variants */
10188 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10192 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10196 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10197 board_config = snd_hda_check_board_codec_sid_config(codec,
10198 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10200 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10201 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10203 board_config = ALC882_AUTO;
10206 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10208 if (board_config == ALC882_AUTO) {
10209 /* automatic parse from the BIOS config */
10210 err = alc882_parse_auto_config(codec);
10216 "hda_codec: Cannot set up configuration "
10217 "from BIOS. Using base mode...\n");
10218 board_config = ALC882_3ST_DIG;
10222 err = snd_hda_attach_beep_device(codec, 0x1);
10228 if (board_config != ALC882_AUTO)
10229 setup_preset(codec, &alc882_presets[board_config]);
10231 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10232 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10233 /* FIXME: setup DAC5 */
10234 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10235 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10237 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10238 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10240 if (codec->vendor_id == 0x10ec0888)
10241 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10243 if (!spec->adc_nids && spec->input_mux) {
10245 spec->num_adc_nids = 0;
10246 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10247 const struct hda_input_mux *imux = spec->input_mux;
10249 hda_nid_t items[16];
10250 hda_nid_t nid = alc882_adc_nids[i];
10251 unsigned int wcap = get_wcaps(codec, nid);
10253 wcap = get_wcaps_type(wcap);
10254 if (wcap != AC_WID_AUD_IN)
10256 spec->private_adc_nids[spec->num_adc_nids] = nid;
10257 err = snd_hda_get_connections(codec, nid, &cap, 1);
10260 err = snd_hda_get_connections(codec, cap, items,
10261 ARRAY_SIZE(items));
10264 for (j = 0; j < imux->num_items; j++)
10265 if (imux->items[j].index >= err)
10267 if (j < imux->num_items)
10269 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10270 spec->num_adc_nids++;
10272 spec->adc_nids = spec->private_adc_nids;
10273 spec->capsrc_nids = spec->private_capsrc_nids;
10276 set_capture_mixer(codec);
10277 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10279 spec->vmaster_nid = 0x0c;
10281 codec->patch_ops = alc_patch_ops;
10282 if (board_config == ALC882_AUTO)
10283 spec->init_hook = alc882_auto_init;
10284 #ifdef CONFIG_SND_HDA_POWER_SAVE
10285 if (!spec->loopback.amplist)
10286 spec->loopback.amplist = alc882_loopbacks;
10297 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10298 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10300 #define alc262_dac_nids alc260_dac_nids
10301 #define alc262_adc_nids alc882_adc_nids
10302 #define alc262_adc_nids_alt alc882_adc_nids_alt
10303 #define alc262_capsrc_nids alc882_capsrc_nids
10304 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10306 #define alc262_modes alc260_modes
10307 #define alc262_capture_source alc882_capture_source
10309 static hda_nid_t alc262_dmic_adc_nids[1] = {
10314 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10316 static struct snd_kcontrol_new alc262_base_mixer[] = {
10317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10318 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10319 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10320 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10321 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10322 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10323 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10324 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10325 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10326 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10327 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10328 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10329 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10330 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10331 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10332 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10336 /* update HP, line and mono-out pins according to the master switch */
10337 static void alc262_hp_master_update(struct hda_codec *codec)
10339 struct alc_spec *spec = codec->spec;
10340 int val = spec->master_sw;
10342 /* HP & line-out */
10343 snd_hda_codec_write_cache(codec, 0x1b, 0,
10344 AC_VERB_SET_PIN_WIDGET_CONTROL,
10346 snd_hda_codec_write_cache(codec, 0x15, 0,
10347 AC_VERB_SET_PIN_WIDGET_CONTROL,
10349 /* mono (speaker) depending on the HP jack sense */
10350 val = val && !spec->jack_present;
10351 snd_hda_codec_write_cache(codec, 0x16, 0,
10352 AC_VERB_SET_PIN_WIDGET_CONTROL,
10353 val ? PIN_OUT : 0);
10356 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10358 struct alc_spec *spec = codec->spec;
10360 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10361 alc262_hp_master_update(codec);
10364 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10366 if ((res >> 26) != ALC880_HP_EVENT)
10368 alc262_hp_bpc_automute(codec);
10371 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10373 struct alc_spec *spec = codec->spec;
10375 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10376 alc262_hp_master_update(codec);
10379 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10382 if ((res >> 26) != ALC880_HP_EVENT)
10384 alc262_hp_wildwest_automute(codec);
10387 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10389 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10390 struct snd_ctl_elem_value *ucontrol)
10392 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10393 struct alc_spec *spec = codec->spec;
10394 int val = !!*ucontrol->value.integer.value;
10396 if (val == spec->master_sw)
10398 spec->master_sw = val;
10399 alc262_hp_master_update(codec);
10403 #define ALC262_HP_MASTER_SWITCH \
10405 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10406 .name = "Master Playback Switch", \
10407 .info = snd_ctl_boolean_mono_info, \
10408 .get = alc262_hp_master_sw_get, \
10409 .put = alc262_hp_master_sw_put, \
10412 .iface = NID_MAPPING, \
10413 .name = "Master Playback Switch", \
10414 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10418 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10419 ALC262_HP_MASTER_SWITCH,
10420 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10421 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10422 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10423 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10425 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10427 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10428 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10429 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10430 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10431 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10432 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10435 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10436 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10437 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10438 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10442 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10443 ALC262_HP_MASTER_SWITCH,
10444 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10445 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10446 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10448 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10450 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10452 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10453 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10454 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10455 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10456 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10457 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10462 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10463 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10464 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10465 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10469 /* mute/unmute internal speaker according to the hp jack and mute state */
10470 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10472 struct alc_spec *spec = codec->spec;
10474 spec->autocfg.hp_pins[0] = 0x15;
10475 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10478 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10479 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10480 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10481 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10482 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10483 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10484 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10485 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10489 static struct hda_verb alc262_hp_t5735_verbs[] = {
10490 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10491 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10493 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10497 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10498 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10499 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10500 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10501 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10502 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10503 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10507 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10509 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10510 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10511 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10512 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10513 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10515 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10517 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10521 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10528 /* bind hp and internal speaker mute (with plug check) as master switch */
10529 static void alc262_hippo_master_update(struct hda_codec *codec)
10531 struct alc_spec *spec = codec->spec;
10532 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10533 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10534 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10538 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10539 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10540 HDA_AMP_MUTE, mute);
10541 /* mute internal speaker per jack sense */
10542 if (spec->jack_present)
10543 mute = HDA_AMP_MUTE;
10545 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10546 HDA_AMP_MUTE, mute);
10547 if (speaker_nid && speaker_nid != line_nid)
10548 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10549 HDA_AMP_MUTE, mute);
10552 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10554 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10555 struct snd_ctl_elem_value *ucontrol)
10557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10558 struct alc_spec *spec = codec->spec;
10559 int val = !!*ucontrol->value.integer.value;
10561 if (val == spec->master_sw)
10563 spec->master_sw = val;
10564 alc262_hippo_master_update(codec);
10568 #define ALC262_HIPPO_MASTER_SWITCH \
10570 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10571 .name = "Master Playback Switch", \
10572 .info = snd_ctl_boolean_mono_info, \
10573 .get = alc262_hippo_master_sw_get, \
10574 .put = alc262_hippo_master_sw_put, \
10577 .iface = NID_MAPPING, \
10578 .name = "Master Playback Switch", \
10579 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10580 (SUBDEV_SPEAKER(0) << 16), \
10583 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10584 ALC262_HIPPO_MASTER_SWITCH,
10585 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10586 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10587 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10588 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10589 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10590 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10591 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10592 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10594 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10595 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10596 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10600 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10601 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10602 ALC262_HIPPO_MASTER_SWITCH,
10603 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10604 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10612 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10616 /* mute/unmute internal speaker according to the hp jack and mute state */
10617 static void alc262_hippo_automute(struct hda_codec *codec)
10619 struct alc_spec *spec = codec->spec;
10620 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10622 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10623 alc262_hippo_master_update(codec);
10626 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10628 if ((res >> 26) != ALC880_HP_EVENT)
10630 alc262_hippo_automute(codec);
10633 static void alc262_hippo_setup(struct hda_codec *codec)
10635 struct alc_spec *spec = codec->spec;
10637 spec->autocfg.hp_pins[0] = 0x15;
10638 spec->autocfg.speaker_pins[0] = 0x14;
10641 static void alc262_hippo1_setup(struct hda_codec *codec)
10643 struct alc_spec *spec = codec->spec;
10645 spec->autocfg.hp_pins[0] = 0x1b;
10646 spec->autocfg.speaker_pins[0] = 0x14;
10650 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10651 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10652 ALC262_HIPPO_MASTER_SWITCH,
10653 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10654 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10655 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10656 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10660 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10661 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10662 ALC262_HIPPO_MASTER_SWITCH,
10663 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10664 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10665 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10666 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10667 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10671 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10672 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10673 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10674 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10675 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10676 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10677 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10680 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10681 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10682 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10683 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10687 static struct hda_verb alc262_tyan_verbs[] = {
10688 /* Headphone automute */
10689 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10690 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10691 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10693 /* P11 AUX_IN, white 4-pin connector */
10694 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10695 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10696 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10697 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10702 /* unsolicited event for HP jack sensing */
10703 static void alc262_tyan_setup(struct hda_codec *codec)
10705 struct alc_spec *spec = codec->spec;
10707 spec->autocfg.hp_pins[0] = 0x1b;
10708 spec->autocfg.speaker_pins[0] = 0x15;
10712 #define alc262_capture_mixer alc882_capture_mixer
10713 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10716 * generic initialization of ADC, input mixers and output mixers
10718 static struct hda_verb alc262_init_verbs[] = {
10720 * Unmute ADC0-2 and set the default input to mic-in
10722 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10723 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10724 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10725 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10726 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10727 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10729 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10731 * Note: PASD motherboards uses the Line In 2 as the input for
10732 * front panel mic (mic 2)
10734 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10735 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10736 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10737 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10738 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10739 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10742 * Set up output mixers (0x0c - 0x0e)
10744 /* set vol=0 to output mixers */
10745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10747 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10748 /* set up input amps for analog loopback */
10749 /* Amp Indices: DAC = 0, mixer = 1 */
10750 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10751 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10752 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10753 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10754 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10755 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10757 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10758 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10759 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10760 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10761 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10762 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10766 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10767 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10768 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10770 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10771 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10773 /* FIXME: use matrix-type input source selection */
10774 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10775 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10776 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10777 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10778 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10779 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10781 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10782 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10783 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10784 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10786 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10787 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10794 static struct hda_verb alc262_eapd_verbs[] = {
10795 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10796 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10800 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10801 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10802 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10803 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10805 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10810 static struct hda_verb alc262_sony_unsol_verbs[] = {
10811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10812 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10815 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10816 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10820 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10821 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10822 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10823 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10824 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10825 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10829 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10830 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10833 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10834 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10835 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10836 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10837 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10841 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10843 struct alc_spec *spec = codec->spec;
10845 spec->autocfg.hp_pins[0] = 0x15;
10846 spec->autocfg.speaker_pins[0] = 0x14;
10847 spec->ext_mic.pin = 0x18;
10848 spec->ext_mic.mux_idx = 0;
10849 spec->int_mic.pin = 0x12;
10850 spec->int_mic.mux_idx = 9;
10851 spec->auto_mic = 1;
10857 * 0x16 = internal speaker
10858 * 0x18 = external mic
10861 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10862 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10863 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10866 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10867 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10869 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10870 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10874 static struct hda_verb alc262_nec_verbs[] = {
10875 /* Unmute Speaker */
10876 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10879 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10882 /* External mic to headphone */
10883 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10884 /* External mic to speaker */
10885 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10891 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10892 * 0x1b = port replicator headphone out
10895 #define ALC_HP_EVENT 0x37
10897 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10898 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10899 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10900 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10901 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10905 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10906 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10907 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10911 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10912 /* Front Mic pin: input vref at 50% */
10913 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10914 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10918 static struct hda_input_mux alc262_fujitsu_capture_source = {
10922 { "Int Mic", 0x1 },
10927 static struct hda_input_mux alc262_HP_capture_source = {
10931 { "Front Mic", 0x1 },
10938 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10942 { "Front Mic", 0x2 },
10948 /* mute/unmute internal speaker according to the hp jacks and mute state */
10949 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10951 struct alc_spec *spec = codec->spec;
10954 if (force || !spec->sense_updated) {
10955 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10956 snd_hda_jack_detect(codec, 0x1b);
10957 spec->sense_updated = 1;
10959 /* unmute internal speaker only if both HPs are unplugged and
10960 * master switch is on
10962 if (spec->jack_present)
10963 mute = HDA_AMP_MUTE;
10965 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10966 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10967 HDA_AMP_MUTE, mute);
10970 /* unsolicited event for HP jack sensing */
10971 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10974 if ((res >> 26) != ALC_HP_EVENT)
10976 alc262_fujitsu_automute(codec, 1);
10979 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10981 alc262_fujitsu_automute(codec, 1);
10984 /* bind volumes of both NID 0x0c and 0x0d */
10985 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10986 .ops = &snd_hda_bind_vol,
10988 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10989 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10994 /* mute/unmute internal speaker according to the hp jack and mute state */
10995 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10997 struct alc_spec *spec = codec->spec;
11000 if (force || !spec->sense_updated) {
11001 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11002 spec->sense_updated = 1;
11004 if (spec->jack_present) {
11005 /* mute internal speaker */
11006 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11007 HDA_AMP_MUTE, HDA_AMP_MUTE);
11008 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11009 HDA_AMP_MUTE, HDA_AMP_MUTE);
11011 /* unmute internal speaker if necessary */
11012 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11013 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11014 HDA_AMP_MUTE, mute);
11015 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11016 HDA_AMP_MUTE, mute);
11020 /* unsolicited event for HP jack sensing */
11021 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11024 if ((res >> 26) != ALC_HP_EVENT)
11026 alc262_lenovo_3000_automute(codec, 1);
11029 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11030 int dir, int idx, long *valp)
11034 for (i = 0; i < 2; i++, valp++)
11035 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11037 *valp ? 0 : HDA_AMP_MUTE);
11041 /* bind hp and internal speaker mute (with plug check) */
11042 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11043 struct snd_ctl_elem_value *ucontrol)
11045 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11046 long *valp = ucontrol->value.integer.value;
11049 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11050 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11052 alc262_fujitsu_automute(codec, 0);
11056 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11057 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11060 .name = "Master Playback Switch",
11061 .subdevice = HDA_SUBDEV_AMP_FLAG,
11062 .info = snd_hda_mixer_amp_switch_info,
11063 .get = snd_hda_mixer_amp_switch_get,
11064 .put = alc262_fujitsu_master_sw_put,
11065 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11068 .iface = NID_MAPPING,
11069 .name = "Master Playback Switch",
11070 .private_value = 0x1b,
11072 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11073 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11074 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11077 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11078 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11079 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11083 /* bind hp and internal speaker mute (with plug check) */
11084 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11085 struct snd_ctl_elem_value *ucontrol)
11087 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11088 long *valp = ucontrol->value.integer.value;
11091 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11093 alc262_lenovo_3000_automute(codec, 0);
11097 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11098 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11101 .name = "Master Playback Switch",
11102 .subdevice = HDA_SUBDEV_AMP_FLAG,
11103 .info = snd_hda_mixer_amp_switch_info,
11104 .get = snd_hda_mixer_amp_switch_get,
11105 .put = alc262_lenovo_3000_master_sw_put,
11106 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11108 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11109 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11110 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11111 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11112 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11113 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11114 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11115 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11119 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11120 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11121 ALC262_HIPPO_MASTER_SWITCH,
11122 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11124 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11127 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11131 /* additional init verbs for Benq laptops */
11132 static struct hda_verb alc262_EAPD_verbs[] = {
11133 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11134 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11138 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11139 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11140 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11142 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11143 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11147 /* Samsung Q1 Ultra Vista model setup */
11148 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11149 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11150 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11153 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11154 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11158 static struct hda_verb alc262_ultra_verbs[] = {
11160 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11161 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11164 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11165 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11166 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11167 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11169 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11170 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11171 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11172 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11173 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11175 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11177 /* ADC, choose mic */
11178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11179 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11180 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11181 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11182 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11183 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11184 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11185 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11186 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11187 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11191 /* mute/unmute internal speaker according to the hp jack and mute state */
11192 static void alc262_ultra_automute(struct hda_codec *codec)
11194 struct alc_spec *spec = codec->spec;
11198 /* auto-mute only when HP is used as HP */
11199 if (!spec->cur_mux[0]) {
11200 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11201 if (spec->jack_present)
11202 mute = HDA_AMP_MUTE;
11204 /* mute/unmute internal speaker */
11205 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11206 HDA_AMP_MUTE, mute);
11207 /* mute/unmute HP */
11208 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11209 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11212 /* unsolicited event for HP jack sensing */
11213 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11216 if ((res >> 26) != ALC880_HP_EVENT)
11218 alc262_ultra_automute(codec);
11221 static struct hda_input_mux alc262_ultra_capture_source = {
11225 { "Headphone", 0x7 },
11229 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11230 struct snd_ctl_elem_value *ucontrol)
11232 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11233 struct alc_spec *spec = codec->spec;
11236 ret = alc_mux_enum_put(kcontrol, ucontrol);
11239 /* reprogram the HP pin as mic or HP according to the input source */
11240 snd_hda_codec_write_cache(codec, 0x15, 0,
11241 AC_VERB_SET_PIN_WIDGET_CONTROL,
11242 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11243 alc262_ultra_automute(codec); /* mute/unmute HP */
11247 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11248 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11249 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11252 .name = "Capture Source",
11253 .info = alc_mux_enum_info,
11254 .get = alc_mux_enum_get,
11255 .put = alc262_ultra_mux_enum_put,
11258 .iface = NID_MAPPING,
11259 .name = "Capture Source",
11260 .private_value = 0x15,
11265 /* We use two mixers depending on the output pin; 0x16 is a mono output
11266 * and thus it's bound with a different mixer.
11267 * This function returns which mixer amp should be used.
11269 static int alc262_check_volbit(hda_nid_t nid)
11273 else if (nid == 0x16)
11279 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11280 const char *pfx, int *vbits)
11285 vbit = alc262_check_volbit(nid);
11288 if (*vbits & vbit) /* a volume control for this mixer already there */
11292 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11294 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11295 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11298 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11306 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11308 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11309 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11312 /* add playback controls from the parsed DAC table */
11313 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11314 const struct auto_pin_cfg *cfg)
11320 spec->multiout.num_dacs = 1; /* only use one dac */
11321 spec->multiout.dac_nids = spec->private_dac_nids;
11322 spec->multiout.dac_nids[0] = 2;
11324 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11326 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11330 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11333 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11336 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11340 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11341 alc262_check_volbit(cfg->speaker_pins[0]) |
11342 alc262_check_volbit(cfg->hp_pins[0]);
11343 if (vbits == 1 || vbits == 2)
11344 pfx = "Master"; /* only one mixer is used */
11345 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11350 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11353 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11357 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11364 #define alc262_auto_create_input_ctls \
11365 alc882_auto_create_input_ctls
11368 * generic initialization of ADC, input mixers and output mixers
11370 static struct hda_verb alc262_volume_init_verbs[] = {
11372 * Unmute ADC0-2 and set the default input to mic-in
11374 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11376 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11377 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11378 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11381 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11383 * Note: PASD motherboards uses the Line In 2 as the input for
11384 * front panel mic (mic 2)
11386 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11387 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11388 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11389 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11390 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11391 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11394 * Set up output mixers (0x0c - 0x0f)
11396 /* set vol=0 to output mixers */
11397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11399 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11401 /* set up input amps for analog loopback */
11402 /* Amp Indices: DAC = 0, mixer = 1 */
11403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11410 /* FIXME: use matrix-type input source selection */
11411 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11412 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11413 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11414 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11415 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11416 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11418 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11419 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11420 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11421 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11423 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11424 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11425 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11426 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11431 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11433 * Unmute ADC0-2 and set the default input to mic-in
11435 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11436 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11437 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11438 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11439 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11440 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11442 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11444 * Note: PASD motherboards uses the Line In 2 as the input for
11445 * front panel mic (mic 2)
11447 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11448 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11449 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11450 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11451 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11452 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11453 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11454 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11457 * Set up output mixers (0x0c - 0x0e)
11459 /* set vol=0 to output mixers */
11460 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11461 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11464 /* set up input amps for analog loopback */
11465 /* Amp Indices: DAC = 0, mixer = 1 */
11466 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11467 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11468 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11469 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11470 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11473 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11475 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11477 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11478 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11480 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11483 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11486 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11487 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11489 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11490 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11491 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11492 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11493 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11494 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11497 /* FIXME: use matrix-type input source selection */
11498 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11499 /* Input mixer1: only unmute Mic */
11500 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11501 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11502 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11503 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11504 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11505 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11506 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11507 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11508 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11511 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11512 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11513 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11514 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11515 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11516 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11517 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11518 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11520 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11521 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11522 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11523 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11524 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11525 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11526 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11527 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11528 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11530 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11535 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11537 * Unmute ADC0-2 and set the default input to mic-in
11539 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11541 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11542 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11543 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11546 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11548 * Note: PASD motherboards uses the Line In 2 as the input for front
11549 * panel mic (mic 2)
11551 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11555 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11561 * Set up output mixers (0x0c - 0x0e)
11563 /* set vol=0 to output mixers */
11564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11568 /* set up input amps for analog loopback */
11569 /* Amp Indices: DAC = 0, mixer = 1 */
11570 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11572 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11574 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11578 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11581 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11582 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11583 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11584 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11586 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11589 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11590 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11592 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11594 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11595 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11596 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11597 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11599 /* FIXME: use matrix-type input source selection */
11600 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11601 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11604 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11605 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11606 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11607 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11608 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11610 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11613 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11614 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11615 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11616 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11621 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11622 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11623 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11626 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11631 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11635 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11637 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11638 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11642 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11643 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11644 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11649 #ifdef CONFIG_SND_HDA_POWER_SAVE
11650 #define alc262_loopbacks alc880_loopbacks
11653 /* pcm configuration: identical with ALC880 */
11654 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11655 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11656 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11657 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11660 * BIOS auto configuration
11662 static int alc262_parse_auto_config(struct hda_codec *codec)
11664 struct alc_spec *spec = codec->spec;
11666 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11668 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11672 if (!spec->autocfg.line_outs) {
11673 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11674 spec->multiout.max_channels = 2;
11675 spec->no_analog = 1;
11678 return 0; /* can't find valid BIOS pin config */
11680 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11683 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11687 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11690 if (spec->autocfg.dig_outs) {
11691 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11692 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11694 if (spec->autocfg.dig_in_pin)
11695 spec->dig_in_nid = ALC262_DIGIN_NID;
11697 if (spec->kctls.list)
11698 add_mixer(spec, spec->kctls.list);
11700 add_verb(spec, alc262_volume_init_verbs);
11701 spec->num_mux_defs = 1;
11702 spec->input_mux = &spec->private_imux[0];
11704 err = alc_auto_add_mic_boost(codec);
11708 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11713 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11714 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11715 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11716 #define alc262_auto_init_input_src alc882_auto_init_input_src
11719 /* init callback for auto-configuration model -- overriding the default init */
11720 static void alc262_auto_init(struct hda_codec *codec)
11722 struct alc_spec *spec = codec->spec;
11723 alc262_auto_init_multi_out(codec);
11724 alc262_auto_init_hp_out(codec);
11725 alc262_auto_init_analog_input(codec);
11726 alc262_auto_init_input_src(codec);
11727 if (spec->unsol_event)
11728 alc_inithook(codec);
11732 * configuration and preset
11734 static const char *alc262_models[ALC262_MODEL_LAST] = {
11735 [ALC262_BASIC] = "basic",
11736 [ALC262_HIPPO] = "hippo",
11737 [ALC262_HIPPO_1] = "hippo_1",
11738 [ALC262_FUJITSU] = "fujitsu",
11739 [ALC262_HP_BPC] = "hp-bpc",
11740 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11741 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11742 [ALC262_HP_RP5700] = "hp-rp5700",
11743 [ALC262_BENQ_ED8] = "benq",
11744 [ALC262_BENQ_T31] = "benq-t31",
11745 [ALC262_SONY_ASSAMD] = "sony-assamd",
11746 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11747 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11748 [ALC262_ULTRA] = "ultra",
11749 [ALC262_LENOVO_3000] = "lenovo-3000",
11750 [ALC262_NEC] = "nec",
11751 [ALC262_TYAN] = "tyan",
11752 [ALC262_AUTO] = "auto",
11755 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11756 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11757 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11758 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11760 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11762 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11764 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11765 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11766 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11767 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11768 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11769 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11770 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11771 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11772 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11773 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11774 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11775 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11776 ALC262_HP_TC_T5735),
11777 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11778 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11779 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11780 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11781 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11782 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11783 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11784 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11785 #if 0 /* disable the quirk since model=auto works better in recent versions */
11786 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11787 ALC262_SONY_ASSAMD),
11789 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11790 ALC262_TOSHIBA_RX1),
11791 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11792 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11793 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11794 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11795 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11797 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11798 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11799 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11800 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11801 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11805 static struct alc_config_preset alc262_presets[] = {
11807 .mixers = { alc262_base_mixer },
11808 .init_verbs = { alc262_init_verbs },
11809 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11810 .dac_nids = alc262_dac_nids,
11812 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11813 .channel_mode = alc262_modes,
11814 .input_mux = &alc262_capture_source,
11817 .mixers = { alc262_hippo_mixer },
11818 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11819 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11820 .dac_nids = alc262_dac_nids,
11822 .dig_out_nid = ALC262_DIGOUT_NID,
11823 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11824 .channel_mode = alc262_modes,
11825 .input_mux = &alc262_capture_source,
11826 .unsol_event = alc262_hippo_unsol_event,
11827 .setup = alc262_hippo_setup,
11828 .init_hook = alc262_hippo_automute,
11830 [ALC262_HIPPO_1] = {
11831 .mixers = { alc262_hippo1_mixer },
11832 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11833 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11834 .dac_nids = alc262_dac_nids,
11836 .dig_out_nid = ALC262_DIGOUT_NID,
11837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11838 .channel_mode = alc262_modes,
11839 .input_mux = &alc262_capture_source,
11840 .unsol_event = alc262_hippo_unsol_event,
11841 .setup = alc262_hippo1_setup,
11842 .init_hook = alc262_hippo_automute,
11844 [ALC262_FUJITSU] = {
11845 .mixers = { alc262_fujitsu_mixer },
11846 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11847 alc262_fujitsu_unsol_verbs },
11848 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11849 .dac_nids = alc262_dac_nids,
11851 .dig_out_nid = ALC262_DIGOUT_NID,
11852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11853 .channel_mode = alc262_modes,
11854 .input_mux = &alc262_fujitsu_capture_source,
11855 .unsol_event = alc262_fujitsu_unsol_event,
11856 .init_hook = alc262_fujitsu_init_hook,
11858 [ALC262_HP_BPC] = {
11859 .mixers = { alc262_HP_BPC_mixer },
11860 .init_verbs = { alc262_HP_BPC_init_verbs },
11861 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11862 .dac_nids = alc262_dac_nids,
11864 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11865 .channel_mode = alc262_modes,
11866 .input_mux = &alc262_HP_capture_source,
11867 .unsol_event = alc262_hp_bpc_unsol_event,
11868 .init_hook = alc262_hp_bpc_automute,
11870 [ALC262_HP_BPC_D7000_WF] = {
11871 .mixers = { alc262_HP_BPC_WildWest_mixer },
11872 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11873 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11874 .dac_nids = alc262_dac_nids,
11876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11877 .channel_mode = alc262_modes,
11878 .input_mux = &alc262_HP_D7000_capture_source,
11879 .unsol_event = alc262_hp_wildwest_unsol_event,
11880 .init_hook = alc262_hp_wildwest_automute,
11882 [ALC262_HP_BPC_D7000_WL] = {
11883 .mixers = { alc262_HP_BPC_WildWest_mixer,
11884 alc262_HP_BPC_WildWest_option_mixer },
11885 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11886 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11887 .dac_nids = alc262_dac_nids,
11889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11890 .channel_mode = alc262_modes,
11891 .input_mux = &alc262_HP_D7000_capture_source,
11892 .unsol_event = alc262_hp_wildwest_unsol_event,
11893 .init_hook = alc262_hp_wildwest_automute,
11895 [ALC262_HP_TC_T5735] = {
11896 .mixers = { alc262_hp_t5735_mixer },
11897 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11898 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11899 .dac_nids = alc262_dac_nids,
11901 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11902 .channel_mode = alc262_modes,
11903 .input_mux = &alc262_capture_source,
11904 .unsol_event = alc_automute_amp_unsol_event,
11905 .setup = alc262_hp_t5735_setup,
11906 .init_hook = alc_automute_amp,
11908 [ALC262_HP_RP5700] = {
11909 .mixers = { alc262_hp_rp5700_mixer },
11910 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11911 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11912 .dac_nids = alc262_dac_nids,
11913 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11914 .channel_mode = alc262_modes,
11915 .input_mux = &alc262_hp_rp5700_capture_source,
11917 [ALC262_BENQ_ED8] = {
11918 .mixers = { alc262_base_mixer },
11919 .init_verbs = { alc262_init_verbs, alc262_EAPD_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,
11927 [ALC262_SONY_ASSAMD] = {
11928 .mixers = { alc262_sony_mixer },
11929 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11930 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11931 .dac_nids = alc262_dac_nids,
11933 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11934 .channel_mode = alc262_modes,
11935 .input_mux = &alc262_capture_source,
11936 .unsol_event = alc262_hippo_unsol_event,
11937 .setup = alc262_hippo_setup,
11938 .init_hook = alc262_hippo_automute,
11940 [ALC262_BENQ_T31] = {
11941 .mixers = { alc262_benq_t31_mixer },
11942 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11943 alc_hp15_unsol_verbs },
11944 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11945 .dac_nids = alc262_dac_nids,
11947 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11948 .channel_mode = alc262_modes,
11949 .input_mux = &alc262_capture_source,
11950 .unsol_event = alc262_hippo_unsol_event,
11951 .setup = alc262_hippo_setup,
11952 .init_hook = alc262_hippo_automute,
11955 .mixers = { alc262_ultra_mixer },
11956 .cap_mixer = alc262_ultra_capture_mixer,
11957 .init_verbs = { alc262_ultra_verbs },
11958 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11959 .dac_nids = alc262_dac_nids,
11960 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11961 .channel_mode = alc262_modes,
11962 .input_mux = &alc262_ultra_capture_source,
11963 .adc_nids = alc262_adc_nids, /* ADC0 */
11964 .capsrc_nids = alc262_capsrc_nids,
11965 .num_adc_nids = 1, /* single ADC */
11966 .unsol_event = alc262_ultra_unsol_event,
11967 .init_hook = alc262_ultra_automute,
11969 [ALC262_LENOVO_3000] = {
11970 .mixers = { alc262_lenovo_3000_mixer },
11971 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11972 alc262_lenovo_3000_unsol_verbs,
11973 alc262_lenovo_3000_init_verbs },
11974 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11975 .dac_nids = alc262_dac_nids,
11977 .dig_out_nid = ALC262_DIGOUT_NID,
11978 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11979 .channel_mode = alc262_modes,
11980 .input_mux = &alc262_fujitsu_capture_source,
11981 .unsol_event = alc262_lenovo_3000_unsol_event,
11984 .mixers = { alc262_nec_mixer },
11985 .init_verbs = { alc262_nec_verbs },
11986 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11987 .dac_nids = alc262_dac_nids,
11989 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11990 .channel_mode = alc262_modes,
11991 .input_mux = &alc262_capture_source,
11993 [ALC262_TOSHIBA_S06] = {
11994 .mixers = { alc262_toshiba_s06_mixer },
11995 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11996 alc262_eapd_verbs },
11997 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11998 .capsrc_nids = alc262_dmic_capsrc_nids,
11999 .dac_nids = alc262_dac_nids,
12000 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12001 .num_adc_nids = 1, /* single ADC */
12002 .dig_out_nid = ALC262_DIGOUT_NID,
12003 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12004 .channel_mode = alc262_modes,
12005 .unsol_event = alc_sku_unsol_event,
12006 .setup = alc262_toshiba_s06_setup,
12007 .init_hook = alc_inithook,
12009 [ALC262_TOSHIBA_RX1] = {
12010 .mixers = { alc262_toshiba_rx1_mixer },
12011 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12012 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12013 .dac_nids = alc262_dac_nids,
12015 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12016 .channel_mode = alc262_modes,
12017 .input_mux = &alc262_capture_source,
12018 .unsol_event = alc262_hippo_unsol_event,
12019 .setup = alc262_hippo_setup,
12020 .init_hook = alc262_hippo_automute,
12023 .mixers = { alc262_tyan_mixer },
12024 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12025 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12026 .dac_nids = alc262_dac_nids,
12028 .dig_out_nid = ALC262_DIGOUT_NID,
12029 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12030 .channel_mode = alc262_modes,
12031 .input_mux = &alc262_capture_source,
12032 .unsol_event = alc_automute_amp_unsol_event,
12033 .setup = alc262_tyan_setup,
12034 .init_hook = alc_automute_amp,
12038 static int patch_alc262(struct hda_codec *codec)
12040 struct alc_spec *spec;
12044 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12048 codec->spec = spec;
12050 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12055 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12056 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12057 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12058 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12062 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12064 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12068 if (board_config < 0) {
12069 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12071 board_config = ALC262_AUTO;
12074 if (board_config == ALC262_AUTO) {
12075 /* automatic parse from the BIOS config */
12076 err = alc262_parse_auto_config(codec);
12082 "hda_codec: Cannot set up configuration "
12083 "from BIOS. Using base mode...\n");
12084 board_config = ALC262_BASIC;
12088 if (!spec->no_analog) {
12089 err = snd_hda_attach_beep_device(codec, 0x1);
12096 if (board_config != ALC262_AUTO)
12097 setup_preset(codec, &alc262_presets[board_config]);
12099 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12100 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12102 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12103 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12105 if (!spec->adc_nids && spec->input_mux) {
12107 /* check whether the digital-mic has to be supported */
12108 for (i = 0; i < spec->input_mux->num_items; i++) {
12109 if (spec->input_mux->items[i].index >= 9)
12112 if (i < spec->input_mux->num_items) {
12113 /* use only ADC0 */
12114 spec->adc_nids = alc262_dmic_adc_nids;
12115 spec->num_adc_nids = 1;
12116 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12118 /* all analog inputs */
12119 /* check whether NID 0x07 is valid */
12120 unsigned int wcap = get_wcaps(codec, 0x07);
12123 wcap = get_wcaps_type(wcap);
12124 if (wcap != AC_WID_AUD_IN) {
12125 spec->adc_nids = alc262_adc_nids_alt;
12126 spec->num_adc_nids =
12127 ARRAY_SIZE(alc262_adc_nids_alt);
12128 spec->capsrc_nids = alc262_capsrc_nids_alt;
12130 spec->adc_nids = alc262_adc_nids;
12131 spec->num_adc_nids =
12132 ARRAY_SIZE(alc262_adc_nids);
12133 spec->capsrc_nids = alc262_capsrc_nids;
12137 if (!spec->cap_mixer && !spec->no_analog)
12138 set_capture_mixer(codec);
12139 if (!spec->no_analog)
12140 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12142 spec->vmaster_nid = 0x0c;
12144 codec->patch_ops = alc_patch_ops;
12145 if (board_config == ALC262_AUTO)
12146 spec->init_hook = alc262_auto_init;
12147 #ifdef CONFIG_SND_HDA_POWER_SAVE
12148 if (!spec->loopback.amplist)
12149 spec->loopback.amplist = alc262_loopbacks;
12156 * ALC268 channel source setting (2 channel)
12158 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12159 #define alc268_modes alc260_modes
12161 static hda_nid_t alc268_dac_nids[2] = {
12166 static hda_nid_t alc268_adc_nids[2] = {
12171 static hda_nid_t alc268_adc_nids_alt[1] = {
12176 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12178 static struct snd_kcontrol_new alc268_base_mixer[] = {
12179 /* output mixer control */
12180 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12181 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12182 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12184 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12185 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12186 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12190 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12191 /* output mixer control */
12192 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12193 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12194 ALC262_HIPPO_MASTER_SWITCH,
12195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12196 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12197 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12201 /* bind Beep switches of both NID 0x0f and 0x10 */
12202 static struct hda_bind_ctls alc268_bind_beep_sw = {
12203 .ops = &snd_hda_bind_sw,
12205 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12206 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12211 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12212 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12213 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12217 static struct hda_verb alc268_eapd_verbs[] = {
12218 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12219 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12223 /* Toshiba specific */
12224 static struct hda_verb alc268_toshiba_verbs[] = {
12225 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12229 /* Acer specific */
12230 /* bind volumes of both NID 0x02 and 0x03 */
12231 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12232 .ops = &snd_hda_bind_vol,
12234 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12235 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12240 /* mute/unmute internal speaker according to the hp jack and mute state */
12241 static void alc268_acer_automute(struct hda_codec *codec, int force)
12243 struct alc_spec *spec = codec->spec;
12246 if (force || !spec->sense_updated) {
12247 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12248 spec->sense_updated = 1;
12250 if (spec->jack_present)
12251 mute = HDA_AMP_MUTE; /* mute internal speaker */
12252 else /* unmute internal speaker if necessary */
12253 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12254 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12255 HDA_AMP_MUTE, mute);
12259 /* bind hp and internal speaker mute (with plug check) */
12260 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12261 struct snd_ctl_elem_value *ucontrol)
12263 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12264 long *valp = ucontrol->value.integer.value;
12267 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12269 alc268_acer_automute(codec, 0);
12273 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12274 /* output mixer control */
12275 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12277 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12278 .name = "Master Playback Switch",
12279 .subdevice = HDA_SUBDEV_AMP_FLAG,
12280 .info = snd_hda_mixer_amp_switch_info,
12281 .get = snd_hda_mixer_amp_switch_get,
12282 .put = alc268_acer_master_sw_put,
12283 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12285 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12289 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12290 /* output mixer control */
12291 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12293 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12294 .name = "Master Playback Switch",
12295 .subdevice = HDA_SUBDEV_AMP_FLAG,
12296 .info = snd_hda_mixer_amp_switch_info,
12297 .get = snd_hda_mixer_amp_switch_get,
12298 .put = alc268_acer_master_sw_put,
12299 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12301 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12302 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12303 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12307 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12308 /* output mixer control */
12309 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12311 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12312 .name = "Master Playback Switch",
12313 .subdevice = HDA_SUBDEV_AMP_FLAG,
12314 .info = snd_hda_mixer_amp_switch_info,
12315 .get = snd_hda_mixer_amp_switch_get,
12316 .put = alc268_acer_master_sw_put,
12317 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12319 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12320 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12324 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12325 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12327 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12329 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12330 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12334 static struct hda_verb alc268_acer_verbs[] = {
12335 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12336 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12337 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12339 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12341 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12345 /* unsolicited event for HP jack sensing */
12346 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12347 #define alc268_toshiba_setup alc262_hippo_setup
12348 #define alc268_toshiba_automute alc262_hippo_automute
12350 static void alc268_acer_unsol_event(struct hda_codec *codec,
12353 if ((res >> 26) != ALC880_HP_EVENT)
12355 alc268_acer_automute(codec, 1);
12358 static void alc268_acer_init_hook(struct hda_codec *codec)
12360 alc268_acer_automute(codec, 1);
12363 /* toggle speaker-output according to the hp-jack state */
12364 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12366 unsigned int present;
12367 unsigned char bits;
12369 present = snd_hda_jack_detect(codec, 0x15);
12370 bits = present ? AMP_IN_MUTE(0) : 0;
12371 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12372 AMP_IN_MUTE(0), bits);
12373 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12374 AMP_IN_MUTE(0), bits);
12377 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12380 switch (res >> 26) {
12381 case ALC880_HP_EVENT:
12382 alc268_aspire_one_speaker_automute(codec);
12384 case ALC880_MIC_EVENT:
12385 alc_mic_automute(codec);
12390 static void alc268_acer_lc_setup(struct hda_codec *codec)
12392 struct alc_spec *spec = codec->spec;
12393 spec->ext_mic.pin = 0x18;
12394 spec->ext_mic.mux_idx = 0;
12395 spec->int_mic.pin = 0x12;
12396 spec->int_mic.mux_idx = 6;
12397 spec->auto_mic = 1;
12400 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12402 alc268_aspire_one_speaker_automute(codec);
12403 alc_mic_automute(codec);
12406 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12407 /* output mixer control */
12408 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12409 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12410 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12411 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12413 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12417 static struct hda_verb alc268_dell_verbs[] = {
12418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12420 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12421 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12425 /* mute/unmute internal speaker according to the hp jack and mute state */
12426 static void alc268_dell_setup(struct hda_codec *codec)
12428 struct alc_spec *spec = codec->spec;
12430 spec->autocfg.hp_pins[0] = 0x15;
12431 spec->autocfg.speaker_pins[0] = 0x14;
12432 spec->ext_mic.pin = 0x18;
12433 spec->ext_mic.mux_idx = 0;
12434 spec->int_mic.pin = 0x19;
12435 spec->int_mic.mux_idx = 1;
12436 spec->auto_mic = 1;
12439 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12440 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12441 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12442 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12443 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12444 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12445 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12446 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12447 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12451 static struct hda_verb alc267_quanta_il1_verbs[] = {
12452 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12453 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12457 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12459 struct alc_spec *spec = codec->spec;
12460 spec->autocfg.hp_pins[0] = 0x15;
12461 spec->autocfg.speaker_pins[0] = 0x14;
12462 spec->ext_mic.pin = 0x18;
12463 spec->ext_mic.mux_idx = 0;
12464 spec->int_mic.pin = 0x19;
12465 spec->int_mic.mux_idx = 1;
12466 spec->auto_mic = 1;
12470 * generic initialization of ADC, input mixers and output mixers
12472 static struct hda_verb alc268_base_init_verbs[] = {
12473 /* Unmute DAC0-1 and set vol = 0 */
12474 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12475 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12478 * Set up output mixers (0x0c - 0x0e)
12480 /* set vol=0 to output mixers */
12481 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12482 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12484 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12485 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12487 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12488 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12489 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12490 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12491 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12492 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12493 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12494 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12497 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12499 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12500 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12502 /* set PCBEEP vol = 0, mute connections */
12503 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12504 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12505 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12507 /* Unmute Selector 23h,24h and set the default input to mic-in */
12509 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12510 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12511 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12512 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12518 * generic initialization of ADC, input mixers and output mixers
12520 static struct hda_verb alc268_volume_init_verbs[] = {
12521 /* set output DAC */
12522 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12523 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12525 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12526 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12527 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12528 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12529 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12531 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12533 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12535 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12536 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12538 /* set PCBEEP vol = 0, mute connections */
12539 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12540 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12541 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12546 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12547 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12548 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12552 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12553 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12554 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12559 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12560 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12561 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12562 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12563 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12568 static struct hda_input_mux alc268_capture_source = {
12572 { "Front Mic", 0x1 },
12578 static struct hda_input_mux alc268_acer_capture_source = {
12582 { "Internal Mic", 0x1 },
12587 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12591 { "Internal Mic", 0x6 },
12596 #ifdef CONFIG_SND_DEBUG
12597 static struct snd_kcontrol_new alc268_test_mixer[] = {
12598 /* Volume widgets */
12599 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12600 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12601 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12602 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12603 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12604 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12605 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12606 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12607 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12608 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12609 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12610 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12611 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12612 /* The below appears problematic on some hardwares */
12613 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12614 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12615 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12616 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12617 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12619 /* Modes for retasking pin widgets */
12620 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12621 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12622 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12623 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12625 /* Controls for GPIO pins, assuming they are configured as outputs */
12626 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12627 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12628 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12629 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12631 /* Switches to allow the digital SPDIF output pin to be enabled.
12632 * The ALC268 does not have an SPDIF input.
12634 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12636 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12637 * this output to turn on an external amplifier.
12639 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12640 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12646 /* create input playback/capture controls for the given pin */
12647 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12648 const char *ctlname, int idx)
12665 if (spec->multiout.dac_nids[0] != dac &&
12666 spec->multiout.dac_nids[1] != dac) {
12667 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12668 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12672 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12676 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12677 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12679 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12680 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12686 /* add playback controls from the parsed DAC table */
12687 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12688 const struct auto_pin_cfg *cfg)
12693 spec->multiout.dac_nids = spec->private_dac_nids;
12695 nid = cfg->line_out_pins[0];
12698 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12702 err = alc268_new_analog_output(spec, nid, name, 0);
12707 nid = cfg->speaker_pins[0];
12709 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12710 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12714 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12718 nid = cfg->hp_pins[0];
12720 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12725 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12727 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12728 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12735 /* create playback/capture controls for input pins */
12736 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12737 const struct auto_pin_cfg *cfg)
12739 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12742 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12743 hda_nid_t nid, int pin_type)
12747 alc_set_pin_output(codec, nid, pin_type);
12748 if (nid == 0x14 || nid == 0x16)
12752 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12755 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12757 struct alc_spec *spec = codec->spec;
12758 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12760 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12761 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12765 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12767 struct alc_spec *spec = codec->spec;
12770 pin = spec->autocfg.hp_pins[0];
12772 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12773 pin = spec->autocfg.speaker_pins[0];
12775 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12778 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12780 struct alc_spec *spec = codec->spec;
12781 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12782 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12783 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12784 unsigned int dac_vol1, dac_vol2;
12786 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12787 snd_hda_codec_write(codec, speaker_nid, 0,
12788 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12789 /* mute mixer inputs from 0x1d */
12790 snd_hda_codec_write(codec, 0x0f, 0,
12791 AC_VERB_SET_AMP_GAIN_MUTE,
12793 snd_hda_codec_write(codec, 0x10, 0,
12794 AC_VERB_SET_AMP_GAIN_MUTE,
12797 /* unmute mixer inputs from 0x1d */
12798 snd_hda_codec_write(codec, 0x0f, 0,
12799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12800 snd_hda_codec_write(codec, 0x10, 0,
12801 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12804 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12805 if (line_nid == 0x14)
12806 dac_vol2 = AMP_OUT_ZERO;
12807 else if (line_nid == 0x15)
12808 dac_vol1 = AMP_OUT_ZERO;
12809 if (hp_nid == 0x14)
12810 dac_vol2 = AMP_OUT_ZERO;
12811 else if (hp_nid == 0x15)
12812 dac_vol1 = AMP_OUT_ZERO;
12813 if (line_nid != 0x16 || hp_nid != 0x16 ||
12814 spec->autocfg.line_out_pins[1] != 0x16 ||
12815 spec->autocfg.line_out_pins[2] != 0x16)
12816 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12818 snd_hda_codec_write(codec, 0x02, 0,
12819 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12820 snd_hda_codec_write(codec, 0x03, 0,
12821 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12824 /* pcm configuration: identical with ALC880 */
12825 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12826 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12827 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12828 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12831 * BIOS auto configuration
12833 static int alc268_parse_auto_config(struct hda_codec *codec)
12835 struct alc_spec *spec = codec->spec;
12837 static hda_nid_t alc268_ignore[] = { 0 };
12839 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12843 if (!spec->autocfg.line_outs) {
12844 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12845 spec->multiout.max_channels = 2;
12846 spec->no_analog = 1;
12849 return 0; /* can't find valid BIOS pin config */
12851 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12854 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12858 spec->multiout.max_channels = 2;
12861 /* digital only support output */
12862 if (spec->autocfg.dig_outs) {
12863 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12864 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12866 if (spec->kctls.list)
12867 add_mixer(spec, spec->kctls.list);
12869 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12870 add_mixer(spec, alc268_beep_mixer);
12872 add_verb(spec, alc268_volume_init_verbs);
12873 spec->num_mux_defs = 2;
12874 spec->input_mux = &spec->private_imux[0];
12876 err = alc_auto_add_mic_boost(codec);
12880 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12885 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12887 /* init callback for auto-configuration model -- overriding the default init */
12888 static void alc268_auto_init(struct hda_codec *codec)
12890 struct alc_spec *spec = codec->spec;
12891 alc268_auto_init_multi_out(codec);
12892 alc268_auto_init_hp_out(codec);
12893 alc268_auto_init_mono_speaker_out(codec);
12894 alc268_auto_init_analog_input(codec);
12895 if (spec->unsol_event)
12896 alc_inithook(codec);
12900 * configuration and preset
12902 static const char *alc268_models[ALC268_MODEL_LAST] = {
12903 [ALC267_QUANTA_IL1] = "quanta-il1",
12904 [ALC268_3ST] = "3stack",
12905 [ALC268_TOSHIBA] = "toshiba",
12906 [ALC268_ACER] = "acer",
12907 [ALC268_ACER_DMIC] = "acer-dmic",
12908 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12909 [ALC268_DELL] = "dell",
12910 [ALC268_ZEPTO] = "zepto",
12911 #ifdef CONFIG_SND_DEBUG
12912 [ALC268_TEST] = "test",
12914 [ALC268_AUTO] = "auto",
12917 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12918 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12919 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12920 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12921 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12922 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12923 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12924 ALC268_ACER_ASPIRE_ONE),
12925 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12926 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12927 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12928 /* almost compatible with toshiba but with optional digital outs;
12929 * auto-probing seems working fine
12931 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12933 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12934 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12935 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12936 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12937 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12938 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12942 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12943 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12944 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12945 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12946 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12951 static struct alc_config_preset alc268_presets[] = {
12952 [ALC267_QUANTA_IL1] = {
12953 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12954 alc268_capture_nosrc_mixer },
12955 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12956 alc267_quanta_il1_verbs },
12957 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12958 .dac_nids = alc268_dac_nids,
12959 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12960 .adc_nids = alc268_adc_nids_alt,
12962 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12963 .channel_mode = alc268_modes,
12964 .unsol_event = alc_sku_unsol_event,
12965 .setup = alc267_quanta_il1_setup,
12966 .init_hook = alc_inithook,
12969 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12970 alc268_beep_mixer },
12971 .init_verbs = { alc268_base_init_verbs },
12972 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12973 .dac_nids = alc268_dac_nids,
12974 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12975 .adc_nids = alc268_adc_nids_alt,
12976 .capsrc_nids = alc268_capsrc_nids,
12978 .dig_out_nid = ALC268_DIGOUT_NID,
12979 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12980 .channel_mode = alc268_modes,
12981 .input_mux = &alc268_capture_source,
12983 [ALC268_TOSHIBA] = {
12984 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12985 alc268_beep_mixer },
12986 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12987 alc268_toshiba_verbs },
12988 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12989 .dac_nids = alc268_dac_nids,
12990 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12991 .adc_nids = alc268_adc_nids_alt,
12992 .capsrc_nids = alc268_capsrc_nids,
12994 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12995 .channel_mode = alc268_modes,
12996 .input_mux = &alc268_capture_source,
12997 .unsol_event = alc268_toshiba_unsol_event,
12998 .setup = alc268_toshiba_setup,
12999 .init_hook = alc268_toshiba_automute,
13002 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13003 alc268_beep_mixer },
13004 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13005 alc268_acer_verbs },
13006 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13007 .dac_nids = alc268_dac_nids,
13008 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13009 .adc_nids = alc268_adc_nids_alt,
13010 .capsrc_nids = alc268_capsrc_nids,
13012 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13013 .channel_mode = alc268_modes,
13014 .input_mux = &alc268_acer_capture_source,
13015 .unsol_event = alc268_acer_unsol_event,
13016 .init_hook = alc268_acer_init_hook,
13018 [ALC268_ACER_DMIC] = {
13019 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13020 alc268_beep_mixer },
13021 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13022 alc268_acer_verbs },
13023 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13024 .dac_nids = alc268_dac_nids,
13025 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13026 .adc_nids = alc268_adc_nids_alt,
13027 .capsrc_nids = alc268_capsrc_nids,
13029 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13030 .channel_mode = alc268_modes,
13031 .input_mux = &alc268_acer_dmic_capture_source,
13032 .unsol_event = alc268_acer_unsol_event,
13033 .init_hook = alc268_acer_init_hook,
13035 [ALC268_ACER_ASPIRE_ONE] = {
13036 .mixers = { alc268_acer_aspire_one_mixer,
13038 alc268_capture_nosrc_mixer },
13039 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13040 alc268_acer_aspire_one_verbs },
13041 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13042 .dac_nids = alc268_dac_nids,
13043 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13044 .adc_nids = alc268_adc_nids_alt,
13045 .capsrc_nids = alc268_capsrc_nids,
13047 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13048 .channel_mode = alc268_modes,
13049 .unsol_event = alc268_acer_lc_unsol_event,
13050 .setup = alc268_acer_lc_setup,
13051 .init_hook = alc268_acer_lc_init_hook,
13054 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13055 alc268_capture_nosrc_mixer },
13056 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13057 alc268_dell_verbs },
13058 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13059 .dac_nids = alc268_dac_nids,
13060 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13061 .adc_nids = alc268_adc_nids_alt,
13062 .capsrc_nids = alc268_capsrc_nids,
13064 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13065 .channel_mode = alc268_modes,
13066 .unsol_event = alc_sku_unsol_event,
13067 .setup = alc268_dell_setup,
13068 .init_hook = alc_inithook,
13071 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13072 alc268_beep_mixer },
13073 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13074 alc268_toshiba_verbs },
13075 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13076 .dac_nids = alc268_dac_nids,
13077 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13078 .adc_nids = alc268_adc_nids_alt,
13079 .capsrc_nids = alc268_capsrc_nids,
13081 .dig_out_nid = ALC268_DIGOUT_NID,
13082 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13083 .channel_mode = alc268_modes,
13084 .input_mux = &alc268_capture_source,
13085 .setup = alc268_toshiba_setup,
13086 .init_hook = alc268_toshiba_automute,
13088 #ifdef CONFIG_SND_DEBUG
13090 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13091 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13092 alc268_volume_init_verbs },
13093 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13094 .dac_nids = alc268_dac_nids,
13095 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13096 .adc_nids = alc268_adc_nids_alt,
13097 .capsrc_nids = alc268_capsrc_nids,
13099 .dig_out_nid = ALC268_DIGOUT_NID,
13100 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13101 .channel_mode = alc268_modes,
13102 .input_mux = &alc268_capture_source,
13107 static int patch_alc268(struct hda_codec *codec)
13109 struct alc_spec *spec;
13111 int i, has_beep, err;
13113 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13117 codec->spec = spec;
13119 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13123 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13124 board_config = snd_hda_check_board_codec_sid_config(codec,
13125 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13127 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13128 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13130 board_config = ALC268_AUTO;
13133 if (board_config == ALC268_AUTO) {
13134 /* automatic parse from the BIOS config */
13135 err = alc268_parse_auto_config(codec);
13141 "hda_codec: Cannot set up configuration "
13142 "from BIOS. Using base mode...\n");
13143 board_config = ALC268_3ST;
13147 if (board_config != ALC268_AUTO)
13148 setup_preset(codec, &alc268_presets[board_config]);
13150 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13151 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13152 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13154 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13157 for (i = 0; i < spec->num_mixers; i++) {
13158 if (spec->mixers[i] == alc268_beep_mixer) {
13165 err = snd_hda_attach_beep_device(codec, 0x1);
13170 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13171 /* override the amp caps for beep generator */
13172 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13173 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13174 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13175 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13176 (0 << AC_AMPCAP_MUTE_SHIFT));
13179 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13180 /* check whether NID 0x07 is valid */
13181 unsigned int wcap = get_wcaps(codec, 0x07);
13184 spec->capsrc_nids = alc268_capsrc_nids;
13186 wcap = get_wcaps_type(wcap);
13187 if (spec->auto_mic ||
13188 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13189 spec->adc_nids = alc268_adc_nids_alt;
13190 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13191 if (spec->auto_mic)
13192 fixup_automic_adc(codec);
13193 if (spec->auto_mic || spec->input_mux->num_items == 1)
13194 add_mixer(spec, alc268_capture_nosrc_mixer);
13196 add_mixer(spec, alc268_capture_alt_mixer);
13198 spec->adc_nids = alc268_adc_nids;
13199 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13200 add_mixer(spec, alc268_capture_mixer);
13202 /* set default input source */
13203 for (i = 0; i < spec->num_adc_nids; i++)
13204 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13205 0, AC_VERB_SET_CONNECT_SEL,
13206 i < spec->num_mux_defs ?
13207 spec->input_mux[i].items[0].index :
13208 spec->input_mux->items[0].index);
13211 spec->vmaster_nid = 0x02;
13213 codec->patch_ops = alc_patch_ops;
13214 if (board_config == ALC268_AUTO)
13215 spec->init_hook = alc268_auto_init;
13221 * ALC269 channel source setting (2 channel)
13223 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13225 #define alc269_dac_nids alc260_dac_nids
13227 static hda_nid_t alc269_adc_nids[1] = {
13232 static hda_nid_t alc269_capsrc_nids[1] = {
13236 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13240 #define alc269_modes alc260_modes
13241 #define alc269_capture_source alc880_lg_lw_capture_source
13243 static struct snd_kcontrol_new alc269_base_mixer[] = {
13244 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13245 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13246 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13247 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13251 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13252 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13253 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13255 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13259 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13260 /* output mixer control */
13261 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13263 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13264 .name = "Master Playback Switch",
13265 .subdevice = HDA_SUBDEV_AMP_FLAG,
13266 .info = snd_hda_mixer_amp_switch_info,
13267 .get = snd_hda_mixer_amp_switch_get,
13268 .put = alc268_acer_master_sw_put,
13269 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13274 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13275 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13276 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13280 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13281 /* output mixer control */
13282 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13284 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13285 .name = "Master Playback Switch",
13286 .subdevice = HDA_SUBDEV_AMP_FLAG,
13287 .info = snd_hda_mixer_amp_switch_info,
13288 .get = snd_hda_mixer_amp_switch_get,
13289 .put = alc268_acer_master_sw_put,
13290 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13293 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13294 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13295 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13296 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13297 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13298 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13299 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13300 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13304 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13305 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13306 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13307 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13308 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13312 /* capture mixer elements */
13313 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13314 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13315 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13316 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13321 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13323 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13324 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13325 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13327 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13328 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13329 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13333 static struct hda_verb alc269_lifebook_verbs[] = {
13334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13335 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13336 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13337 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13338 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13339 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13340 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13341 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13342 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13343 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13347 /* toggle speaker-output according to the hp-jack state */
13348 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13350 unsigned int present;
13351 unsigned char bits;
13353 present = snd_hda_jack_detect(codec, 0x15);
13354 bits = present ? AMP_IN_MUTE(0) : 0;
13355 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13356 AMP_IN_MUTE(0), bits);
13357 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13358 AMP_IN_MUTE(0), bits);
13360 snd_hda_codec_write(codec, 0x20, 0,
13361 AC_VERB_SET_COEF_INDEX, 0x0c);
13362 snd_hda_codec_write(codec, 0x20, 0,
13363 AC_VERB_SET_PROC_COEF, 0x680);
13365 snd_hda_codec_write(codec, 0x20, 0,
13366 AC_VERB_SET_COEF_INDEX, 0x0c);
13367 snd_hda_codec_write(codec, 0x20, 0,
13368 AC_VERB_SET_PROC_COEF, 0x480);
13371 /* toggle speaker-output according to the hp-jacks state */
13372 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13374 unsigned int present;
13375 unsigned char bits;
13377 /* Check laptop headphone socket */
13378 present = snd_hda_jack_detect(codec, 0x15);
13380 /* Check port replicator headphone socket */
13381 present |= snd_hda_jack_detect(codec, 0x1a);
13383 bits = present ? AMP_IN_MUTE(0) : 0;
13384 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13385 AMP_IN_MUTE(0), bits);
13386 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13387 AMP_IN_MUTE(0), bits);
13389 snd_hda_codec_write(codec, 0x20, 0,
13390 AC_VERB_SET_COEF_INDEX, 0x0c);
13391 snd_hda_codec_write(codec, 0x20, 0,
13392 AC_VERB_SET_PROC_COEF, 0x680);
13394 snd_hda_codec_write(codec, 0x20, 0,
13395 AC_VERB_SET_COEF_INDEX, 0x0c);
13396 snd_hda_codec_write(codec, 0x20, 0,
13397 AC_VERB_SET_PROC_COEF, 0x480);
13400 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13402 unsigned int present_laptop;
13403 unsigned int present_dock;
13405 present_laptop = snd_hda_jack_detect(codec, 0x18);
13406 present_dock = snd_hda_jack_detect(codec, 0x1b);
13408 /* Laptop mic port overrides dock mic port, design decision */
13410 snd_hda_codec_write(codec, 0x23, 0,
13411 AC_VERB_SET_CONNECT_SEL, 0x3);
13412 if (present_laptop)
13413 snd_hda_codec_write(codec, 0x23, 0,
13414 AC_VERB_SET_CONNECT_SEL, 0x0);
13415 if (!present_dock && !present_laptop)
13416 snd_hda_codec_write(codec, 0x23, 0,
13417 AC_VERB_SET_CONNECT_SEL, 0x1);
13420 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13423 switch (res >> 26) {
13424 case ALC880_HP_EVENT:
13425 alc269_quanta_fl1_speaker_automute(codec);
13427 case ALC880_MIC_EVENT:
13428 alc_mic_automute(codec);
13433 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13436 if ((res >> 26) == ALC880_HP_EVENT)
13437 alc269_lifebook_speaker_automute(codec);
13438 if ((res >> 26) == ALC880_MIC_EVENT)
13439 alc269_lifebook_mic_autoswitch(codec);
13442 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13444 struct alc_spec *spec = codec->spec;
13445 spec->ext_mic.pin = 0x18;
13446 spec->ext_mic.mux_idx = 0;
13447 spec->int_mic.pin = 0x19;
13448 spec->int_mic.mux_idx = 1;
13449 spec->auto_mic = 1;
13452 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13454 alc269_quanta_fl1_speaker_automute(codec);
13455 alc_mic_automute(codec);
13458 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13460 alc269_lifebook_speaker_automute(codec);
13461 alc269_lifebook_mic_autoswitch(codec);
13464 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13466 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13467 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13468 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13469 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13471 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13475 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13476 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13477 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13478 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13479 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13480 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13481 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13485 /* toggle speaker-output according to the hp-jack state */
13486 static void alc269_speaker_automute(struct hda_codec *codec)
13488 struct alc_spec *spec = codec->spec;
13489 unsigned int nid = spec->autocfg.hp_pins[0];
13490 unsigned int present;
13491 unsigned char bits;
13493 present = snd_hda_jack_detect(codec, nid);
13494 bits = present ? AMP_IN_MUTE(0) : 0;
13495 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13496 AMP_IN_MUTE(0), bits);
13497 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13498 AMP_IN_MUTE(0), bits);
13501 /* unsolicited event for HP jack sensing */
13502 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13505 switch (res >> 26) {
13506 case ALC880_HP_EVENT:
13507 alc269_speaker_automute(codec);
13509 case ALC880_MIC_EVENT:
13510 alc_mic_automute(codec);
13515 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13517 struct alc_spec *spec = codec->spec;
13518 spec->ext_mic.pin = 0x18;
13519 spec->ext_mic.mux_idx = 0;
13520 spec->int_mic.pin = 0x12;
13521 spec->int_mic.mux_idx = 5;
13522 spec->auto_mic = 1;
13525 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13527 struct alc_spec *spec = codec->spec;
13528 spec->ext_mic.pin = 0x18;
13529 spec->ext_mic.mux_idx = 0;
13530 spec->int_mic.pin = 0x19;
13531 spec->int_mic.mux_idx = 1;
13532 spec->auto_mic = 1;
13535 static void alc269_eeepc_inithook(struct hda_codec *codec)
13537 alc269_speaker_automute(codec);
13538 alc_mic_automute(codec);
13542 * generic initialization of ADC, input mixers and output mixers
13544 static struct hda_verb alc269_init_verbs[] = {
13546 * Unmute ADC0 and set the default input to mic-in
13548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13550 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13551 * analog-loopback mixer widget
13552 * Note: PASD motherboards uses the Line In 2 as the input for
13553 * front panel mic (mic 2)
13555 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13556 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13557 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13558 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13559 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13560 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13563 * Set up output mixers (0x0c - 0x0e)
13565 /* set vol=0 to output mixers */
13566 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13567 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13569 /* set up input amps for analog loopback */
13570 /* Amp Indices: DAC = 0, mixer = 1 */
13571 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13572 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13573 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13574 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13575 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13576 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13578 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13579 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13580 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13581 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13583 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13584 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13586 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13588 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13589 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13590 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13591 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13592 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13594 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13595 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13597 /* FIXME: use matrix-type input source selection */
13598 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13599 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13600 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13601 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13602 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13603 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13606 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13607 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13611 #define alc269_auto_create_multi_out_ctls \
13612 alc268_auto_create_multi_out_ctls
13613 #define alc269_auto_create_input_ctls \
13614 alc268_auto_create_input_ctls
13616 #ifdef CONFIG_SND_HDA_POWER_SAVE
13617 #define alc269_loopbacks alc880_loopbacks
13620 /* pcm configuration: identical with ALC880 */
13621 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13622 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13623 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13624 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13626 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13630 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13631 /* NID is set in alc_build_pcms */
13633 .open = alc880_playback_pcm_open,
13634 .prepare = alc880_playback_pcm_prepare,
13635 .cleanup = alc880_playback_pcm_cleanup
13639 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13643 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13644 /* NID is set in alc_build_pcms */
13648 * BIOS auto configuration
13650 static int alc269_parse_auto_config(struct hda_codec *codec)
13652 struct alc_spec *spec = codec->spec;
13654 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13656 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13661 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13664 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13668 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13670 if (spec->autocfg.dig_outs)
13671 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13673 if (spec->kctls.list)
13674 add_mixer(spec, spec->kctls.list);
13676 add_verb(spec, alc269_init_verbs);
13677 spec->num_mux_defs = 1;
13678 spec->input_mux = &spec->private_imux[0];
13679 /* set default input source */
13680 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13681 0, AC_VERB_SET_CONNECT_SEL,
13682 spec->input_mux->items[0].index);
13684 err = alc_auto_add_mic_boost(codec);
13688 if (!spec->cap_mixer && !spec->no_analog)
13689 set_capture_mixer(codec);
13691 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13696 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13697 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13698 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13701 /* init callback for auto-configuration model -- overriding the default init */
13702 static void alc269_auto_init(struct hda_codec *codec)
13704 struct alc_spec *spec = codec->spec;
13705 alc269_auto_init_multi_out(codec);
13706 alc269_auto_init_hp_out(codec);
13707 alc269_auto_init_analog_input(codec);
13708 if (spec->unsol_event)
13709 alc_inithook(codec);
13713 * configuration and preset
13715 static const char *alc269_models[ALC269_MODEL_LAST] = {
13716 [ALC269_BASIC] = "basic",
13717 [ALC269_QUANTA_FL1] = "quanta",
13718 [ALC269_ASUS_AMIC] = "asus-amic",
13719 [ALC269_ASUS_DMIC] = "asus-dmic",
13720 [ALC269_FUJITSU] = "fujitsu",
13721 [ALC269_LIFEBOOK] = "lifebook",
13722 [ALC269_AUTO] = "auto",
13725 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13726 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13727 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13729 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13730 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13731 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13732 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13733 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13734 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13735 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13736 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13737 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13738 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13739 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13740 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13741 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13742 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13743 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13744 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13745 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13746 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13747 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13748 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13749 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13750 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13751 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13752 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13753 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13754 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13755 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13756 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13757 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13759 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13761 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13762 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13763 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13764 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13768 static struct alc_config_preset alc269_presets[] = {
13770 .mixers = { alc269_base_mixer },
13771 .init_verbs = { alc269_init_verbs },
13772 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13773 .dac_nids = alc269_dac_nids,
13775 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13776 .channel_mode = alc269_modes,
13777 .input_mux = &alc269_capture_source,
13779 [ALC269_QUANTA_FL1] = {
13780 .mixers = { alc269_quanta_fl1_mixer },
13781 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13782 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13783 .dac_nids = alc269_dac_nids,
13785 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13786 .channel_mode = alc269_modes,
13787 .input_mux = &alc269_capture_source,
13788 .unsol_event = alc269_quanta_fl1_unsol_event,
13789 .setup = alc269_quanta_fl1_setup,
13790 .init_hook = alc269_quanta_fl1_init_hook,
13792 [ALC269_ASUS_AMIC] = {
13793 .mixers = { alc269_eeepc_mixer },
13794 .cap_mixer = alc269_epc_capture_mixer,
13795 .init_verbs = { alc269_init_verbs,
13796 alc269_eeepc_amic_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 .unsol_event = alc269_eeepc_unsol_event,
13803 .setup = alc269_eeepc_amic_setup,
13804 .init_hook = alc269_eeepc_inithook,
13806 [ALC269_ASUS_DMIC] = {
13807 .mixers = { alc269_eeepc_mixer },
13808 .cap_mixer = alc269_epc_capture_mixer,
13809 .init_verbs = { alc269_init_verbs,
13810 alc269_eeepc_dmic_init_verbs },
13811 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13812 .dac_nids = alc269_dac_nids,
13814 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13815 .channel_mode = alc269_modes,
13816 .unsol_event = alc269_eeepc_unsol_event,
13817 .setup = alc269_eeepc_dmic_setup,
13818 .init_hook = alc269_eeepc_inithook,
13820 [ALC269_FUJITSU] = {
13821 .mixers = { alc269_fujitsu_mixer },
13822 .cap_mixer = alc269_epc_capture_mixer,
13823 .init_verbs = { alc269_init_verbs,
13824 alc269_eeepc_dmic_init_verbs },
13825 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13826 .dac_nids = alc269_dac_nids,
13828 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13829 .channel_mode = alc269_modes,
13830 .unsol_event = alc269_eeepc_unsol_event,
13831 .setup = alc269_eeepc_dmic_setup,
13832 .init_hook = alc269_eeepc_inithook,
13834 [ALC269_LIFEBOOK] = {
13835 .mixers = { alc269_lifebook_mixer },
13836 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13837 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13838 .dac_nids = alc269_dac_nids,
13840 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13841 .channel_mode = alc269_modes,
13842 .input_mux = &alc269_capture_source,
13843 .unsol_event = alc269_lifebook_unsol_event,
13844 .init_hook = alc269_lifebook_init_hook,
13848 static int patch_alc269(struct hda_codec *codec)
13850 struct alc_spec *spec;
13854 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13858 codec->spec = spec;
13860 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13862 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13863 kfree(codec->chip_name);
13864 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13865 if (!codec->chip_name) {
13871 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13875 if (board_config < 0) {
13876 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13878 board_config = ALC269_AUTO;
13881 if (board_config == ALC269_AUTO) {
13882 /* automatic parse from the BIOS config */
13883 err = alc269_parse_auto_config(codec);
13889 "hda_codec: Cannot set up configuration "
13890 "from BIOS. Using base mode...\n");
13891 board_config = ALC269_BASIC;
13895 err = snd_hda_attach_beep_device(codec, 0x1);
13901 if (board_config != ALC269_AUTO)
13902 setup_preset(codec, &alc269_presets[board_config]);
13904 if (codec->subsystem_id == 0x17aa3bf8) {
13905 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13906 * fix the sample rate of analog I/O to 44.1kHz
13908 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13909 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13911 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13912 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13914 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13915 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13917 spec->adc_nids = alc269_adc_nids;
13918 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13919 spec->capsrc_nids = alc269_capsrc_nids;
13920 if (!spec->cap_mixer)
13921 set_capture_mixer(codec);
13922 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13924 spec->vmaster_nid = 0x02;
13926 codec->patch_ops = alc_patch_ops;
13927 if (board_config == ALC269_AUTO)
13928 spec->init_hook = alc269_auto_init;
13929 #ifdef CONFIG_SND_HDA_POWER_SAVE
13930 if (!spec->loopback.amplist)
13931 spec->loopback.amplist = alc269_loopbacks;
13938 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13942 * set the path ways for 2 channel output
13943 * need to set the codec line out and mic 1 pin widgets to inputs
13945 static struct hda_verb alc861_threestack_ch2_init[] = {
13946 /* set pin widget 1Ah (line in) for input */
13947 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13948 /* set pin widget 18h (mic1/2) for input, for mic also enable
13951 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13953 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13955 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13956 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13962 * need to set the codec line out and mic 1 pin widgets to outputs
13964 static struct hda_verb alc861_threestack_ch6_init[] = {
13965 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13966 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13967 /* set pin widget 18h (mic1) for output (CLFE)*/
13968 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13970 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13971 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13973 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13975 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13976 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13981 static struct hda_channel_mode alc861_threestack_modes[2] = {
13982 { 2, alc861_threestack_ch2_init },
13983 { 6, alc861_threestack_ch6_init },
13985 /* Set mic1 as input and unmute the mixer */
13986 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13987 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13988 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13991 /* Set mic1 as output and mute mixer */
13992 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13993 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13994 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13998 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13999 { 2, alc861_uniwill_m31_ch2_init },
14000 { 4, alc861_uniwill_m31_ch4_init },
14003 /* Set mic1 and line-in as input and unmute the mixer */
14004 static struct hda_verb alc861_asus_ch2_init[] = {
14005 /* set pin widget 1Ah (line in) for input */
14006 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14007 /* set pin widget 18h (mic1/2) for input, for mic also enable
14010 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14012 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
14014 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
14015 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
14019 /* Set mic1 nad line-in as output and mute mixer */
14020 static struct hda_verb alc861_asus_ch6_init[] = {
14021 /* set pin widget 1Ah (line in) for output (Back Surround)*/
14022 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14023 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14024 /* set pin widget 18h (mic1) for output (CLFE)*/
14025 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14026 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
14027 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
14028 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
14030 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
14032 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
14033 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
14038 static struct hda_channel_mode alc861_asus_modes[2] = {
14039 { 2, alc861_asus_ch2_init },
14040 { 6, alc861_asus_ch6_init },
14045 static struct snd_kcontrol_new alc861_base_mixer[] = {
14046 /* output mixer control */
14047 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14048 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14049 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14050 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14051 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14053 /*Input mixer control */
14054 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14055 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14056 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14057 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14058 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14059 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14061 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14062 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14063 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14068 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14069 /* output mixer control */
14070 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14071 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14072 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14073 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14074 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14076 /* Input mixer control */
14077 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14078 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14079 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14080 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14081 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14082 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14083 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14084 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14085 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14086 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14089 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14090 .name = "Channel Mode",
14091 .info = alc_ch_mode_info,
14092 .get = alc_ch_mode_get,
14093 .put = alc_ch_mode_put,
14094 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14099 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14100 /* output mixer control */
14101 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14103 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14108 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14109 /* output mixer control */
14110 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14111 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14112 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14113 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14114 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14116 /* Input mixer control */
14117 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14118 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14119 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14120 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14121 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14122 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14124 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14126 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14129 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14130 .name = "Channel Mode",
14131 .info = alc_ch_mode_info,
14132 .get = alc_ch_mode_get,
14133 .put = alc_ch_mode_put,
14134 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14139 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14140 /* output mixer control */
14141 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14142 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14143 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14144 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14145 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14147 /* Input mixer control */
14148 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14149 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14150 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14151 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14152 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14153 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14155 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14156 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14160 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14161 .name = "Channel Mode",
14162 .info = alc_ch_mode_info,
14163 .get = alc_ch_mode_get,
14164 .put = alc_ch_mode_put,
14165 .private_value = ARRAY_SIZE(alc861_asus_modes),
14170 /* additional mixer */
14171 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14172 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14173 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14178 * generic initialization of ADC, input mixers and output mixers
14180 static struct hda_verb alc861_base_init_verbs[] = {
14182 * Unmute ADC0 and set the default input to mic-in
14184 /* port-A for surround (rear panel) */
14185 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14186 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14187 /* port-B for mic-in (rear panel) with vref */
14188 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14189 /* port-C for line-in (rear panel) */
14190 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14191 /* port-D for Front */
14192 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14193 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14194 /* port-E for HP out (front panel) */
14195 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14196 /* route front PCM to HP */
14197 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14198 /* port-F for mic-in (front panel) with vref */
14199 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14200 /* port-G for CLFE (rear panel) */
14201 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14202 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14203 /* port-H for side (rear panel) */
14204 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14205 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14207 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14208 /* route front mic to ADC1*/
14209 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14210 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14212 /* Unmute DAC0~3 & spdif out*/
14213 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14214 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14215 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14216 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14217 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14219 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14220 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14221 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14222 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14223 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14225 /* Unmute Stereo Mixer 15 */
14226 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14228 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14229 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14231 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14232 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14233 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14234 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14235 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14236 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14237 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14238 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14239 /* hp used DAC 3 (Front) */
14240 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14241 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14246 static struct hda_verb alc861_threestack_init_verbs[] = {
14248 * Unmute ADC0 and set the default input to mic-in
14250 /* port-A for surround (rear panel) */
14251 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14252 /* port-B for mic-in (rear panel) with vref */
14253 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14254 /* port-C for line-in (rear panel) */
14255 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14256 /* port-D for Front */
14257 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14258 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14259 /* port-E for HP out (front panel) */
14260 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14261 /* route front PCM to HP */
14262 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14263 /* port-F for mic-in (front panel) with vref */
14264 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14265 /* port-G for CLFE (rear panel) */
14266 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14267 /* port-H for side (rear panel) */
14268 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14270 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14271 /* route front mic to ADC1*/
14272 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14274 /* Unmute DAC0~3 & spdif out*/
14275 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14276 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14277 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14278 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14279 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14281 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14282 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14283 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14284 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14285 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14287 /* Unmute Stereo Mixer 15 */
14288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14289 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14290 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14291 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14293 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14294 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14295 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14296 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14297 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14299 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14300 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14301 /* hp used DAC 3 (Front) */
14302 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14303 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14307 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14309 * Unmute ADC0 and set the default input to mic-in
14311 /* port-A for surround (rear panel) */
14312 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14313 /* port-B for mic-in (rear panel) with vref */
14314 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14315 /* port-C for line-in (rear panel) */
14316 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14317 /* port-D for Front */
14318 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14319 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14320 /* port-E for HP out (front panel) */
14321 /* this has to be set to VREF80 */
14322 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14323 /* route front PCM to HP */
14324 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14325 /* port-F for mic-in (front panel) with vref */
14326 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14327 /* port-G for CLFE (rear panel) */
14328 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14329 /* port-H for side (rear panel) */
14330 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14332 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14333 /* route front mic to ADC1*/
14334 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14336 /* Unmute DAC0~3 & spdif out*/
14337 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14338 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14339 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14340 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14343 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14344 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14345 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14346 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14347 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14349 /* Unmute Stereo Mixer 15 */
14350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14352 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14355 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14356 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14357 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14358 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14359 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14361 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14362 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14363 /* hp used DAC 3 (Front) */
14364 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14365 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14369 static struct hda_verb alc861_asus_init_verbs[] = {
14371 * Unmute ADC0 and set the default input to mic-in
14373 /* port-A for surround (rear panel)
14374 * according to codec#0 this is the HP jack
14376 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14377 /* route front PCM to HP */
14378 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14379 /* port-B for mic-in (rear panel) with vref */
14380 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14381 /* port-C for line-in (rear panel) */
14382 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14383 /* port-D for Front */
14384 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14385 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14386 /* port-E for HP out (front panel) */
14387 /* this has to be set to VREF80 */
14388 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14389 /* route front PCM to HP */
14390 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14391 /* port-F for mic-in (front panel) with vref */
14392 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14393 /* port-G for CLFE (rear panel) */
14394 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14395 /* port-H for side (rear panel) */
14396 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14398 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14399 /* route front mic to ADC1*/
14400 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14401 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14402 /* Unmute DAC0~3 & spdif out*/
14403 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14405 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14406 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14408 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14409 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14410 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14411 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14412 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14414 /* Unmute Stereo Mixer 15 */
14415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14422 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14423 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14428 /* hp used DAC 3 (Front) */
14429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14434 /* additional init verbs for ASUS laptops */
14435 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14436 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14437 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14442 * generic initialization of ADC, input mixers and output mixers
14444 static struct hda_verb alc861_auto_init_verbs[] = {
14446 * Unmute ADC0 and set the default input to mic-in
14448 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14451 /* Unmute DAC0~3 & spdif out*/
14452 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14453 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14454 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14455 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14458 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14459 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14460 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14461 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14462 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14464 /* Unmute Stereo Mixer 15 */
14465 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14466 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14467 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14468 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14470 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14471 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14472 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14473 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14474 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14475 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14476 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14477 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14479 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14480 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14481 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14482 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14483 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14484 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14485 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14486 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14488 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14493 static struct hda_verb alc861_toshiba_init_verbs[] = {
14494 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14499 /* toggle speaker-output according to the hp-jack state */
14500 static void alc861_toshiba_automute(struct hda_codec *codec)
14502 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14504 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14505 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14506 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14507 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14510 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14513 if ((res >> 26) == ALC880_HP_EVENT)
14514 alc861_toshiba_automute(codec);
14517 /* pcm configuration: identical with ALC880 */
14518 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14519 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14520 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14521 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14524 #define ALC861_DIGOUT_NID 0x07
14526 static struct hda_channel_mode alc861_8ch_modes[1] = {
14530 static hda_nid_t alc861_dac_nids[4] = {
14531 /* front, surround, clfe, side */
14532 0x03, 0x06, 0x05, 0x04
14535 static hda_nid_t alc660_dac_nids[3] = {
14536 /* front, clfe, surround */
14540 static hda_nid_t alc861_adc_nids[1] = {
14545 static struct hda_input_mux alc861_capture_source = {
14549 { "Front Mic", 0x3 },
14556 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14558 struct alc_spec *spec = codec->spec;
14559 hda_nid_t mix, srcs[5];
14562 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14564 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14567 for (i = 0; i < num; i++) {
14569 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14570 if (type != AC_WID_AUD_OUT)
14572 for (j = 0; j < spec->multiout.num_dacs; j++)
14573 if (spec->multiout.dac_nids[j] == srcs[i])
14575 if (j >= spec->multiout.num_dacs)
14581 /* fill in the dac_nids table from the parsed pin configuration */
14582 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14583 const struct auto_pin_cfg *cfg)
14585 struct alc_spec *spec = codec->spec;
14587 hda_nid_t nid, dac;
14589 spec->multiout.dac_nids = spec->private_dac_nids;
14590 for (i = 0; i < cfg->line_outs; i++) {
14591 nid = cfg->line_out_pins[i];
14592 dac = alc861_look_for_dac(codec, nid);
14595 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14600 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14601 hda_nid_t nid, unsigned int chs)
14603 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14604 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14607 /* add playback controls from the parsed DAC table */
14608 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14609 const struct auto_pin_cfg *cfg)
14611 struct alc_spec *spec = codec->spec;
14612 static const char *chname[4] = {
14613 "Front", "Surround", NULL /*CLFE*/, "Side"
14618 if (cfg->line_outs == 1) {
14619 const char *pfx = NULL;
14622 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14625 nid = spec->multiout.dac_nids[0];
14626 return alc861_create_out_sw(codec, pfx, nid, 3);
14630 for (i = 0; i < cfg->line_outs; i++) {
14631 nid = spec->multiout.dac_nids[i];
14636 err = alc861_create_out_sw(codec, "Center", nid, 1);
14639 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14643 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14651 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14653 struct alc_spec *spec = codec->spec;
14660 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14661 nid = alc861_look_for_dac(codec, pin);
14663 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14666 spec->multiout.hp_nid = nid;
14672 /* create playback/capture controls for input pins */
14673 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14674 const struct auto_pin_cfg *cfg)
14676 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14679 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14681 int pin_type, hda_nid_t dac)
14683 hda_nid_t mix, srcs[5];
14686 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14688 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14690 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14692 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14695 for (i = 0; i < num; i++) {
14697 if (srcs[i] == dac || srcs[i] == 0x15)
14698 mute = AMP_IN_UNMUTE(i);
14700 mute = AMP_IN_MUTE(i);
14701 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14706 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14708 struct alc_spec *spec = codec->spec;
14711 for (i = 0; i < spec->autocfg.line_outs; i++) {
14712 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14713 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14715 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14716 spec->multiout.dac_nids[i]);
14720 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14722 struct alc_spec *spec = codec->spec;
14724 if (spec->autocfg.hp_outs)
14725 alc861_auto_set_output_and_unmute(codec,
14726 spec->autocfg.hp_pins[0],
14728 spec->multiout.hp_nid);
14729 if (spec->autocfg.speaker_outs)
14730 alc861_auto_set_output_and_unmute(codec,
14731 spec->autocfg.speaker_pins[0],
14733 spec->multiout.dac_nids[0]);
14736 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14738 struct alc_spec *spec = codec->spec;
14741 for (i = 0; i < AUTO_PIN_LAST; i++) {
14742 hda_nid_t nid = spec->autocfg.input_pins[i];
14743 if (nid >= 0x0c && nid <= 0x11)
14744 alc_set_input_pin(codec, nid, i);
14748 /* parse the BIOS configuration and set up the alc_spec */
14749 /* return 1 if successful, 0 if the proper config is not found,
14750 * or a negative error code
14752 static int alc861_parse_auto_config(struct hda_codec *codec)
14754 struct alc_spec *spec = codec->spec;
14756 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14758 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14762 if (!spec->autocfg.line_outs)
14763 return 0; /* can't find valid BIOS pin config */
14765 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14768 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14771 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14774 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14778 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14780 if (spec->autocfg.dig_outs)
14781 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14783 if (spec->kctls.list)
14784 add_mixer(spec, spec->kctls.list);
14786 add_verb(spec, alc861_auto_init_verbs);
14788 spec->num_mux_defs = 1;
14789 spec->input_mux = &spec->private_imux[0];
14791 spec->adc_nids = alc861_adc_nids;
14792 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14793 set_capture_mixer(codec);
14795 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14800 /* additional initialization for auto-configuration model */
14801 static void alc861_auto_init(struct hda_codec *codec)
14803 struct alc_spec *spec = codec->spec;
14804 alc861_auto_init_multi_out(codec);
14805 alc861_auto_init_hp_out(codec);
14806 alc861_auto_init_analog_input(codec);
14807 if (spec->unsol_event)
14808 alc_inithook(codec);
14811 #ifdef CONFIG_SND_HDA_POWER_SAVE
14812 static struct hda_amp_list alc861_loopbacks[] = {
14813 { 0x15, HDA_INPUT, 0 },
14814 { 0x15, HDA_INPUT, 1 },
14815 { 0x15, HDA_INPUT, 2 },
14816 { 0x15, HDA_INPUT, 3 },
14823 * configuration and preset
14825 static const char *alc861_models[ALC861_MODEL_LAST] = {
14826 [ALC861_3ST] = "3stack",
14827 [ALC660_3ST] = "3stack-660",
14828 [ALC861_3ST_DIG] = "3stack-dig",
14829 [ALC861_6ST_DIG] = "6stack-dig",
14830 [ALC861_UNIWILL_M31] = "uniwill-m31",
14831 [ALC861_TOSHIBA] = "toshiba",
14832 [ALC861_ASUS] = "asus",
14833 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14834 [ALC861_AUTO] = "auto",
14837 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14838 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14839 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14840 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14841 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14842 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14843 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14844 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14845 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14846 * Any other models that need this preset?
14848 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14849 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14850 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14851 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14852 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14853 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14854 /* FIXME: the below seems conflict */
14855 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14856 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14857 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14861 static struct alc_config_preset alc861_presets[] = {
14863 .mixers = { alc861_3ST_mixer },
14864 .init_verbs = { alc861_threestack_init_verbs },
14865 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14866 .dac_nids = alc861_dac_nids,
14867 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14868 .channel_mode = alc861_threestack_modes,
14870 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14871 .adc_nids = alc861_adc_nids,
14872 .input_mux = &alc861_capture_source,
14874 [ALC861_3ST_DIG] = {
14875 .mixers = { alc861_base_mixer },
14876 .init_verbs = { alc861_threestack_init_verbs },
14877 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14878 .dac_nids = alc861_dac_nids,
14879 .dig_out_nid = ALC861_DIGOUT_NID,
14880 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14881 .channel_mode = alc861_threestack_modes,
14883 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14884 .adc_nids = alc861_adc_nids,
14885 .input_mux = &alc861_capture_source,
14887 [ALC861_6ST_DIG] = {
14888 .mixers = { alc861_base_mixer },
14889 .init_verbs = { alc861_base_init_verbs },
14890 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14891 .dac_nids = alc861_dac_nids,
14892 .dig_out_nid = ALC861_DIGOUT_NID,
14893 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14894 .channel_mode = alc861_8ch_modes,
14895 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14896 .adc_nids = alc861_adc_nids,
14897 .input_mux = &alc861_capture_source,
14900 .mixers = { alc861_3ST_mixer },
14901 .init_verbs = { alc861_threestack_init_verbs },
14902 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14903 .dac_nids = alc660_dac_nids,
14904 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14905 .channel_mode = alc861_threestack_modes,
14907 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14908 .adc_nids = alc861_adc_nids,
14909 .input_mux = &alc861_capture_source,
14911 [ALC861_UNIWILL_M31] = {
14912 .mixers = { alc861_uniwill_m31_mixer },
14913 .init_verbs = { alc861_uniwill_m31_init_verbs },
14914 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14915 .dac_nids = alc861_dac_nids,
14916 .dig_out_nid = ALC861_DIGOUT_NID,
14917 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14918 .channel_mode = alc861_uniwill_m31_modes,
14920 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14921 .adc_nids = alc861_adc_nids,
14922 .input_mux = &alc861_capture_source,
14924 [ALC861_TOSHIBA] = {
14925 .mixers = { alc861_toshiba_mixer },
14926 .init_verbs = { alc861_base_init_verbs,
14927 alc861_toshiba_init_verbs },
14928 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14929 .dac_nids = alc861_dac_nids,
14930 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14931 .channel_mode = alc883_3ST_2ch_modes,
14932 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14933 .adc_nids = alc861_adc_nids,
14934 .input_mux = &alc861_capture_source,
14935 .unsol_event = alc861_toshiba_unsol_event,
14936 .init_hook = alc861_toshiba_automute,
14939 .mixers = { alc861_asus_mixer },
14940 .init_verbs = { alc861_asus_init_verbs },
14941 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14942 .dac_nids = alc861_dac_nids,
14943 .dig_out_nid = ALC861_DIGOUT_NID,
14944 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14945 .channel_mode = alc861_asus_modes,
14948 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14949 .adc_nids = alc861_adc_nids,
14950 .input_mux = &alc861_capture_source,
14952 [ALC861_ASUS_LAPTOP] = {
14953 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14954 .init_verbs = { alc861_asus_init_verbs,
14955 alc861_asus_laptop_init_verbs },
14956 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14957 .dac_nids = alc861_dac_nids,
14958 .dig_out_nid = ALC861_DIGOUT_NID,
14959 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14960 .channel_mode = alc883_3ST_2ch_modes,
14962 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14963 .adc_nids = alc861_adc_nids,
14964 .input_mux = &alc861_capture_source,
14968 /* Pin config fixes */
14970 PINFIX_FSC_AMILO_PI1505,
14973 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14974 { 0x0b, 0x0221101f }, /* HP */
14975 { 0x0f, 0x90170310 }, /* speaker */
14979 static const struct alc_fixup alc861_fixups[] = {
14980 [PINFIX_FSC_AMILO_PI1505] = {
14981 .pins = alc861_fsc_amilo_pi1505_pinfix
14985 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14986 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14990 static int patch_alc861(struct hda_codec *codec)
14992 struct alc_spec *spec;
14996 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15000 codec->spec = spec;
15002 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
15006 if (board_config < 0) {
15007 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15009 board_config = ALC861_AUTO;
15012 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
15014 if (board_config == ALC861_AUTO) {
15015 /* automatic parse from the BIOS config */
15016 err = alc861_parse_auto_config(codec);
15022 "hda_codec: Cannot set up configuration "
15023 "from BIOS. Using base mode...\n");
15024 board_config = ALC861_3ST_DIG;
15028 err = snd_hda_attach_beep_device(codec, 0x23);
15034 if (board_config != ALC861_AUTO)
15035 setup_preset(codec, &alc861_presets[board_config]);
15037 spec->stream_analog_playback = &alc861_pcm_analog_playback;
15038 spec->stream_analog_capture = &alc861_pcm_analog_capture;
15040 spec->stream_digital_playback = &alc861_pcm_digital_playback;
15041 spec->stream_digital_capture = &alc861_pcm_digital_capture;
15043 if (!spec->cap_mixer)
15044 set_capture_mixer(codec);
15045 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
15047 spec->vmaster_nid = 0x03;
15049 codec->patch_ops = alc_patch_ops;
15050 if (board_config == ALC861_AUTO) {
15051 spec->init_hook = alc861_auto_init;
15052 #ifdef CONFIG_SND_HDA_POWER_SAVE
15053 spec->power_hook = alc_power_eapd;
15056 #ifdef CONFIG_SND_HDA_POWER_SAVE
15057 if (!spec->loopback.amplist)
15058 spec->loopback.amplist = alc861_loopbacks;
15065 * ALC861-VD support
15069 * In addition, an independent DAC
15071 #define ALC861VD_DIGOUT_NID 0x06
15073 static hda_nid_t alc861vd_dac_nids[4] = {
15074 /* front, surr, clfe, side surr */
15075 0x02, 0x03, 0x04, 0x05
15078 /* dac_nids for ALC660vd are in a different order - according to
15079 * Realtek's driver.
15080 * This should probably result in a different mixer for 6stack models
15081 * of ALC660vd codecs, but for now there is only 3stack mixer
15082 * - and it is the same as in 861vd.
15083 * adc_nids in ALC660vd are (is) the same as in 861vd
15085 static hda_nid_t alc660vd_dac_nids[3] = {
15086 /* front, rear, clfe, rear_surr */
15090 static hda_nid_t alc861vd_adc_nids[1] = {
15095 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15098 /* FIXME: should be a matrix-type input source selection */
15099 static struct hda_input_mux alc861vd_capture_source = {
15103 { "Front Mic", 0x1 },
15109 static struct hda_input_mux alc861vd_dallas_capture_source = {
15112 { "Ext Mic", 0x0 },
15113 { "Int Mic", 0x1 },
15117 static struct hda_input_mux alc861vd_hp_capture_source = {
15120 { "Front Mic", 0x0 },
15121 { "ATAPI Mic", 0x1 },
15128 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15135 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15136 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15137 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15138 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15139 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15146 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15147 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15148 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15149 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15150 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15154 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15155 { 6, alc861vd_6stack_ch6_init },
15156 { 8, alc861vd_6stack_ch8_init },
15159 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15161 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15162 .name = "Channel Mode",
15163 .info = alc_ch_mode_info,
15164 .get = alc_ch_mode_get,
15165 .put = alc_ch_mode_put,
15170 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15171 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15173 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15174 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15175 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15177 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15178 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15180 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15182 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15184 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15187 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15188 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15190 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15193 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15194 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15196 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15197 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15198 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15203 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15204 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15209 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15210 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15211 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15213 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15215 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15219 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15220 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15221 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15223 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15224 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15232 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15233 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15234 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15235 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15237 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15239 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15240 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15241 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15243 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15244 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15245 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15253 /* Pin assignment: Speaker=0x14, HP = 0x15,
15254 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15256 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15257 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15258 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15259 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15260 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15261 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15262 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15263 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15264 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15265 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15266 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15270 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15271 * Front Mic=0x18, ATAPI Mic = 0x19,
15273 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15274 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15275 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15277 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15278 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15279 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15280 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15281 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15287 * generic initialization of ADC, input mixers and output mixers
15289 static struct hda_verb alc861vd_volume_init_verbs[] = {
15291 * Unmute ADC0 and set the default input to mic-in
15293 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15294 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15296 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15297 * the analog-loopback mixer widget
15299 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15300 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15301 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15306 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15313 * Set up output mixers (0x02 - 0x05)
15315 /* set vol=0 to output mixers */
15316 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15317 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15318 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15319 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15321 /* set up input amps for analog loopback */
15322 /* Amp Indices: DAC = 0, mixer = 1 */
15323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15329 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15330 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15336 * 3-stack pin configuration:
15337 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15339 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15341 * Set pin mode and muting
15343 /* set front pin widgets 0x14 for output */
15344 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15345 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15346 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15348 /* Mic (rear) pin: input vref at 80% */
15349 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15350 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15351 /* Front Mic pin: input vref at 80% */
15352 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15353 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15354 /* Line In pin: input */
15355 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15356 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15357 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15358 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15359 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15360 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15361 /* CD pin widget for input */
15362 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15368 * 6-stack pin configuration:
15370 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15372 * Set pin mode and muting
15374 /* set front pin widgets 0x14 for output */
15375 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15376 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15377 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15379 /* Rear Pin: output 1 (0x0d) */
15380 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15381 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15382 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15383 /* CLFE Pin: output 2 (0x0e) */
15384 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15385 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15386 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15387 /* Side Pin: output 3 (0x0f) */
15388 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15389 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15390 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15392 /* Mic (rear) pin: input vref at 80% */
15393 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15394 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15395 /* Front Mic pin: input vref at 80% */
15396 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15397 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15398 /* Line In pin: input */
15399 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15400 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15401 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15403 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15404 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15405 /* CD pin widget for input */
15406 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15411 static struct hda_verb alc861vd_eapd_verbs[] = {
15412 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15416 static struct hda_verb alc660vd_eapd_verbs[] = {
15417 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15418 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15422 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15423 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15425 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15426 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15427 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15431 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15433 unsigned int present;
15434 unsigned char bits;
15436 present = snd_hda_jack_detect(codec, 0x18);
15437 bits = present ? HDA_AMP_MUTE : 0;
15439 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15440 HDA_AMP_MUTE, bits);
15443 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15445 struct alc_spec *spec = codec->spec;
15446 spec->autocfg.hp_pins[0] = 0x1b;
15447 spec->autocfg.speaker_pins[0] = 0x14;
15450 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15452 alc_automute_amp(codec);
15453 alc861vd_lenovo_mic_automute(codec);
15456 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15459 switch (res >> 26) {
15460 case ALC880_MIC_EVENT:
15461 alc861vd_lenovo_mic_automute(codec);
15464 alc_automute_amp_unsol_event(codec, res);
15469 static struct hda_verb alc861vd_dallas_verbs[] = {
15470 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15471 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15472 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15473 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15475 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15476 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15477 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15478 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15479 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15482 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15484 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15485 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15488 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15489 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15490 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15491 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15493 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15494 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15495 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15496 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15498 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15499 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15500 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15503 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15504 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15505 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15508 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15509 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15514 /* toggle speaker-output according to the hp-jack state */
15515 static void alc861vd_dallas_setup(struct hda_codec *codec)
15517 struct alc_spec *spec = codec->spec;
15519 spec->autocfg.hp_pins[0] = 0x15;
15520 spec->autocfg.speaker_pins[0] = 0x14;
15523 #ifdef CONFIG_SND_HDA_POWER_SAVE
15524 #define alc861vd_loopbacks alc880_loopbacks
15527 /* pcm configuration: identical with ALC880 */
15528 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15529 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15530 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15531 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15534 * configuration and preset
15536 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15537 [ALC660VD_3ST] = "3stack-660",
15538 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15539 [ALC660VD_ASUS_V1S] = "asus-v1s",
15540 [ALC861VD_3ST] = "3stack",
15541 [ALC861VD_3ST_DIG] = "3stack-digout",
15542 [ALC861VD_6ST_DIG] = "6stack-digout",
15543 [ALC861VD_LENOVO] = "lenovo",
15544 [ALC861VD_DALLAS] = "dallas",
15545 [ALC861VD_HP] = "hp",
15546 [ALC861VD_AUTO] = "auto",
15549 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15550 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15551 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15552 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15553 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15554 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15555 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15556 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15557 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15558 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15559 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15560 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15561 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15562 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15563 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15564 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15568 static struct alc_config_preset alc861vd_presets[] = {
15570 .mixers = { alc861vd_3st_mixer },
15571 .init_verbs = { alc861vd_volume_init_verbs,
15572 alc861vd_3stack_init_verbs },
15573 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15574 .dac_nids = alc660vd_dac_nids,
15575 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15576 .channel_mode = alc861vd_3stack_2ch_modes,
15577 .input_mux = &alc861vd_capture_source,
15579 [ALC660VD_3ST_DIG] = {
15580 .mixers = { alc861vd_3st_mixer },
15581 .init_verbs = { alc861vd_volume_init_verbs,
15582 alc861vd_3stack_init_verbs },
15583 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15584 .dac_nids = alc660vd_dac_nids,
15585 .dig_out_nid = ALC861VD_DIGOUT_NID,
15586 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15587 .channel_mode = alc861vd_3stack_2ch_modes,
15588 .input_mux = &alc861vd_capture_source,
15591 .mixers = { alc861vd_3st_mixer },
15592 .init_verbs = { alc861vd_volume_init_verbs,
15593 alc861vd_3stack_init_verbs },
15594 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15595 .dac_nids = alc861vd_dac_nids,
15596 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15597 .channel_mode = alc861vd_3stack_2ch_modes,
15598 .input_mux = &alc861vd_capture_source,
15600 [ALC861VD_3ST_DIG] = {
15601 .mixers = { alc861vd_3st_mixer },
15602 .init_verbs = { alc861vd_volume_init_verbs,
15603 alc861vd_3stack_init_verbs },
15604 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15605 .dac_nids = alc861vd_dac_nids,
15606 .dig_out_nid = ALC861VD_DIGOUT_NID,
15607 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15608 .channel_mode = alc861vd_3stack_2ch_modes,
15609 .input_mux = &alc861vd_capture_source,
15611 [ALC861VD_6ST_DIG] = {
15612 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15613 .init_verbs = { alc861vd_volume_init_verbs,
15614 alc861vd_6stack_init_verbs },
15615 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15616 .dac_nids = alc861vd_dac_nids,
15617 .dig_out_nid = ALC861VD_DIGOUT_NID,
15618 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15619 .channel_mode = alc861vd_6stack_modes,
15620 .input_mux = &alc861vd_capture_source,
15622 [ALC861VD_LENOVO] = {
15623 .mixers = { alc861vd_lenovo_mixer },
15624 .init_verbs = { alc861vd_volume_init_verbs,
15625 alc861vd_3stack_init_verbs,
15626 alc861vd_eapd_verbs,
15627 alc861vd_lenovo_unsol_verbs },
15628 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15629 .dac_nids = alc660vd_dac_nids,
15630 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15631 .channel_mode = alc861vd_3stack_2ch_modes,
15632 .input_mux = &alc861vd_capture_source,
15633 .unsol_event = alc861vd_lenovo_unsol_event,
15634 .setup = alc861vd_lenovo_setup,
15635 .init_hook = alc861vd_lenovo_init_hook,
15637 [ALC861VD_DALLAS] = {
15638 .mixers = { alc861vd_dallas_mixer },
15639 .init_verbs = { alc861vd_dallas_verbs },
15640 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15641 .dac_nids = alc861vd_dac_nids,
15642 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15643 .channel_mode = alc861vd_3stack_2ch_modes,
15644 .input_mux = &alc861vd_dallas_capture_source,
15645 .unsol_event = alc_automute_amp_unsol_event,
15646 .setup = alc861vd_dallas_setup,
15647 .init_hook = alc_automute_amp,
15650 .mixers = { alc861vd_hp_mixer },
15651 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15652 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15653 .dac_nids = alc861vd_dac_nids,
15654 .dig_out_nid = ALC861VD_DIGOUT_NID,
15655 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15656 .channel_mode = alc861vd_3stack_2ch_modes,
15657 .input_mux = &alc861vd_hp_capture_source,
15658 .unsol_event = alc_automute_amp_unsol_event,
15659 .setup = alc861vd_dallas_setup,
15660 .init_hook = alc_automute_amp,
15662 [ALC660VD_ASUS_V1S] = {
15663 .mixers = { alc861vd_lenovo_mixer },
15664 .init_verbs = { alc861vd_volume_init_verbs,
15665 alc861vd_3stack_init_verbs,
15666 alc861vd_eapd_verbs,
15667 alc861vd_lenovo_unsol_verbs },
15668 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15669 .dac_nids = alc660vd_dac_nids,
15670 .dig_out_nid = ALC861VD_DIGOUT_NID,
15671 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15672 .channel_mode = alc861vd_3stack_2ch_modes,
15673 .input_mux = &alc861vd_capture_source,
15674 .unsol_event = alc861vd_lenovo_unsol_event,
15675 .setup = alc861vd_lenovo_setup,
15676 .init_hook = alc861vd_lenovo_init_hook,
15681 * BIOS auto configuration
15683 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15684 const struct auto_pin_cfg *cfg)
15686 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15690 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15691 hda_nid_t nid, int pin_type, int dac_idx)
15693 alc_set_pin_output(codec, nid, pin_type);
15696 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15698 struct alc_spec *spec = codec->spec;
15701 for (i = 0; i <= HDA_SIDE; i++) {
15702 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15703 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15705 alc861vd_auto_set_output_and_unmute(codec, nid,
15711 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15713 struct alc_spec *spec = codec->spec;
15716 pin = spec->autocfg.hp_pins[0];
15717 if (pin) /* connect to front and use dac 0 */
15718 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15719 pin = spec->autocfg.speaker_pins[0];
15721 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15724 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15726 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15728 struct alc_spec *spec = codec->spec;
15731 for (i = 0; i < AUTO_PIN_LAST; i++) {
15732 hda_nid_t nid = spec->autocfg.input_pins[i];
15733 if (alc_is_input_pin(codec, nid)) {
15734 alc_set_input_pin(codec, nid, i);
15735 if (nid != ALC861VD_PIN_CD_NID &&
15736 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15737 snd_hda_codec_write(codec, nid, 0,
15738 AC_VERB_SET_AMP_GAIN_MUTE,
15744 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15746 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15747 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15749 /* add playback controls from the parsed DAC table */
15750 /* Based on ALC880 version. But ALC861VD has separate,
15751 * different NIDs for mute/unmute switch and volume control */
15752 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15753 const struct auto_pin_cfg *cfg)
15755 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15756 hda_nid_t nid_v, nid_s;
15759 for (i = 0; i < cfg->line_outs; i++) {
15760 if (!spec->multiout.dac_nids[i])
15762 nid_v = alc861vd_idx_to_mixer_vol(
15764 spec->multiout.dac_nids[i]));
15765 nid_s = alc861vd_idx_to_mixer_switch(
15767 spec->multiout.dac_nids[i]));
15771 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15773 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15777 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15779 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15783 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15785 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15789 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15791 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15797 if (cfg->line_outs == 1 &&
15798 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15805 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15806 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15810 if (cfg->line_outs == 1 &&
15811 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15813 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15814 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15823 /* add playback controls for speaker and HP outputs */
15824 /* Based on ALC880 version. But ALC861VD has separate,
15825 * different NIDs for mute/unmute switch and volume control */
15826 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15827 hda_nid_t pin, const char *pfx)
15829 hda_nid_t nid_v, nid_s;
15835 if (alc880_is_fixed_pin(pin)) {
15836 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15837 /* specify the DAC as the extra output */
15838 if (!spec->multiout.hp_nid)
15839 spec->multiout.hp_nid = nid_v;
15841 spec->multiout.extra_out_nid[0] = nid_v;
15842 /* control HP volume/switch on the output mixer amp */
15843 nid_v = alc861vd_idx_to_mixer_vol(
15844 alc880_fixed_pin_idx(pin));
15845 nid_s = alc861vd_idx_to_mixer_switch(
15846 alc880_fixed_pin_idx(pin));
15848 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15849 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15852 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15853 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15856 } else if (alc880_is_multi_pin(pin)) {
15857 /* set manual connection */
15858 /* we have only a switch on HP-out PIN */
15859 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15860 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15867 /* parse the BIOS configuration and set up the alc_spec
15868 * return 1 if successful, 0 if the proper config is not found,
15869 * or a negative error code
15870 * Based on ALC880 version - had to change it to override
15871 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15872 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15874 struct alc_spec *spec = codec->spec;
15876 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15878 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15882 if (!spec->autocfg.line_outs)
15883 return 0; /* can't find valid BIOS pin config */
15885 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15888 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15891 err = alc861vd_auto_create_extra_out(spec,
15892 spec->autocfg.speaker_pins[0],
15896 err = alc861vd_auto_create_extra_out(spec,
15897 spec->autocfg.hp_pins[0],
15901 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15905 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15907 if (spec->autocfg.dig_outs)
15908 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15910 if (spec->kctls.list)
15911 add_mixer(spec, spec->kctls.list);
15913 add_verb(spec, alc861vd_volume_init_verbs);
15915 spec->num_mux_defs = 1;
15916 spec->input_mux = &spec->private_imux[0];
15918 err = alc_auto_add_mic_boost(codec);
15922 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15927 /* additional initialization for auto-configuration model */
15928 static void alc861vd_auto_init(struct hda_codec *codec)
15930 struct alc_spec *spec = codec->spec;
15931 alc861vd_auto_init_multi_out(codec);
15932 alc861vd_auto_init_hp_out(codec);
15933 alc861vd_auto_init_analog_input(codec);
15934 alc861vd_auto_init_input_src(codec);
15935 if (spec->unsol_event)
15936 alc_inithook(codec);
15940 ALC660VD_FIX_ASUS_GPIO1
15944 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15945 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15946 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15947 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15951 static const struct alc_fixup alc861vd_fixups[] = {
15952 [ALC660VD_FIX_ASUS_GPIO1] = {
15953 .verbs = alc660vd_fix_asus_gpio1_verbs,
15957 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15958 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15962 static int patch_alc861vd(struct hda_codec *codec)
15964 struct alc_spec *spec;
15965 int err, board_config;
15967 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15971 codec->spec = spec;
15973 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15977 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15978 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15980 board_config = ALC861VD_AUTO;
15983 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15985 if (board_config == ALC861VD_AUTO) {
15986 /* automatic parse from the BIOS config */
15987 err = alc861vd_parse_auto_config(codec);
15993 "hda_codec: Cannot set up configuration "
15994 "from BIOS. Using base mode...\n");
15995 board_config = ALC861VD_3ST;
15999 err = snd_hda_attach_beep_device(codec, 0x23);
16005 if (board_config != ALC861VD_AUTO)
16006 setup_preset(codec, &alc861vd_presets[board_config]);
16008 if (codec->vendor_id == 0x10ec0660) {
16009 /* always turn on EAPD */
16010 add_verb(spec, alc660vd_eapd_verbs);
16013 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
16014 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
16016 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
16017 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
16019 if (!spec->adc_nids) {
16020 spec->adc_nids = alc861vd_adc_nids;
16021 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
16023 if (!spec->capsrc_nids)
16024 spec->capsrc_nids = alc861vd_capsrc_nids;
16026 set_capture_mixer(codec);
16027 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
16029 spec->vmaster_nid = 0x02;
16031 codec->patch_ops = alc_patch_ops;
16033 if (board_config == ALC861VD_AUTO)
16034 spec->init_hook = alc861vd_auto_init;
16035 #ifdef CONFIG_SND_HDA_POWER_SAVE
16036 if (!spec->loopback.amplist)
16037 spec->loopback.amplist = alc861vd_loopbacks;
16046 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
16047 * configuration. Each pin widget can choose any input DACs and a mixer.
16048 * Each ADC is connected from a mixer of all inputs. This makes possible
16049 * 6-channel independent captures.
16051 * In addition, an independent DAC for the multi-playback (not used in this
16054 #define ALC662_DIGOUT_NID 0x06
16055 #define ALC662_DIGIN_NID 0x0a
16057 static hda_nid_t alc662_dac_nids[4] = {
16058 /* front, rear, clfe, rear_surr */
16062 static hda_nid_t alc272_dac_nids[2] = {
16066 static hda_nid_t alc662_adc_nids[2] = {
16071 static hda_nid_t alc272_adc_nids[1] = {
16076 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16077 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16081 /* FIXME: should be a matrix-type input source selection */
16082 static struct hda_input_mux alc662_capture_source = {
16086 { "Front Mic", 0x1 },
16092 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16100 static struct hda_input_mux alc663_capture_source = {
16104 { "Front Mic", 0x1 },
16109 #if 0 /* set to 1 for testing other input sources below */
16110 static struct hda_input_mux alc272_nc10_capture_source = {
16113 { "Autoselect Mic", 0x0 },
16114 { "Internal Mic", 0x1 },
16115 { "In-0x02", 0x2 },
16116 { "In-0x03", 0x3 },
16117 { "In-0x04", 0x4 },
16118 { "In-0x05", 0x5 },
16119 { "In-0x06", 0x6 },
16120 { "In-0x07", 0x7 },
16121 { "In-0x08", 0x8 },
16122 { "In-0x09", 0x9 },
16123 { "In-0x0a", 0x0a },
16124 { "In-0x0b", 0x0b },
16125 { "In-0x0c", 0x0c },
16126 { "In-0x0d", 0x0d },
16127 { "In-0x0e", 0x0e },
16128 { "In-0x0f", 0x0f },
16136 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16143 static struct hda_verb alc662_3ST_ch2_init[] = {
16144 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16145 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16146 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16147 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16154 static struct hda_verb alc662_3ST_ch6_init[] = {
16155 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16156 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16157 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16158 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16159 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16160 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16164 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16165 { 2, alc662_3ST_ch2_init },
16166 { 6, alc662_3ST_ch6_init },
16172 static struct hda_verb alc662_sixstack_ch6_init[] = {
16173 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16174 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16175 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16182 static struct hda_verb alc662_sixstack_ch8_init[] = {
16183 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16184 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16185 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16189 static struct hda_channel_mode alc662_5stack_modes[2] = {
16190 { 2, alc662_sixstack_ch6_init },
16191 { 6, alc662_sixstack_ch8_init },
16194 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16195 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16198 static struct snd_kcontrol_new alc662_base_mixer[] = {
16199 /* output mixer control */
16200 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16201 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16202 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16203 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16204 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16205 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16206 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16207 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16210 /*Input mixer control */
16211 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16212 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16213 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16214 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16215 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16216 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16218 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16222 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16223 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16224 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16225 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16228 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16229 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16230 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16231 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16237 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16238 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16239 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16240 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16241 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16242 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16243 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16244 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16245 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16246 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16247 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16248 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16250 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16252 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16258 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16259 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16260 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16261 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16262 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16271 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16272 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16273 ALC262_HIPPO_MASTER_SWITCH,
16275 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16276 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16277 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16279 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16280 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16281 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16285 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16286 ALC262_HIPPO_MASTER_SWITCH,
16287 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16288 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16289 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16290 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16291 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
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, 0x0, HDA_INPUT),
16295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16299 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16300 .ops = &snd_hda_bind_vol,
16302 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16303 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16308 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16309 .ops = &snd_hda_bind_sw,
16311 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16312 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16317 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16318 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16319 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16320 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16321 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16325 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16326 .ops = &snd_hda_bind_sw,
16328 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16329 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16330 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16335 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16336 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16337 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16338 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16339 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16340 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16341 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16346 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16347 .ops = &snd_hda_bind_sw,
16349 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16350 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16351 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16356 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16357 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16358 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16361 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16362 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16366 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16367 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16368 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16369 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16370 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16371 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16372 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16373 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16377 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16378 .ops = &snd_hda_bind_vol,
16380 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16381 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16386 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16387 .ops = &snd_hda_bind_sw,
16389 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16390 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16395 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16396 HDA_BIND_VOL("Master Playback Volume",
16397 &alc663_asus_two_bind_master_vol),
16398 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16399 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16400 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16406 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16407 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16408 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16409 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16410 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16412 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16416 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16417 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16418 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16419 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16420 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16421 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16423 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16424 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16425 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16426 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16430 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16431 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16432 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16433 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16437 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16438 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16439 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16440 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16444 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16445 .ops = &snd_hda_bind_sw,
16447 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16448 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16449 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16450 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16451 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16456 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16457 .ops = &snd_hda_bind_sw,
16459 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16460 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16465 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16466 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16467 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16468 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16469 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16470 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16471 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16472 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16473 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16474 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16478 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16479 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16480 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16481 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16482 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16483 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16484 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16485 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16490 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16493 .name = "Channel Mode",
16494 .info = alc_ch_mode_info,
16495 .get = alc_ch_mode_get,
16496 .put = alc_ch_mode_put,
16501 static struct hda_verb alc662_init_verbs[] = {
16502 /* ADC: mute amp left and right */
16503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16504 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16505 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16511 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16516 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16517 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16518 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16520 /* Front Pin: output 0 (0x0c) */
16521 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16522 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16524 /* Rear Pin: output 1 (0x0d) */
16525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16526 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16528 /* CLFE Pin: output 2 (0x0e) */
16529 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16530 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16532 /* Mic (rear) pin: input vref at 80% */
16533 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16534 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16535 /* Front Mic pin: input vref at 80% */
16536 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16537 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16538 /* Line In pin: input */
16539 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16541 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16542 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16543 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16544 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16545 /* CD pin widget for input */
16546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16548 /* FIXME: use matrix-type input source selection */
16549 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16554 /* always trun on EAPD */
16555 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16556 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16561 static struct hda_verb alc662_sue_init_verbs[] = {
16562 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16563 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16567 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16568 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16573 /* Set Unsolicited Event*/
16574 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16576 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16581 * generic initialization of ADC, input mixers and output mixers
16583 static struct hda_verb alc662_auto_init_verbs[] = {
16585 * Unmute ADC and set the default input to mic-in
16587 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16588 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16590 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16592 * Note: PASD motherboards uses the Line In 2 as the input for front
16593 * panel mic (mic 2)
16595 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16596 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16597 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16598 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16599 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16600 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16603 * Set up output mixers (0x0c - 0x0f)
16605 /* set vol=0 to output mixers */
16606 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16607 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16608 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16610 /* set up input amps for analog loopback */
16611 /* Amp Indices: DAC = 0, mixer = 1 */
16612 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16613 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16614 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16615 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16616 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16617 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16620 /* FIXME: use matrix-type input source selection */
16621 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16623 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16624 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16628 /* additional verbs for ALC663 */
16629 static struct hda_verb alc663_auto_init_verbs[] = {
16630 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16631 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16635 static struct hda_verb alc663_m51va_init_verbs[] = {
16636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16637 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16638 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16639 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16640 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16643 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16644 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16648 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16649 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16650 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16651 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16653 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16654 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16655 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16659 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16660 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16661 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16662 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16663 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16664 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16666 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16667 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16671 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16672 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16673 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16674 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16675 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16676 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16677 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16678 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16682 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16683 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16684 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16685 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16686 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16689 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16690 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16691 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16692 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16693 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16694 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16698 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16699 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16701 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16702 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16703 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16704 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16705 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16708 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16709 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16710 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16714 static struct hda_verb alc663_g71v_init_verbs[] = {
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, 0x01}, */ /* Headphone */
16719 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16720 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16721 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16723 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16724 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16725 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16729 static struct hda_verb alc663_g50v_init_verbs[] = {
16730 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16731 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16732 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16734 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16735 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16739 static struct hda_verb alc662_ecs_init_verbs[] = {
16740 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16741 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16742 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16743 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16747 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16748 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16749 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16750 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16751 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16752 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16753 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16754 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16755 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16756 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16757 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16758 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16762 static struct hda_verb alc272_dell_init_verbs[] = {
16763 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16764 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16765 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16767 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16768 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16769 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16770 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16771 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16772 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16773 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16777 static struct hda_verb alc663_mode7_init_verbs[] = {
16778 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16779 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16780 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16781 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16782 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16783 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16784 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16785 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16786 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16787 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16788 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16789 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16790 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16791 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16792 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16796 static struct hda_verb alc663_mode8_init_verbs[] = {
16797 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16798 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16799 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16800 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16801 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16802 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16803 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16804 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16805 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16806 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16807 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16808 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16809 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16810 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16811 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16812 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16816 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16817 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16818 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16822 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16823 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16824 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16828 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16830 unsigned int present;
16831 unsigned char bits;
16833 present = snd_hda_jack_detect(codec, 0x14);
16834 bits = present ? HDA_AMP_MUTE : 0;
16836 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16837 HDA_AMP_MUTE, bits);
16840 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16842 unsigned int present;
16843 unsigned char bits;
16845 present = snd_hda_jack_detect(codec, 0x1b);
16846 bits = present ? HDA_AMP_MUTE : 0;
16848 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16849 HDA_AMP_MUTE, bits);
16850 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16851 HDA_AMP_MUTE, bits);
16854 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16857 if ((res >> 26) == ALC880_HP_EVENT)
16858 alc662_lenovo_101e_all_automute(codec);
16859 if ((res >> 26) == ALC880_FRONT_EVENT)
16860 alc662_lenovo_101e_ispeaker_automute(codec);
16863 /* unsolicited event for HP jack sensing */
16864 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16867 if ((res >> 26) == ALC880_MIC_EVENT)
16868 alc_mic_automute(codec);
16870 alc262_hippo_unsol_event(codec, res);
16873 static void alc662_eeepc_setup(struct hda_codec *codec)
16875 struct alc_spec *spec = codec->spec;
16877 alc262_hippo1_setup(codec);
16878 spec->ext_mic.pin = 0x18;
16879 spec->ext_mic.mux_idx = 0;
16880 spec->int_mic.pin = 0x19;
16881 spec->int_mic.mux_idx = 1;
16882 spec->auto_mic = 1;
16885 static void alc662_eeepc_inithook(struct hda_codec *codec)
16887 alc262_hippo_automute(codec);
16888 alc_mic_automute(codec);
16891 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16893 struct alc_spec *spec = codec->spec;
16895 spec->autocfg.hp_pins[0] = 0x14;
16896 spec->autocfg.speaker_pins[0] = 0x1b;
16899 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16901 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16903 unsigned int present;
16904 unsigned char bits;
16906 present = snd_hda_jack_detect(codec, 0x21);
16907 bits = present ? HDA_AMP_MUTE : 0;
16908 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16909 AMP_IN_MUTE(0), bits);
16910 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16911 AMP_IN_MUTE(0), bits);
16914 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16916 unsigned int present;
16917 unsigned char bits;
16919 present = snd_hda_jack_detect(codec, 0x21);
16920 bits = present ? HDA_AMP_MUTE : 0;
16921 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16922 AMP_IN_MUTE(0), bits);
16923 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16924 AMP_IN_MUTE(0), bits);
16925 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16926 AMP_IN_MUTE(0), bits);
16927 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16928 AMP_IN_MUTE(0), bits);
16931 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16933 unsigned int present;
16934 unsigned char bits;
16936 present = snd_hda_jack_detect(codec, 0x15);
16937 bits = present ? HDA_AMP_MUTE : 0;
16938 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16939 AMP_IN_MUTE(0), bits);
16940 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16941 AMP_IN_MUTE(0), bits);
16942 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16943 AMP_IN_MUTE(0), bits);
16944 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16945 AMP_IN_MUTE(0), bits);
16948 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16950 unsigned int present;
16951 unsigned char bits;
16953 present = snd_hda_jack_detect(codec, 0x1b);
16954 bits = present ? 0 : PIN_OUT;
16955 snd_hda_codec_write(codec, 0x14, 0,
16956 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16959 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16961 unsigned int present1, present2;
16963 present1 = snd_hda_jack_detect(codec, 0x21);
16964 present2 = snd_hda_jack_detect(codec, 0x15);
16966 if (present1 || present2) {
16967 snd_hda_codec_write_cache(codec, 0x14, 0,
16968 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16970 snd_hda_codec_write_cache(codec, 0x14, 0,
16971 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16975 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16977 unsigned int present1, present2;
16979 present1 = snd_hda_jack_detect(codec, 0x1b);
16980 present2 = snd_hda_jack_detect(codec, 0x15);
16982 if (present1 || present2) {
16983 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16984 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16985 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16986 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16988 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16989 AMP_IN_MUTE(0), 0);
16990 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16991 AMP_IN_MUTE(0), 0);
16995 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16997 unsigned int present1, present2;
16999 present1 = snd_hda_codec_read(codec, 0x1b, 0,
17000 AC_VERB_GET_PIN_SENSE, 0)
17001 & AC_PINSENSE_PRESENCE;
17002 present2 = snd_hda_codec_read(codec, 0x21, 0,
17003 AC_VERB_GET_PIN_SENSE, 0)
17004 & AC_PINSENSE_PRESENCE;
17006 if (present1 || present2) {
17007 snd_hda_codec_write_cache(codec, 0x14, 0,
17008 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17009 snd_hda_codec_write_cache(codec, 0x17, 0,
17010 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17012 snd_hda_codec_write_cache(codec, 0x14, 0,
17013 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17014 snd_hda_codec_write_cache(codec, 0x17, 0,
17015 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17019 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
17021 unsigned int present1, present2;
17023 present1 = snd_hda_codec_read(codec, 0x21, 0,
17024 AC_VERB_GET_PIN_SENSE, 0)
17025 & AC_PINSENSE_PRESENCE;
17026 present2 = snd_hda_codec_read(codec, 0x15, 0,
17027 AC_VERB_GET_PIN_SENSE, 0)
17028 & AC_PINSENSE_PRESENCE;
17030 if (present1 || present2) {
17031 snd_hda_codec_write_cache(codec, 0x14, 0,
17032 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17033 snd_hda_codec_write_cache(codec, 0x17, 0,
17034 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
17036 snd_hda_codec_write_cache(codec, 0x14, 0,
17037 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17038 snd_hda_codec_write_cache(codec, 0x17, 0,
17039 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
17043 static void alc663_m51va_unsol_event(struct hda_codec *codec,
17046 switch (res >> 26) {
17047 case ALC880_HP_EVENT:
17048 alc663_m51va_speaker_automute(codec);
17050 case ALC880_MIC_EVENT:
17051 alc_mic_automute(codec);
17056 static void alc663_m51va_setup(struct hda_codec *codec)
17058 struct alc_spec *spec = codec->spec;
17059 spec->ext_mic.pin = 0x18;
17060 spec->ext_mic.mux_idx = 0;
17061 spec->int_mic.pin = 0x12;
17062 spec->int_mic.mux_idx = 9;
17063 spec->auto_mic = 1;
17066 static void alc663_m51va_inithook(struct hda_codec *codec)
17068 alc663_m51va_speaker_automute(codec);
17069 alc_mic_automute(codec);
17072 /* ***************** Mode1 ******************************/
17073 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17075 static void alc663_mode1_setup(struct hda_codec *codec)
17077 struct alc_spec *spec = codec->spec;
17078 spec->ext_mic.pin = 0x18;
17079 spec->ext_mic.mux_idx = 0;
17080 spec->int_mic.pin = 0x19;
17081 spec->int_mic.mux_idx = 1;
17082 spec->auto_mic = 1;
17085 #define alc663_mode1_inithook alc663_m51va_inithook
17087 /* ***************** Mode2 ******************************/
17088 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17091 switch (res >> 26) {
17092 case ALC880_HP_EVENT:
17093 alc662_f5z_speaker_automute(codec);
17095 case ALC880_MIC_EVENT:
17096 alc_mic_automute(codec);
17101 #define alc662_mode2_setup alc663_mode1_setup
17103 static void alc662_mode2_inithook(struct hda_codec *codec)
17105 alc662_f5z_speaker_automute(codec);
17106 alc_mic_automute(codec);
17108 /* ***************** Mode3 ******************************/
17109 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17112 switch (res >> 26) {
17113 case ALC880_HP_EVENT:
17114 alc663_two_hp_m1_speaker_automute(codec);
17116 case ALC880_MIC_EVENT:
17117 alc_mic_automute(codec);
17122 #define alc663_mode3_setup alc663_mode1_setup
17124 static void alc663_mode3_inithook(struct hda_codec *codec)
17126 alc663_two_hp_m1_speaker_automute(codec);
17127 alc_mic_automute(codec);
17129 /* ***************** Mode4 ******************************/
17130 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17133 switch (res >> 26) {
17134 case ALC880_HP_EVENT:
17135 alc663_21jd_two_speaker_automute(codec);
17137 case ALC880_MIC_EVENT:
17138 alc_mic_automute(codec);
17143 #define alc663_mode4_setup alc663_mode1_setup
17145 static void alc663_mode4_inithook(struct hda_codec *codec)
17147 alc663_21jd_two_speaker_automute(codec);
17148 alc_mic_automute(codec);
17150 /* ***************** Mode5 ******************************/
17151 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17154 switch (res >> 26) {
17155 case ALC880_HP_EVENT:
17156 alc663_15jd_two_speaker_automute(codec);
17158 case ALC880_MIC_EVENT:
17159 alc_mic_automute(codec);
17164 #define alc663_mode5_setup alc663_mode1_setup
17166 static void alc663_mode5_inithook(struct hda_codec *codec)
17168 alc663_15jd_two_speaker_automute(codec);
17169 alc_mic_automute(codec);
17171 /* ***************** Mode6 ******************************/
17172 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17175 switch (res >> 26) {
17176 case ALC880_HP_EVENT:
17177 alc663_two_hp_m2_speaker_automute(codec);
17179 case ALC880_MIC_EVENT:
17180 alc_mic_automute(codec);
17185 #define alc663_mode6_setup alc663_mode1_setup
17187 static void alc663_mode6_inithook(struct hda_codec *codec)
17189 alc663_two_hp_m2_speaker_automute(codec);
17190 alc_mic_automute(codec);
17193 /* ***************** Mode7 ******************************/
17194 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17197 switch (res >> 26) {
17198 case ALC880_HP_EVENT:
17199 alc663_two_hp_m7_speaker_automute(codec);
17201 case ALC880_MIC_EVENT:
17202 alc_mic_automute(codec);
17207 #define alc663_mode7_setup alc663_mode1_setup
17209 static void alc663_mode7_inithook(struct hda_codec *codec)
17211 alc663_two_hp_m7_speaker_automute(codec);
17212 alc_mic_automute(codec);
17215 /* ***************** Mode8 ******************************/
17216 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17219 switch (res >> 26) {
17220 case ALC880_HP_EVENT:
17221 alc663_two_hp_m8_speaker_automute(codec);
17223 case ALC880_MIC_EVENT:
17224 alc_mic_automute(codec);
17229 #define alc663_mode8_setup alc663_m51va_setup
17231 static void alc663_mode8_inithook(struct hda_codec *codec)
17233 alc663_two_hp_m8_speaker_automute(codec);
17234 alc_mic_automute(codec);
17237 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17239 unsigned int present;
17240 unsigned char bits;
17242 present = snd_hda_jack_detect(codec, 0x21);
17243 bits = present ? HDA_AMP_MUTE : 0;
17244 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17245 HDA_AMP_MUTE, bits);
17246 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17247 HDA_AMP_MUTE, bits);
17250 static void alc663_g71v_front_automute(struct hda_codec *codec)
17252 unsigned int present;
17253 unsigned char bits;
17255 present = snd_hda_jack_detect(codec, 0x15);
17256 bits = present ? HDA_AMP_MUTE : 0;
17257 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17258 HDA_AMP_MUTE, bits);
17261 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17264 switch (res >> 26) {
17265 case ALC880_HP_EVENT:
17266 alc663_g71v_hp_automute(codec);
17268 case ALC880_FRONT_EVENT:
17269 alc663_g71v_front_automute(codec);
17271 case ALC880_MIC_EVENT:
17272 alc_mic_automute(codec);
17277 #define alc663_g71v_setup alc663_m51va_setup
17279 static void alc663_g71v_inithook(struct hda_codec *codec)
17281 alc663_g71v_front_automute(codec);
17282 alc663_g71v_hp_automute(codec);
17283 alc_mic_automute(codec);
17286 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17289 switch (res >> 26) {
17290 case ALC880_HP_EVENT:
17291 alc663_m51va_speaker_automute(codec);
17293 case ALC880_MIC_EVENT:
17294 alc_mic_automute(codec);
17299 #define alc663_g50v_setup alc663_m51va_setup
17301 static void alc663_g50v_inithook(struct hda_codec *codec)
17303 alc663_m51va_speaker_automute(codec);
17304 alc_mic_automute(codec);
17307 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17308 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17309 ALC262_HIPPO_MASTER_SWITCH,
17311 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17312 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17313 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17315 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17316 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17317 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17321 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17322 /* Master Playback automatically created from Speaker and Headphone */
17323 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17324 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17325 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17328 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17329 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17330 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17332 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17333 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17334 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17338 #ifdef CONFIG_SND_HDA_POWER_SAVE
17339 #define alc662_loopbacks alc880_loopbacks
17343 /* pcm configuration: identical with ALC880 */
17344 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17345 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17346 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17347 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17350 * configuration and preset
17352 static const char *alc662_models[ALC662_MODEL_LAST] = {
17353 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17354 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17355 [ALC662_3ST_6ch] = "3stack-6ch",
17356 [ALC662_5ST_DIG] = "6stack-dig",
17357 [ALC662_LENOVO_101E] = "lenovo-101e",
17358 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17359 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17360 [ALC662_ECS] = "ecs",
17361 [ALC663_ASUS_M51VA] = "m51va",
17362 [ALC663_ASUS_G71V] = "g71v",
17363 [ALC663_ASUS_H13] = "h13",
17364 [ALC663_ASUS_G50V] = "g50v",
17365 [ALC663_ASUS_MODE1] = "asus-mode1",
17366 [ALC662_ASUS_MODE2] = "asus-mode2",
17367 [ALC663_ASUS_MODE3] = "asus-mode3",
17368 [ALC663_ASUS_MODE4] = "asus-mode4",
17369 [ALC663_ASUS_MODE5] = "asus-mode5",
17370 [ALC663_ASUS_MODE6] = "asus-mode6",
17371 [ALC663_ASUS_MODE7] = "asus-mode7",
17372 [ALC663_ASUS_MODE8] = "asus-mode8",
17373 [ALC272_DELL] = "dell",
17374 [ALC272_DELL_ZM1] = "dell-zm1",
17375 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17376 [ALC662_AUTO] = "auto",
17379 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17380 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17381 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17382 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17383 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17384 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17385 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17386 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17387 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17388 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17389 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17390 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17391 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17392 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17393 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17394 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17395 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17396 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17397 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17398 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17399 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17400 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17401 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17402 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17403 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17404 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17405 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17406 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17407 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17408 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17409 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17410 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17411 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17412 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17413 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17414 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17415 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17416 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17417 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17418 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17419 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17420 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17421 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17422 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17423 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17424 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17425 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17426 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17427 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17428 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17429 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17430 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17431 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17432 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17433 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17434 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17435 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17436 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17437 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17438 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17439 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17440 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17441 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17442 ALC662_3ST_6ch_DIG),
17443 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17444 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17445 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17446 ALC662_3ST_6ch_DIG),
17447 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17448 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17449 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17450 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17451 ALC662_3ST_6ch_DIG),
17452 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17454 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17458 static struct alc_config_preset alc662_presets[] = {
17459 [ALC662_3ST_2ch_DIG] = {
17460 .mixers = { alc662_3ST_2ch_mixer },
17461 .init_verbs = { alc662_init_verbs },
17462 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17463 .dac_nids = alc662_dac_nids,
17464 .dig_out_nid = ALC662_DIGOUT_NID,
17465 .dig_in_nid = ALC662_DIGIN_NID,
17466 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17467 .channel_mode = alc662_3ST_2ch_modes,
17468 .input_mux = &alc662_capture_source,
17470 [ALC662_3ST_6ch_DIG] = {
17471 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17472 .init_verbs = { alc662_init_verbs },
17473 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17474 .dac_nids = alc662_dac_nids,
17475 .dig_out_nid = ALC662_DIGOUT_NID,
17476 .dig_in_nid = ALC662_DIGIN_NID,
17477 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17478 .channel_mode = alc662_3ST_6ch_modes,
17480 .input_mux = &alc662_capture_source,
17482 [ALC662_3ST_6ch] = {
17483 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17484 .init_verbs = { alc662_init_verbs },
17485 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17486 .dac_nids = alc662_dac_nids,
17487 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17488 .channel_mode = alc662_3ST_6ch_modes,
17490 .input_mux = &alc662_capture_source,
17492 [ALC662_5ST_DIG] = {
17493 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17494 .init_verbs = { alc662_init_verbs },
17495 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .dig_out_nid = ALC662_DIGOUT_NID,
17498 .dig_in_nid = ALC662_DIGIN_NID,
17499 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17500 .channel_mode = alc662_5stack_modes,
17501 .input_mux = &alc662_capture_source,
17503 [ALC662_LENOVO_101E] = {
17504 .mixers = { alc662_lenovo_101e_mixer },
17505 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17507 .dac_nids = alc662_dac_nids,
17508 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17509 .channel_mode = alc662_3ST_2ch_modes,
17510 .input_mux = &alc662_lenovo_101e_capture_source,
17511 .unsol_event = alc662_lenovo_101e_unsol_event,
17512 .init_hook = alc662_lenovo_101e_all_automute,
17514 [ALC662_ASUS_EEEPC_P701] = {
17515 .mixers = { alc662_eeepc_p701_mixer },
17516 .init_verbs = { alc662_init_verbs,
17517 alc662_eeepc_sue_init_verbs },
17518 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17519 .dac_nids = alc662_dac_nids,
17520 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17521 .channel_mode = alc662_3ST_2ch_modes,
17522 .unsol_event = alc662_eeepc_unsol_event,
17523 .setup = alc662_eeepc_setup,
17524 .init_hook = alc662_eeepc_inithook,
17526 [ALC662_ASUS_EEEPC_EP20] = {
17527 .mixers = { alc662_eeepc_ep20_mixer,
17528 alc662_chmode_mixer },
17529 .init_verbs = { alc662_init_verbs,
17530 alc662_eeepc_ep20_sue_init_verbs },
17531 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17532 .dac_nids = alc662_dac_nids,
17533 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17534 .channel_mode = alc662_3ST_6ch_modes,
17535 .input_mux = &alc662_lenovo_101e_capture_source,
17536 .unsol_event = alc662_eeepc_unsol_event,
17537 .setup = alc662_eeepc_ep20_setup,
17538 .init_hook = alc662_eeepc_ep20_inithook,
17541 .mixers = { alc662_ecs_mixer },
17542 .init_verbs = { alc662_init_verbs,
17543 alc662_ecs_init_verbs },
17544 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17545 .dac_nids = alc662_dac_nids,
17546 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17547 .channel_mode = alc662_3ST_2ch_modes,
17548 .unsol_event = alc662_eeepc_unsol_event,
17549 .setup = alc662_eeepc_setup,
17550 .init_hook = alc662_eeepc_inithook,
17552 [ALC663_ASUS_M51VA] = {
17553 .mixers = { alc663_m51va_mixer },
17554 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17555 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17556 .dac_nids = alc662_dac_nids,
17557 .dig_out_nid = ALC662_DIGOUT_NID,
17558 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17559 .channel_mode = alc662_3ST_2ch_modes,
17560 .unsol_event = alc663_m51va_unsol_event,
17561 .setup = alc663_m51va_setup,
17562 .init_hook = alc663_m51va_inithook,
17564 [ALC663_ASUS_G71V] = {
17565 .mixers = { alc663_g71v_mixer },
17566 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17567 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17568 .dac_nids = alc662_dac_nids,
17569 .dig_out_nid = ALC662_DIGOUT_NID,
17570 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17571 .channel_mode = alc662_3ST_2ch_modes,
17572 .unsol_event = alc663_g71v_unsol_event,
17573 .setup = alc663_g71v_setup,
17574 .init_hook = alc663_g71v_inithook,
17576 [ALC663_ASUS_H13] = {
17577 .mixers = { alc663_m51va_mixer },
17578 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17579 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17580 .dac_nids = alc662_dac_nids,
17581 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17582 .channel_mode = alc662_3ST_2ch_modes,
17583 .unsol_event = alc663_m51va_unsol_event,
17584 .init_hook = alc663_m51va_inithook,
17586 [ALC663_ASUS_G50V] = {
17587 .mixers = { alc663_g50v_mixer },
17588 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17589 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17590 .dac_nids = alc662_dac_nids,
17591 .dig_out_nid = ALC662_DIGOUT_NID,
17592 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17593 .channel_mode = alc662_3ST_6ch_modes,
17594 .input_mux = &alc663_capture_source,
17595 .unsol_event = alc663_g50v_unsol_event,
17596 .setup = alc663_g50v_setup,
17597 .init_hook = alc663_g50v_inithook,
17599 [ALC663_ASUS_MODE1] = {
17600 .mixers = { alc663_m51va_mixer },
17601 .cap_mixer = alc662_auto_capture_mixer,
17602 .init_verbs = { alc662_init_verbs,
17603 alc663_21jd_amic_init_verbs },
17604 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17606 .dac_nids = alc662_dac_nids,
17607 .dig_out_nid = ALC662_DIGOUT_NID,
17608 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17609 .channel_mode = alc662_3ST_2ch_modes,
17610 .unsol_event = alc663_mode1_unsol_event,
17611 .setup = alc663_mode1_setup,
17612 .init_hook = alc663_mode1_inithook,
17614 [ALC662_ASUS_MODE2] = {
17615 .mixers = { alc662_1bjd_mixer },
17616 .cap_mixer = alc662_auto_capture_mixer,
17617 .init_verbs = { alc662_init_verbs,
17618 alc662_1bjd_amic_init_verbs },
17619 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17620 .dac_nids = alc662_dac_nids,
17621 .dig_out_nid = ALC662_DIGOUT_NID,
17622 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17623 .channel_mode = alc662_3ST_2ch_modes,
17624 .unsol_event = alc662_mode2_unsol_event,
17625 .setup = alc662_mode2_setup,
17626 .init_hook = alc662_mode2_inithook,
17628 [ALC663_ASUS_MODE3] = {
17629 .mixers = { alc663_two_hp_m1_mixer },
17630 .cap_mixer = alc662_auto_capture_mixer,
17631 .init_verbs = { alc662_init_verbs,
17632 alc663_two_hp_amic_m1_init_verbs },
17633 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17635 .dac_nids = alc662_dac_nids,
17636 .dig_out_nid = ALC662_DIGOUT_NID,
17637 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17638 .channel_mode = alc662_3ST_2ch_modes,
17639 .unsol_event = alc663_mode3_unsol_event,
17640 .setup = alc663_mode3_setup,
17641 .init_hook = alc663_mode3_inithook,
17643 [ALC663_ASUS_MODE4] = {
17644 .mixers = { alc663_asus_21jd_clfe_mixer },
17645 .cap_mixer = alc662_auto_capture_mixer,
17646 .init_verbs = { alc662_init_verbs,
17647 alc663_21jd_amic_init_verbs},
17648 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17650 .dac_nids = alc662_dac_nids,
17651 .dig_out_nid = ALC662_DIGOUT_NID,
17652 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17653 .channel_mode = alc662_3ST_2ch_modes,
17654 .unsol_event = alc663_mode4_unsol_event,
17655 .setup = alc663_mode4_setup,
17656 .init_hook = alc663_mode4_inithook,
17658 [ALC663_ASUS_MODE5] = {
17659 .mixers = { alc663_asus_15jd_clfe_mixer },
17660 .cap_mixer = alc662_auto_capture_mixer,
17661 .init_verbs = { alc662_init_verbs,
17662 alc663_15jd_amic_init_verbs },
17663 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17665 .dac_nids = alc662_dac_nids,
17666 .dig_out_nid = ALC662_DIGOUT_NID,
17667 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17668 .channel_mode = alc662_3ST_2ch_modes,
17669 .unsol_event = alc663_mode5_unsol_event,
17670 .setup = alc663_mode5_setup,
17671 .init_hook = alc663_mode5_inithook,
17673 [ALC663_ASUS_MODE6] = {
17674 .mixers = { alc663_two_hp_m2_mixer },
17675 .cap_mixer = alc662_auto_capture_mixer,
17676 .init_verbs = { alc662_init_verbs,
17677 alc663_two_hp_amic_m2_init_verbs },
17678 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17680 .dac_nids = alc662_dac_nids,
17681 .dig_out_nid = ALC662_DIGOUT_NID,
17682 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17683 .channel_mode = alc662_3ST_2ch_modes,
17684 .unsol_event = alc663_mode6_unsol_event,
17685 .setup = alc663_mode6_setup,
17686 .init_hook = alc663_mode6_inithook,
17688 [ALC663_ASUS_MODE7] = {
17689 .mixers = { alc663_mode7_mixer },
17690 .cap_mixer = alc662_auto_capture_mixer,
17691 .init_verbs = { alc662_init_verbs,
17692 alc663_mode7_init_verbs },
17693 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17695 .dac_nids = alc662_dac_nids,
17696 .dig_out_nid = ALC662_DIGOUT_NID,
17697 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17698 .channel_mode = alc662_3ST_2ch_modes,
17699 .unsol_event = alc663_mode7_unsol_event,
17700 .setup = alc663_mode7_setup,
17701 .init_hook = alc663_mode7_inithook,
17703 [ALC663_ASUS_MODE8] = {
17704 .mixers = { alc663_mode8_mixer },
17705 .cap_mixer = alc662_auto_capture_mixer,
17706 .init_verbs = { alc662_init_verbs,
17707 alc663_mode8_init_verbs },
17708 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17710 .dac_nids = alc662_dac_nids,
17711 .dig_out_nid = ALC662_DIGOUT_NID,
17712 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17713 .channel_mode = alc662_3ST_2ch_modes,
17714 .unsol_event = alc663_mode8_unsol_event,
17715 .setup = alc663_mode8_setup,
17716 .init_hook = alc663_mode8_inithook,
17719 .mixers = { alc663_m51va_mixer },
17720 .cap_mixer = alc272_auto_capture_mixer,
17721 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17722 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17723 .dac_nids = alc662_dac_nids,
17724 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17725 .adc_nids = alc272_adc_nids,
17726 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17727 .capsrc_nids = alc272_capsrc_nids,
17728 .channel_mode = alc662_3ST_2ch_modes,
17729 .unsol_event = alc663_m51va_unsol_event,
17730 .setup = alc663_m51va_setup,
17731 .init_hook = alc663_m51va_inithook,
17733 [ALC272_DELL_ZM1] = {
17734 .mixers = { alc663_m51va_mixer },
17735 .cap_mixer = alc662_auto_capture_mixer,
17736 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17737 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17738 .dac_nids = alc662_dac_nids,
17739 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17740 .adc_nids = alc662_adc_nids,
17742 .capsrc_nids = alc662_capsrc_nids,
17743 .channel_mode = alc662_3ST_2ch_modes,
17744 .unsol_event = alc663_m51va_unsol_event,
17745 .setup = alc663_m51va_setup,
17746 .init_hook = alc663_m51va_inithook,
17748 [ALC272_SAMSUNG_NC10] = {
17749 .mixers = { alc272_nc10_mixer },
17750 .init_verbs = { alc662_init_verbs,
17751 alc663_21jd_amic_init_verbs },
17752 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17753 .dac_nids = alc272_dac_nids,
17754 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17755 .channel_mode = alc662_3ST_2ch_modes,
17756 /*.input_mux = &alc272_nc10_capture_source,*/
17757 .unsol_event = alc663_mode4_unsol_event,
17758 .setup = alc663_mode4_setup,
17759 .init_hook = alc663_mode4_inithook,
17765 * BIOS auto configuration
17768 /* convert from MIX nid to DAC */
17769 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17773 else if (nid >= 0x0c && nid <= 0x0e)
17774 return nid - 0x0c + 0x02;
17779 /* get MIX nid connected to the given pin targeted to DAC */
17780 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17786 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17787 for (i = 0; i < num; i++) {
17788 if (alc662_mix_to_dac(mix[i]) == dac)
17794 /* look for an empty DAC slot */
17795 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17797 struct alc_spec *spec = codec->spec;
17801 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17804 for (i = 0; i < num; i++) {
17805 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17808 for (j = 0; j < spec->multiout.num_dacs; j++)
17809 if (spec->multiout.dac_nids[j] == nid)
17811 if (j >= spec->multiout.num_dacs)
17817 /* fill in the dac_nids table from the parsed pin configuration */
17818 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17819 const struct auto_pin_cfg *cfg)
17821 struct alc_spec *spec = codec->spec;
17825 spec->multiout.dac_nids = spec->private_dac_nids;
17826 for (i = 0; i < cfg->line_outs; i++) {
17827 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17830 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17835 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17836 hda_nid_t nid, unsigned int chs)
17838 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17839 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17842 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17843 hda_nid_t nid, unsigned int chs)
17845 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17846 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17849 #define alc662_add_stereo_vol(spec, pfx, nid) \
17850 alc662_add_vol_ctl(spec, pfx, nid, 3)
17851 #define alc662_add_stereo_sw(spec, pfx, nid) \
17852 alc662_add_sw_ctl(spec, pfx, nid, 3)
17854 /* add playback controls from the parsed DAC table */
17855 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17856 const struct auto_pin_cfg *cfg)
17858 struct alc_spec *spec = codec->spec;
17859 static const char *chname[4] = {
17860 "Front", "Surround", NULL /*CLFE*/, "Side"
17862 hda_nid_t nid, mix;
17865 for (i = 0; i < cfg->line_outs; i++) {
17866 nid = spec->multiout.dac_nids[i];
17869 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17874 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17877 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17880 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17883 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17888 if (cfg->line_outs == 1 &&
17889 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17896 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17899 if (cfg->line_outs == 1 &&
17900 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17902 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17910 /* add playback controls for speaker and HP outputs */
17911 /* return DAC nid if any new DAC is assigned */
17912 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17915 struct alc_spec *spec = codec->spec;
17916 hda_nid_t nid, mix;
17921 nid = alc662_look_for_dac(codec, pin);
17923 /* the corresponding DAC is already occupied */
17924 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17925 return 0; /* no way */
17926 /* create a switch only */
17927 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17928 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17931 mix = alc662_dac_to_mix(codec, pin, nid);
17934 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17937 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17943 /* create playback/capture controls for input pins */
17944 #define alc662_auto_create_input_ctls \
17945 alc882_auto_create_input_ctls
17947 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17948 hda_nid_t nid, int pin_type,
17954 alc_set_pin_output(codec, nid, pin_type);
17955 /* need the manual connection? */
17956 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17959 for (i = 0; i < num; i++) {
17960 if (alc662_mix_to_dac(srcs[i]) != dac)
17962 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17967 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17969 struct alc_spec *spec = codec->spec;
17970 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17973 for (i = 0; i <= HDA_SIDE; i++) {
17974 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17976 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17977 spec->multiout.dac_nids[i]);
17981 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17983 struct alc_spec *spec = codec->spec;
17986 pin = spec->autocfg.hp_pins[0];
17988 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17989 spec->multiout.hp_nid);
17990 pin = spec->autocfg.speaker_pins[0];
17992 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17993 spec->multiout.extra_out_nid[0]);
17996 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17998 static void alc662_auto_init_analog_input(struct hda_codec *codec)
18000 struct alc_spec *spec = codec->spec;
18003 for (i = 0; i < AUTO_PIN_LAST; i++) {
18004 hda_nid_t nid = spec->autocfg.input_pins[i];
18005 if (alc_is_input_pin(codec, nid)) {
18006 alc_set_input_pin(codec, nid, i);
18007 if (nid != ALC662_PIN_CD_NID &&
18008 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
18009 snd_hda_codec_write(codec, nid, 0,
18010 AC_VERB_SET_AMP_GAIN_MUTE,
18016 #define alc662_auto_init_input_src alc882_auto_init_input_src
18018 static int alc662_parse_auto_config(struct hda_codec *codec)
18020 struct alc_spec *spec = codec->spec;
18022 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
18024 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
18028 if (!spec->autocfg.line_outs)
18029 return 0; /* can't find valid BIOS pin config */
18031 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
18034 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
18037 err = alc662_auto_create_extra_out(codec,
18038 spec->autocfg.speaker_pins[0],
18043 spec->multiout.extra_out_nid[0] = err;
18044 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18049 spec->multiout.hp_nid = err;
18050 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18054 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18056 if (spec->autocfg.dig_outs)
18057 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18059 if (spec->kctls.list)
18060 add_mixer(spec, spec->kctls.list);
18062 spec->num_mux_defs = 1;
18063 spec->input_mux = &spec->private_imux[0];
18065 add_verb(spec, alc662_auto_init_verbs);
18066 if (codec->vendor_id == 0x10ec0663)
18067 add_verb(spec, alc663_auto_init_verbs);
18069 err = alc_auto_add_mic_boost(codec);
18073 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18078 /* additional initialization for auto-configuration model */
18079 static void alc662_auto_init(struct hda_codec *codec)
18081 struct alc_spec *spec = codec->spec;
18082 alc662_auto_init_multi_out(codec);
18083 alc662_auto_init_hp_out(codec);
18084 alc662_auto_init_analog_input(codec);
18085 alc662_auto_init_input_src(codec);
18086 if (spec->unsol_event)
18087 alc_inithook(codec);
18090 static int patch_alc662(struct hda_codec *codec)
18092 struct alc_spec *spec;
18093 int err, board_config;
18095 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18099 codec->spec = spec;
18101 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18103 if (alc_read_coef_idx(codec, 0)==0x8020){
18104 kfree(codec->chip_name);
18105 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18106 if (!codec->chip_name) {
18112 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18115 if (board_config < 0) {
18116 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18118 board_config = ALC662_AUTO;
18121 if (board_config == ALC662_AUTO) {
18122 /* automatic parse from the BIOS config */
18123 err = alc662_parse_auto_config(codec);
18129 "hda_codec: Cannot set up configuration "
18130 "from BIOS. Using base mode...\n");
18131 board_config = ALC662_3ST_2ch_DIG;
18135 err = snd_hda_attach_beep_device(codec, 0x1);
18141 if (board_config != ALC662_AUTO)
18142 setup_preset(codec, &alc662_presets[board_config]);
18144 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18145 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18147 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18148 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18150 if (!spec->adc_nids) {
18151 spec->adc_nids = alc662_adc_nids;
18152 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18154 if (!spec->capsrc_nids)
18155 spec->capsrc_nids = alc662_capsrc_nids;
18157 if (!spec->cap_mixer)
18158 set_capture_mixer(codec);
18159 if (codec->vendor_id == 0x10ec0662)
18160 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18162 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18164 spec->vmaster_nid = 0x02;
18166 codec->patch_ops = alc_patch_ops;
18167 if (board_config == ALC662_AUTO)
18168 spec->init_hook = alc662_auto_init;
18169 #ifdef CONFIG_SND_HDA_POWER_SAVE
18170 if (!spec->loopback.amplist)
18171 spec->loopback.amplist = alc662_loopbacks;
18177 static int patch_alc888(struct hda_codec *codec)
18179 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18180 kfree(codec->chip_name);
18181 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18182 if (!codec->chip_name) {
18186 return patch_alc662(codec);
18188 return patch_alc882(codec);
18194 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18195 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18196 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18197 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18198 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18199 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18200 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18201 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18202 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18203 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18204 .patch = patch_alc861 },
18205 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18206 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18207 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18208 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18209 .patch = patch_alc882 },
18210 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18211 .patch = patch_alc662 },
18212 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18213 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18214 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18215 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18216 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18217 .patch = patch_alc882 },
18218 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18219 .patch = patch_alc882 },
18220 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18221 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18222 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18223 .patch = patch_alc882 },
18224 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18225 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18226 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18227 {} /* terminator */
18230 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18232 MODULE_LICENSE("GPL");
18233 MODULE_DESCRIPTION("Realtek HD-audio codec");
18235 static struct hda_codec_preset_list realtek_list = {
18236 .preset = snd_hda_preset_realtek,
18237 .owner = THIS_MODULE,
18240 static int __init patch_realtek_init(void)
18242 return snd_hda_add_codec_preset(&realtek_list);
18245 static void __exit patch_realtek_exit(void)
18247 snd_hda_delete_codec_preset(&realtek_list);
18250 module_init(patch_realtek_init)
18251 module_exit(patch_realtek_exit)