2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
637 .info = alc_pin_mode_info, \
638 .get = alc_pin_mode_get, \
639 .put = alc_pin_mode_put, \
640 .private_value = nid | (dir<<16) }
642 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
643 * together using a mask with more than one bit set. This control is
644 * currently used only by the ALC260 test model. At this stage they are not
645 * needed for any "production" models.
647 #ifdef CONFIG_SND_DEBUG
648 #define alc_gpio_data_info snd_ctl_boolean_mono_info
650 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long *valp = ucontrol->value.integer.value;
657 unsigned int val = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_GPIO_DATA, 0x00);
660 *valp = (val & mask) != 0;
663 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 hda_nid_t nid = kcontrol->private_value & 0xffff;
669 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
670 long val = *ucontrol->value.integer.value;
671 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
672 AC_VERB_GET_GPIO_DATA,
675 /* Set/unset the masked GPIO bit(s) as needed */
676 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
681 snd_hda_codec_write_cache(codec, nid, 0,
682 AC_VERB_SET_GPIO_DATA, gpio_data);
686 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
689 .info = alc_gpio_data_info, \
690 .get = alc_gpio_data_get, \
691 .put = alc_gpio_data_put, \
692 .private_value = nid | (mask<<16) }
693 #endif /* CONFIG_SND_DEBUG */
695 /* A switch control to allow the enabling of the digital IO pins on the
696 * ALC260. This is incredibly simplistic; the intention of this control is
697 * to provide something in the test model allowing digital outputs to be
698 * identified if present. If models are found which can utilise these
699 * outputs a more complete mixer control can be devised for those models if
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
705 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_DIGI_CONVERT_1,
730 /* Set/unset the masked control bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
741 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_spdif_ctrl_info, \
745 .get = alc_spdif_ctrl_get, \
746 .put = alc_spdif_ctrl_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
751 * Again, this is only used in the ALC26x test models to help identify when
752 * the EAPD line must be asserted for features to work.
754 #ifdef CONFIG_SND_DEBUG
755 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
757 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
758 struct snd_ctl_elem_value *ucontrol)
760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
761 hda_nid_t nid = kcontrol->private_value & 0xffff;
762 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
763 long *valp = ucontrol->value.integer.value;
764 unsigned int val = snd_hda_codec_read(codec, nid, 0,
765 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
767 *valp = (val & mask) != 0;
771 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
772 struct snd_ctl_elem_value *ucontrol)
775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
776 hda_nid_t nid = kcontrol->private_value & 0xffff;
777 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
778 long val = *ucontrol->value.integer.value;
779 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
780 AC_VERB_GET_EAPD_BTLENABLE,
783 /* Set/unset the masked control bit(s) as needed */
784 change = (!val ? 0 : mask) != (ctrl_data & mask);
789 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
795 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
796 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
797 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
798 .info = alc_eapd_ctrl_info, \
799 .get = alc_eapd_ctrl_get, \
800 .put = alc_eapd_ctrl_put, \
801 .private_value = nid | (mask<<16) }
802 #endif /* CONFIG_SND_DEBUG */
805 * set up the input pin config (depending on the given auto-pin type)
807 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
810 unsigned int val = PIN_IN;
812 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
814 pincap = snd_hda_query_pin_caps(codec, nid);
815 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
816 if (pincap & AC_PINCAP_VREF_80)
818 else if (pincap & AC_PINCAP_VREF_50)
820 else if (pincap & AC_PINCAP_VREF_100)
822 else if (pincap & AC_PINCAP_VREF_GRD)
825 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
830 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
832 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
834 spec->mixers[spec->num_mixers++] = mix;
837 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
839 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
841 spec->init_verbs[spec->num_init_verbs++] = verb;
844 #ifdef CONFIG_PROC_FS
848 static void print_realtek_coef(struct snd_info_buffer *buffer,
849 struct hda_codec *codec, hda_nid_t nid)
855 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
856 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
857 coeff = snd_hda_codec_read(codec, nid, 0,
858 AC_VERB_GET_COEF_INDEX, 0);
859 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
862 #define print_realtek_coef NULL
866 * set up from the preset table
868 static void setup_preset(struct hda_codec *codec,
869 const struct alc_config_preset *preset)
871 struct alc_spec *spec = codec->spec;
874 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
875 add_mixer(spec, preset->mixers[i]);
876 spec->cap_mixer = preset->cap_mixer;
877 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
879 add_verb(spec, preset->init_verbs[i]);
881 spec->channel_mode = preset->channel_mode;
882 spec->num_channel_mode = preset->num_channel_mode;
883 spec->need_dac_fix = preset->need_dac_fix;
884 spec->const_channel_count = preset->const_channel_count;
886 if (preset->const_channel_count)
887 spec->multiout.max_channels = preset->const_channel_count;
889 spec->multiout.max_channels = spec->channel_mode[0].channels;
890 spec->ext_channel_count = spec->channel_mode[0].channels;
892 spec->multiout.num_dacs = preset->num_dacs;
893 spec->multiout.dac_nids = preset->dac_nids;
894 spec->multiout.dig_out_nid = preset->dig_out_nid;
895 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
896 spec->multiout.hp_nid = preset->hp_nid;
898 spec->num_mux_defs = preset->num_mux_defs;
899 if (!spec->num_mux_defs)
900 spec->num_mux_defs = 1;
901 spec->input_mux = preset->input_mux;
903 spec->num_adc_nids = preset->num_adc_nids;
904 spec->adc_nids = preset->adc_nids;
905 spec->capsrc_nids = preset->capsrc_nids;
906 spec->dig_in_nid = preset->dig_in_nid;
908 spec->unsol_event = preset->unsol_event;
909 spec->init_hook = preset->init_hook;
910 #ifdef CONFIG_SND_HDA_POWER_SAVE
911 spec->power_hook = preset->power_hook;
912 spec->loopback.amplist = preset->loopbacks;
916 preset->setup(codec);
919 /* Enable GPIO mask and set output */
920 static struct hda_verb alc_gpio1_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
927 static struct hda_verb alc_gpio2_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
934 static struct hda_verb alc_gpio3_init_verbs[] = {
935 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
936 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
942 * Fix hardware PLL issue
943 * On some codecs, the analog PLL gating control must be off while
944 * the default value is 1.
946 static void alc_fix_pll(struct hda_codec *codec)
948 struct alc_spec *spec = codec->spec;
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
956 AC_VERB_GET_PROC_COEF, 0);
957 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
959 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
960 val & ~(1 << spec->pll_coef_bit));
963 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
964 unsigned int coef_idx, unsigned int coef_bit)
966 struct alc_spec *spec = codec->spec;
968 spec->pll_coef_idx = coef_idx;
969 spec->pll_coef_bit = coef_bit;
973 static void alc_automute_pin(struct hda_codec *codec)
975 struct alc_spec *spec = codec->spec;
976 unsigned int nid = spec->autocfg.hp_pins[0];
981 spec->jack_present = snd_hda_jack_detect(codec, nid);
982 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
983 nid = spec->autocfg.speaker_pins[i];
986 snd_hda_codec_write(codec, nid, 0,
987 AC_VERB_SET_PIN_WIDGET_CONTROL,
988 spec->jack_present ? 0 : PIN_OUT);
992 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
995 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
998 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
999 for (i = 0; i < nums; i++)
1005 static void alc_mic_automute(struct hda_codec *codec)
1007 struct alc_spec *spec = codec->spec;
1008 struct alc_mic_route *dead, *alive;
1009 unsigned int present, type;
1012 if (!spec->auto_mic)
1014 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1016 if (snd_BUG_ON(!spec->adc_nids))
1019 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1021 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1023 alive = &spec->ext_mic;
1024 dead = &spec->int_mic;
1026 alive = &spec->int_mic;
1027 dead = &spec->ext_mic;
1030 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1031 if (type == AC_WID_AUD_MIX) {
1032 /* Matrix-mixer style (e.g. ALC882) */
1033 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1036 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 HDA_AMP_MUTE, HDA_AMP_MUTE);
1040 /* MUX style (e.g. ALC880) */
1041 snd_hda_codec_write_cache(codec, cap_nid, 0,
1042 AC_VERB_SET_CONNECT_SEL,
1046 /* FIXME: analog mixer */
1049 /* unsolicited event for HP jack sensing */
1050 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1052 if (codec->vendor_id == 0x10ec0880)
1057 case ALC880_HP_EVENT:
1058 alc_automute_pin(codec);
1060 case ALC880_MIC_EVENT:
1061 alc_mic_automute(codec);
1066 static void alc_inithook(struct hda_codec *codec)
1068 alc_automute_pin(codec);
1069 alc_mic_automute(codec);
1072 /* additional initialization for ALC888 variants */
1073 static void alc888_coef_init(struct hda_codec *codec)
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1080 if ((tmp & 0xf0) == 0x20)
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x830);
1086 snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF, 0x3030);
1090 static void alc889_coef_init(struct hda_codec *codec)
1094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1095 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1100 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1105 case ALC_INIT_GPIO1:
1106 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1108 case ALC_INIT_GPIO2:
1109 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1111 case ALC_INIT_GPIO3:
1112 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1114 case ALC_INIT_DEFAULT:
1115 switch (codec->vendor_id) {
1117 snd_hda_codec_write(codec, 0x0f, 0,
1118 AC_VERB_SET_EAPD_BTLENABLE, 2);
1119 snd_hda_codec_write(codec, 0x10, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 snd_hda_codec_write(codec, 0x14, 0,
1133 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 snd_hda_codec_write(codec, 0x15, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1138 switch (codec->vendor_id) {
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1143 AC_VERB_GET_PROC_COEF, 0);
1144 snd_hda_codec_write(codec, 0x1a, 0,
1145 AC_VERB_SET_COEF_INDEX, 7);
1146 snd_hda_codec_write(codec, 0x1a, 0,
1147 AC_VERB_SET_PROC_COEF,
1157 alc889_coef_init(codec);
1160 alc888_coef_init(codec);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 tmp = snd_hda_codec_read(codec, 0x20, 0,
1167 AC_VERB_GET_PROC_COEF, 0);
1168 snd_hda_codec_write(codec, 0x20, 0,
1169 AC_VERB_SET_COEF_INDEX, 7);
1170 snd_hda_codec_write(codec, 0x20, 0,
1171 AC_VERB_SET_PROC_COEF,
1179 static void alc_init_auto_hp(struct hda_codec *codec)
1181 struct alc_spec *spec = codec->spec;
1183 if (!spec->autocfg.hp_pins[0])
1186 if (!spec->autocfg.speaker_pins[0]) {
1187 if (spec->autocfg.line_out_pins[0] &&
1188 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1189 spec->autocfg.speaker_pins[0] =
1190 spec->autocfg.line_out_pins[0];
1195 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1196 spec->autocfg.hp_pins[0]);
1197 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1198 AC_VERB_SET_UNSOLICITED_ENABLE,
1199 AC_USRSP_EN | ALC880_HP_EVENT);
1200 spec->unsol_event = alc_sku_unsol_event;
1203 static void alc_init_auto_mic(struct hda_codec *codec)
1205 struct alc_spec *spec = codec->spec;
1206 struct auto_pin_cfg *cfg = &spec->autocfg;
1207 hda_nid_t fixed, ext;
1210 /* there must be only two mic inputs exclusively */
1211 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1212 if (cfg->input_pins[i])
1216 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1217 hda_nid_t nid = cfg->input_pins[i];
1218 unsigned int defcfg;
1221 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1222 switch (get_defcfg_connect(defcfg)) {
1223 case AC_JACK_PORT_FIXED:
1225 return; /* already occupied */
1228 case AC_JACK_PORT_COMPLEX:
1230 return; /* already occupied */
1234 return; /* invalid entry */
1237 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1238 return; /* no unsol support */
1239 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1241 spec->ext_mic.pin = ext;
1242 spec->int_mic.pin = fixed;
1243 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1244 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1246 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1247 AC_VERB_SET_UNSOLICITED_ENABLE,
1248 AC_USRSP_EN | ALC880_MIC_EVENT);
1249 spec->unsol_event = alc_sku_unsol_event;
1252 /* check subsystem ID and set up device-specific initialization;
1253 * return 1 if initialized, 0 if invalid SSID
1255 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1256 * 31 ~ 16 : Manufacture ID
1258 * 7 ~ 0 : Assembly ID
1259 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1261 static int alc_subsystem_id(struct hda_codec *codec,
1262 hda_nid_t porta, hda_nid_t porte,
1265 unsigned int ass, tmp, i;
1267 struct alc_spec *spec = codec->spec;
1269 ass = codec->subsystem_id & 0xffff;
1270 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1273 /* invalid SSID, check the special NID pin defcfg instead */
1275 * 31~30 : port connectivity
1278 * 19~16 : Check sum (15:1)
1283 if (codec->vendor_id == 0x10ec0260)
1285 ass = snd_hda_codec_get_pincfg(codec, nid);
1286 snd_printd("realtek: No valid SSID, "
1287 "checking pincfg 0x%08x for NID 0x%x\n",
1289 if (!(ass & 1) && !(ass & 0x100000))
1291 if ((ass >> 30) != 1) /* no physical connection */
1296 for (i = 1; i < 16; i++) {
1300 if (((ass >> 16) & 0xf) != tmp)
1303 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1304 ass & 0xffff, codec->vendor_id);
1308 * 2 : 0 --> Desktop, 1 --> Laptop
1309 * 3~5 : External Amplifier control
1312 tmp = (ass & 0x38) >> 3; /* external Amp control */
1315 spec->init_amp = ALC_INIT_GPIO1;
1318 spec->init_amp = ALC_INIT_GPIO2;
1321 spec->init_amp = ALC_INIT_GPIO3;
1324 spec->init_amp = ALC_INIT_DEFAULT;
1328 /* is laptop or Desktop and enable the function "Mute internal speaker
1329 * when the external headphone out jack is plugged"
1331 if (!(ass & 0x8000))
1334 * 10~8 : Jack location
1335 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1337 * 15 : 1 --> enable the function "Mute internal speaker
1338 * when the external headphone out jack is plugged"
1340 if (!spec->autocfg.hp_pins[0]) {
1342 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1351 for (i = 0; i < spec->autocfg.line_outs; i++)
1352 if (spec->autocfg.line_out_pins[i] == nid)
1354 spec->autocfg.hp_pins[0] = nid;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1362 static void alc_ssid_check(struct hda_codec *codec,
1363 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1365 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1366 struct alc_spec *spec = codec->spec;
1367 snd_printd("realtek: "
1368 "Enable default setup for auto mode as fallback\n");
1369 spec->init_amp = ALC_INIT_DEFAULT;
1370 alc_init_auto_hp(codec);
1371 alc_init_auto_mic(codec);
1376 * Fix-up pin default configurations and add default verbs
1385 const struct alc_pincfg *pins;
1386 const struct hda_verb *verbs;
1389 static void alc_pick_fixup(struct hda_codec *codec,
1390 const struct snd_pci_quirk *quirk,
1391 const struct alc_fixup *fix)
1393 const struct alc_pincfg *cfg;
1395 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1399 fix += quirk->value;
1402 for (; cfg->nid; cfg++)
1403 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1406 add_verb(codec->spec, fix->verbs);
1409 static int alc_read_coef_idx(struct hda_codec *codec,
1410 unsigned int coef_idx)
1413 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1415 val = snd_hda_codec_read(codec, 0x20, 0,
1416 AC_VERB_GET_PROC_COEF, 0);
1427 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1428 /* Mic-in jack as mic in */
1429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1431 /* Line-in jack as Line in */
1432 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1433 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1434 /* Line-Out as Front */
1435 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1442 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1443 /* Mic-in jack as mic in */
1444 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1445 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1446 /* Line-in jack as Surround */
1447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1449 /* Line-Out as Front */
1450 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1457 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1458 /* Mic-in jack as CLFE */
1459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1461 /* Line-in jack as Surround */
1462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1464 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1465 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1472 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1473 /* Mic-in jack as CLFE */
1474 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1475 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1476 /* Line-in jack as Surround */
1477 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1478 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1479 /* Line-Out as Side */
1480 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1484 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1485 { 2, alc888_4ST_ch2_intel_init },
1486 { 4, alc888_4ST_ch4_intel_init },
1487 { 6, alc888_4ST_ch6_intel_init },
1488 { 8, alc888_4ST_ch8_intel_init },
1492 * ALC888 Fujitsu Siemens Amillo xa3530
1495 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1496 /* Front Mic: set to PIN_IN (empty by default) */
1497 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1498 /* Connect Internal HP to Front */
1499 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1502 /* Connect Bass HP to Front */
1503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1506 /* Connect Line-Out side jack (SPDIF) to Side */
1507 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1510 /* Connect Mic jack to CLFE */
1511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1514 /* Connect Line-in jack to Surround */
1515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1518 /* Connect HP out jack to Front */
1519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1521 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 /* Enable unsolicited event for HP jack and Line-out jack */
1523 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1524 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1528 static void alc_automute_amp(struct hda_codec *codec)
1530 struct alc_spec *spec = codec->spec;
1535 spec->jack_present = 0;
1536 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1537 nid = spec->autocfg.hp_pins[i];
1540 if (snd_hda_jack_detect(codec, nid)) {
1541 spec->jack_present = 1;
1546 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1547 /* Toggle internal speakers muting */
1548 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1549 nid = spec->autocfg.speaker_pins[i];
1552 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1553 HDA_AMP_MUTE, mute);
1557 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1560 if (codec->vendor_id == 0x10ec0880)
1564 if (res == ALC880_HP_EVENT)
1565 alc_automute_amp(codec);
1568 static void alc889_automute_setup(struct hda_codec *codec)
1570 struct alc_spec *spec = codec->spec;
1572 spec->autocfg.hp_pins[0] = 0x15;
1573 spec->autocfg.speaker_pins[0] = 0x14;
1574 spec->autocfg.speaker_pins[1] = 0x16;
1575 spec->autocfg.speaker_pins[2] = 0x17;
1576 spec->autocfg.speaker_pins[3] = 0x19;
1577 spec->autocfg.speaker_pins[4] = 0x1a;
1580 static void alc889_intel_init_hook(struct hda_codec *codec)
1582 alc889_coef_init(codec);
1583 alc_automute_amp(codec);
1586 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1588 struct alc_spec *spec = codec->spec;
1590 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1591 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1592 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1593 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1597 * ALC888 Acer Aspire 4930G model
1600 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1601 /* Front Mic: set to PIN_IN (empty by default) */
1602 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1603 /* Unselect Front Mic by default in input mixer 3 */
1604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1605 /* Enable unsolicited event for HP jack */
1606 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1607 /* Connect Internal HP to front */
1608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1609 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1611 /* Connect HP out to front */
1612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1613 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1614 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1619 * ALC888 Acer Aspire 6530G model
1622 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1623 /* Bias voltage on for external mic port */
1624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1625 /* Front Mic: set to PIN_IN (empty by default) */
1626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1627 /* Unselect Front Mic by default in input mixer 3 */
1628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1629 /* Enable unsolicited event for HP jack */
1630 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1631 /* Enable speaker output */
1632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1633 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1634 /* Enable headphone output */
1635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1637 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 * ALC889 Acer Aspire 8930G model
1645 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1646 /* Front Mic: set to PIN_IN (empty by default) */
1647 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1648 /* Unselect Front Mic by default in input mixer 3 */
1649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1650 /* Enable unsolicited event for HP jack */
1651 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1652 /* Connect Internal Front to Front */
1653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1656 /* Connect Internal Rear to Rear */
1657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1660 /* Connect Internal CLFE to CLFE */
1661 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1664 /* Connect HP out to Front */
1665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1668 /* Enable all DACs */
1669 /* DAC DISABLE/MUTE 1? */
1670 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1673 /* DAC DISABLE/MUTE 2? */
1674 /* some bit here disables the other DACs. Init=0x4900 */
1675 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1676 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1678 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1679 * which makes the stereo useless. However, either the mic or the ALC889
1680 * makes the signal become a difference/sum signal instead of standard
1681 * stereo, which is annoying. So instead we flip this bit which makes the
1682 * codec replicate the sum signal to both channels, turning it into a
1685 /* DMIC_CONTROL? Init value = 0x0001 */
1686 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1687 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1691 static struct hda_input_mux alc888_2_capture_sources[2] = {
1692 /* Front mic only available on one ADC */
1699 { "Front Mic", 0xb },
1712 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1713 /* Interal mic only available on one ADC */
1720 { "Input Mix", 0xa },
1730 { "Input Mix", 0xa },
1735 static struct hda_input_mux alc889_capture_sources[3] = {
1736 /* Digital mic only available on first "ADC" */
1743 { "Front Mic", 0xb },
1744 { "Input Mix", 0xa },
1753 { "Input Mix", 0xa },
1762 { "Input Mix", 0xa },
1767 static struct snd_kcontrol_new alc888_base_mixer[] = {
1768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1772 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1778 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1784 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1789 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1794 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1796 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1797 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1798 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1808 static void alc888_acer_aspire_4930g_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 alc888_acer_aspire_6530g_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] = 0x17;
1828 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1830 struct alc_spec *spec = codec->spec;
1832 spec->autocfg.hp_pins[0] = 0x15;
1833 spec->autocfg.speaker_pins[0] = 0x14;
1834 spec->autocfg.speaker_pins[1] = 0x16;
1835 spec->autocfg.speaker_pins[2] = 0x1b;
1839 * ALC880 3-stack model
1841 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1842 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1843 * F-Mic = 0x1b, HP = 0x19
1846 static hda_nid_t alc880_dac_nids[4] = {
1847 /* front, rear, clfe, rear_surr */
1848 0x02, 0x05, 0x04, 0x03
1851 static hda_nid_t alc880_adc_nids[3] = {
1856 /* The datasheet says the node 0x07 is connected from inputs,
1857 * but it shows zero connection in the real implementation on some devices.
1858 * Note: this is a 915GAV bug, fixed on 915GLV
1860 static hda_nid_t alc880_adc_nids_alt[2] = {
1865 #define ALC880_DIGOUT_NID 0x06
1866 #define ALC880_DIGIN_NID 0x0a
1868 static struct hda_input_mux alc880_capture_source = {
1872 { "Front Mic", 0x3 },
1878 /* channel source setting (2/6 channel selection for 3-stack) */
1880 static struct hda_verb alc880_threestack_ch2_init[] = {
1881 /* set line-in to input, mute it */
1882 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1883 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1884 /* set mic-in to input vref 80%, mute it */
1885 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1886 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1891 static struct hda_verb alc880_threestack_ch6_init[] = {
1892 /* set line-in to output, unmute it */
1893 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1894 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1895 /* set mic-in to output, unmute it */
1896 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1897 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1901 static struct hda_channel_mode alc880_threestack_modes[2] = {
1902 { 2, alc880_threestack_ch2_init },
1903 { 6, alc880_threestack_ch6_init },
1906 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1907 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1908 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1910 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1911 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1912 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1913 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1914 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1915 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1916 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1917 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1918 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1919 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1920 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1921 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1922 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1923 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1926 .name = "Channel Mode",
1927 .info = alc_ch_mode_info,
1928 .get = alc_ch_mode_get,
1929 .put = alc_ch_mode_put,
1934 /* capture mixer elements */
1935 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1936 struct snd_ctl_elem_info *uinfo)
1938 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1939 struct alc_spec *spec = codec->spec;
1942 mutex_lock(&codec->control_mutex);
1943 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1945 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1946 mutex_unlock(&codec->control_mutex);
1950 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1951 unsigned int size, unsigned int __user *tlv)
1953 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1954 struct alc_spec *spec = codec->spec;
1957 mutex_lock(&codec->control_mutex);
1958 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1960 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1961 mutex_unlock(&codec->control_mutex);
1965 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1966 struct snd_ctl_elem_value *ucontrol);
1968 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1969 struct snd_ctl_elem_value *ucontrol,
1972 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1973 struct alc_spec *spec = codec->spec;
1974 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1977 mutex_lock(&codec->control_mutex);
1978 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1980 err = func(kcontrol, ucontrol);
1981 mutex_unlock(&codec->control_mutex);
1985 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1986 struct snd_ctl_elem_value *ucontrol)
1988 return alc_cap_getput_caller(kcontrol, ucontrol,
1989 snd_hda_mixer_amp_volume_get);
1992 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1993 struct snd_ctl_elem_value *ucontrol)
1995 return alc_cap_getput_caller(kcontrol, ucontrol,
1996 snd_hda_mixer_amp_volume_put);
1999 /* capture mixer elements */
2000 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2002 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2003 struct snd_ctl_elem_value *ucontrol)
2005 return alc_cap_getput_caller(kcontrol, ucontrol,
2006 snd_hda_mixer_amp_switch_get);
2009 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2010 struct snd_ctl_elem_value *ucontrol)
2012 return alc_cap_getput_caller(kcontrol, ucontrol,
2013 snd_hda_mixer_amp_switch_put);
2016 #define _DEFINE_CAPMIX(num) \
2018 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2019 .name = "Capture Switch", \
2020 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2022 .info = alc_cap_sw_info, \
2023 .get = alc_cap_sw_get, \
2024 .put = alc_cap_sw_put, \
2027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2028 .name = "Capture Volume", \
2029 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2030 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2031 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2033 .info = alc_cap_vol_info, \
2034 .get = alc_cap_vol_get, \
2035 .put = alc_cap_vol_put, \
2036 .tlv = { .c = alc_cap_vol_tlv }, \
2039 #define _DEFINE_CAPSRC(num) \
2041 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2042 /* .name = "Capture Source", */ \
2043 .name = "Input Source", \
2045 .info = alc_mux_enum_info, \
2046 .get = alc_mux_enum_get, \
2047 .put = alc_mux_enum_put, \
2050 #define DEFINE_CAPMIX(num) \
2051 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2052 _DEFINE_CAPMIX(num), \
2053 _DEFINE_CAPSRC(num), \
2057 #define DEFINE_CAPMIX_NOSRC(num) \
2058 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2059 _DEFINE_CAPMIX(num), \
2063 /* up to three ADCs */
2067 DEFINE_CAPMIX_NOSRC(1);
2068 DEFINE_CAPMIX_NOSRC(2);
2069 DEFINE_CAPMIX_NOSRC(3);
2072 * ALC880 5-stack model
2074 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2076 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2077 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2080 /* additional mixers to alc880_three_stack_mixer */
2081 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2082 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2083 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2087 /* channel source setting (6/8 channel selection for 5-stack) */
2089 static struct hda_verb alc880_fivestack_ch6_init[] = {
2090 /* set line-in to input, mute it */
2091 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2092 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2097 static struct hda_verb alc880_fivestack_ch8_init[] = {
2098 /* set line-in to output, unmute it */
2099 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2100 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2104 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2105 { 6, alc880_fivestack_ch6_init },
2106 { 8, alc880_fivestack_ch8_init },
2111 * ALC880 6-stack model
2113 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2114 * Side = 0x05 (0x0f)
2115 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2116 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2119 static hda_nid_t alc880_6st_dac_nids[4] = {
2120 /* front, rear, clfe, rear_surr */
2121 0x02, 0x03, 0x04, 0x05
2124 static struct hda_input_mux alc880_6stack_capture_source = {
2128 { "Front Mic", 0x1 },
2134 /* fixed 8-channels */
2135 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2139 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2140 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2141 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2142 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2143 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2144 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2145 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2146 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2147 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2148 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2149 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2155 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2156 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2159 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2160 .name = "Channel Mode",
2161 .info = alc_ch_mode_info,
2162 .get = alc_ch_mode_get,
2163 .put = alc_ch_mode_put,
2172 * W810 has rear IO for:
2175 * Center/LFE (DAC 04)
2178 * The system also has a pair of internal speakers, and a headphone jack.
2179 * These are both connected to Line2 on the codec, hence to DAC 02.
2181 * There is a variable resistor to control the speaker or headphone
2182 * volume. This is a hardware-only device without a software API.
2184 * Plugging headphones in will disable the internal speakers. This is
2185 * implemented in hardware, not via the driver using jack sense. In
2186 * a similar fashion, plugging into the rear socket marked "front" will
2187 * disable both the speakers and headphones.
2189 * For input, there's a microphone jack, and an "audio in" jack.
2190 * These may not do anything useful with this driver yet, because I
2191 * haven't setup any initialization verbs for these yet...
2194 static hda_nid_t alc880_w810_dac_nids[3] = {
2195 /* front, rear/surround, clfe */
2199 /* fixed 6 channels */
2200 static struct hda_channel_mode alc880_w810_modes[1] = {
2204 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2205 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2206 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2207 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2208 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2209 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2210 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2222 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2223 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2227 static hda_nid_t alc880_z71v_dac_nids[1] = {
2230 #define ALC880_Z71V_HP_DAC 0x03
2232 /* fixed 2 channels */
2233 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2237 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2238 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2239 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2241 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2242 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2243 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2244 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2245 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2251 * ALC880 F1734 model
2253 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2254 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2257 static hda_nid_t alc880_f1734_dac_nids[1] = {
2260 #define ALC880_F1734_HP_DAC 0x02
2262 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2263 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2264 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2265 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2266 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2274 static struct hda_input_mux alc880_f1734_capture_source = {
2286 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2287 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2288 * Mic = 0x18, Line = 0x1a
2291 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2292 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2294 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2295 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2296 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2298 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2299 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2300 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2301 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2302 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2303 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2304 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2305 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2306 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2311 .name = "Channel Mode",
2312 .info = alc_ch_mode_info,
2313 .get = alc_ch_mode_get,
2314 .put = alc_ch_mode_put,
2320 * ALC880 ASUS W1V model
2322 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2323 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2324 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2327 /* additional mixers to alc880_asus_mixer */
2328 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2329 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2330 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2335 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2336 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2337 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2339 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2340 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2342 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2343 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2344 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2349 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2351 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2353 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2354 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2355 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2356 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2357 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2358 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2359 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2360 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2361 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2364 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2365 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2367 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2368 .name = "Channel Mode",
2369 .info = alc_ch_mode_info,
2370 .get = alc_ch_mode_get,
2371 .put = alc_ch_mode_put,
2376 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2377 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2378 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2379 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2380 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2381 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2382 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2384 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2386 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2390 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2392 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2393 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2394 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2401 * virtual master controls
2405 * slave controls for virtual master
2407 static const char *alc_slave_vols[] = {
2408 "Front Playback Volume",
2409 "Surround Playback Volume",
2410 "Center Playback Volume",
2411 "LFE Playback Volume",
2412 "Side Playback Volume",
2413 "Headphone Playback Volume",
2414 "Speaker Playback Volume",
2415 "Mono Playback Volume",
2416 "Line-Out Playback Volume",
2417 "PCM Playback Volume",
2421 static const char *alc_slave_sws[] = {
2422 "Front Playback Switch",
2423 "Surround Playback Switch",
2424 "Center Playback Switch",
2425 "LFE Playback Switch",
2426 "Side Playback Switch",
2427 "Headphone Playback Switch",
2428 "Speaker Playback Switch",
2429 "Mono Playback Switch",
2430 "IEC958 Playback Switch",
2431 "Line-Out Playback Switch",
2432 "PCM Playback Switch",
2437 * build control elements
2440 #define NID_MAPPING (-1)
2442 #define SUBDEV_SPEAKER_ (0 << 6)
2443 #define SUBDEV_HP_ (1 << 6)
2444 #define SUBDEV_LINE_ (2 << 6)
2445 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2446 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2447 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2449 static void alc_free_kctls(struct hda_codec *codec);
2451 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2452 /* additional beep mixers; the actual parameters are overwritten at build */
2453 static struct snd_kcontrol_new alc_beep_mixer[] = {
2454 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2455 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2460 static int alc_build_controls(struct hda_codec *codec)
2462 struct alc_spec *spec = codec->spec;
2463 struct snd_kcontrol *kctl;
2464 struct snd_kcontrol_new *knew;
2469 for (i = 0; i < spec->num_mixers; i++) {
2470 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2474 if (spec->cap_mixer) {
2475 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2479 if (spec->multiout.dig_out_nid) {
2480 err = snd_hda_create_spdif_out_ctls(codec,
2481 spec->multiout.dig_out_nid);
2484 if (!spec->no_analog) {
2485 err = snd_hda_create_spdif_share_sw(codec,
2489 spec->multiout.share_spdif = 1;
2492 if (spec->dig_in_nid) {
2493 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2498 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2499 /* create beep controls if needed */
2500 if (spec->beep_amp) {
2501 struct snd_kcontrol_new *knew;
2502 for (knew = alc_beep_mixer; knew->name; knew++) {
2503 struct snd_kcontrol *kctl;
2504 kctl = snd_ctl_new1(knew, codec);
2507 kctl->private_value = spec->beep_amp;
2508 err = snd_hda_ctl_add(codec, 0, kctl);
2515 /* if we have no master control, let's create it */
2516 if (!spec->no_analog &&
2517 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2518 unsigned int vmaster_tlv[4];
2519 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2520 HDA_OUTPUT, vmaster_tlv);
2521 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2522 vmaster_tlv, alc_slave_vols);
2526 if (!spec->no_analog &&
2527 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2528 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2529 NULL, alc_slave_sws);
2534 alc_free_kctls(codec); /* no longer needed */
2536 /* assign Capture Source enums to NID */
2537 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2539 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2540 for (i = 0; kctl && i < kctl->count; i++) {
2541 hda_nid_t *nids = spec->capsrc_nids;
2543 nids = spec->adc_nids;
2544 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2548 if (spec->cap_mixer) {
2549 const char *kname = kctl ? kctl->id.name : NULL;
2550 for (knew = spec->cap_mixer; knew->name; knew++) {
2551 if (kname && strcmp(knew->name, kname) == 0)
2553 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2554 for (i = 0; kctl && i < kctl->count; i++) {
2555 err = snd_hda_add_nid(codec, kctl, i,
2563 /* other nid->control mapping */
2564 for (i = 0; i < spec->num_mixers; i++) {
2565 for (knew = spec->mixers[i]; knew->name; knew++) {
2566 if (knew->iface != NID_MAPPING)
2568 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2571 u = knew->subdevice;
2572 for (j = 0; j < 4; j++, u >>= 8) {
2577 case SUBDEV_SPEAKER_:
2578 nid = spec->autocfg.speaker_pins[nid];
2581 nid = spec->autocfg.line_out_pins[nid];
2584 nid = spec->autocfg.hp_pins[nid];
2589 err = snd_hda_add_nid(codec, kctl, 0, nid);
2593 u = knew->private_value;
2594 for (j = 0; j < 4; j++, u >>= 8) {
2598 err = snd_hda_add_nid(codec, kctl, 0, nid);
2609 * initialize the codec volumes, etc
2613 * generic initialization of ADC, input mixers and output mixers
2615 static struct hda_verb alc880_volume_init_verbs[] = {
2617 * Unmute ADC0-2 and set the default input to mic-in
2619 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2620 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2621 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2623 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2626 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2628 * Note: PASD motherboards uses the Line In 2 as the input for front
2631 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2633 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2634 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2635 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2636 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2637 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2638 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2641 * Set up output mixers (0x0c - 0x0f)
2643 /* set vol=0 to output mixers */
2644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2646 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2648 /* set up input amps for analog loopback */
2649 /* Amp Indices: DAC = 0, mixer = 1 */
2650 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2651 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2655 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2656 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2663 * 3-stack pin configuration:
2664 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2666 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2668 * preset connection lists of input pins
2669 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2671 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2672 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2673 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2676 * Set pin mode and muting
2678 /* set front pin widgets 0x14 for output */
2679 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2680 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2681 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2682 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2684 /* Mic2 (as headphone out) for HP output */
2685 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2686 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2687 /* Line In pin widget for input */
2688 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2689 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2690 /* Line2 (as front mic) pin widget for input and vref at 80% */
2691 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2692 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2693 /* CD pin widget for input */
2694 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2700 * 5-stack pin configuration:
2701 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2702 * line-in/side = 0x1a, f-mic = 0x1b
2704 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2706 * preset connection lists of input pins
2707 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2709 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2710 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2713 * Set pin mode and muting
2715 /* set pin widgets 0x14-0x17 for output */
2716 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2717 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2718 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2719 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2720 /* unmute pins for output (no gain on this amp) */
2721 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2723 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2724 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2726 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2727 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2728 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2729 /* Mic2 (as headphone out) for HP output */
2730 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2731 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 /* Line In pin widget for input */
2733 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2734 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2735 /* Line2 (as front mic) pin widget for input and vref at 80% */
2736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2737 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2738 /* CD pin widget for input */
2739 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2745 * W810 pin configuration:
2746 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2748 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2749 /* hphone/speaker input selector: front DAC */
2750 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2752 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2753 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2754 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2755 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2756 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2757 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2759 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2760 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2766 * Z71V pin configuration:
2767 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2769 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2770 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2771 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2772 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2773 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2775 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2776 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2777 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2778 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2784 * 6-stack pin configuration:
2785 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2786 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2788 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2789 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2791 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2792 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2793 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2794 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2795 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2796 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2797 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2798 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2800 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2801 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2802 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2803 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2806 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2807 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2808 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2814 * Uniwill pin configuration:
2815 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2818 static struct hda_verb alc880_uniwill_init_verbs[] = {
2819 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2821 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2822 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2823 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2824 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2825 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2826 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2834 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2836 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2837 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2838 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2839 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2840 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2841 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2842 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2843 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2844 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2846 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2847 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2854 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2856 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2857 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2859 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2860 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2861 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2862 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2863 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2864 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2865 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2866 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2867 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2868 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2869 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2870 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2872 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2873 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2874 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2875 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2876 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2877 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2879 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2880 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2885 static struct hda_verb alc880_beep_init_verbs[] = {
2886 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2890 /* auto-toggle front mic */
2891 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2893 unsigned int present;
2896 present = snd_hda_jack_detect(codec, 0x18);
2897 bits = present ? HDA_AMP_MUTE : 0;
2898 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2901 static void alc880_uniwill_setup(struct hda_codec *codec)
2903 struct alc_spec *spec = codec->spec;
2905 spec->autocfg.hp_pins[0] = 0x14;
2906 spec->autocfg.speaker_pins[0] = 0x15;
2907 spec->autocfg.speaker_pins[0] = 0x16;
2910 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2912 alc_automute_amp(codec);
2913 alc880_uniwill_mic_automute(codec);
2916 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2919 /* Looks like the unsol event is incompatible with the standard
2920 * definition. 4bit tag is placed at 28 bit!
2922 switch (res >> 28) {
2923 case ALC880_MIC_EVENT:
2924 alc880_uniwill_mic_automute(codec);
2927 alc_automute_amp_unsol_event(codec, res);
2932 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2934 struct alc_spec *spec = codec->spec;
2936 spec->autocfg.hp_pins[0] = 0x14;
2937 spec->autocfg.speaker_pins[0] = 0x15;
2940 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2942 unsigned int present;
2944 present = snd_hda_codec_read(codec, 0x21, 0,
2945 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2946 present &= HDA_AMP_VOLMASK;
2947 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2948 HDA_AMP_VOLMASK, present);
2949 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2950 HDA_AMP_VOLMASK, present);
2953 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2956 /* Looks like the unsol event is incompatible with the standard
2957 * definition. 4bit tag is placed at 28 bit!
2959 if ((res >> 28) == ALC880_DCVOL_EVENT)
2960 alc880_uniwill_p53_dcvol_automute(codec);
2962 alc_automute_amp_unsol_event(codec, res);
2966 * F1734 pin configuration:
2967 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2969 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2970 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2971 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2972 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2973 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2974 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2981 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2982 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2983 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2984 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2985 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2986 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2987 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2988 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2991 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2992 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2998 * ASUS pin configuration:
2999 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3001 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3002 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3003 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3004 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3005 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3007 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3008 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3010 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3012 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3013 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3014 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3016 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3018 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3020 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3022 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3024 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3029 /* Enable GPIO mask and set output */
3030 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3031 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3032 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3034 /* Clevo m520g init */
3035 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3036 /* headphone output */
3037 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3039 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3040 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3042 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3043 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3045 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3046 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3047 /* Mic1 (rear panel) */
3048 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3049 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3050 /* Mic2 (front panel) */
3051 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3052 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3054 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3055 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 /* change to EAPD mode */
3057 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3058 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3063 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3064 /* change to EAPD mode */
3065 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3066 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3068 /* Headphone output */
3069 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3071 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3072 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3074 /* Line In pin widget for input */
3075 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3076 /* CD pin widget for input */
3077 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3078 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3079 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3081 /* change to EAPD mode */
3082 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3083 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3089 * LG m1 express dual
3092 * Rear Line-In/Out (blue): 0x14
3093 * Build-in Mic-In: 0x15
3095 * HP-Out (green): 0x1b
3096 * Mic-In/Out (red): 0x19
3100 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3101 static hda_nid_t alc880_lg_dac_nids[3] = {
3105 /* seems analog CD is not working */
3106 static struct hda_input_mux alc880_lg_capture_source = {
3111 { "Internal Mic", 0x6 },
3115 /* 2,4,6 channel modes */
3116 static struct hda_verb alc880_lg_ch2_init[] = {
3117 /* set line-in and mic-in to input */
3118 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3119 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3123 static struct hda_verb alc880_lg_ch4_init[] = {
3124 /* set line-in to out and mic-in to input */
3125 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3126 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3130 static struct hda_verb alc880_lg_ch6_init[] = {
3131 /* set line-in and mic-in to output */
3132 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3133 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3137 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3138 { 2, alc880_lg_ch2_init },
3139 { 4, alc880_lg_ch4_init },
3140 { 6, alc880_lg_ch6_init },
3143 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3144 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3145 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3146 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3147 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3148 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3149 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3150 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3151 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3154 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3155 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3156 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3157 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3159 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3160 .name = "Channel Mode",
3161 .info = alc_ch_mode_info,
3162 .get = alc_ch_mode_get,
3163 .put = alc_ch_mode_put,
3168 static struct hda_verb alc880_lg_init_verbs[] = {
3169 /* set capture source to mic-in */
3170 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3171 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3172 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3173 /* mute all amp mixer inputs */
3174 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3175 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3176 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3177 /* line-in to input */
3178 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3179 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3181 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3186 /* mic-in to input */
3187 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3188 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3192 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3193 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3195 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3199 /* toggle speaker-output according to the hp-jack state */
3200 static void alc880_lg_setup(struct hda_codec *codec)
3202 struct alc_spec *spec = codec->spec;
3204 spec->autocfg.hp_pins[0] = 0x1b;
3205 spec->autocfg.speaker_pins[0] = 0x17;
3214 * Built-in Mic-In: 0x19
3220 static struct hda_input_mux alc880_lg_lw_capture_source = {
3224 { "Internal Mic", 0x1 },
3229 #define alc880_lg_lw_modes alc880_threestack_modes
3231 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3233 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3235 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3236 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3237 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3238 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3239 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3240 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3241 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3245 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3248 .name = "Channel Mode",
3249 .info = alc_ch_mode_info,
3250 .get = alc_ch_mode_get,
3251 .put = alc_ch_mode_put,
3256 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3257 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3258 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3259 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3261 /* set capture source to mic-in */
3262 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3263 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3264 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3265 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3268 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3270 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3271 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3272 /* mic-in to input */
3273 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3274 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3276 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3277 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3279 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3283 /* toggle speaker-output according to the hp-jack state */
3284 static void alc880_lg_lw_setup(struct hda_codec *codec)
3286 struct alc_spec *spec = codec->spec;
3288 spec->autocfg.hp_pins[0] = 0x1b;
3289 spec->autocfg.speaker_pins[0] = 0x14;
3292 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3293 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3294 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3295 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3296 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3297 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3298 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3302 static struct hda_input_mux alc880_medion_rim_capture_source = {
3306 { "Internal Mic", 0x1 },
3310 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3311 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3314 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3316 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3318 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3319 /* Mic2 (as headphone out) for HP output */
3320 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3321 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3322 /* Internal Speaker */
3323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3324 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3326 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3327 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3329 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3333 /* toggle speaker-output according to the hp-jack state */
3334 static void alc880_medion_rim_automute(struct hda_codec *codec)
3336 struct alc_spec *spec = codec->spec;
3337 alc_automute_amp(codec);
3339 if (spec->jack_present)
3340 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3342 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3345 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3348 /* Looks like the unsol event is incompatible with the standard
3349 * definition. 4bit tag is placed at 28 bit!
3351 if ((res >> 28) == ALC880_HP_EVENT)
3352 alc880_medion_rim_automute(codec);
3355 static void alc880_medion_rim_setup(struct hda_codec *codec)
3357 struct alc_spec *spec = codec->spec;
3359 spec->autocfg.hp_pins[0] = 0x14;
3360 spec->autocfg.speaker_pins[0] = 0x1b;
3363 #ifdef CONFIG_SND_HDA_POWER_SAVE
3364 static struct hda_amp_list alc880_loopbacks[] = {
3365 { 0x0b, HDA_INPUT, 0 },
3366 { 0x0b, HDA_INPUT, 1 },
3367 { 0x0b, HDA_INPUT, 2 },
3368 { 0x0b, HDA_INPUT, 3 },
3369 { 0x0b, HDA_INPUT, 4 },
3373 static struct hda_amp_list alc880_lg_loopbacks[] = {
3374 { 0x0b, HDA_INPUT, 1 },
3375 { 0x0b, HDA_INPUT, 6 },
3376 { 0x0b, HDA_INPUT, 7 },
3385 static int alc_init(struct hda_codec *codec)
3387 struct alc_spec *spec = codec->spec;
3391 alc_auto_init_amp(codec, spec->init_amp);
3393 for (i = 0; i < spec->num_init_verbs; i++)
3394 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3396 if (spec->init_hook)
3397 spec->init_hook(codec);
3402 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3404 struct alc_spec *spec = codec->spec;
3406 if (spec->unsol_event)
3407 spec->unsol_event(codec, res);
3410 #ifdef CONFIG_SND_HDA_POWER_SAVE
3411 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3413 struct alc_spec *spec = codec->spec;
3414 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3419 * Analog playback callbacks
3421 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3422 struct hda_codec *codec,
3423 struct snd_pcm_substream *substream)
3425 struct alc_spec *spec = codec->spec;
3426 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3430 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3431 struct hda_codec *codec,
3432 unsigned int stream_tag,
3433 unsigned int format,
3434 struct snd_pcm_substream *substream)
3436 struct alc_spec *spec = codec->spec;
3437 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3438 stream_tag, format, substream);
3441 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3442 struct hda_codec *codec,
3443 struct snd_pcm_substream *substream)
3445 struct alc_spec *spec = codec->spec;
3446 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3452 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3453 struct hda_codec *codec,
3454 struct snd_pcm_substream *substream)
3456 struct alc_spec *spec = codec->spec;
3457 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3460 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3461 struct hda_codec *codec,
3462 unsigned int stream_tag,
3463 unsigned int format,
3464 struct snd_pcm_substream *substream)
3466 struct alc_spec *spec = codec->spec;
3467 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3468 stream_tag, format, substream);
3471 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3472 struct hda_codec *codec,
3473 struct snd_pcm_substream *substream)
3475 struct alc_spec *spec = codec->spec;
3476 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3479 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3480 struct hda_codec *codec,
3481 struct snd_pcm_substream *substream)
3483 struct alc_spec *spec = codec->spec;
3484 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3490 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3491 struct hda_codec *codec,
3492 unsigned int stream_tag,
3493 unsigned int format,
3494 struct snd_pcm_substream *substream)
3496 struct alc_spec *spec = codec->spec;
3498 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3499 stream_tag, 0, format);
3503 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3504 struct hda_codec *codec,
3505 struct snd_pcm_substream *substream)
3507 struct alc_spec *spec = codec->spec;
3509 snd_hda_codec_cleanup_stream(codec,
3510 spec->adc_nids[substream->number + 1]);
3517 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3521 /* NID is set in alc_build_pcms */
3523 .open = alc880_playback_pcm_open,
3524 .prepare = alc880_playback_pcm_prepare,
3525 .cleanup = alc880_playback_pcm_cleanup
3529 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3533 /* NID is set in alc_build_pcms */
3536 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3540 /* NID is set in alc_build_pcms */
3543 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3544 .substreams = 2, /* can be overridden */
3547 /* NID is set in alc_build_pcms */
3549 .prepare = alc880_alt_capture_pcm_prepare,
3550 .cleanup = alc880_alt_capture_pcm_cleanup
3554 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3558 /* NID is set in alc_build_pcms */
3560 .open = alc880_dig_playback_pcm_open,
3561 .close = alc880_dig_playback_pcm_close,
3562 .prepare = alc880_dig_playback_pcm_prepare,
3563 .cleanup = alc880_dig_playback_pcm_cleanup
3567 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3571 /* NID is set in alc_build_pcms */
3574 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3575 static struct hda_pcm_stream alc_pcm_null_stream = {
3581 static int alc_build_pcms(struct hda_codec *codec)
3583 struct alc_spec *spec = codec->spec;
3584 struct hda_pcm *info = spec->pcm_rec;
3587 codec->num_pcms = 1;
3588 codec->pcm_info = info;
3590 if (spec->no_analog)
3593 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3594 "%s Analog", codec->chip_name);
3595 info->name = spec->stream_name_analog;
3597 if (spec->stream_analog_playback) {
3598 if (snd_BUG_ON(!spec->multiout.dac_nids))
3600 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3601 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3603 if (spec->stream_analog_capture) {
3604 if (snd_BUG_ON(!spec->adc_nids))
3606 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3607 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3610 if (spec->channel_mode) {
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3612 for (i = 0; i < spec->num_channel_mode; i++) {
3613 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3614 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3620 /* SPDIF for stream index #1 */
3621 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3622 snprintf(spec->stream_name_digital,
3623 sizeof(spec->stream_name_digital),
3624 "%s Digital", codec->chip_name);
3625 codec->num_pcms = 2;
3626 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3627 info = spec->pcm_rec + 1;
3628 info->name = spec->stream_name_digital;
3629 if (spec->dig_out_type)
3630 info->pcm_type = spec->dig_out_type;
3632 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3633 if (spec->multiout.dig_out_nid &&
3634 spec->stream_digital_playback) {
3635 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3636 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3638 if (spec->dig_in_nid &&
3639 spec->stream_digital_capture) {
3640 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3641 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3643 /* FIXME: do we need this for all Realtek codec models? */
3644 codec->spdif_status_reset = 1;
3647 if (spec->no_analog)
3650 /* If the use of more than one ADC is requested for the current
3651 * model, configure a second analog capture-only PCM.
3653 /* Additional Analaog capture for index #2 */
3654 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3655 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3656 codec->num_pcms = 3;
3657 info = spec->pcm_rec + 2;
3658 info->name = spec->stream_name_analog;
3659 if (spec->alt_dac_nid) {
3660 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3661 *spec->stream_analog_alt_playback;
3662 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3665 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3666 alc_pcm_null_stream;
3667 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3669 if (spec->num_adc_nids > 1) {
3670 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3671 *spec->stream_analog_alt_capture;
3672 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3674 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3675 spec->num_adc_nids - 1;
3677 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3678 alc_pcm_null_stream;
3679 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3686 static inline void alc_shutup(struct hda_codec *codec)
3688 snd_hda_shutup_pins(codec);
3691 static void alc_free_kctls(struct hda_codec *codec)
3693 struct alc_spec *spec = codec->spec;
3695 if (spec->kctls.list) {
3696 struct snd_kcontrol_new *kctl = spec->kctls.list;
3698 for (i = 0; i < spec->kctls.used; i++)
3699 kfree(kctl[i].name);
3701 snd_array_free(&spec->kctls);
3704 static void alc_free(struct hda_codec *codec)
3706 struct alc_spec *spec = codec->spec;
3712 alc_free_kctls(codec);
3714 snd_hda_detach_beep_device(codec);
3717 #ifdef CONFIG_SND_HDA_POWER_SAVE
3718 static void alc_power_eapd(struct hda_codec *codec)
3720 /* We currently only handle front, HP */
3721 switch (codec->vendor_id) {
3723 snd_hda_codec_write(codec, 0x0f, 0,
3724 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3725 snd_hda_codec_write(codec, 0x10, 0,
3726 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3738 snd_hda_codec_write(codec, 0x14, 0,
3739 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3740 snd_hda_codec_write(codec, 0x15, 0,
3741 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3746 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3748 struct alc_spec *spec = codec->spec;
3750 if (spec && spec->power_hook)
3751 spec->power_hook(codec);
3756 #ifdef SND_HDA_NEEDS_RESUME
3757 static int alc_resume(struct hda_codec *codec)
3759 codec->patch_ops.init(codec);
3760 snd_hda_codec_resume_amp(codec);
3761 snd_hda_codec_resume_cache(codec);
3768 static struct hda_codec_ops alc_patch_ops = {
3769 .build_controls = alc_build_controls,
3770 .build_pcms = alc_build_pcms,
3773 .unsol_event = alc_unsol_event,
3774 #ifdef SND_HDA_NEEDS_RESUME
3775 .resume = alc_resume,
3777 #ifdef CONFIG_SND_HDA_POWER_SAVE
3778 .suspend = alc_suspend,
3779 .check_power_status = alc_check_power_status,
3781 .reboot_notify = alc_shutup,
3786 * Test configuration for debugging
3788 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3791 #ifdef CONFIG_SND_DEBUG
3792 static hda_nid_t alc880_test_dac_nids[4] = {
3793 0x02, 0x03, 0x04, 0x05
3796 static struct hda_input_mux alc880_test_capture_source = {
3805 { "Surround", 0x6 },
3809 static struct hda_channel_mode alc880_test_modes[4] = {
3816 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3817 struct snd_ctl_elem_info *uinfo)
3819 static char *texts[] = {
3820 "N/A", "Line Out", "HP Out",
3821 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3823 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3825 uinfo->value.enumerated.items = 8;
3826 if (uinfo->value.enumerated.item >= 8)
3827 uinfo->value.enumerated.item = 7;
3828 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3832 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3833 struct snd_ctl_elem_value *ucontrol)
3835 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3836 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3837 unsigned int pin_ctl, item = 0;
3839 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3840 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3841 if (pin_ctl & AC_PINCTL_OUT_EN) {
3842 if (pin_ctl & AC_PINCTL_HP_EN)
3846 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3847 switch (pin_ctl & AC_PINCTL_VREFEN) {
3848 case AC_PINCTL_VREF_HIZ: item = 3; break;
3849 case AC_PINCTL_VREF_50: item = 4; break;
3850 case AC_PINCTL_VREF_GRD: item = 5; break;
3851 case AC_PINCTL_VREF_80: item = 6; break;
3852 case AC_PINCTL_VREF_100: item = 7; break;
3855 ucontrol->value.enumerated.item[0] = item;
3859 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3860 struct snd_ctl_elem_value *ucontrol)
3862 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3863 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3864 static unsigned int ctls[] = {
3865 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3866 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3867 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3868 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3869 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3870 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3872 unsigned int old_ctl, new_ctl;
3874 old_ctl = snd_hda_codec_read(codec, nid, 0,
3875 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3876 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3877 if (old_ctl != new_ctl) {
3879 snd_hda_codec_write_cache(codec, nid, 0,
3880 AC_VERB_SET_PIN_WIDGET_CONTROL,
3882 val = ucontrol->value.enumerated.item[0] >= 3 ?
3884 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3891 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3892 struct snd_ctl_elem_info *uinfo)
3894 static char *texts[] = {
3895 "Front", "Surround", "CLFE", "Side"
3897 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3899 uinfo->value.enumerated.items = 4;
3900 if (uinfo->value.enumerated.item >= 4)
3901 uinfo->value.enumerated.item = 3;
3902 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3906 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3907 struct snd_ctl_elem_value *ucontrol)
3909 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3910 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3913 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3914 ucontrol->value.enumerated.item[0] = sel & 3;
3918 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3919 struct snd_ctl_elem_value *ucontrol)
3921 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3922 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3925 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3926 if (ucontrol->value.enumerated.item[0] != sel) {
3927 sel = ucontrol->value.enumerated.item[0] & 3;
3928 snd_hda_codec_write_cache(codec, nid, 0,
3929 AC_VERB_SET_CONNECT_SEL, sel);
3935 #define PIN_CTL_TEST(xname,nid) { \
3936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3938 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3939 .info = alc_test_pin_ctl_info, \
3940 .get = alc_test_pin_ctl_get, \
3941 .put = alc_test_pin_ctl_put, \
3942 .private_value = nid \
3945 #define PIN_SRC_TEST(xname,nid) { \
3946 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3948 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3949 .info = alc_test_pin_src_info, \
3950 .get = alc_test_pin_src_get, \
3951 .put = alc_test_pin_src_put, \
3952 .private_value = nid \
3955 static struct snd_kcontrol_new alc880_test_mixer[] = {
3956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3957 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3958 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3959 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3960 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3961 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3962 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3963 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3964 PIN_CTL_TEST("Front Pin Mode", 0x14),
3965 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3966 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3967 PIN_CTL_TEST("Side Pin Mode", 0x17),
3968 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3969 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3970 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3971 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3972 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3973 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3974 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3975 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3976 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3977 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3978 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3979 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3980 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3981 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3982 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3983 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3984 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3985 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3988 .name = "Channel Mode",
3989 .info = alc_ch_mode_info,
3990 .get = alc_ch_mode_get,
3991 .put = alc_ch_mode_put,
3996 static struct hda_verb alc880_test_init_verbs[] = {
3997 /* Unmute inputs of 0x0c - 0x0f */
3998 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3999 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4000 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4001 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4002 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4003 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4004 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4005 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4006 /* Vol output for 0x0c-0x0f */
4007 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4008 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4009 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4010 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4011 /* Set output pins 0x14-0x17 */
4012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4013 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4014 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4015 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4016 /* Unmute output pins 0x14-0x17 */
4017 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4019 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4020 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4021 /* Set input pins 0x18-0x1c */
4022 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4023 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4024 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4025 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4026 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4027 /* Mute input pins 0x18-0x1b */
4028 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4029 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4030 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4031 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4033 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4034 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4035 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4036 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4037 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4038 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4039 /* Analog input/passthru */
4040 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4041 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4042 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4043 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4044 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4052 static const char *alc880_models[ALC880_MODEL_LAST] = {
4053 [ALC880_3ST] = "3stack",
4054 [ALC880_TCL_S700] = "tcl",
4055 [ALC880_3ST_DIG] = "3stack-digout",
4056 [ALC880_CLEVO] = "clevo",
4057 [ALC880_5ST] = "5stack",
4058 [ALC880_5ST_DIG] = "5stack-digout",
4059 [ALC880_W810] = "w810",
4060 [ALC880_Z71V] = "z71v",
4061 [ALC880_6ST] = "6stack",
4062 [ALC880_6ST_DIG] = "6stack-digout",
4063 [ALC880_ASUS] = "asus",
4064 [ALC880_ASUS_W1V] = "asus-w1v",
4065 [ALC880_ASUS_DIG] = "asus-dig",
4066 [ALC880_ASUS_DIG2] = "asus-dig2",
4067 [ALC880_UNIWILL_DIG] = "uniwill",
4068 [ALC880_UNIWILL_P53] = "uniwill-p53",
4069 [ALC880_FUJITSU] = "fujitsu",
4070 [ALC880_F1734] = "F1734",
4072 [ALC880_LG_LW] = "lg-lw",
4073 [ALC880_MEDION_RIM] = "medion",
4074 #ifdef CONFIG_SND_DEBUG
4075 [ALC880_TEST] = "test",
4077 [ALC880_AUTO] = "auto",
4080 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4081 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4082 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4083 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4084 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4085 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4086 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4087 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4088 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4089 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4090 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4091 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4092 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4093 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4094 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4095 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4096 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4097 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4098 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4099 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4100 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4101 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4102 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4104 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4105 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4106 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4107 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4108 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4109 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4110 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4111 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4112 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4113 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4114 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4115 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4116 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4117 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4118 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4119 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4120 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4121 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4122 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4123 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4124 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4125 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4126 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4128 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4129 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4130 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4131 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4132 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4133 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4134 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4135 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4136 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4137 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4138 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4139 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4140 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4141 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4142 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4143 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4144 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4145 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4146 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4147 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4148 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4150 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4151 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4152 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4157 * ALC880 codec presets
4159 static struct alc_config_preset alc880_presets[] = {
4161 .mixers = { alc880_three_stack_mixer },
4162 .init_verbs = { alc880_volume_init_verbs,
4163 alc880_pin_3stack_init_verbs },
4164 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4165 .dac_nids = alc880_dac_nids,
4166 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4167 .channel_mode = alc880_threestack_modes,
4169 .input_mux = &alc880_capture_source,
4171 [ALC880_3ST_DIG] = {
4172 .mixers = { alc880_three_stack_mixer },
4173 .init_verbs = { alc880_volume_init_verbs,
4174 alc880_pin_3stack_init_verbs },
4175 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4176 .dac_nids = alc880_dac_nids,
4177 .dig_out_nid = ALC880_DIGOUT_NID,
4178 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4179 .channel_mode = alc880_threestack_modes,
4181 .input_mux = &alc880_capture_source,
4183 [ALC880_TCL_S700] = {
4184 .mixers = { alc880_tcl_s700_mixer },
4185 .init_verbs = { alc880_volume_init_verbs,
4186 alc880_pin_tcl_S700_init_verbs,
4187 alc880_gpio2_init_verbs },
4188 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4189 .dac_nids = alc880_dac_nids,
4190 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4191 .num_adc_nids = 1, /* single ADC */
4193 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4194 .channel_mode = alc880_2_jack_modes,
4195 .input_mux = &alc880_capture_source,
4198 .mixers = { alc880_three_stack_mixer,
4199 alc880_five_stack_mixer},
4200 .init_verbs = { alc880_volume_init_verbs,
4201 alc880_pin_5stack_init_verbs },
4202 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4203 .dac_nids = alc880_dac_nids,
4204 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4205 .channel_mode = alc880_fivestack_modes,
4206 .input_mux = &alc880_capture_source,
4208 [ALC880_5ST_DIG] = {
4209 .mixers = { alc880_three_stack_mixer,
4210 alc880_five_stack_mixer },
4211 .init_verbs = { alc880_volume_init_verbs,
4212 alc880_pin_5stack_init_verbs },
4213 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4214 .dac_nids = alc880_dac_nids,
4215 .dig_out_nid = ALC880_DIGOUT_NID,
4216 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4217 .channel_mode = alc880_fivestack_modes,
4218 .input_mux = &alc880_capture_source,
4221 .mixers = { alc880_six_stack_mixer },
4222 .init_verbs = { alc880_volume_init_verbs,
4223 alc880_pin_6stack_init_verbs },
4224 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4225 .dac_nids = alc880_6st_dac_nids,
4226 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4227 .channel_mode = alc880_sixstack_modes,
4228 .input_mux = &alc880_6stack_capture_source,
4230 [ALC880_6ST_DIG] = {
4231 .mixers = { alc880_six_stack_mixer },
4232 .init_verbs = { alc880_volume_init_verbs,
4233 alc880_pin_6stack_init_verbs },
4234 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4235 .dac_nids = alc880_6st_dac_nids,
4236 .dig_out_nid = ALC880_DIGOUT_NID,
4237 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4238 .channel_mode = alc880_sixstack_modes,
4239 .input_mux = &alc880_6stack_capture_source,
4242 .mixers = { alc880_w810_base_mixer },
4243 .init_verbs = { alc880_volume_init_verbs,
4244 alc880_pin_w810_init_verbs,
4245 alc880_gpio2_init_verbs },
4246 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4247 .dac_nids = alc880_w810_dac_nids,
4248 .dig_out_nid = ALC880_DIGOUT_NID,
4249 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4250 .channel_mode = alc880_w810_modes,
4251 .input_mux = &alc880_capture_source,
4254 .mixers = { alc880_z71v_mixer },
4255 .init_verbs = { alc880_volume_init_verbs,
4256 alc880_pin_z71v_init_verbs },
4257 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4258 .dac_nids = alc880_z71v_dac_nids,
4259 .dig_out_nid = ALC880_DIGOUT_NID,
4261 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4262 .channel_mode = alc880_2_jack_modes,
4263 .input_mux = &alc880_capture_source,
4266 .mixers = { alc880_f1734_mixer },
4267 .init_verbs = { alc880_volume_init_verbs,
4268 alc880_pin_f1734_init_verbs },
4269 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4270 .dac_nids = alc880_f1734_dac_nids,
4272 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4273 .channel_mode = alc880_2_jack_modes,
4274 .input_mux = &alc880_f1734_capture_source,
4275 .unsol_event = alc880_uniwill_p53_unsol_event,
4276 .setup = alc880_uniwill_p53_setup,
4277 .init_hook = alc_automute_amp,
4280 .mixers = { alc880_asus_mixer },
4281 .init_verbs = { alc880_volume_init_verbs,
4282 alc880_pin_asus_init_verbs,
4283 alc880_gpio1_init_verbs },
4284 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4285 .dac_nids = alc880_asus_dac_nids,
4286 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4287 .channel_mode = alc880_asus_modes,
4289 .input_mux = &alc880_capture_source,
4291 [ALC880_ASUS_DIG] = {
4292 .mixers = { alc880_asus_mixer },
4293 .init_verbs = { alc880_volume_init_verbs,
4294 alc880_pin_asus_init_verbs,
4295 alc880_gpio1_init_verbs },
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_DIG2] = {
4305 .mixers = { alc880_asus_mixer },
4306 .init_verbs = { alc880_volume_init_verbs,
4307 alc880_pin_asus_init_verbs,
4308 alc880_gpio2_init_verbs }, /* use GPIO2 */
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_ASUS_W1V] = {
4318 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4319 .init_verbs = { alc880_volume_init_verbs,
4320 alc880_pin_asus_init_verbs,
4321 alc880_gpio1_init_verbs },
4322 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4323 .dac_nids = alc880_asus_dac_nids,
4324 .dig_out_nid = ALC880_DIGOUT_NID,
4325 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4326 .channel_mode = alc880_asus_modes,
4328 .input_mux = &alc880_capture_source,
4330 [ALC880_UNIWILL_DIG] = {
4331 .mixers = { alc880_asus_mixer },
4332 .init_verbs = { alc880_volume_init_verbs,
4333 alc880_pin_asus_init_verbs },
4334 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4335 .dac_nids = alc880_asus_dac_nids,
4336 .dig_out_nid = ALC880_DIGOUT_NID,
4337 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4338 .channel_mode = alc880_asus_modes,
4340 .input_mux = &alc880_capture_source,
4342 [ALC880_UNIWILL] = {
4343 .mixers = { alc880_uniwill_mixer },
4344 .init_verbs = { alc880_volume_init_verbs,
4345 alc880_uniwill_init_verbs },
4346 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4347 .dac_nids = alc880_asus_dac_nids,
4348 .dig_out_nid = ALC880_DIGOUT_NID,
4349 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4350 .channel_mode = alc880_threestack_modes,
4352 .input_mux = &alc880_capture_source,
4353 .unsol_event = alc880_uniwill_unsol_event,
4354 .setup = alc880_uniwill_setup,
4355 .init_hook = alc880_uniwill_init_hook,
4357 [ALC880_UNIWILL_P53] = {
4358 .mixers = { alc880_uniwill_p53_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_uniwill_p53_init_verbs },
4361 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4362 .dac_nids = alc880_asus_dac_nids,
4363 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4364 .channel_mode = alc880_threestack_modes,
4365 .input_mux = &alc880_capture_source,
4366 .unsol_event = alc880_uniwill_p53_unsol_event,
4367 .setup = alc880_uniwill_p53_setup,
4368 .init_hook = alc_automute_amp,
4370 [ALC880_FUJITSU] = {
4371 .mixers = { alc880_fujitsu_mixer },
4372 .init_verbs = { alc880_volume_init_verbs,
4373 alc880_uniwill_p53_init_verbs,
4374 alc880_beep_init_verbs },
4375 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4376 .dac_nids = alc880_dac_nids,
4377 .dig_out_nid = ALC880_DIGOUT_NID,
4378 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4379 .channel_mode = alc880_2_jack_modes,
4380 .input_mux = &alc880_capture_source,
4381 .unsol_event = alc880_uniwill_p53_unsol_event,
4382 .setup = alc880_uniwill_p53_setup,
4383 .init_hook = alc_automute_amp,
4386 .mixers = { alc880_three_stack_mixer },
4387 .init_verbs = { alc880_volume_init_verbs,
4388 alc880_pin_clevo_init_verbs },
4389 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4390 .dac_nids = alc880_dac_nids,
4392 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4393 .channel_mode = alc880_threestack_modes,
4395 .input_mux = &alc880_capture_source,
4398 .mixers = { alc880_lg_mixer },
4399 .init_verbs = { alc880_volume_init_verbs,
4400 alc880_lg_init_verbs },
4401 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4402 .dac_nids = alc880_lg_dac_nids,
4403 .dig_out_nid = ALC880_DIGOUT_NID,
4404 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4405 .channel_mode = alc880_lg_ch_modes,
4407 .input_mux = &alc880_lg_capture_source,
4408 .unsol_event = alc_automute_amp_unsol_event,
4409 .setup = alc880_lg_setup,
4410 .init_hook = alc_automute_amp,
4411 #ifdef CONFIG_SND_HDA_POWER_SAVE
4412 .loopbacks = alc880_lg_loopbacks,
4416 .mixers = { alc880_lg_lw_mixer },
4417 .init_verbs = { alc880_volume_init_verbs,
4418 alc880_lg_lw_init_verbs },
4419 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4420 .dac_nids = alc880_dac_nids,
4421 .dig_out_nid = ALC880_DIGOUT_NID,
4422 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4423 .channel_mode = alc880_lg_lw_modes,
4424 .input_mux = &alc880_lg_lw_capture_source,
4425 .unsol_event = alc_automute_amp_unsol_event,
4426 .setup = alc880_lg_lw_setup,
4427 .init_hook = alc_automute_amp,
4429 [ALC880_MEDION_RIM] = {
4430 .mixers = { alc880_medion_rim_mixer },
4431 .init_verbs = { alc880_volume_init_verbs,
4432 alc880_medion_rim_init_verbs,
4433 alc_gpio2_init_verbs },
4434 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4435 .dac_nids = alc880_dac_nids,
4436 .dig_out_nid = ALC880_DIGOUT_NID,
4437 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4438 .channel_mode = alc880_2_jack_modes,
4439 .input_mux = &alc880_medion_rim_capture_source,
4440 .unsol_event = alc880_medion_rim_unsol_event,
4441 .setup = alc880_medion_rim_setup,
4442 .init_hook = alc880_medion_rim_automute,
4444 #ifdef CONFIG_SND_DEBUG
4446 .mixers = { alc880_test_mixer },
4447 .init_verbs = { alc880_test_init_verbs },
4448 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4449 .dac_nids = alc880_test_dac_nids,
4450 .dig_out_nid = ALC880_DIGOUT_NID,
4451 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4452 .channel_mode = alc880_test_modes,
4453 .input_mux = &alc880_test_capture_source,
4459 * Automatic parse of I/O pins from the BIOS configuration
4464 ALC_CTL_WIDGET_MUTE,
4467 static struct snd_kcontrol_new alc880_control_templates[] = {
4468 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4469 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4470 HDA_BIND_MUTE(NULL, 0, 0, 0),
4473 /* add dynamic controls */
4474 static int add_control(struct alc_spec *spec, int type, const char *name,
4477 struct snd_kcontrol_new *knew;
4479 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4480 knew = snd_array_new(&spec->kctls);
4483 *knew = alc880_control_templates[type];
4484 knew->name = kstrdup(name, GFP_KERNEL);
4487 if (get_amp_nid_(val))
4488 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4489 knew->private_value = val;
4493 static int add_control_with_pfx(struct alc_spec *spec, int type,
4494 const char *pfx, const char *dir,
4495 const char *sfx, unsigned long val)
4498 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4499 return add_control(spec, type, name, val);
4502 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4503 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4504 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4505 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4507 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4508 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4509 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4510 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4511 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4512 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4513 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4514 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4515 #define ALC880_PIN_CD_NID 0x1c
4517 /* fill in the dac_nids table from the parsed pin configuration */
4518 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4519 const struct auto_pin_cfg *cfg)
4525 memset(assigned, 0, sizeof(assigned));
4526 spec->multiout.dac_nids = spec->private_dac_nids;
4528 /* check the pins hardwired to audio widget */
4529 for (i = 0; i < cfg->line_outs; i++) {
4530 nid = cfg->line_out_pins[i];
4531 if (alc880_is_fixed_pin(nid)) {
4532 int idx = alc880_fixed_pin_idx(nid);
4533 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4537 /* left pins can be connect to any audio widget */
4538 for (i = 0; i < cfg->line_outs; i++) {
4539 nid = cfg->line_out_pins[i];
4540 if (alc880_is_fixed_pin(nid))
4542 /* search for an empty channel */
4543 for (j = 0; j < cfg->line_outs; j++) {
4545 spec->multiout.dac_nids[i] =
4546 alc880_idx_to_dac(j);
4552 spec->multiout.num_dacs = cfg->line_outs;
4556 /* add playback controls from the parsed DAC table */
4557 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4558 const struct auto_pin_cfg *cfg)
4560 static const char *chname[4] = {
4561 "Front", "Surround", NULL /*CLFE*/, "Side"
4566 for (i = 0; i < cfg->line_outs; i++) {
4567 if (!spec->multiout.dac_nids[i])
4569 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4572 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4574 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4578 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4580 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4584 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4586 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4590 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4592 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4598 if (cfg->line_outs == 1 &&
4599 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4603 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4604 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4608 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4609 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4618 /* add playback controls for speaker and HP outputs */
4619 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4628 if (alc880_is_fixed_pin(pin)) {
4629 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4630 /* specify the DAC as the extra output */
4631 if (!spec->multiout.hp_nid)
4632 spec->multiout.hp_nid = nid;
4634 spec->multiout.extra_out_nid[0] = nid;
4635 /* control HP volume/switch on the output mixer amp */
4636 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4637 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4638 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4641 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4642 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4645 } else if (alc880_is_multi_pin(pin)) {
4646 /* set manual connection */
4647 /* we have only a switch on HP-out PIN */
4648 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4649 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4656 /* create input playback/capture controls for the given pin */
4657 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4658 const char *ctlname,
4659 int idx, hda_nid_t mix_nid)
4663 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4664 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4667 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4668 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4674 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4676 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4677 return (pincap & AC_PINCAP_IN) != 0;
4680 /* create playback/capture controls for input pins */
4681 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4682 const struct auto_pin_cfg *cfg,
4684 hda_nid_t cap1, hda_nid_t cap2)
4686 struct alc_spec *spec = codec->spec;
4687 struct hda_input_mux *imux = &spec->private_imux[0];
4690 for (i = 0; i < AUTO_PIN_LAST; i++) {
4693 pin = cfg->input_pins[i];
4694 if (!alc_is_input_pin(codec, pin))
4698 idx = get_connection_index(codec, mixer, pin);
4700 err = new_analog_input(spec, pin,
4701 auto_pin_cfg_labels[i],
4710 idx = get_connection_index(codec, cap1, pin);
4711 if (idx < 0 && cap2)
4712 idx = get_connection_index(codec, cap2, pin);
4714 imux->items[imux->num_items].label =
4715 auto_pin_cfg_labels[i];
4716 imux->items[imux->num_items].index = idx;
4723 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4724 const struct auto_pin_cfg *cfg)
4726 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4729 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4730 unsigned int pin_type)
4732 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4735 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4739 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4740 hda_nid_t nid, int pin_type,
4743 alc_set_pin_output(codec, nid, pin_type);
4744 /* need the manual connection? */
4745 if (alc880_is_multi_pin(nid)) {
4746 struct alc_spec *spec = codec->spec;
4747 int idx = alc880_multi_pin_idx(nid);
4748 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4749 AC_VERB_SET_CONNECT_SEL,
4750 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4754 static int get_pin_type(int line_out_type)
4756 if (line_out_type == AUTO_PIN_HP_OUT)
4762 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4764 struct alc_spec *spec = codec->spec;
4767 for (i = 0; i < spec->autocfg.line_outs; i++) {
4768 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4769 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4770 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4774 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4776 struct alc_spec *spec = codec->spec;
4779 pin = spec->autocfg.speaker_pins[0];
4780 if (pin) /* connect to front */
4781 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4782 pin = spec->autocfg.hp_pins[0];
4783 if (pin) /* connect to front */
4784 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4787 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4789 struct alc_spec *spec = codec->spec;
4792 for (i = 0; i < AUTO_PIN_LAST; i++) {
4793 hda_nid_t nid = spec->autocfg.input_pins[i];
4794 if (alc_is_input_pin(codec, nid)) {
4795 alc_set_input_pin(codec, nid, i);
4796 if (nid != ALC880_PIN_CD_NID &&
4797 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4798 snd_hda_codec_write(codec, nid, 0,
4799 AC_VERB_SET_AMP_GAIN_MUTE,
4805 /* parse the BIOS configuration and set up the alc_spec */
4806 /* return 1 if successful, 0 if the proper config is not found,
4807 * or a negative error code
4809 static int alc880_parse_auto_config(struct hda_codec *codec)
4811 struct alc_spec *spec = codec->spec;
4813 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4815 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4819 if (!spec->autocfg.line_outs)
4820 return 0; /* can't find valid BIOS pin config */
4822 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4825 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4828 err = alc880_auto_create_extra_out(spec,
4829 spec->autocfg.speaker_pins[0],
4833 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4837 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4841 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4843 /* check multiple SPDIF-out (for recent codecs) */
4844 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4846 err = snd_hda_get_connections(codec,
4847 spec->autocfg.dig_out_pins[i],
4852 spec->multiout.dig_out_nid = dig_nid;
4854 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4855 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4857 spec->slave_dig_outs[i - 1] = dig_nid;
4860 if (spec->autocfg.dig_in_pin)
4861 spec->dig_in_nid = ALC880_DIGIN_NID;
4863 if (spec->kctls.list)
4864 add_mixer(spec, spec->kctls.list);
4866 add_verb(spec, alc880_volume_init_verbs);
4868 spec->num_mux_defs = 1;
4869 spec->input_mux = &spec->private_imux[0];
4871 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4876 /* additional initialization for auto-configuration model */
4877 static void alc880_auto_init(struct hda_codec *codec)
4879 struct alc_spec *spec = codec->spec;
4880 alc880_auto_init_multi_out(codec);
4881 alc880_auto_init_extra_out(codec);
4882 alc880_auto_init_analog_input(codec);
4883 if (spec->unsol_event)
4884 alc_inithook(codec);
4887 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4888 * one of two digital mic pins, e.g. on ALC272
4890 static void fixup_automic_adc(struct hda_codec *codec)
4892 struct alc_spec *spec = codec->spec;
4895 for (i = 0; i < spec->num_adc_nids; i++) {
4896 hda_nid_t cap = spec->capsrc_nids ?
4897 spec->capsrc_nids[i] : spec->adc_nids[i];
4900 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4903 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4906 spec->int_mic.mux_idx = iidx;
4907 spec->ext_mic.mux_idx = eidx;
4908 if (spec->capsrc_nids)
4909 spec->capsrc_nids += i;
4910 spec->adc_nids += i;
4911 spec->num_adc_nids = 1;
4914 snd_printd(KERN_INFO "hda_codec: %s: "
4915 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4916 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4917 spec->auto_mic = 0; /* disable auto-mic to be sure */
4920 static void set_capture_mixer(struct hda_codec *codec)
4922 struct alc_spec *spec = codec->spec;
4923 static struct snd_kcontrol_new *caps[2][3] = {
4924 { alc_capture_mixer_nosrc1,
4925 alc_capture_mixer_nosrc2,
4926 alc_capture_mixer_nosrc3 },
4927 { alc_capture_mixer1,
4929 alc_capture_mixer3 },
4931 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4933 if (spec->auto_mic) {
4935 fixup_automic_adc(codec);
4936 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4940 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4944 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4945 #define set_beep_amp(spec, nid, idx, dir) \
4946 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4948 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4952 * OK, here we have finally the patch for ALC880
4955 static int patch_alc880(struct hda_codec *codec)
4957 struct alc_spec *spec;
4961 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4967 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4970 if (board_config < 0) {
4971 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4973 board_config = ALC880_AUTO;
4976 if (board_config == ALC880_AUTO) {
4977 /* automatic parse from the BIOS config */
4978 err = alc880_parse_auto_config(codec);
4984 "hda_codec: Cannot set up configuration "
4985 "from BIOS. Using 3-stack mode...\n");
4986 board_config = ALC880_3ST;
4990 err = snd_hda_attach_beep_device(codec, 0x1);
4996 if (board_config != ALC880_AUTO)
4997 setup_preset(codec, &alc880_presets[board_config]);
4999 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5000 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5001 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5003 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5004 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5006 if (!spec->adc_nids && spec->input_mux) {
5007 /* check whether NID 0x07 is valid */
5008 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5010 wcap = get_wcaps_type(wcap);
5011 if (wcap != AC_WID_AUD_IN) {
5012 spec->adc_nids = alc880_adc_nids_alt;
5013 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5015 spec->adc_nids = alc880_adc_nids;
5016 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5019 set_capture_mixer(codec);
5020 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5022 spec->vmaster_nid = 0x0c;
5024 codec->patch_ops = alc_patch_ops;
5025 if (board_config == ALC880_AUTO)
5026 spec->init_hook = alc880_auto_init;
5027 #ifdef CONFIG_SND_HDA_POWER_SAVE
5028 if (!spec->loopback.amplist)
5029 spec->loopback.amplist = alc880_loopbacks;
5031 codec->proc_widget_hook = print_realtek_coef;
5041 static hda_nid_t alc260_dac_nids[1] = {
5046 static hda_nid_t alc260_adc_nids[1] = {
5051 static hda_nid_t alc260_adc_nids_alt[1] = {
5056 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5057 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5059 static hda_nid_t alc260_dual_adc_nids[2] = {
5064 #define ALC260_DIGOUT_NID 0x03
5065 #define ALC260_DIGIN_NID 0x06
5067 static struct hda_input_mux alc260_capture_source = {
5071 { "Front Mic", 0x1 },
5077 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5078 * headphone jack and the internal CD lines since these are the only pins at
5079 * which audio can appear. For flexibility, also allow the option of
5080 * recording the mixer output on the second ADC (ADC0 doesn't have a
5081 * connection to the mixer output).
5083 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5087 { "Mic/Line", 0x0 },
5089 { "Headphone", 0x2 },
5095 { "Mic/Line", 0x0 },
5097 { "Headphone", 0x2 },
5104 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5105 * the Fujitsu S702x, but jacks are marked differently.
5107 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5114 { "Headphone", 0x5 },
5123 { "Headphone", 0x6 },
5129 /* Maxdata Favorit 100XS */
5130 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5134 { "Line/Mic", 0x0 },
5141 { "Line/Mic", 0x0 },
5149 * This is just place-holder, so there's something for alc_build_pcms to look
5150 * at when it calculates the maximum number of channels. ALC260 has no mixer
5151 * element which allows changing the channel mode, so the verb list is
5154 static struct hda_channel_mode alc260_modes[1] = {
5159 /* Mixer combinations
5161 * basic: base_output + input + pc_beep + capture
5162 * HP: base_output + input + capture_alt
5163 * HP_3013: hp_3013 + input + capture
5164 * fujitsu: fujitsu + capture
5165 * acer: acer + capture
5168 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5169 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5170 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5171 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5172 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5173 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5174 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5178 static struct snd_kcontrol_new alc260_input_mixer[] = {
5179 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5180 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5181 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5182 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5183 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5184 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5185 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5186 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5190 /* update HP, line and mono out pins according to the master switch */
5191 static void alc260_hp_master_update(struct hda_codec *codec,
5192 hda_nid_t hp, hda_nid_t line,
5195 struct alc_spec *spec = codec->spec;
5196 unsigned int val = spec->master_sw ? PIN_HP : 0;
5197 /* change HP and line-out pins */
5198 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5200 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5202 /* mono (speaker) depending on the HP jack sense */
5203 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5204 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5208 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5209 struct snd_ctl_elem_value *ucontrol)
5211 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5212 struct alc_spec *spec = codec->spec;
5213 *ucontrol->value.integer.value = spec->master_sw;
5217 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5218 struct snd_ctl_elem_value *ucontrol)
5220 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5221 struct alc_spec *spec = codec->spec;
5222 int val = !!*ucontrol->value.integer.value;
5223 hda_nid_t hp, line, mono;
5225 if (val == spec->master_sw)
5227 spec->master_sw = val;
5228 hp = (kcontrol->private_value >> 16) & 0xff;
5229 line = (kcontrol->private_value >> 8) & 0xff;
5230 mono = kcontrol->private_value & 0xff;
5231 alc260_hp_master_update(codec, hp, line, mono);
5235 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5238 .name = "Master Playback Switch",
5239 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5240 .info = snd_ctl_boolean_mono_info,
5241 .get = alc260_hp_master_sw_get,
5242 .put = alc260_hp_master_sw_put,
5243 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5245 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5246 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5247 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5248 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5249 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5251 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5255 static struct hda_verb alc260_hp_unsol_verbs[] = {
5256 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5260 static void alc260_hp_automute(struct hda_codec *codec)
5262 struct alc_spec *spec = codec->spec;
5264 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5265 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5268 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5270 if ((res >> 26) == ALC880_HP_EVENT)
5271 alc260_hp_automute(codec);
5274 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5277 .name = "Master Playback Switch",
5278 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5279 .info = snd_ctl_boolean_mono_info,
5280 .get = alc260_hp_master_sw_get,
5281 .put = alc260_hp_master_sw_put,
5282 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5284 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5285 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5286 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5287 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5288 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5290 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5291 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5295 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5296 .ops = &snd_hda_bind_vol,
5298 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5299 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5300 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5305 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5306 .ops = &snd_hda_bind_sw,
5308 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5309 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5314 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5315 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5316 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5317 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5318 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5322 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5323 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5327 static void alc260_hp_3013_automute(struct hda_codec *codec)
5329 struct alc_spec *spec = codec->spec;
5331 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5332 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5335 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5338 if ((res >> 26) == ALC880_HP_EVENT)
5339 alc260_hp_3013_automute(codec);
5342 static void alc260_hp_3012_automute(struct hda_codec *codec)
5344 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5346 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5348 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5350 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5354 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5357 if ((res >> 26) == ALC880_HP_EVENT)
5358 alc260_hp_3012_automute(codec);
5361 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5362 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5364 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5366 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5367 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5368 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5369 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5370 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5371 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5372 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5373 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5374 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5378 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5379 * versions of the ALC260 don't act on requests to enable mic bias from NID
5380 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5381 * datasheet doesn't mention this restriction. At this stage it's not clear
5382 * whether this behaviour is intentional or is a hardware bug in chip
5383 * revisions available in early 2006. Therefore for now allow the
5384 * "Headphone Jack Mode" control to span all choices, but if it turns out
5385 * that the lack of mic bias for this NID is intentional we could change the
5386 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5388 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5389 * don't appear to make the mic bias available from the "line" jack, even
5390 * though the NID used for this jack (0x14) can supply it. The theory is
5391 * that perhaps Acer have included blocking capacitors between the ALC260
5392 * and the output jack. If this turns out to be the case for all such
5393 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5394 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5396 * The C20x Tablet series have a mono internal speaker which is controlled
5397 * via the chip's Mono sum widget and pin complex, so include the necessary
5398 * controls for such models. On models without a "mono speaker" the control
5399 * won't do anything.
5401 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5402 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5403 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5404 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5405 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5407 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5409 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5410 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5411 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5412 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5413 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5414 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5415 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5416 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5420 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5422 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5423 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5424 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5425 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5426 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5427 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5428 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5432 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5433 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5435 static struct snd_kcontrol_new alc260_will_mixer[] = {
5436 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5437 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5438 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5439 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5440 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5441 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5442 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5443 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5444 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5445 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5449 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5450 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5452 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5453 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5454 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5455 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5456 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5457 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5458 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5459 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5460 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5461 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5462 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5467 * initialization verbs
5469 static struct hda_verb alc260_init_verbs[] = {
5470 /* Line In pin widget for input */
5471 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5472 /* CD pin widget for input */
5473 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5474 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5475 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5476 /* Mic2 (front panel) pin widget for input and vref at 80% */
5477 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5478 /* LINE-2 is used for line-out in rear */
5479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5480 /* select line-out */
5481 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5483 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5485 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5487 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5488 /* mute capture amp left and right */
5489 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5490 /* set connection select to line in (default select for this ADC) */
5491 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5492 /* mute capture amp left and right */
5493 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5494 /* set connection select to line in (default select for this ADC) */
5495 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5496 /* set vol=0 Line-Out mixer amp left and right */
5497 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5498 /* unmute pin widget amp left and right (no gain on this amp) */
5499 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5500 /* set vol=0 HP mixer amp left and right */
5501 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5502 /* unmute pin widget amp left and right (no gain on this amp) */
5503 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5504 /* set vol=0 Mono mixer amp left and right */
5505 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5506 /* unmute pin widget amp left and right (no gain on this amp) */
5507 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5508 /* unmute LINE-2 out pin */
5509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5510 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5513 /* mute analog inputs */
5514 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5515 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5516 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5517 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5518 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5519 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5520 /* mute Front out path */
5521 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5522 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5523 /* mute Headphone out path */
5524 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5525 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5526 /* mute Mono out path */
5527 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5528 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5532 #if 0 /* should be identical with alc260_init_verbs? */
5533 static struct hda_verb alc260_hp_init_verbs[] = {
5534 /* Headphone and output */
5535 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5537 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5538 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5539 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5540 /* Mic2 (front panel) pin widget for input and vref at 80% */
5541 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5542 /* Line In pin widget for input */
5543 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5544 /* Line-2 pin widget for output */
5545 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5546 /* CD pin widget for input */
5547 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5548 /* unmute amp left and right */
5549 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5550 /* set connection select to line in (default select for this ADC) */
5551 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5552 /* unmute Line-Out mixer amp left and right (volume = 0) */
5553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5554 /* mute pin widget amp left and right (no gain on this amp) */
5555 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5556 /* unmute HP mixer amp left and right (volume = 0) */
5557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5558 /* mute pin widget amp left and right (no gain on this amp) */
5559 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5560 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5563 /* mute analog inputs */
5564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5565 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5566 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5567 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5568 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5569 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5570 /* Unmute Front out path */
5571 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5572 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5573 /* Unmute Headphone out path */
5574 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5575 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5576 /* Unmute Mono out path */
5577 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5578 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5583 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5584 /* Line out and output */
5585 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5587 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5588 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5589 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5590 /* Mic2 (front panel) pin widget for input and vref at 80% */
5591 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5592 /* Line In pin widget for input */
5593 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5594 /* Headphone pin widget for output */
5595 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5596 /* CD pin widget for input */
5597 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5598 /* unmute amp left and right */
5599 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5600 /* set connection select to line in (default select for this ADC) */
5601 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5602 /* unmute Line-Out mixer amp left and right (volume = 0) */
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5604 /* mute pin widget amp left and right (no gain on this amp) */
5605 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5606 /* unmute HP mixer amp left and right (volume = 0) */
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5608 /* mute pin widget amp left and right (no gain on this amp) */
5609 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5610 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5613 /* mute analog inputs */
5614 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5615 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5617 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5618 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5619 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5620 /* Unmute Front out path */
5621 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5622 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5623 /* Unmute Headphone out path */
5624 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5625 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5626 /* Unmute Mono out path */
5627 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5628 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5632 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5633 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5634 * audio = 0x16, internal speaker = 0x10.
5636 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5637 /* Disable all GPIOs */
5638 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5639 /* Internal speaker is connected to headphone pin */
5640 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5641 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5643 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5644 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5645 /* Ensure all other unused pins are disabled and muted. */
5646 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5649 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5650 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5651 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5655 /* Disable digital (SPDIF) pins */
5656 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5657 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5659 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5660 * when acting as an output.
5662 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5664 /* Start with output sum widgets muted and their output gains at min */
5665 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5666 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5667 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5669 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5670 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5671 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5672 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5673 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5675 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5676 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5677 /* Unmute Line1 pin widget output buffer since it starts as an output.
5678 * If the pin mode is changed by the user the pin mode control will
5679 * take care of enabling the pin's input/output buffers as needed.
5680 * Therefore there's no need to enable the input buffer at this
5683 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5684 /* Unmute input buffer of pin widget used for Line-in (no equiv
5687 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5689 /* Mute capture amp left and right */
5690 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5691 /* Set ADC connection select to match default mixer setting - line
5694 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5696 /* Do the same for the second ADC: mute capture input amp and
5697 * set ADC connection to line in (on mic1 pin)
5699 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5700 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5702 /* Mute all inputs to mixer widget (even unconnected ones) */
5703 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5704 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5705 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5706 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5707 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5708 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5715 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5716 * similar laptops (adapted from Fujitsu init verbs).
5718 static struct hda_verb alc260_acer_init_verbs[] = {
5719 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5720 * the headphone jack. Turn this on and rely on the standard mute
5721 * methods whenever the user wants to turn these outputs off.
5723 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5724 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5725 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5726 /* Internal speaker/Headphone jack is connected to Line-out pin */
5727 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5728 /* Internal microphone/Mic jack is connected to Mic1 pin */
5729 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5730 /* Line In jack is connected to Line1 pin */
5731 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5732 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5733 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5734 /* Ensure all other unused pins are disabled and muted. */
5735 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5736 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5737 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5738 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5739 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5740 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5741 /* Disable digital (SPDIF) pins */
5742 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5743 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5745 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5746 * bus when acting as outputs.
5748 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5749 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5751 /* Start with output sum widgets muted and their output gains at min */
5752 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5753 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5754 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5755 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5756 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5758 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5759 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5760 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5762 /* Unmute Line-out pin widget amp left and right
5763 * (no equiv mixer ctrl)
5765 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5766 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5767 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5768 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5769 * inputs. If the pin mode is changed by the user the pin mode control
5770 * will take care of enabling the pin's input/output buffers as needed.
5771 * Therefore there's no need to enable the input buffer at this
5774 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5775 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5777 /* Mute capture amp left and right */
5778 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5779 /* Set ADC connection select to match default mixer setting - mic
5782 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5784 /* Do similar with the second ADC: mute capture input amp and
5785 * set ADC connection to mic to match ALSA's default state.
5787 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5788 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5790 /* Mute all inputs to mixer widget (even unconnected ones) */
5791 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5792 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5793 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5794 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5795 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5796 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5797 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5798 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5803 /* Initialisation sequence for Maxdata Favorit 100XS
5804 * (adapted from Acer init verbs).
5806 static struct hda_verb alc260_favorit100_init_verbs[] = {
5807 /* GPIO 0 enables the output jack.
5808 * Turn this on and rely on the standard mute
5809 * methods whenever the user wants to turn these outputs off.
5811 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5812 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5813 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5814 /* Line/Mic input jack is connected to Mic1 pin */
5815 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5816 /* Ensure all other unused pins are disabled and muted. */
5817 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5818 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5819 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5820 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5822 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5823 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5825 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5826 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5827 /* Disable digital (SPDIF) pins */
5828 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5829 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5831 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5832 * bus when acting as outputs.
5834 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5835 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5837 /* Start with output sum widgets muted and their output gains at min */
5838 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5839 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5840 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5841 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5842 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5843 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5844 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5845 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5846 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5848 /* Unmute Line-out pin widget amp left and right
5849 * (no equiv mixer ctrl)
5851 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5852 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5853 * inputs. If the pin mode is changed by the user the pin mode control
5854 * will take care of enabling the pin's input/output buffers as needed.
5855 * Therefore there's no need to enable the input buffer at this
5858 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5860 /* Mute capture amp left and right */
5861 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5862 /* Set ADC connection select to match default mixer setting - mic
5865 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5867 /* Do similar with the second ADC: mute capture input amp and
5868 * set ADC connection to mic to match ALSA's default state.
5870 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5871 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5873 /* Mute all inputs to mixer widget (even unconnected ones) */
5874 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5875 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5876 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5877 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5878 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5879 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5880 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5881 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5886 static struct hda_verb alc260_will_verbs[] = {
5887 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5888 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5889 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5890 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5891 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5892 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5896 static struct hda_verb alc260_replacer_672v_verbs[] = {
5897 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5898 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5899 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5901 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5902 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5903 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5905 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5909 /* toggle speaker-output according to the hp-jack state */
5910 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5912 unsigned int present;
5914 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5915 present = snd_hda_jack_detect(codec, 0x0f);
5917 snd_hda_codec_write_cache(codec, 0x01, 0,
5918 AC_VERB_SET_GPIO_DATA, 1);
5919 snd_hda_codec_write_cache(codec, 0x0f, 0,
5920 AC_VERB_SET_PIN_WIDGET_CONTROL,
5923 snd_hda_codec_write_cache(codec, 0x01, 0,
5924 AC_VERB_SET_GPIO_DATA, 0);
5925 snd_hda_codec_write_cache(codec, 0x0f, 0,
5926 AC_VERB_SET_PIN_WIDGET_CONTROL,
5931 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5934 if ((res >> 26) == ALC880_HP_EVENT)
5935 alc260_replacer_672v_automute(codec);
5938 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5939 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5940 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5941 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5942 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5943 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5944 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5945 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5946 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5947 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5948 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5952 /* Test configuration for debugging, modelled after the ALC880 test
5955 #ifdef CONFIG_SND_DEBUG
5956 static hda_nid_t alc260_test_dac_nids[1] = {
5959 static hda_nid_t alc260_test_adc_nids[2] = {
5962 /* For testing the ALC260, each input MUX needs its own definition since
5963 * the signal assignments are different. This assumes that the first ADC
5966 static struct hda_input_mux alc260_test_capture_sources[2] = {
5970 { "MIC1 pin", 0x0 },
5971 { "MIC2 pin", 0x1 },
5972 { "LINE1 pin", 0x2 },
5973 { "LINE2 pin", 0x3 },
5975 { "LINE-OUT pin", 0x5 },
5976 { "HP-OUT pin", 0x6 },
5982 { "MIC1 pin", 0x0 },
5983 { "MIC2 pin", 0x1 },
5984 { "LINE1 pin", 0x2 },
5985 { "LINE2 pin", 0x3 },
5988 { "LINE-OUT pin", 0x6 },
5989 { "HP-OUT pin", 0x7 },
5993 static struct snd_kcontrol_new alc260_test_mixer[] = {
5994 /* Output driver widgets */
5995 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5996 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5997 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5998 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5999 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6000 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6002 /* Modes for retasking pin widgets
6003 * Note: the ALC260 doesn't seem to act on requests to enable mic
6004 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6005 * mention this restriction. At this stage it's not clear whether
6006 * this behaviour is intentional or is a hardware bug in chip
6007 * revisions available at least up until early 2006. Therefore for
6008 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6009 * choices, but if it turns out that the lack of mic bias for these
6010 * NIDs is intentional we could change their modes from
6011 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6013 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6014 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6015 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6016 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6017 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6018 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6020 /* Loopback mixer controls */
6021 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6022 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6023 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6024 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6025 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6026 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6027 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6028 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6029 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6030 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6031 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6032 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6033 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6034 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6036 /* Controls for GPIO pins, assuming they are configured as outputs */
6037 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6038 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6039 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6040 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6042 /* Switches to allow the digital IO pins to be enabled. The datasheet
6043 * is ambigious as to which NID is which; testing on laptops which
6044 * make this output available should provide clarification.
6046 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6047 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6049 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6050 * this output to turn on an external amplifier.
6052 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6053 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6057 static struct hda_verb alc260_test_init_verbs[] = {
6058 /* Enable all GPIOs as outputs with an initial value of 0 */
6059 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6060 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6061 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6063 /* Enable retasking pins as output, initially without power amp */
6064 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6065 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6066 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6067 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6068 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6069 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6071 /* Disable digital (SPDIF) pins initially, but users can enable
6072 * them via a mixer switch. In the case of SPDIF-out, this initverb
6073 * payload also sets the generation to 0, output to be in "consumer"
6074 * PCM format, copyright asserted, no pre-emphasis and no validity
6077 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6078 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6080 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6081 * OUT1 sum bus when acting as an output.
6083 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6084 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6085 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6086 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6088 /* Start with output sum widgets muted and their output gains at min */
6089 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6090 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6091 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6092 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6093 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6094 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6095 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6096 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6097 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6099 /* Unmute retasking pin widget output buffers since the default
6100 * state appears to be output. As the pin mode is changed by the
6101 * user the pin mode control will take care of enabling the pin's
6102 * input/output buffers as needed.
6104 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6105 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6106 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6107 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6108 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6109 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6110 /* Also unmute the mono-out pin widget */
6111 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6113 /* Mute capture amp left and right */
6114 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6115 /* Set ADC connection select to match default mixer setting (mic1
6118 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6120 /* Do the same for the second ADC: mute capture input amp and
6121 * set ADC connection to mic1 pin
6123 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6124 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6126 /* Mute all inputs to mixer widget (even unconnected ones) */
6127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6129 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6130 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6131 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6132 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6133 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6134 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6140 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6141 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6143 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6144 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6147 * for BIOS auto-configuration
6150 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6151 const char *pfx, int *vol_bits)
6154 unsigned long vol_val, sw_val;
6157 if (nid >= 0x0f && nid < 0x11) {
6158 nid_vol = nid - 0x7;
6159 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6160 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6161 } else if (nid == 0x11) {
6162 nid_vol = nid - 0x7;
6163 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6164 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6165 } else if (nid >= 0x12 && nid <= 0x15) {
6167 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6168 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6172 if (!(*vol_bits & (1 << nid_vol))) {
6173 /* first control for the volume widget */
6174 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6177 *vol_bits |= (1 << nid_vol);
6179 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6185 /* add playback controls from the parsed DAC table */
6186 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6187 const struct auto_pin_cfg *cfg)
6193 spec->multiout.num_dacs = 1;
6194 spec->multiout.dac_nids = spec->private_dac_nids;
6195 spec->multiout.dac_nids[0] = 0x02;
6197 nid = cfg->line_out_pins[0];
6200 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6202 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6206 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6211 nid = cfg->speaker_pins[0];
6213 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6218 nid = cfg->hp_pins[0];
6220 err = alc260_add_playback_controls(spec, nid, "Headphone",
6228 /* create playback/capture controls for input pins */
6229 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6230 const struct auto_pin_cfg *cfg)
6232 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6235 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6236 hda_nid_t nid, int pin_type,
6239 alc_set_pin_output(codec, nid, pin_type);
6240 /* need the manual connection? */
6242 int idx = nid - 0x12;
6243 snd_hda_codec_write(codec, idx + 0x0b, 0,
6244 AC_VERB_SET_CONNECT_SEL, sel_idx);
6248 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6250 struct alc_spec *spec = codec->spec;
6253 nid = spec->autocfg.line_out_pins[0];
6255 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6256 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6259 nid = spec->autocfg.speaker_pins[0];
6261 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6263 nid = spec->autocfg.hp_pins[0];
6265 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6268 #define ALC260_PIN_CD_NID 0x16
6269 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6271 struct alc_spec *spec = codec->spec;
6274 for (i = 0; i < AUTO_PIN_LAST; i++) {
6275 hda_nid_t nid = spec->autocfg.input_pins[i];
6277 alc_set_input_pin(codec, nid, i);
6278 if (nid != ALC260_PIN_CD_NID &&
6279 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6280 snd_hda_codec_write(codec, nid, 0,
6281 AC_VERB_SET_AMP_GAIN_MUTE,
6288 * generic initialization of ADC, input mixers and output mixers
6290 static struct hda_verb alc260_volume_init_verbs[] = {
6292 * Unmute ADC0-1 and set the default input to mic-in
6294 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6295 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6296 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6297 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6299 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6301 * Note: PASD motherboards uses the Line In 2 as the input for
6302 * front panel mic (mic 2)
6304 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6305 /* mute analog inputs */
6306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6313 * Set up output mixers (0x08 - 0x0a)
6315 /* set vol=0 to output mixers */
6316 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6318 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6319 /* set up input amps for analog loopback */
6320 /* Amp Indices: DAC = 0, mixer = 1 */
6321 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6322 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6323 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6324 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6325 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6326 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6331 static int alc260_parse_auto_config(struct hda_codec *codec)
6333 struct alc_spec *spec = codec->spec;
6335 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6337 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6341 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6344 if (!spec->kctls.list)
6345 return 0; /* can't find valid BIOS pin config */
6346 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6350 spec->multiout.max_channels = 2;
6352 if (spec->autocfg.dig_outs)
6353 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6354 if (spec->kctls.list)
6355 add_mixer(spec, spec->kctls.list);
6357 add_verb(spec, alc260_volume_init_verbs);
6359 spec->num_mux_defs = 1;
6360 spec->input_mux = &spec->private_imux[0];
6362 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6367 /* additional initialization for auto-configuration model */
6368 static void alc260_auto_init(struct hda_codec *codec)
6370 struct alc_spec *spec = codec->spec;
6371 alc260_auto_init_multi_out(codec);
6372 alc260_auto_init_analog_input(codec);
6373 if (spec->unsol_event)
6374 alc_inithook(codec);
6377 #ifdef CONFIG_SND_HDA_POWER_SAVE
6378 static struct hda_amp_list alc260_loopbacks[] = {
6379 { 0x07, HDA_INPUT, 0 },
6380 { 0x07, HDA_INPUT, 1 },
6381 { 0x07, HDA_INPUT, 2 },
6382 { 0x07, HDA_INPUT, 3 },
6383 { 0x07, HDA_INPUT, 4 },
6389 * ALC260 configurations
6391 static const char *alc260_models[ALC260_MODEL_LAST] = {
6392 [ALC260_BASIC] = "basic",
6394 [ALC260_HP_3013] = "hp-3013",
6395 [ALC260_HP_DC7600] = "hp-dc7600",
6396 [ALC260_FUJITSU_S702X] = "fujitsu",
6397 [ALC260_ACER] = "acer",
6398 [ALC260_WILL] = "will",
6399 [ALC260_REPLACER_672V] = "replacer",
6400 [ALC260_FAVORIT100] = "favorit100",
6401 #ifdef CONFIG_SND_DEBUG
6402 [ALC260_TEST] = "test",
6404 [ALC260_AUTO] = "auto",
6407 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6408 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6409 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6410 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6411 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6412 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6413 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6414 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6415 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6416 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6417 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6418 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6419 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6420 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6421 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6422 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6423 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6424 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6425 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6426 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6427 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6431 static struct alc_config_preset alc260_presets[] = {
6433 .mixers = { alc260_base_output_mixer,
6434 alc260_input_mixer },
6435 .init_verbs = { alc260_init_verbs },
6436 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6437 .dac_nids = alc260_dac_nids,
6438 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6439 .adc_nids = alc260_adc_nids,
6440 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6441 .channel_mode = alc260_modes,
6442 .input_mux = &alc260_capture_source,
6445 .mixers = { alc260_hp_output_mixer,
6446 alc260_input_mixer },
6447 .init_verbs = { alc260_init_verbs,
6448 alc260_hp_unsol_verbs },
6449 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6450 .dac_nids = alc260_dac_nids,
6451 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6452 .adc_nids = alc260_adc_nids_alt,
6453 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6454 .channel_mode = alc260_modes,
6455 .input_mux = &alc260_capture_source,
6456 .unsol_event = alc260_hp_unsol_event,
6457 .init_hook = alc260_hp_automute,
6459 [ALC260_HP_DC7600] = {
6460 .mixers = { alc260_hp_dc7600_mixer,
6461 alc260_input_mixer },
6462 .init_verbs = { alc260_init_verbs,
6463 alc260_hp_dc7600_verbs },
6464 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6465 .dac_nids = alc260_dac_nids,
6466 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6467 .adc_nids = alc260_adc_nids_alt,
6468 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6469 .channel_mode = alc260_modes,
6470 .input_mux = &alc260_capture_source,
6471 .unsol_event = alc260_hp_3012_unsol_event,
6472 .init_hook = alc260_hp_3012_automute,
6474 [ALC260_HP_3013] = {
6475 .mixers = { alc260_hp_3013_mixer,
6476 alc260_input_mixer },
6477 .init_verbs = { alc260_hp_3013_init_verbs,
6478 alc260_hp_3013_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_3013_unsol_event,
6487 .init_hook = alc260_hp_3013_automute,
6489 [ALC260_FUJITSU_S702X] = {
6490 .mixers = { alc260_fujitsu_mixer },
6491 .init_verbs = { alc260_fujitsu_init_verbs },
6492 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6493 .dac_nids = alc260_dac_nids,
6494 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6495 .adc_nids = alc260_dual_adc_nids,
6496 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6497 .channel_mode = alc260_modes,
6498 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6499 .input_mux = alc260_fujitsu_capture_sources,
6502 .mixers = { alc260_acer_mixer },
6503 .init_verbs = { alc260_acer_init_verbs },
6504 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6505 .dac_nids = alc260_dac_nids,
6506 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6507 .adc_nids = alc260_dual_adc_nids,
6508 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6509 .channel_mode = alc260_modes,
6510 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6511 .input_mux = alc260_acer_capture_sources,
6513 [ALC260_FAVORIT100] = {
6514 .mixers = { alc260_favorit100_mixer },
6515 .init_verbs = { alc260_favorit100_init_verbs },
6516 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6517 .dac_nids = alc260_dac_nids,
6518 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6519 .adc_nids = alc260_dual_adc_nids,
6520 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6521 .channel_mode = alc260_modes,
6522 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6523 .input_mux = alc260_favorit100_capture_sources,
6526 .mixers = { alc260_will_mixer },
6527 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6528 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6529 .dac_nids = alc260_dac_nids,
6530 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6531 .adc_nids = alc260_adc_nids,
6532 .dig_out_nid = ALC260_DIGOUT_NID,
6533 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6534 .channel_mode = alc260_modes,
6535 .input_mux = &alc260_capture_source,
6537 [ALC260_REPLACER_672V] = {
6538 .mixers = { alc260_replacer_672v_mixer },
6539 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6540 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6541 .dac_nids = alc260_dac_nids,
6542 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6543 .adc_nids = alc260_adc_nids,
6544 .dig_out_nid = ALC260_DIGOUT_NID,
6545 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6546 .channel_mode = alc260_modes,
6547 .input_mux = &alc260_capture_source,
6548 .unsol_event = alc260_replacer_672v_unsol_event,
6549 .init_hook = alc260_replacer_672v_automute,
6551 #ifdef CONFIG_SND_DEBUG
6553 .mixers = { alc260_test_mixer },
6554 .init_verbs = { alc260_test_init_verbs },
6555 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6556 .dac_nids = alc260_test_dac_nids,
6557 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6558 .adc_nids = alc260_test_adc_nids,
6559 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6560 .channel_mode = alc260_modes,
6561 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6562 .input_mux = alc260_test_capture_sources,
6567 static int patch_alc260(struct hda_codec *codec)
6569 struct alc_spec *spec;
6570 int err, board_config;
6572 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6578 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6581 if (board_config < 0) {
6582 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6584 board_config = ALC260_AUTO;
6587 if (board_config == ALC260_AUTO) {
6588 /* automatic parse from the BIOS config */
6589 err = alc260_parse_auto_config(codec);
6595 "hda_codec: Cannot set up configuration "
6596 "from BIOS. Using base mode...\n");
6597 board_config = ALC260_BASIC;
6601 err = snd_hda_attach_beep_device(codec, 0x1);
6607 if (board_config != ALC260_AUTO)
6608 setup_preset(codec, &alc260_presets[board_config]);
6610 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6611 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6613 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6614 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6616 if (!spec->adc_nids && spec->input_mux) {
6617 /* check whether NID 0x04 is valid */
6618 unsigned int wcap = get_wcaps(codec, 0x04);
6619 wcap = get_wcaps_type(wcap);
6621 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6622 spec->adc_nids = alc260_adc_nids_alt;
6623 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6625 spec->adc_nids = alc260_adc_nids;
6626 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6629 set_capture_mixer(codec);
6630 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6632 spec->vmaster_nid = 0x08;
6634 codec->patch_ops = alc_patch_ops;
6635 if (board_config == ALC260_AUTO)
6636 spec->init_hook = alc260_auto_init;
6637 #ifdef CONFIG_SND_HDA_POWER_SAVE
6638 if (!spec->loopback.amplist)
6639 spec->loopback.amplist = alc260_loopbacks;
6641 codec->proc_widget_hook = print_realtek_coef;
6648 * ALC882/883/885/888/889 support
6650 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6651 * configuration. Each pin widget can choose any input DACs and a mixer.
6652 * Each ADC is connected from a mixer of all inputs. This makes possible
6653 * 6-channel independent captures.
6655 * In addition, an independent DAC for the multi-playback (not used in this
6658 #define ALC882_DIGOUT_NID 0x06
6659 #define ALC882_DIGIN_NID 0x0a
6660 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6661 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6662 #define ALC1200_DIGOUT_NID 0x10
6665 static struct hda_channel_mode alc882_ch_modes[1] = {
6670 static hda_nid_t alc882_dac_nids[4] = {
6671 /* front, rear, clfe, rear_surr */
6672 0x02, 0x03, 0x04, 0x05
6674 #define alc883_dac_nids alc882_dac_nids
6677 #define alc882_adc_nids alc880_adc_nids
6678 #define alc882_adc_nids_alt alc880_adc_nids_alt
6679 #define alc883_adc_nids alc882_adc_nids_alt
6680 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6681 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6682 #define alc889_adc_nids alc880_adc_nids
6684 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6685 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6686 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6687 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6688 #define alc889_capsrc_nids alc882_capsrc_nids
6691 /* FIXME: should be a matrix-type input source selection */
6693 static struct hda_input_mux alc882_capture_source = {
6697 { "Front Mic", 0x1 },
6703 #define alc883_capture_source alc882_capture_source
6705 static struct hda_input_mux alc889_capture_source = {
6708 { "Front Mic", 0x0 },
6714 static struct hda_input_mux mb5_capture_source = {
6723 static struct hda_input_mux alc883_3stack_6ch_intel = {
6727 { "Front Mic", 0x0 },
6733 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6741 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6751 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6759 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6763 { "Front Mic", 0x1 },
6768 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6776 static struct hda_input_mux alc889A_mb31_capture_source = {
6780 /* Front Mic (0x01) unused */
6782 /* Line 2 (0x03) unused */
6783 /* CD (0x04) unused? */
6790 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6797 static struct hda_verb alc882_3ST_ch2_init[] = {
6798 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6799 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6800 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6801 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6808 static struct hda_verb alc882_3ST_ch4_init[] = {
6809 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6810 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6811 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6812 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6813 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6820 static struct hda_verb alc882_3ST_ch6_init[] = {
6821 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6822 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6823 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6824 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6825 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6826 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6830 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6831 { 2, alc882_3ST_ch2_init },
6832 { 4, alc882_3ST_ch4_init },
6833 { 6, alc882_3ST_ch6_init },
6836 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6841 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6842 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6843 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6844 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6845 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6846 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6853 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6854 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6855 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6856 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6857 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6858 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6859 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6866 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6867 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6868 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6869 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6870 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6871 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6872 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6873 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6877 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6878 { 2, alc883_3ST_ch2_clevo_init },
6879 { 4, alc883_3ST_ch4_clevo_init },
6880 { 6, alc883_3ST_ch6_clevo_init },
6887 static struct hda_verb alc882_sixstack_ch6_init[] = {
6888 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6889 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6890 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6891 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6898 static struct hda_verb alc882_sixstack_ch8_init[] = {
6899 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6900 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6901 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6902 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6906 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6907 { 6, alc882_sixstack_ch6_init },
6908 { 8, alc882_sixstack_ch8_init },
6912 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6918 static struct hda_verb alc885_mbp_ch2_init[] = {
6919 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6920 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6921 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6928 static struct hda_verb alc885_mbp_ch4_init[] = {
6929 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6930 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6931 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6932 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6933 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6937 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6938 { 2, alc885_mbp_ch2_init },
6939 { 4, alc885_mbp_ch4_init },
6944 * Speakers/Woofer/HP = Front
6947 static struct hda_verb alc885_mb5_ch2_init[] = {
6948 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6949 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6955 * Speakers/HP = Front
6959 static struct hda_verb alc885_mb5_ch6_init[] = {
6960 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6961 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6962 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6966 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6967 { 2, alc885_mb5_ch2_init },
6968 { 6, alc885_mb5_ch6_init },
6975 static struct hda_verb alc883_4ST_ch2_init[] = {
6976 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6977 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6978 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6979 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6980 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6981 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6988 static struct hda_verb alc883_4ST_ch4_init[] = {
6989 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6991 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6992 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6995 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7002 static struct hda_verb alc883_4ST_ch6_init[] = {
7003 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7005 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7006 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7007 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7008 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7009 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7010 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7017 static struct hda_verb alc883_4ST_ch8_init[] = {
7018 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7020 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7021 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7022 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7023 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7024 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7025 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7026 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7030 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7031 { 2, alc883_4ST_ch2_init },
7032 { 4, alc883_4ST_ch4_init },
7033 { 6, alc883_4ST_ch6_init },
7034 { 8, alc883_4ST_ch8_init },
7041 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7042 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7043 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7044 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7045 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7052 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7053 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7054 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7055 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7056 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7057 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7064 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7065 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7066 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7067 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7068 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7069 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7070 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7074 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7075 { 2, alc883_3ST_ch2_intel_init },
7076 { 4, alc883_3ST_ch4_intel_init },
7077 { 6, alc883_3ST_ch6_intel_init },
7083 static struct hda_verb alc889_ch2_intel_init[] = {
7084 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7085 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7086 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7087 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7088 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7089 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7096 static struct hda_verb alc889_ch6_intel_init[] = {
7097 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7098 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7099 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7100 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7109 static struct hda_verb alc889_ch8_intel_init[] = {
7110 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7111 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7112 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7113 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7114 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7115 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7116 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7120 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7121 { 2, alc889_ch2_intel_init },
7122 { 6, alc889_ch6_intel_init },
7123 { 8, alc889_ch8_intel_init },
7129 static struct hda_verb alc883_sixstack_ch6_init[] = {
7130 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7131 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7132 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7133 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7140 static struct hda_verb alc883_sixstack_ch8_init[] = {
7141 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7142 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7143 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7144 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7148 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7149 { 6, alc883_sixstack_ch6_init },
7150 { 8, alc883_sixstack_ch8_init },
7154 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7155 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7157 static struct snd_kcontrol_new alc882_base_mixer[] = {
7158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7159 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7160 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7161 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7162 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7163 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7164 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7165 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7167 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7169 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7170 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7171 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7172 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7176 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7177 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7178 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7182 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7183 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7184 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7185 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7186 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7189 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7191 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7193 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7197 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7198 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7199 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7201 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7202 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7203 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7204 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7205 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7207 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7209 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7210 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7211 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7215 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7216 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7217 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7218 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7219 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7221 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7223 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7224 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7229 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7230 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7231 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7235 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7236 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7238 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7242 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7245 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7255 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7259 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7260 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7262 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7263 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7264 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7266 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7271 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7272 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7273 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7275 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7279 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7280 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7281 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7282 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7283 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7284 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7285 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7286 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7293 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7296 .name = "Channel Mode",
7297 .info = alc_ch_mode_info,
7298 .get = alc_ch_mode_get,
7299 .put = alc_ch_mode_put,
7304 static struct hda_verb alc882_base_init_verbs[] = {
7305 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7319 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7322 /* mute analog input loopbacks */
7323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7327 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7329 /* Front Pin: output 0 (0x0c) */
7330 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7331 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7332 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7333 /* Rear Pin: output 1 (0x0d) */
7334 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7335 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7337 /* CLFE Pin: output 2 (0x0e) */
7338 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7339 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7340 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7341 /* Side Pin: output 3 (0x0f) */
7342 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7343 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7344 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7345 /* Mic (rear) pin: input vref at 80% */
7346 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7347 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7348 /* Front Mic pin: input vref at 80% */
7349 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7350 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7351 /* Line In pin: input */
7352 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7353 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7354 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7355 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7356 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7357 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7358 /* CD pin widget for input */
7359 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7361 /* FIXME: use matrix-type input source selection */
7362 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7373 /* ADC2: mute amp left and right */
7374 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7375 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7376 /* ADC3: mute amp left and right */
7377 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7378 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7383 static struct hda_verb alc882_adc1_init_verbs[] = {
7384 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7389 /* ADC1: mute amp left and right */
7390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7391 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7395 static struct hda_verb alc882_eapd_verbs[] = {
7396 /* change to EAPD mode */
7397 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7398 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7402 static struct hda_verb alc889_eapd_verbs[] = {
7403 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7404 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7408 static struct hda_verb alc_hp15_unsol_verbs[] = {
7409 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7410 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7414 static struct hda_verb alc885_init_verbs[] = {
7415 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7417 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7418 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7420 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7421 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7422 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7424 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7425 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7429 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7432 /* mute analog input loopbacks */
7433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7437 /* Front HP Pin: output 0 (0x0c) */
7438 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7439 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7440 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7441 /* Front Pin: output 0 (0x0c) */
7442 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7443 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7444 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7445 /* Rear Pin: output 1 (0x0d) */
7446 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7447 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7448 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7449 /* CLFE Pin: output 2 (0x0e) */
7450 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7451 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7452 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7453 /* Side Pin: output 3 (0x0f) */
7454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7455 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7456 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7457 /* Mic (rear) pin: input vref at 80% */
7458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7459 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7460 /* Front Mic pin: input vref at 80% */
7461 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7463 /* Line In pin: input */
7464 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7465 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7467 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7473 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7475 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7478 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7480 /* ADC2: mute amp left and right */
7481 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7482 /* ADC3: mute amp left and right */
7483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7488 static struct hda_verb alc885_init_input_verbs[] = {
7489 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7490 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7491 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7496 /* Unmute Selector 24h and set the default input to front mic */
7497 static struct hda_verb alc889_init_input_verbs[] = {
7498 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7504 #define alc883_init_verbs alc882_base_init_verbs
7507 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7508 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7509 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7510 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7511 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7512 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7513 /* FIXME: this looks suspicious...
7514 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7515 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7520 static struct hda_verb alc882_macpro_init_verbs[] = {
7521 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7523 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7524 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7525 /* Front Pin: output 0 (0x0c) */
7526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7527 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7528 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7529 /* Front Mic pin: input vref at 80% */
7530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7531 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7532 /* Speaker: output */
7533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7534 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7535 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7536 /* Headphone output (output 0 - 0x0c) */
7537 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7539 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7541 /* FIXME: use matrix-type input source selection */
7542 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7543 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7558 /* ADC1: mute amp left and right */
7559 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7560 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7561 /* ADC2: mute amp left and right */
7562 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7563 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7564 /* ADC3: mute amp left and right */
7565 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7566 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7572 static struct hda_verb alc885_mb5_init_verbs[] = {
7574 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7575 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7576 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7577 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7579 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7580 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7581 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7582 /* Surround mixer */
7583 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7584 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7585 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7587 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7588 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7589 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7591 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7592 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7593 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7594 /* Front Pin (0x0c) */
7595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7597 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7598 /* LFE Pin (0x0e) */
7599 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7600 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7601 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7606 /* Front Mic pin: input vref at 80% */
7607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7610 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7611 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7615 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7616 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7620 /* Macbook Pro rev3 */
7621 static struct hda_verb alc885_mbp3_init_verbs[] = {
7622 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7624 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7628 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7629 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7632 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7633 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7634 /* Front Pin: output 0 (0x0c) */
7635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7637 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7638 /* HP Pin: output 0 (0x0e) */
7639 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7640 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7641 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7642 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7643 /* Mic (rear) pin: input vref at 80% */
7644 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7645 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7646 /* Front Mic pin: input vref at 80% */
7647 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7648 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7649 /* Line In pin: use output 1 when in LineOut mode */
7650 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7651 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7652 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7654 /* FIXME: use matrix-type input source selection */
7655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7656 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7671 /* ADC1: mute amp left and right */
7672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7673 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7674 /* ADC2: mute amp left and right */
7675 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7677 /* ADC3: mute amp left and right */
7678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 static struct hda_verb alc885_imac91_init_verbs[] = {
7686 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7688 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7689 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7691 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7692 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7693 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7694 /* HP Pin: output 0 (0x0c) */
7695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7697 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7698 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7699 /* Internal Speakers: output 0 (0x0d) */
7700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7701 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7702 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7703 /* Mic (rear) pin: input vref at 80% */
7704 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7705 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7706 /* Front Mic pin: input vref at 80% */
7707 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7708 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7709 /* Line In pin: use output 1 when in LineOut mode */
7710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7711 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7712 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7714 /* FIXME: use matrix-type input source selection */
7715 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7716 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7719 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7720 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7725 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7729 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7730 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7731 /* ADC1: mute amp left and right */
7732 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7733 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7734 /* ADC2: mute amp left and right */
7735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7736 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7737 /* ADC3: mute amp left and right */
7738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7739 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7744 /* iMac 24 mixer. */
7745 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7746 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7747 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7751 /* iMac 24 init verbs. */
7752 static struct hda_verb alc885_imac24_init_verbs[] = {
7753 /* Internal speakers: output 0 (0x0c) */
7754 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7755 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7756 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7757 /* Internal speakers: output 0 (0x0c) */
7758 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7759 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7760 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7761 /* Headphone: output 0 (0x0c) */
7762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7764 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7765 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7766 /* Front Mic: input vref at 80% */
7767 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7768 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7772 /* Toggle speaker-output according to the hp-jack state */
7773 static void alc885_imac24_setup(struct hda_codec *codec)
7775 struct alc_spec *spec = codec->spec;
7777 spec->autocfg.hp_pins[0] = 0x14;
7778 spec->autocfg.speaker_pins[0] = 0x18;
7779 spec->autocfg.speaker_pins[1] = 0x1a;
7782 static void alc885_mbp3_setup(struct hda_codec *codec)
7784 struct alc_spec *spec = codec->spec;
7786 spec->autocfg.hp_pins[0] = 0x15;
7787 spec->autocfg.speaker_pins[0] = 0x14;
7790 static void alc885_imac91_automute(struct hda_codec *codec)
7792 unsigned int present;
7794 present = snd_hda_codec_read(codec, 0x14, 0,
7795 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7796 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7797 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7798 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7799 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7803 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7806 /* Headphone insertion or removal. */
7807 if ((res >> 26) == ALC880_HP_EVENT)
7808 alc885_imac91_automute(codec);
7811 static struct hda_verb alc882_targa_verbs[] = {
7812 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7813 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7815 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7818 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7819 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7820 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7822 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7826 /* toggle speaker-output according to the hp-jack state */
7827 static void alc882_targa_automute(struct hda_codec *codec)
7829 struct alc_spec *spec = codec->spec;
7830 alc_automute_amp(codec);
7831 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7832 spec->jack_present ? 1 : 3);
7835 static void alc882_targa_setup(struct hda_codec *codec)
7837 struct alc_spec *spec = codec->spec;
7839 spec->autocfg.hp_pins[0] = 0x14;
7840 spec->autocfg.speaker_pins[0] = 0x1b;
7843 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7845 if ((res >> 26) == ALC880_HP_EVENT)
7846 alc882_targa_automute(codec);
7849 static struct hda_verb alc882_asus_a7j_verbs[] = {
7850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7854 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7855 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7857 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7859 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7861 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7867 static struct hda_verb alc882_asus_a7m_verbs[] = {
7868 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7872 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7875 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7876 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7877 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7879 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7880 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7881 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7885 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7887 unsigned int gpiostate, gpiomask, gpiodir;
7889 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7890 AC_VERB_GET_GPIO_DATA, 0);
7893 gpiostate |= (1 << pin);
7895 gpiostate &= ~(1 << pin);
7897 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7898 AC_VERB_GET_GPIO_MASK, 0);
7899 gpiomask |= (1 << pin);
7901 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7902 AC_VERB_GET_GPIO_DIRECTION, 0);
7903 gpiodir |= (1 << pin);
7906 snd_hda_codec_write(codec, codec->afg, 0,
7907 AC_VERB_SET_GPIO_MASK, gpiomask);
7908 snd_hda_codec_write(codec, codec->afg, 0,
7909 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7913 snd_hda_codec_write(codec, codec->afg, 0,
7914 AC_VERB_SET_GPIO_DATA, gpiostate);
7917 /* set up GPIO at initialization */
7918 static void alc885_macpro_init_hook(struct hda_codec *codec)
7920 alc882_gpio_mute(codec, 0, 0);
7921 alc882_gpio_mute(codec, 1, 0);
7924 /* set up GPIO and update auto-muting at initialization */
7925 static void alc885_imac24_init_hook(struct hda_codec *codec)
7927 alc885_macpro_init_hook(codec);
7928 alc_automute_amp(codec);
7932 * generic initialization of ADC, input mixers and output mixers
7934 static struct hda_verb alc883_auto_init_verbs[] = {
7936 * Unmute ADC0-2 and set the default input to mic-in
7938 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7939 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7940 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7941 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7943 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7945 * Note: PASD motherboards uses the Line In 2 as the input for
7946 * front panel mic (mic 2)
7948 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7949 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7950 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7951 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7952 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7953 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7956 * Set up output mixers (0x0c - 0x0f)
7958 /* set vol=0 to output mixers */
7959 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7960 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7961 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7962 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7963 /* set up input amps for analog loopback */
7964 /* Amp Indices: DAC = 0, mixer = 1 */
7965 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7967 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7968 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7969 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7970 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7971 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7972 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7973 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7974 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7976 /* FIXME: use matrix-type input source selection */
7977 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7979 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7980 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7981 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7984 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7985 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7992 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7993 static struct hda_verb alc889A_mb31_ch2_init[] = {
7994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8001 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8002 static struct hda_verb alc889A_mb31_ch4_init[] = {
8003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8004 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8005 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8006 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8010 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8011 static struct hda_verb alc889A_mb31_ch5_init[] = {
8012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8013 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8019 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8020 static struct hda_verb alc889A_mb31_ch6_init[] = {
8021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8028 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8029 { 2, alc889A_mb31_ch2_init },
8030 { 4, alc889A_mb31_ch4_init },
8031 { 5, alc889A_mb31_ch5_init },
8032 { 6, alc889A_mb31_ch6_init },
8035 static struct hda_verb alc883_medion_eapd_verbs[] = {
8036 /* eanable EAPD on medion laptop */
8037 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8038 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8042 #define alc883_base_mixer alc882_base_mixer
8044 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8050 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8061 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8063 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8071 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8075 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8076 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8077 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8085 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8089 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8090 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8106 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8108 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8111 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8113 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8114 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8129 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8136 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8138 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8153 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8155 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8157 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8160 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8162 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8163 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8164 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8177 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8179 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8181 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8182 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8183 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8184 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8187 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8188 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8190 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8196 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8200 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8204 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8205 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8206 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8221 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8233 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8237 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8238 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8239 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8242 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8246 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8258 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8259 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8260 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
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("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8266 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8267 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8271 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8274 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8277 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8278 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8284 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8285 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8286 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8287 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8296 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8299 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8303 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8304 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8313 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8315 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8316 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8317 0x0d, 1, 0x0, HDA_OUTPUT),
8318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8319 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8320 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8332 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8336 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8341 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8347 /* Output switches */
8348 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8349 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8350 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8353 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8362 static struct snd_kcontrol_new alc883_vaiott_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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8372 static struct hda_bind_ctls alc883_bind_cap_vol = {
8373 .ops = &snd_hda_bind_vol,
8375 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8376 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8381 static struct hda_bind_ctls alc883_bind_cap_switch = {
8382 .ops = &snd_hda_bind_sw,
8384 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8385 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8390 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8392 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8402 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8403 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8404 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8407 /* .name = "Capture Source", */
8408 .name = "Input Source",
8410 .info = alc_mux_enum_info,
8411 .get = alc_mux_enum_get,
8412 .put = alc_mux_enum_put,
8417 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8420 .name = "Channel Mode",
8421 .info = alc_ch_mode_info,
8422 .get = alc_ch_mode_get,
8423 .put = alc_ch_mode_put,
8428 /* toggle speaker-output according to the hp-jack state */
8429 static void alc883_mitac_setup(struct hda_codec *codec)
8431 struct alc_spec *spec = codec->spec;
8433 spec->autocfg.hp_pins[0] = 0x15;
8434 spec->autocfg.speaker_pins[0] = 0x14;
8435 spec->autocfg.speaker_pins[1] = 0x17;
8438 /* auto-toggle front mic */
8440 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8442 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8444 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8448 static struct hda_verb alc883_mitac_verbs[] = {
8450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8453 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8456 /* enable unsolicited event */
8457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8458 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8463 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8468 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8470 /* enable unsolicited event */
8472 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8473 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8479 static struct hda_verb alc883_clevo_m720_verbs[] = {
8481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8487 /* enable unsolicited event */
8488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8489 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8494 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8496 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8499 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8502 /* enable unsolicited event */
8503 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8508 static struct hda_verb alc883_targa_verbs[] = {
8509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8515 /* Connect Line-Out side jack (SPDIF) to Side */
8516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8518 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8519 /* Connect Mic jack to CLFE */
8520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8522 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8523 /* Connect Line-in jack to Surround */
8524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8526 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8527 /* Connect HP out jack to Front */
8528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8529 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8530 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8537 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8540 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8544 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8545 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8547 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8552 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8555 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8556 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8557 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8561 static struct hda_verb alc883_haier_w66_verbs[] = {
8562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8567 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8568 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8574 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8577 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8578 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8581 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8582 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8586 static struct hda_verb alc888_6st_dell_verbs[] = {
8587 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8591 static struct hda_verb alc883_vaiott_verbs[] = {
8593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8596 /* enable unsolicited event */
8597 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8602 static void alc888_3st_hp_setup(struct hda_codec *codec)
8604 struct alc_spec *spec = codec->spec;
8606 spec->autocfg.hp_pins[0] = 0x1b;
8607 spec->autocfg.speaker_pins[0] = 0x14;
8608 spec->autocfg.speaker_pins[1] = 0x16;
8609 spec->autocfg.speaker_pins[2] = 0x18;
8612 static struct hda_verb alc888_3st_hp_verbs[] = {
8613 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8614 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8615 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8616 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8623 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8624 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8625 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8626 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8627 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8634 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8635 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8636 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8637 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8638 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8639 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8646 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8647 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8648 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8649 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8650 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8651 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8652 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8656 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8657 { 2, alc888_3st_hp_2ch_init },
8658 { 4, alc888_3st_hp_4ch_init },
8659 { 6, alc888_3st_hp_6ch_init },
8662 /* toggle front-jack and RCA according to the hp-jack state */
8663 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8665 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8667 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8668 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8669 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8670 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8673 /* toggle RCA according to the front-jack state */
8674 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8676 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8678 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8679 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8682 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8685 if ((res >> 26) == ALC880_HP_EVENT)
8686 alc888_lenovo_ms7195_front_automute(codec);
8687 if ((res >> 26) == ALC880_FRONT_EVENT)
8688 alc888_lenovo_ms7195_rca_automute(codec);
8691 static struct hda_verb alc883_medion_md2_verbs[] = {
8692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8697 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8701 /* toggle speaker-output according to the hp-jack state */
8702 static void alc883_medion_md2_setup(struct hda_codec *codec)
8704 struct alc_spec *spec = codec->spec;
8706 spec->autocfg.hp_pins[0] = 0x14;
8707 spec->autocfg.speaker_pins[0] = 0x15;
8710 /* toggle speaker-output according to the hp-jack state */
8711 #define alc883_targa_init_hook alc882_targa_init_hook
8712 #define alc883_targa_unsol_event alc882_targa_unsol_event
8714 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8716 unsigned int present;
8718 present = snd_hda_jack_detect(codec, 0x18);
8719 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8720 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8723 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8725 struct alc_spec *spec = codec->spec;
8727 spec->autocfg.hp_pins[0] = 0x15;
8728 spec->autocfg.speaker_pins[0] = 0x14;
8731 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8733 alc_automute_amp(codec);
8734 alc883_clevo_m720_mic_automute(codec);
8737 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8740 switch (res >> 26) {
8741 case ALC880_MIC_EVENT:
8742 alc883_clevo_m720_mic_automute(codec);
8745 alc_automute_amp_unsol_event(codec, res);
8750 /* toggle speaker-output according to the hp-jack state */
8751 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8753 struct alc_spec *spec = codec->spec;
8755 spec->autocfg.hp_pins[0] = 0x14;
8756 spec->autocfg.speaker_pins[0] = 0x15;
8759 static void alc883_haier_w66_setup(struct hda_codec *codec)
8761 struct alc_spec *spec = codec->spec;
8763 spec->autocfg.hp_pins[0] = 0x1b;
8764 spec->autocfg.speaker_pins[0] = 0x14;
8767 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8769 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8771 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8772 HDA_AMP_MUTE, bits);
8775 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8777 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8779 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8780 HDA_AMP_MUTE, bits);
8781 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8782 HDA_AMP_MUTE, bits);
8785 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8788 if ((res >> 26) == ALC880_HP_EVENT)
8789 alc883_lenovo_101e_all_automute(codec);
8790 if ((res >> 26) == ALC880_FRONT_EVENT)
8791 alc883_lenovo_101e_ispeaker_automute(codec);
8794 /* toggle speaker-output according to the hp-jack state */
8795 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8799 spec->autocfg.hp_pins[0] = 0x14;
8800 spec->autocfg.speaker_pins[0] = 0x15;
8801 spec->autocfg.speaker_pins[1] = 0x16;
8804 static struct hda_verb alc883_acer_eapd_verbs[] = {
8805 /* HP Pin: output 0 (0x0c) */
8806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8809 /* Front Pin: output 0 (0x0c) */
8810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8812 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8813 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8814 /* eanable EAPD on medion laptop */
8815 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8816 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8817 /* enable unsolicited event */
8818 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8822 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8823 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8824 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8825 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8829 static void alc888_6st_dell_setup(struct hda_codec *codec)
8831 struct alc_spec *spec = codec->spec;
8833 spec->autocfg.hp_pins[0] = 0x1b;
8834 spec->autocfg.speaker_pins[0] = 0x14;
8835 spec->autocfg.speaker_pins[1] = 0x15;
8836 spec->autocfg.speaker_pins[2] = 0x16;
8837 spec->autocfg.speaker_pins[3] = 0x17;
8840 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8842 struct alc_spec *spec = codec->spec;
8844 spec->autocfg.hp_pins[0] = 0x1b;
8845 spec->autocfg.speaker_pins[0] = 0x14;
8846 spec->autocfg.speaker_pins[1] = 0x15;
8847 spec->autocfg.speaker_pins[2] = 0x16;
8848 spec->autocfg.speaker_pins[3] = 0x17;
8849 spec->autocfg.speaker_pins[4] = 0x1a;
8852 static void alc883_vaiott_setup(struct hda_codec *codec)
8854 struct alc_spec *spec = codec->spec;
8856 spec->autocfg.hp_pins[0] = 0x15;
8857 spec->autocfg.speaker_pins[0] = 0x14;
8858 spec->autocfg.speaker_pins[1] = 0x17;
8861 static struct hda_verb alc888_asus_m90v_verbs[] = {
8862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8865 /* enable unsolicited event */
8866 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8871 static void alc883_mode2_setup(struct hda_codec *codec)
8873 struct alc_spec *spec = codec->spec;
8875 spec->autocfg.hp_pins[0] = 0x1b;
8876 spec->autocfg.speaker_pins[0] = 0x14;
8877 spec->autocfg.speaker_pins[1] = 0x15;
8878 spec->autocfg.speaker_pins[2] = 0x16;
8879 spec->ext_mic.pin = 0x18;
8880 spec->int_mic.pin = 0x19;
8881 spec->ext_mic.mux_idx = 0;
8882 spec->int_mic.mux_idx = 1;
8886 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8892 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8893 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8894 /* enable unsolicited event */
8895 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8899 static void alc883_eee1601_inithook(struct hda_codec *codec)
8901 struct alc_spec *spec = codec->spec;
8903 spec->autocfg.hp_pins[0] = 0x14;
8904 spec->autocfg.speaker_pins[0] = 0x1b;
8905 alc_automute_pin(codec);
8908 static struct hda_verb alc889A_mb31_verbs[] = {
8909 /* Init rear pin (used as headphone output) */
8910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8911 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8912 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8913 /* Init line pin (used as output in 4ch and 6ch mode) */
8914 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8915 /* Init line 2 pin (used as headphone out by default) */
8916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8917 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8921 /* Mute speakers according to the headphone jack state */
8922 static void alc889A_mb31_automute(struct hda_codec *codec)
8924 unsigned int present;
8926 /* Mute only in 2ch or 4ch mode */
8927 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8929 present = snd_hda_jack_detect(codec, 0x15);
8930 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8931 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8932 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8933 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8937 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8939 if ((res >> 26) == ALC880_HP_EVENT)
8940 alc889A_mb31_automute(codec);
8944 #ifdef CONFIG_SND_HDA_POWER_SAVE
8945 #define alc882_loopbacks alc880_loopbacks
8948 /* pcm configuration: identical with ALC880 */
8949 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8950 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8951 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8952 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8954 static hda_nid_t alc883_slave_dig_outs[] = {
8955 ALC1200_DIGOUT_NID, 0,
8958 static hda_nid_t alc1200_slave_dig_outs[] = {
8959 ALC883_DIGOUT_NID, 0,
8963 * configuration and preset
8965 static const char *alc882_models[ALC882_MODEL_LAST] = {
8966 [ALC882_3ST_DIG] = "3stack-dig",
8967 [ALC882_6ST_DIG] = "6stack-dig",
8968 [ALC882_ARIMA] = "arima",
8969 [ALC882_W2JC] = "w2jc",
8970 [ALC882_TARGA] = "targa",
8971 [ALC882_ASUS_A7J] = "asus-a7j",
8972 [ALC882_ASUS_A7M] = "asus-a7m",
8973 [ALC885_MACPRO] = "macpro",
8974 [ALC885_MB5] = "mb5",
8975 [ALC885_MBP3] = "mbp3",
8976 [ALC885_IMAC24] = "imac24",
8977 [ALC885_IMAC91] = "imac91",
8978 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8979 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8980 [ALC883_3ST_6ch] = "3stack-6ch",
8981 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8982 [ALC883_TARGA_DIG] = "targa-dig",
8983 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8984 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8985 [ALC883_ACER] = "acer",
8986 [ALC883_ACER_ASPIRE] = "acer-aspire",
8987 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8988 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8989 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8990 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8991 [ALC883_MEDION] = "medion",
8992 [ALC883_MEDION_MD2] = "medion-md2",
8993 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8994 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8995 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8996 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8997 [ALC888_LENOVO_SKY] = "lenovo-sky",
8998 [ALC883_HAIER_W66] = "haier-w66",
8999 [ALC888_3ST_HP] = "3stack-hp",
9000 [ALC888_6ST_DELL] = "6stack-dell",
9001 [ALC883_MITAC] = "mitac",
9002 [ALC883_CLEVO_M540R] = "clevo-m540r",
9003 [ALC883_CLEVO_M720] = "clevo-m720",
9004 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9005 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9006 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9007 [ALC889A_INTEL] = "intel-alc889a",
9008 [ALC889_INTEL] = "intel-x58",
9009 [ALC1200_ASUS_P5Q] = "asus-p5q",
9010 [ALC889A_MB31] = "mb31",
9011 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9012 [ALC882_AUTO] = "auto",
9015 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9016 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9018 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9019 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9020 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9021 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9022 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9023 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9024 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9025 ALC888_ACER_ASPIRE_4930G),
9026 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9027 ALC888_ACER_ASPIRE_4930G),
9028 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9029 ALC888_ACER_ASPIRE_8930G),
9030 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9031 ALC888_ACER_ASPIRE_8930G),
9032 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9033 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9034 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9035 ALC888_ACER_ASPIRE_6530G),
9036 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9037 ALC888_ACER_ASPIRE_6530G),
9038 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9039 ALC888_ACER_ASPIRE_7730G),
9040 /* default Acer -- disabled as it causes more problems.
9041 * model=auto should work fine now
9043 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9045 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9047 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9048 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9049 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9050 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9051 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9052 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9054 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9055 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9056 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9057 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9058 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9059 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9060 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9061 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9062 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9063 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9064 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9066 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9067 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9068 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9069 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9070 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9071 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9072 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9073 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9074 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9076 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9077 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9080 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9081 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9082 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9083 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9084 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9085 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9086 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9087 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9088 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9089 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9090 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9091 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9092 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9093 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9094 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9095 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9096 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9097 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9098 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9099 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9100 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9101 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9102 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9103 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9104 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9106 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9107 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9108 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9109 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9110 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9111 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9112 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9113 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9114 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9115 ALC883_FUJITSU_PI2515),
9116 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9117 ALC888_FUJITSU_XA3530),
9118 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9119 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9120 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9121 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9122 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9123 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9124 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9125 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9126 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9128 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9129 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9130 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9131 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9132 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9133 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9134 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9139 /* codec SSID table for Intel Mac */
9140 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9141 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9142 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9143 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9144 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9145 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9146 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9147 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9148 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9149 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9150 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9151 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9152 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9153 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9154 * so apparently no perfect solution yet
9156 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9157 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9161 static struct alc_config_preset alc882_presets[] = {
9162 [ALC882_3ST_DIG] = {
9163 .mixers = { alc882_base_mixer },
9164 .init_verbs = { alc882_base_init_verbs,
9165 alc882_adc1_init_verbs },
9166 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9167 .dac_nids = alc882_dac_nids,
9168 .dig_out_nid = ALC882_DIGOUT_NID,
9169 .dig_in_nid = ALC882_DIGIN_NID,
9170 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9171 .channel_mode = alc882_ch_modes,
9173 .input_mux = &alc882_capture_source,
9175 [ALC882_6ST_DIG] = {
9176 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9177 .init_verbs = { alc882_base_init_verbs,
9178 alc882_adc1_init_verbs },
9179 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9180 .dac_nids = alc882_dac_nids,
9181 .dig_out_nid = ALC882_DIGOUT_NID,
9182 .dig_in_nid = ALC882_DIGIN_NID,
9183 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9184 .channel_mode = alc882_sixstack_modes,
9185 .input_mux = &alc882_capture_source,
9188 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9189 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9190 alc882_eapd_verbs },
9191 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9192 .dac_nids = alc882_dac_nids,
9193 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9194 .channel_mode = alc882_sixstack_modes,
9195 .input_mux = &alc882_capture_source,
9198 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9199 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9200 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9201 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9202 .dac_nids = alc882_dac_nids,
9203 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9204 .channel_mode = alc880_threestack_modes,
9206 .input_mux = &alc882_capture_source,
9207 .dig_out_nid = ALC882_DIGOUT_NID,
9210 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9211 .init_verbs = { alc885_mbp3_init_verbs,
9212 alc880_gpio1_init_verbs },
9214 .dac_nids = alc882_dac_nids,
9216 .channel_mode = alc885_mbp_4ch_modes,
9217 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9218 .input_mux = &alc882_capture_source,
9219 .dig_out_nid = ALC882_DIGOUT_NID,
9220 .dig_in_nid = ALC882_DIGIN_NID,
9221 .unsol_event = alc_automute_amp_unsol_event,
9222 .setup = alc885_mbp3_setup,
9223 .init_hook = alc_automute_amp,
9226 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9227 .init_verbs = { alc885_mb5_init_verbs,
9228 alc880_gpio1_init_verbs },
9229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9230 .dac_nids = alc882_dac_nids,
9231 .channel_mode = alc885_mb5_6ch_modes,
9232 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9233 .input_mux = &mb5_capture_source,
9234 .dig_out_nid = ALC882_DIGOUT_NID,
9235 .dig_in_nid = ALC882_DIGIN_NID,
9238 .mixers = { alc882_macpro_mixer },
9239 .init_verbs = { alc882_macpro_init_verbs },
9240 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9241 .dac_nids = alc882_dac_nids,
9242 .dig_out_nid = ALC882_DIGOUT_NID,
9243 .dig_in_nid = ALC882_DIGIN_NID,
9244 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9245 .channel_mode = alc882_ch_modes,
9246 .input_mux = &alc882_capture_source,
9247 .init_hook = alc885_macpro_init_hook,
9250 .mixers = { alc885_imac24_mixer },
9251 .init_verbs = { alc885_imac24_init_verbs },
9252 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9253 .dac_nids = alc882_dac_nids,
9254 .dig_out_nid = ALC882_DIGOUT_NID,
9255 .dig_in_nid = ALC882_DIGIN_NID,
9256 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9257 .channel_mode = alc882_ch_modes,
9258 .input_mux = &alc882_capture_source,
9259 .unsol_event = alc_automute_amp_unsol_event,
9260 .setup = alc885_imac24_setup,
9261 .init_hook = alc885_imac24_init_hook,
9264 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9265 .init_verbs = { alc885_imac91_init_verbs,
9266 alc880_gpio1_init_verbs },
9267 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9268 .dac_nids = alc882_dac_nids,
9269 .channel_mode = alc885_mbp_4ch_modes,
9270 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9271 .input_mux = &alc882_capture_source,
9272 .dig_out_nid = ALC882_DIGOUT_NID,
9273 .dig_in_nid = ALC882_DIGIN_NID,
9274 .unsol_event = alc885_imac91_unsol_event,
9275 .init_hook = alc885_imac91_automute,
9278 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9279 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9280 alc880_gpio3_init_verbs, alc882_targa_verbs},
9281 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9282 .dac_nids = alc882_dac_nids,
9283 .dig_out_nid = ALC882_DIGOUT_NID,
9284 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9285 .adc_nids = alc882_adc_nids,
9286 .capsrc_nids = alc882_capsrc_nids,
9287 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9288 .channel_mode = alc882_3ST_6ch_modes,
9290 .input_mux = &alc882_capture_source,
9291 .unsol_event = alc882_targa_unsol_event,
9292 .setup = alc882_targa_setup,
9293 .init_hook = alc882_targa_automute,
9295 [ALC882_ASUS_A7J] = {
9296 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9297 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9298 alc882_asus_a7j_verbs},
9299 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9300 .dac_nids = alc882_dac_nids,
9301 .dig_out_nid = ALC882_DIGOUT_NID,
9302 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9303 .adc_nids = alc882_adc_nids,
9304 .capsrc_nids = alc882_capsrc_nids,
9305 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9306 .channel_mode = alc882_3ST_6ch_modes,
9308 .input_mux = &alc882_capture_source,
9310 [ALC882_ASUS_A7M] = {
9311 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9312 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9313 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9314 alc882_asus_a7m_verbs },
9315 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9316 .dac_nids = alc882_dac_nids,
9317 .dig_out_nid = ALC882_DIGOUT_NID,
9318 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9319 .channel_mode = alc880_threestack_modes,
9321 .input_mux = &alc882_capture_source,
9323 [ALC883_3ST_2ch_DIG] = {
9324 .mixers = { alc883_3ST_2ch_mixer },
9325 .init_verbs = { alc883_init_verbs },
9326 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9327 .dac_nids = alc883_dac_nids,
9328 .dig_out_nid = ALC883_DIGOUT_NID,
9329 .dig_in_nid = ALC883_DIGIN_NID,
9330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9331 .channel_mode = alc883_3ST_2ch_modes,
9332 .input_mux = &alc883_capture_source,
9334 [ALC883_3ST_6ch_DIG] = {
9335 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9336 .init_verbs = { alc883_init_verbs },
9337 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9338 .dac_nids = alc883_dac_nids,
9339 .dig_out_nid = ALC883_DIGOUT_NID,
9340 .dig_in_nid = ALC883_DIGIN_NID,
9341 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9342 .channel_mode = alc883_3ST_6ch_modes,
9344 .input_mux = &alc883_capture_source,
9346 [ALC883_3ST_6ch] = {
9347 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9348 .init_verbs = { alc883_init_verbs },
9349 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9350 .dac_nids = alc883_dac_nids,
9351 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9352 .channel_mode = alc883_3ST_6ch_modes,
9354 .input_mux = &alc883_capture_source,
9356 [ALC883_3ST_6ch_INTEL] = {
9357 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9358 .init_verbs = { alc883_init_verbs },
9359 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9360 .dac_nids = alc883_dac_nids,
9361 .dig_out_nid = ALC883_DIGOUT_NID,
9362 .dig_in_nid = ALC883_DIGIN_NID,
9363 .slave_dig_outs = alc883_slave_dig_outs,
9364 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9365 .channel_mode = alc883_3ST_6ch_intel_modes,
9367 .input_mux = &alc883_3stack_6ch_intel,
9370 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9371 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9372 alc_hp15_unsol_verbs },
9373 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9374 .dac_nids = alc883_dac_nids,
9375 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9376 .adc_nids = alc889_adc_nids,
9377 .dig_out_nid = ALC883_DIGOUT_NID,
9378 .dig_in_nid = ALC883_DIGIN_NID,
9379 .slave_dig_outs = alc883_slave_dig_outs,
9380 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9381 .channel_mode = alc889_8ch_intel_modes,
9382 .capsrc_nids = alc889_capsrc_nids,
9383 .input_mux = &alc889_capture_source,
9384 .setup = alc889_automute_setup,
9385 .init_hook = alc_automute_amp,
9386 .unsol_event = alc_automute_amp_unsol_event,
9390 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9391 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9392 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9396 .adc_nids = alc889_adc_nids,
9397 .dig_out_nid = ALC883_DIGOUT_NID,
9398 .dig_in_nid = ALC883_DIGIN_NID,
9399 .slave_dig_outs = alc883_slave_dig_outs,
9400 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9401 .channel_mode = alc889_8ch_intel_modes,
9402 .capsrc_nids = alc889_capsrc_nids,
9403 .input_mux = &alc889_capture_source,
9404 .setup = alc889_automute_setup,
9405 .init_hook = alc889_intel_init_hook,
9406 .unsol_event = alc_automute_amp_unsol_event,
9409 [ALC883_6ST_DIG] = {
9410 .mixers = { alc883_base_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 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9417 .channel_mode = alc883_sixstack_modes,
9418 .input_mux = &alc883_capture_source,
9420 [ALC883_TARGA_DIG] = {
9421 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9422 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9423 alc883_targa_verbs},
9424 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9425 .dac_nids = alc883_dac_nids,
9426 .dig_out_nid = ALC883_DIGOUT_NID,
9427 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9428 .channel_mode = alc883_3ST_6ch_modes,
9430 .input_mux = &alc883_capture_source,
9431 .unsol_event = alc883_targa_unsol_event,
9432 .setup = alc882_targa_setup,
9433 .init_hook = alc882_targa_automute,
9435 [ALC883_TARGA_2ch_DIG] = {
9436 .mixers = { alc883_targa_2ch_mixer},
9437 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9438 alc883_targa_verbs},
9439 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9440 .dac_nids = alc883_dac_nids,
9441 .adc_nids = alc883_adc_nids_alt,
9442 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9443 .capsrc_nids = alc883_capsrc_nids,
9444 .dig_out_nid = ALC883_DIGOUT_NID,
9445 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9446 .channel_mode = alc883_3ST_2ch_modes,
9447 .input_mux = &alc883_capture_source,
9448 .unsol_event = alc883_targa_unsol_event,
9449 .setup = alc882_targa_setup,
9450 .init_hook = alc882_targa_automute,
9452 [ALC883_TARGA_8ch_DIG] = {
9453 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9454 alc883_chmode_mixer },
9455 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9456 alc883_targa_verbs },
9457 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9458 .dac_nids = alc883_dac_nids,
9459 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9460 .adc_nids = alc883_adc_nids_rev,
9461 .capsrc_nids = alc883_capsrc_nids_rev,
9462 .dig_out_nid = ALC883_DIGOUT_NID,
9463 .dig_in_nid = ALC883_DIGIN_NID,
9464 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9465 .channel_mode = alc883_4ST_8ch_modes,
9467 .input_mux = &alc883_capture_source,
9468 .unsol_event = alc883_targa_unsol_event,
9469 .setup = alc882_targa_setup,
9470 .init_hook = alc882_targa_automute,
9473 .mixers = { alc883_base_mixer },
9474 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9475 * and the headphone jack. Turn this on and rely on the
9476 * standard mute methods whenever the user wants to turn
9477 * these outputs off.
9479 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9480 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9481 .dac_nids = alc883_dac_nids,
9482 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9483 .channel_mode = alc883_3ST_2ch_modes,
9484 .input_mux = &alc883_capture_source,
9486 [ALC883_ACER_ASPIRE] = {
9487 .mixers = { alc883_acer_aspire_mixer },
9488 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9489 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9490 .dac_nids = alc883_dac_nids,
9491 .dig_out_nid = ALC883_DIGOUT_NID,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9493 .channel_mode = alc883_3ST_2ch_modes,
9494 .input_mux = &alc883_capture_source,
9495 .unsol_event = alc_automute_amp_unsol_event,
9496 .setup = alc883_acer_aspire_setup,
9497 .init_hook = alc_automute_amp,
9499 [ALC888_ACER_ASPIRE_4930G] = {
9500 .mixers = { alc888_base_mixer,
9501 alc883_chmode_mixer },
9502 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9503 alc888_acer_aspire_4930g_verbs },
9504 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9505 .dac_nids = alc883_dac_nids,
9506 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9507 .adc_nids = alc883_adc_nids_rev,
9508 .capsrc_nids = alc883_capsrc_nids_rev,
9509 .dig_out_nid = ALC883_DIGOUT_NID,
9510 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9511 .channel_mode = alc883_3ST_6ch_modes,
9514 ARRAY_SIZE(alc888_2_capture_sources),
9515 .input_mux = alc888_2_capture_sources,
9516 .unsol_event = alc_automute_amp_unsol_event,
9517 .setup = alc888_acer_aspire_4930g_setup,
9518 .init_hook = alc_automute_amp,
9520 [ALC888_ACER_ASPIRE_6530G] = {
9521 .mixers = { alc888_acer_aspire_6530_mixer },
9522 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9523 alc888_acer_aspire_6530g_verbs },
9524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9525 .dac_nids = alc883_dac_nids,
9526 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9527 .adc_nids = alc883_adc_nids_rev,
9528 .capsrc_nids = alc883_capsrc_nids_rev,
9529 .dig_out_nid = ALC883_DIGOUT_NID,
9530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9531 .channel_mode = alc883_3ST_2ch_modes,
9533 ARRAY_SIZE(alc888_2_capture_sources),
9534 .input_mux = alc888_acer_aspire_6530_sources,
9535 .unsol_event = alc_automute_amp_unsol_event,
9536 .setup = alc888_acer_aspire_6530g_setup,
9537 .init_hook = alc_automute_amp,
9539 [ALC888_ACER_ASPIRE_8930G] = {
9540 .mixers = { alc889_acer_aspire_8930g_mixer,
9541 alc883_chmode_mixer },
9542 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9543 alc889_acer_aspire_8930g_verbs,
9545 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9546 .dac_nids = alc883_dac_nids,
9547 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9548 .adc_nids = alc889_adc_nids,
9549 .capsrc_nids = alc889_capsrc_nids,
9550 .dig_out_nid = ALC883_DIGOUT_NID,
9551 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9552 .channel_mode = alc883_3ST_6ch_modes,
9554 .const_channel_count = 6,
9556 ARRAY_SIZE(alc889_capture_sources),
9557 .input_mux = alc889_capture_sources,
9558 .unsol_event = alc_automute_amp_unsol_event,
9559 .setup = alc889_acer_aspire_8930g_setup,
9560 .init_hook = alc_automute_amp,
9561 #ifdef CONFIG_SND_HDA_POWER_SAVE
9562 .power_hook = alc_power_eapd,
9565 [ALC888_ACER_ASPIRE_7730G] = {
9566 .mixers = { alc883_3ST_6ch_mixer,
9567 alc883_chmode_mixer },
9568 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9569 alc888_acer_aspire_7730G_verbs },
9570 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9571 .dac_nids = alc883_dac_nids,
9572 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9573 .adc_nids = alc883_adc_nids_rev,
9574 .capsrc_nids = alc883_capsrc_nids_rev,
9575 .dig_out_nid = ALC883_DIGOUT_NID,
9576 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9577 .channel_mode = alc883_3ST_6ch_modes,
9579 .const_channel_count = 6,
9580 .input_mux = &alc883_capture_source,
9581 .unsol_event = alc_automute_amp_unsol_event,
9582 .setup = alc888_acer_aspire_6530g_setup,
9583 .init_hook = alc_automute_amp,
9586 .mixers = { alc883_fivestack_mixer,
9587 alc883_chmode_mixer },
9588 .init_verbs = { alc883_init_verbs,
9589 alc883_medion_eapd_verbs },
9590 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9591 .dac_nids = alc883_dac_nids,
9592 .adc_nids = alc883_adc_nids_alt,
9593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9594 .capsrc_nids = alc883_capsrc_nids,
9595 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9596 .channel_mode = alc883_sixstack_modes,
9597 .input_mux = &alc883_capture_source,
9599 [ALC883_MEDION_MD2] = {
9600 .mixers = { alc883_medion_md2_mixer},
9601 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9603 .dac_nids = alc883_dac_nids,
9604 .dig_out_nid = ALC883_DIGOUT_NID,
9605 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9606 .channel_mode = alc883_3ST_2ch_modes,
9607 .input_mux = &alc883_capture_source,
9608 .unsol_event = alc_automute_amp_unsol_event,
9609 .setup = alc883_medion_md2_setup,
9610 .init_hook = alc_automute_amp,
9612 [ALC883_LAPTOP_EAPD] = {
9613 .mixers = { alc883_base_mixer },
9614 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9615 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9616 .dac_nids = alc883_dac_nids,
9617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9618 .channel_mode = alc883_3ST_2ch_modes,
9619 .input_mux = &alc883_capture_source,
9621 [ALC883_CLEVO_M540R] = {
9622 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9623 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9624 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9625 .dac_nids = alc883_dac_nids,
9626 .dig_out_nid = ALC883_DIGOUT_NID,
9627 .dig_in_nid = ALC883_DIGIN_NID,
9628 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9629 .channel_mode = alc883_3ST_6ch_clevo_modes,
9631 .input_mux = &alc883_capture_source,
9632 /* This machine has the hardware HP auto-muting, thus
9633 * we need no software mute via unsol event
9636 [ALC883_CLEVO_M720] = {
9637 .mixers = { alc883_clevo_m720_mixer },
9638 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9639 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9640 .dac_nids = alc883_dac_nids,
9641 .dig_out_nid = ALC883_DIGOUT_NID,
9642 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9643 .channel_mode = alc883_3ST_2ch_modes,
9644 .input_mux = &alc883_capture_source,
9645 .unsol_event = alc883_clevo_m720_unsol_event,
9646 .setup = alc883_clevo_m720_setup,
9647 .init_hook = alc883_clevo_m720_init_hook,
9649 [ALC883_LENOVO_101E_2ch] = {
9650 .mixers = { alc883_lenovo_101e_2ch_mixer},
9651 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9652 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9653 .dac_nids = alc883_dac_nids,
9654 .adc_nids = alc883_adc_nids_alt,
9655 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9656 .capsrc_nids = alc883_capsrc_nids,
9657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9658 .channel_mode = alc883_3ST_2ch_modes,
9659 .input_mux = &alc883_lenovo_101e_capture_source,
9660 .unsol_event = alc883_lenovo_101e_unsol_event,
9661 .init_hook = alc883_lenovo_101e_all_automute,
9663 [ALC883_LENOVO_NB0763] = {
9664 .mixers = { alc883_lenovo_nb0763_mixer },
9665 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9666 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9667 .dac_nids = alc883_dac_nids,
9668 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9669 .channel_mode = alc883_3ST_2ch_modes,
9671 .input_mux = &alc883_lenovo_nb0763_capture_source,
9672 .unsol_event = alc_automute_amp_unsol_event,
9673 .setup = alc883_medion_md2_setup,
9674 .init_hook = alc_automute_amp,
9676 [ALC888_LENOVO_MS7195_DIG] = {
9677 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9678 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9679 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9680 .dac_nids = alc883_dac_nids,
9681 .dig_out_nid = ALC883_DIGOUT_NID,
9682 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9683 .channel_mode = alc883_3ST_6ch_modes,
9685 .input_mux = &alc883_capture_source,
9686 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9687 .init_hook = alc888_lenovo_ms7195_front_automute,
9689 [ALC883_HAIER_W66] = {
9690 .mixers = { alc883_targa_2ch_mixer},
9691 .init_verbs = { alc883_init_verbs, alc883_haier_w66_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 = alc_automute_amp_unsol_event,
9699 .setup = alc883_haier_w66_setup,
9700 .init_hook = alc_automute_amp,
9703 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9704 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9705 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9706 .dac_nids = alc883_dac_nids,
9707 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9708 .channel_mode = alc888_3st_hp_modes,
9710 .input_mux = &alc883_capture_source,
9711 .unsol_event = alc_automute_amp_unsol_event,
9712 .setup = alc888_3st_hp_setup,
9713 .init_hook = alc_automute_amp,
9715 [ALC888_6ST_DELL] = {
9716 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9717 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9718 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9719 .dac_nids = alc883_dac_nids,
9720 .dig_out_nid = ALC883_DIGOUT_NID,
9721 .dig_in_nid = ALC883_DIGIN_NID,
9722 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9723 .channel_mode = alc883_sixstack_modes,
9724 .input_mux = &alc883_capture_source,
9725 .unsol_event = alc_automute_amp_unsol_event,
9726 .setup = alc888_6st_dell_setup,
9727 .init_hook = alc_automute_amp,
9730 .mixers = { alc883_mitac_mixer },
9731 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9732 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9733 .dac_nids = alc883_dac_nids,
9734 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9735 .channel_mode = alc883_3ST_2ch_modes,
9736 .input_mux = &alc883_capture_source,
9737 .unsol_event = alc_automute_amp_unsol_event,
9738 .setup = alc883_mitac_setup,
9739 .init_hook = alc_automute_amp,
9741 [ALC883_FUJITSU_PI2515] = {
9742 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9743 .init_verbs = { alc883_init_verbs,
9744 alc883_2ch_fujitsu_pi2515_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_fujitsu_pi2515_capture_source,
9751 .unsol_event = alc_automute_amp_unsol_event,
9752 .setup = alc883_2ch_fujitsu_pi2515_setup,
9753 .init_hook = alc_automute_amp,
9755 [ALC888_FUJITSU_XA3530] = {
9756 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9757 .init_verbs = { alc883_init_verbs,
9758 alc888_fujitsu_xa3530_verbs },
9759 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9760 .dac_nids = alc883_dac_nids,
9761 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9762 .adc_nids = alc883_adc_nids_rev,
9763 .capsrc_nids = alc883_capsrc_nids_rev,
9764 .dig_out_nid = ALC883_DIGOUT_NID,
9765 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9766 .channel_mode = alc888_4ST_8ch_intel_modes,
9768 ARRAY_SIZE(alc888_2_capture_sources),
9769 .input_mux = alc888_2_capture_sources,
9770 .unsol_event = alc_automute_amp_unsol_event,
9771 .setup = alc888_fujitsu_xa3530_setup,
9772 .init_hook = alc_automute_amp,
9774 [ALC888_LENOVO_SKY] = {
9775 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9776 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9777 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9778 .dac_nids = alc883_dac_nids,
9779 .dig_out_nid = ALC883_DIGOUT_NID,
9780 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9781 .channel_mode = alc883_sixstack_modes,
9783 .input_mux = &alc883_lenovo_sky_capture_source,
9784 .unsol_event = alc_automute_amp_unsol_event,
9785 .setup = alc888_lenovo_sky_setup,
9786 .init_hook = alc_automute_amp,
9788 [ALC888_ASUS_M90V] = {
9789 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9790 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9791 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9792 .dac_nids = alc883_dac_nids,
9793 .dig_out_nid = ALC883_DIGOUT_NID,
9794 .dig_in_nid = ALC883_DIGIN_NID,
9795 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9796 .channel_mode = alc883_3ST_6ch_modes,
9798 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9799 .unsol_event = alc_sku_unsol_event,
9800 .setup = alc883_mode2_setup,
9801 .init_hook = alc_inithook,
9803 [ALC888_ASUS_EEE1601] = {
9804 .mixers = { alc883_asus_eee1601_mixer },
9805 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9806 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9807 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9808 .dac_nids = alc883_dac_nids,
9809 .dig_out_nid = ALC883_DIGOUT_NID,
9810 .dig_in_nid = ALC883_DIGIN_NID,
9811 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9812 .channel_mode = alc883_3ST_2ch_modes,
9814 .input_mux = &alc883_asus_eee1601_capture_source,
9815 .unsol_event = alc_sku_unsol_event,
9816 .init_hook = alc883_eee1601_inithook,
9818 [ALC1200_ASUS_P5Q] = {
9819 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9820 .init_verbs = { alc883_init_verbs },
9821 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9822 .dac_nids = alc883_dac_nids,
9823 .dig_out_nid = ALC1200_DIGOUT_NID,
9824 .dig_in_nid = ALC883_DIGIN_NID,
9825 .slave_dig_outs = alc1200_slave_dig_outs,
9826 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9827 .channel_mode = alc883_sixstack_modes,
9828 .input_mux = &alc883_capture_source,
9831 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9832 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9833 alc880_gpio1_init_verbs },
9834 .adc_nids = alc883_adc_nids,
9835 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9836 .capsrc_nids = alc883_capsrc_nids,
9837 .dac_nids = alc883_dac_nids,
9838 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9839 .channel_mode = alc889A_mb31_6ch_modes,
9840 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9841 .input_mux = &alc889A_mb31_capture_source,
9842 .dig_out_nid = ALC883_DIGOUT_NID,
9843 .unsol_event = alc889A_mb31_unsol_event,
9844 .init_hook = alc889A_mb31_automute,
9846 [ALC883_SONY_VAIO_TT] = {
9847 .mixers = { alc883_vaiott_mixer },
9848 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9849 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9850 .dac_nids = alc883_dac_nids,
9851 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9852 .channel_mode = alc883_3ST_2ch_modes,
9853 .input_mux = &alc883_capture_source,
9854 .unsol_event = alc_automute_amp_unsol_event,
9855 .setup = alc883_vaiott_setup,
9856 .init_hook = alc_automute_amp,
9865 PINFIX_ABIT_AW9D_MAX
9868 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9869 { 0x15, 0x01080104 }, /* side */
9870 { 0x16, 0x01011012 }, /* rear */
9871 { 0x17, 0x01016011 }, /* clfe */
9875 static const struct alc_fixup alc882_fixups[] = {
9876 [PINFIX_ABIT_AW9D_MAX] = {
9877 .pins = alc882_abit_aw9d_pinfix
9881 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9882 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9887 * BIOS auto configuration
9889 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9890 const struct auto_pin_cfg *cfg)
9892 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9895 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9896 hda_nid_t nid, int pin_type,
9900 struct alc_spec *spec = codec->spec;
9903 alc_set_pin_output(codec, nid, pin_type);
9904 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9907 idx = spec->multiout.dac_nids[dac_idx] - 2;
9908 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9912 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9914 struct alc_spec *spec = codec->spec;
9917 for (i = 0; i <= HDA_SIDE; i++) {
9918 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9919 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9921 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9926 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9928 struct alc_spec *spec = codec->spec;
9931 pin = spec->autocfg.hp_pins[0];
9932 if (pin) /* connect to front */
9934 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9935 pin = spec->autocfg.speaker_pins[0];
9937 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9940 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9942 struct alc_spec *spec = codec->spec;
9945 for (i = 0; i < AUTO_PIN_LAST; i++) {
9946 hda_nid_t nid = spec->autocfg.input_pins[i];
9949 alc_set_input_pin(codec, nid, i);
9950 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9951 snd_hda_codec_write(codec, nid, 0,
9952 AC_VERB_SET_AMP_GAIN_MUTE,
9957 static void alc882_auto_init_input_src(struct hda_codec *codec)
9959 struct alc_spec *spec = codec->spec;
9962 for (c = 0; c < spec->num_adc_nids; c++) {
9963 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9964 hda_nid_t nid = spec->capsrc_nids[c];
9965 unsigned int mux_idx;
9966 const struct hda_input_mux *imux;
9967 int conns, mute, idx, item;
9969 conns = snd_hda_get_connections(codec, nid, conn_list,
9970 ARRAY_SIZE(conn_list));
9973 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9974 imux = &spec->input_mux[mux_idx];
9975 for (idx = 0; idx < conns; idx++) {
9976 /* if the current connection is the selected one,
9977 * unmute it as default - otherwise mute it
9979 mute = AMP_IN_MUTE(idx);
9980 for (item = 0; item < imux->num_items; item++) {
9981 if (imux->items[item].index == idx) {
9982 if (spec->cur_mux[c] == item)
9983 mute = AMP_IN_UNMUTE(idx);
9987 /* check if we have a selector or mixer
9988 * we could check for the widget type instead, but
9989 * just check for Amp-In presence (in case of mixer
9990 * without amp-in there is something wrong, this
9991 * function shouldn't be used or capsrc nid is wrong)
9993 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9994 snd_hda_codec_write(codec, nid, 0,
9995 AC_VERB_SET_AMP_GAIN_MUTE,
9997 else if (mute != AMP_IN_MUTE(idx))
9998 snd_hda_codec_write(codec, nid, 0,
9999 AC_VERB_SET_CONNECT_SEL,
10005 /* add mic boosts if needed */
10006 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10008 struct alc_spec *spec = codec->spec;
10012 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10013 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10014 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10016 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10020 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10021 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10022 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10024 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10031 /* almost identical with ALC880 parser... */
10032 static int alc882_parse_auto_config(struct hda_codec *codec)
10034 struct alc_spec *spec = codec->spec;
10035 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10038 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10042 if (!spec->autocfg.line_outs)
10043 return 0; /* can't find valid BIOS pin config */
10045 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10048 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10051 err = alc880_auto_create_extra_out(spec,
10052 spec->autocfg.speaker_pins[0],
10056 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10060 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10064 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10066 /* check multiple SPDIF-out (for recent codecs) */
10067 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10069 err = snd_hda_get_connections(codec,
10070 spec->autocfg.dig_out_pins[i],
10075 spec->multiout.dig_out_nid = dig_nid;
10077 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10078 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10080 spec->slave_dig_outs[i - 1] = dig_nid;
10083 if (spec->autocfg.dig_in_pin)
10084 spec->dig_in_nid = ALC880_DIGIN_NID;
10086 if (spec->kctls.list)
10087 add_mixer(spec, spec->kctls.list);
10089 add_verb(spec, alc883_auto_init_verbs);
10090 /* if ADC 0x07 is available, initialize it, too */
10091 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10092 add_verb(spec, alc882_adc1_init_verbs);
10094 spec->num_mux_defs = 1;
10095 spec->input_mux = &spec->private_imux[0];
10097 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10099 err = alc_auto_add_mic_boost(codec);
10103 return 1; /* config found */
10106 /* additional initialization for auto-configuration model */
10107 static void alc882_auto_init(struct hda_codec *codec)
10109 struct alc_spec *spec = codec->spec;
10110 alc882_auto_init_multi_out(codec);
10111 alc882_auto_init_hp_out(codec);
10112 alc882_auto_init_analog_input(codec);
10113 alc882_auto_init_input_src(codec);
10114 if (spec->unsol_event)
10115 alc_inithook(codec);
10118 static int patch_alc882(struct hda_codec *codec)
10120 struct alc_spec *spec;
10121 int err, board_config;
10123 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10127 codec->spec = spec;
10129 switch (codec->vendor_id) {
10134 /* ALC883 and variants */
10135 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10139 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10143 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10144 board_config = snd_hda_check_board_codec_sid_config(codec,
10145 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10147 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10148 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10150 board_config = ALC882_AUTO;
10153 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10155 if (board_config == ALC882_AUTO) {
10156 /* automatic parse from the BIOS config */
10157 err = alc882_parse_auto_config(codec);
10163 "hda_codec: Cannot set up configuration "
10164 "from BIOS. Using base mode...\n");
10165 board_config = ALC882_3ST_DIG;
10169 err = snd_hda_attach_beep_device(codec, 0x1);
10175 if (board_config != ALC882_AUTO)
10176 setup_preset(codec, &alc882_presets[board_config]);
10178 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10179 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10180 /* FIXME: setup DAC5 */
10181 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10182 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10184 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10185 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10187 if (codec->vendor_id == 0x10ec0888)
10188 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10190 if (!spec->adc_nids && spec->input_mux) {
10192 spec->num_adc_nids = 0;
10193 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10194 const struct hda_input_mux *imux = spec->input_mux;
10196 hda_nid_t items[16];
10197 hda_nid_t nid = alc882_adc_nids[i];
10198 unsigned int wcap = get_wcaps(codec, nid);
10200 wcap = get_wcaps_type(wcap);
10201 if (wcap != AC_WID_AUD_IN)
10203 spec->private_adc_nids[spec->num_adc_nids] = nid;
10204 err = snd_hda_get_connections(codec, nid, &cap, 1);
10207 err = snd_hda_get_connections(codec, cap, items,
10208 ARRAY_SIZE(items));
10211 for (j = 0; j < imux->num_items; j++)
10212 if (imux->items[j].index >= err)
10214 if (j < imux->num_items)
10216 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10217 spec->num_adc_nids++;
10219 spec->adc_nids = spec->private_adc_nids;
10220 spec->capsrc_nids = spec->private_capsrc_nids;
10223 set_capture_mixer(codec);
10224 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10226 spec->vmaster_nid = 0x0c;
10228 codec->patch_ops = alc_patch_ops;
10229 if (board_config == ALC882_AUTO)
10230 spec->init_hook = alc882_auto_init;
10231 #ifdef CONFIG_SND_HDA_POWER_SAVE
10232 if (!spec->loopback.amplist)
10233 spec->loopback.amplist = alc882_loopbacks;
10235 codec->proc_widget_hook = print_realtek_coef;
10245 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10246 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10248 #define alc262_dac_nids alc260_dac_nids
10249 #define alc262_adc_nids alc882_adc_nids
10250 #define alc262_adc_nids_alt alc882_adc_nids_alt
10251 #define alc262_capsrc_nids alc882_capsrc_nids
10252 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10254 #define alc262_modes alc260_modes
10255 #define alc262_capture_source alc882_capture_source
10257 static hda_nid_t alc262_dmic_adc_nids[1] = {
10262 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10264 static struct snd_kcontrol_new alc262_base_mixer[] = {
10265 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10266 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10275 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10276 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10278 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10279 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10280 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10284 /* update HP, line and mono-out pins according to the master switch */
10285 static void alc262_hp_master_update(struct hda_codec *codec)
10287 struct alc_spec *spec = codec->spec;
10288 int val = spec->master_sw;
10290 /* HP & line-out */
10291 snd_hda_codec_write_cache(codec, 0x1b, 0,
10292 AC_VERB_SET_PIN_WIDGET_CONTROL,
10294 snd_hda_codec_write_cache(codec, 0x15, 0,
10295 AC_VERB_SET_PIN_WIDGET_CONTROL,
10297 /* mono (speaker) depending on the HP jack sense */
10298 val = val && !spec->jack_present;
10299 snd_hda_codec_write_cache(codec, 0x16, 0,
10300 AC_VERB_SET_PIN_WIDGET_CONTROL,
10301 val ? PIN_OUT : 0);
10304 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10306 struct alc_spec *spec = codec->spec;
10308 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10309 alc262_hp_master_update(codec);
10312 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10314 if ((res >> 26) != ALC880_HP_EVENT)
10316 alc262_hp_bpc_automute(codec);
10319 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10321 struct alc_spec *spec = codec->spec;
10323 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10324 alc262_hp_master_update(codec);
10327 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10330 if ((res >> 26) != ALC880_HP_EVENT)
10332 alc262_hp_wildwest_automute(codec);
10335 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10337 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10338 struct snd_ctl_elem_value *ucontrol)
10340 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10341 struct alc_spec *spec = codec->spec;
10342 int val = !!*ucontrol->value.integer.value;
10344 if (val == spec->master_sw)
10346 spec->master_sw = val;
10347 alc262_hp_master_update(codec);
10351 #define ALC262_HP_MASTER_SWITCH \
10353 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10354 .name = "Master Playback Switch", \
10355 .info = snd_ctl_boolean_mono_info, \
10356 .get = alc262_hp_master_sw_get, \
10357 .put = alc262_hp_master_sw_put, \
10360 .iface = NID_MAPPING, \
10361 .name = "Master Playback Switch", \
10362 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10366 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10367 ALC262_HP_MASTER_SWITCH,
10368 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10369 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10371 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10373 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10376 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10377 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10378 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10379 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10380 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10381 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10382 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10384 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10385 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10386 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10390 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10391 ALC262_HP_MASTER_SWITCH,
10392 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10393 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10395 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10396 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10398 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10400 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10402 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10403 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10404 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10405 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10406 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10410 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10411 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10412 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10413 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10417 /* mute/unmute internal speaker according to the hp jack and mute state */
10418 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10420 struct alc_spec *spec = codec->spec;
10422 spec->autocfg.hp_pins[0] = 0x15;
10423 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10426 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10427 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10428 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10429 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10432 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10433 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10437 static struct hda_verb alc262_hp_t5735_verbs[] = {
10438 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10439 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10441 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10445 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10446 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10447 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10448 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10449 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10450 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10451 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10455 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10456 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10457 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10460 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10461 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10463 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10465 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10469 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10476 /* bind hp and internal speaker mute (with plug check) as master switch */
10477 static void alc262_hippo_master_update(struct hda_codec *codec)
10479 struct alc_spec *spec = codec->spec;
10480 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10481 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10482 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10486 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10487 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10488 HDA_AMP_MUTE, mute);
10489 /* mute internal speaker per jack sense */
10490 if (spec->jack_present)
10491 mute = HDA_AMP_MUTE;
10493 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10494 HDA_AMP_MUTE, mute);
10495 if (speaker_nid && speaker_nid != line_nid)
10496 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10497 HDA_AMP_MUTE, mute);
10500 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10502 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10503 struct snd_ctl_elem_value *ucontrol)
10505 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10506 struct alc_spec *spec = codec->spec;
10507 int val = !!*ucontrol->value.integer.value;
10509 if (val == spec->master_sw)
10511 spec->master_sw = val;
10512 alc262_hippo_master_update(codec);
10516 #define ALC262_HIPPO_MASTER_SWITCH \
10518 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10519 .name = "Master Playback Switch", \
10520 .info = snd_ctl_boolean_mono_info, \
10521 .get = alc262_hippo_master_sw_get, \
10522 .put = alc262_hippo_master_sw_put, \
10525 .iface = NID_MAPPING, \
10526 .name = "Master Playback Switch", \
10527 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10528 (SUBDEV_SPEAKER(0) << 16), \
10531 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10532 ALC262_HIPPO_MASTER_SWITCH,
10533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10534 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10535 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10537 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10540 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10542 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10543 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10548 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10549 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10550 ALC262_HIPPO_MASTER_SWITCH,
10551 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10552 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10553 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10554 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10555 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10556 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10557 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10558 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10559 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10560 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10564 /* mute/unmute internal speaker according to the hp jack and mute state */
10565 static void alc262_hippo_automute(struct hda_codec *codec)
10567 struct alc_spec *spec = codec->spec;
10568 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10570 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10571 alc262_hippo_master_update(codec);
10574 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10576 if ((res >> 26) != ALC880_HP_EVENT)
10578 alc262_hippo_automute(codec);
10581 static void alc262_hippo_setup(struct hda_codec *codec)
10583 struct alc_spec *spec = codec->spec;
10585 spec->autocfg.hp_pins[0] = 0x15;
10586 spec->autocfg.speaker_pins[0] = 0x14;
10589 static void alc262_hippo1_setup(struct hda_codec *codec)
10591 struct alc_spec *spec = codec->spec;
10593 spec->autocfg.hp_pins[0] = 0x1b;
10594 spec->autocfg.speaker_pins[0] = 0x14;
10598 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10599 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10600 ALC262_HIPPO_MASTER_SWITCH,
10601 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10602 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10603 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10604 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10608 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10609 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10610 ALC262_HIPPO_MASTER_SWITCH,
10611 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10612 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10613 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10614 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10615 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10619 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10620 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10621 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10622 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10623 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10624 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10625 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10626 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10627 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10628 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10630 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10631 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10635 static struct hda_verb alc262_tyan_verbs[] = {
10636 /* Headphone automute */
10637 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10638 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10641 /* P11 AUX_IN, white 4-pin connector */
10642 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10643 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10644 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10645 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10650 /* unsolicited event for HP jack sensing */
10651 static void alc262_tyan_setup(struct hda_codec *codec)
10653 struct alc_spec *spec = codec->spec;
10655 spec->autocfg.hp_pins[0] = 0x1b;
10656 spec->autocfg.speaker_pins[0] = 0x15;
10660 #define alc262_capture_mixer alc882_capture_mixer
10661 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10664 * generic initialization of ADC, input mixers and output mixers
10666 static struct hda_verb alc262_init_verbs[] = {
10668 * Unmute ADC0-2 and set the default input to mic-in
10670 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10671 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10672 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10674 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10675 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10677 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10679 * Note: PASD motherboards uses the Line In 2 as the input for
10680 * front panel mic (mic 2)
10682 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10683 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10690 * Set up output mixers (0x0c - 0x0e)
10692 /* set vol=0 to output mixers */
10693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10694 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10695 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10696 /* set up input amps for analog loopback */
10697 /* Amp Indices: DAC = 0, mixer = 1 */
10698 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10700 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10702 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10705 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10707 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10708 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10709 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10710 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10712 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10713 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10714 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10715 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10716 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10718 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10719 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10721 /* FIXME: use matrix-type input source selection */
10722 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10723 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10724 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10729 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10742 static struct hda_verb alc262_eapd_verbs[] = {
10743 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10744 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10748 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10749 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10750 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10751 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10753 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10754 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10758 static struct hda_verb alc262_sony_unsol_verbs[] = {
10759 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10761 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10763 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10768 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10769 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10770 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10771 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10772 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10773 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10777 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10778 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10779 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10781 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10782 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10783 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10784 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10785 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10789 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10791 struct alc_spec *spec = codec->spec;
10793 spec->autocfg.hp_pins[0] = 0x15;
10794 spec->autocfg.speaker_pins[0] = 0x14;
10795 spec->ext_mic.pin = 0x18;
10796 spec->ext_mic.mux_idx = 0;
10797 spec->int_mic.pin = 0x12;
10798 spec->int_mic.mux_idx = 9;
10799 spec->auto_mic = 1;
10805 * 0x16 = internal speaker
10806 * 0x18 = external mic
10809 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10810 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10811 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10813 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10814 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10815 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10817 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10818 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10822 static struct hda_verb alc262_nec_verbs[] = {
10823 /* Unmute Speaker */
10824 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10827 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10828 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10830 /* External mic to headphone */
10831 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10832 /* External mic to speaker */
10833 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10839 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10840 * 0x1b = port replicator headphone out
10843 #define ALC_HP_EVENT 0x37
10845 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10846 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10847 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10848 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10849 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10853 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10854 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10855 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10859 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10860 /* Front Mic pin: input vref at 50% */
10861 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10862 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10866 static struct hda_input_mux alc262_fujitsu_capture_source = {
10870 { "Int Mic", 0x1 },
10875 static struct hda_input_mux alc262_HP_capture_source = {
10879 { "Front Mic", 0x1 },
10886 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10890 { "Front Mic", 0x2 },
10896 /* mute/unmute internal speaker according to the hp jacks and mute state */
10897 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10899 struct alc_spec *spec = codec->spec;
10902 if (force || !spec->sense_updated) {
10903 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10904 snd_hda_jack_detect(codec, 0x1b);
10905 spec->sense_updated = 1;
10907 /* unmute internal speaker only if both HPs are unplugged and
10908 * master switch is on
10910 if (spec->jack_present)
10911 mute = HDA_AMP_MUTE;
10913 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10914 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10915 HDA_AMP_MUTE, mute);
10918 /* unsolicited event for HP jack sensing */
10919 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10922 if ((res >> 26) != ALC_HP_EVENT)
10924 alc262_fujitsu_automute(codec, 1);
10927 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10929 alc262_fujitsu_automute(codec, 1);
10932 /* bind volumes of both NID 0x0c and 0x0d */
10933 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10934 .ops = &snd_hda_bind_vol,
10936 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10937 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10942 /* mute/unmute internal speaker according to the hp jack and mute state */
10943 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10945 struct alc_spec *spec = codec->spec;
10948 if (force || !spec->sense_updated) {
10949 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10950 spec->sense_updated = 1;
10952 if (spec->jack_present) {
10953 /* mute internal speaker */
10954 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10955 HDA_AMP_MUTE, HDA_AMP_MUTE);
10956 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10957 HDA_AMP_MUTE, HDA_AMP_MUTE);
10959 /* unmute internal speaker if necessary */
10960 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10961 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10962 HDA_AMP_MUTE, mute);
10963 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10964 HDA_AMP_MUTE, mute);
10968 /* unsolicited event for HP jack sensing */
10969 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10972 if ((res >> 26) != ALC_HP_EVENT)
10974 alc262_lenovo_3000_automute(codec, 1);
10977 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10978 int dir, int idx, long *valp)
10982 for (i = 0; i < 2; i++, valp++)
10983 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10985 *valp ? 0 : HDA_AMP_MUTE);
10989 /* bind hp and internal speaker mute (with plug check) */
10990 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10991 struct snd_ctl_elem_value *ucontrol)
10993 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10994 long *valp = ucontrol->value.integer.value;
10997 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10998 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11000 alc262_fujitsu_automute(codec, 0);
11004 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11005 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11008 .name = "Master Playback Switch",
11009 .subdevice = HDA_SUBDEV_AMP_FLAG,
11010 .info = snd_hda_mixer_amp_switch_info,
11011 .get = snd_hda_mixer_amp_switch_get,
11012 .put = alc262_fujitsu_master_sw_put,
11013 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11016 .iface = NID_MAPPING,
11017 .name = "Master Playback Switch",
11018 .private_value = 0x1b,
11020 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11021 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11022 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11023 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11024 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11025 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11026 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11027 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11031 /* bind hp and internal speaker mute (with plug check) */
11032 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11033 struct snd_ctl_elem_value *ucontrol)
11035 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11036 long *valp = ucontrol->value.integer.value;
11039 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11041 alc262_lenovo_3000_automute(codec, 0);
11045 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11046 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11048 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11049 .name = "Master Playback Switch",
11050 .subdevice = HDA_SUBDEV_AMP_FLAG,
11051 .info = snd_hda_mixer_amp_switch_info,
11052 .get = snd_hda_mixer_amp_switch_get,
11053 .put = alc262_lenovo_3000_master_sw_put,
11054 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11056 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11057 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11058 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11060 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11061 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11062 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11063 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11067 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11068 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11069 ALC262_HIPPO_MASTER_SWITCH,
11070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11071 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11072 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11073 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11074 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11075 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11079 /* additional init verbs for Benq laptops */
11080 static struct hda_verb alc262_EAPD_verbs[] = {
11081 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11082 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11086 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11087 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11088 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11090 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11091 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11095 /* Samsung Q1 Ultra Vista model setup */
11096 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11097 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11098 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11100 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11101 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11102 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11106 static struct hda_verb alc262_ultra_verbs[] = {
11108 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11112 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11113 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11114 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11115 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11120 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11121 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11123 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11125 /* ADC, choose mic */
11126 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11127 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11139 /* mute/unmute internal speaker according to the hp jack and mute state */
11140 static void alc262_ultra_automute(struct hda_codec *codec)
11142 struct alc_spec *spec = codec->spec;
11146 /* auto-mute only when HP is used as HP */
11147 if (!spec->cur_mux[0]) {
11148 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11149 if (spec->jack_present)
11150 mute = HDA_AMP_MUTE;
11152 /* mute/unmute internal speaker */
11153 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11154 HDA_AMP_MUTE, mute);
11155 /* mute/unmute HP */
11156 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11157 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11160 /* unsolicited event for HP jack sensing */
11161 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11164 if ((res >> 26) != ALC880_HP_EVENT)
11166 alc262_ultra_automute(codec);
11169 static struct hda_input_mux alc262_ultra_capture_source = {
11173 { "Headphone", 0x7 },
11177 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11178 struct snd_ctl_elem_value *ucontrol)
11180 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11181 struct alc_spec *spec = codec->spec;
11184 ret = alc_mux_enum_put(kcontrol, ucontrol);
11187 /* reprogram the HP pin as mic or HP according to the input source */
11188 snd_hda_codec_write_cache(codec, 0x15, 0,
11189 AC_VERB_SET_PIN_WIDGET_CONTROL,
11190 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11191 alc262_ultra_automute(codec); /* mute/unmute HP */
11195 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11196 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11197 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11199 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11200 .name = "Capture Source",
11201 .info = alc_mux_enum_info,
11202 .get = alc_mux_enum_get,
11203 .put = alc262_ultra_mux_enum_put,
11206 .iface = NID_MAPPING,
11207 .name = "Capture Source",
11208 .private_value = 0x15,
11213 /* We use two mixers depending on the output pin; 0x16 is a mono output
11214 * and thus it's bound with a different mixer.
11215 * This function returns which mixer amp should be used.
11217 static int alc262_check_volbit(hda_nid_t nid)
11221 else if (nid == 0x16)
11227 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11228 const char *pfx, int *vbits)
11233 vbit = alc262_check_volbit(nid);
11236 if (*vbits & vbit) /* a volume control for this mixer already there */
11240 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11242 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11243 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11246 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11254 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11256 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11257 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11260 /* add playback controls from the parsed DAC table */
11261 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11262 const struct auto_pin_cfg *cfg)
11268 spec->multiout.num_dacs = 1; /* only use one dac */
11269 spec->multiout.dac_nids = spec->private_dac_nids;
11270 spec->multiout.dac_nids[0] = 2;
11272 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11274 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11278 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11281 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11284 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11288 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11289 alc262_check_volbit(cfg->speaker_pins[0]) |
11290 alc262_check_volbit(cfg->hp_pins[0]);
11291 if (vbits == 1 || vbits == 2)
11292 pfx = "Master"; /* only one mixer is used */
11293 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11298 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11301 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11305 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11312 #define alc262_auto_create_input_ctls \
11313 alc880_auto_create_input_ctls
11316 * generic initialization of ADC, input mixers and output mixers
11318 static struct hda_verb alc262_volume_init_verbs[] = {
11320 * Unmute ADC0-2 and set the default input to mic-in
11322 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11323 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11324 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11325 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11326 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11327 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11329 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11331 * Note: PASD motherboards uses the Line In 2 as the input for
11332 * front panel mic (mic 2)
11334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11342 * Set up output mixers (0x0c - 0x0f)
11344 /* set vol=0 to output mixers */
11345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11346 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11349 /* set up input amps for analog loopback */
11350 /* Amp Indices: DAC = 0, mixer = 1 */
11351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11353 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11355 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11358 /* FIXME: use matrix-type input source selection */
11359 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11360 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11361 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11379 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11381 * Unmute ADC0-2 and set the default input to mic-in
11383 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11384 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11385 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11387 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11390 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11392 * Note: PASD motherboards uses the Line In 2 as the input for
11393 * front panel mic (mic 2)
11395 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11396 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11405 * Set up output mixers (0x0c - 0x0e)
11407 /* set vol=0 to output mixers */
11408 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11409 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11410 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11412 /* set up input amps for analog loopback */
11413 /* Amp Indices: DAC = 0, mixer = 1 */
11414 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11416 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11418 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11421 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11425 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11428 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11431 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11432 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11433 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11434 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11435 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11437 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11438 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11439 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11441 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11442 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11445 /* FIXME: use matrix-type input source selection */
11446 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11447 /* Input mixer1: only unmute Mic */
11448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11458 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11478 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11483 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11485 * Unmute ADC0-2 and set the default input to mic-in
11487 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11489 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11490 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11491 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11492 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11494 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11496 * Note: PASD motherboards uses the Line In 2 as the input for front
11497 * panel mic (mic 2)
11499 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11500 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11509 * Set up output mixers (0x0c - 0x0e)
11511 /* set vol=0 to output mixers */
11512 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11513 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11514 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11516 /* set up input amps for analog loopback */
11517 /* Amp Indices: DAC = 0, mixer = 1 */
11518 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11520 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11522 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11527 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11528 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11529 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11531 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11532 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11534 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11535 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11537 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11540 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11541 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11542 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11543 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11544 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11545 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11547 /* FIXME: use matrix-type input source selection */
11548 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11549 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11555 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11556 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11558 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11563 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11564 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11566 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11571 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11574 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11579 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11581 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11582 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11583 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11585 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11587 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11588 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11590 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11591 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11592 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11597 #ifdef CONFIG_SND_HDA_POWER_SAVE
11598 #define alc262_loopbacks alc880_loopbacks
11601 /* pcm configuration: identical with ALC880 */
11602 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11603 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11604 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11605 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11608 * BIOS auto configuration
11610 static int alc262_parse_auto_config(struct hda_codec *codec)
11612 struct alc_spec *spec = codec->spec;
11614 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11616 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11620 if (!spec->autocfg.line_outs) {
11621 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11622 spec->multiout.max_channels = 2;
11623 spec->no_analog = 1;
11626 return 0; /* can't find valid BIOS pin config */
11628 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11631 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11635 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11638 if (spec->autocfg.dig_outs) {
11639 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11640 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11642 if (spec->autocfg.dig_in_pin)
11643 spec->dig_in_nid = ALC262_DIGIN_NID;
11645 if (spec->kctls.list)
11646 add_mixer(spec, spec->kctls.list);
11648 add_verb(spec, alc262_volume_init_verbs);
11649 spec->num_mux_defs = 1;
11650 spec->input_mux = &spec->private_imux[0];
11652 err = alc_auto_add_mic_boost(codec);
11656 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11661 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11662 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11663 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11664 #define alc262_auto_init_input_src alc882_auto_init_input_src
11667 /* init callback for auto-configuration model -- overriding the default init */
11668 static void alc262_auto_init(struct hda_codec *codec)
11670 struct alc_spec *spec = codec->spec;
11671 alc262_auto_init_multi_out(codec);
11672 alc262_auto_init_hp_out(codec);
11673 alc262_auto_init_analog_input(codec);
11674 alc262_auto_init_input_src(codec);
11675 if (spec->unsol_event)
11676 alc_inithook(codec);
11680 * configuration and preset
11682 static const char *alc262_models[ALC262_MODEL_LAST] = {
11683 [ALC262_BASIC] = "basic",
11684 [ALC262_HIPPO] = "hippo",
11685 [ALC262_HIPPO_1] = "hippo_1",
11686 [ALC262_FUJITSU] = "fujitsu",
11687 [ALC262_HP_BPC] = "hp-bpc",
11688 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11689 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11690 [ALC262_HP_RP5700] = "hp-rp5700",
11691 [ALC262_BENQ_ED8] = "benq",
11692 [ALC262_BENQ_T31] = "benq-t31",
11693 [ALC262_SONY_ASSAMD] = "sony-assamd",
11694 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11695 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11696 [ALC262_ULTRA] = "ultra",
11697 [ALC262_LENOVO_3000] = "lenovo-3000",
11698 [ALC262_NEC] = "nec",
11699 [ALC262_TYAN] = "tyan",
11700 [ALC262_AUTO] = "auto",
11703 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11704 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11705 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11706 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11708 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11710 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11712 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11713 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11714 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11715 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11716 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11717 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11718 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11719 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11720 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11721 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11722 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11723 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11724 ALC262_HP_TC_T5735),
11725 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11726 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11727 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11728 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11729 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11730 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11731 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11732 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11733 #if 0 /* disable the quirk since model=auto works better in recent versions */
11734 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11735 ALC262_SONY_ASSAMD),
11737 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11738 ALC262_TOSHIBA_RX1),
11739 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11740 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11741 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11742 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11743 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11745 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11746 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11747 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11748 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11749 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11753 static struct alc_config_preset alc262_presets[] = {
11755 .mixers = { alc262_base_mixer },
11756 .init_verbs = { alc262_init_verbs },
11757 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11758 .dac_nids = alc262_dac_nids,
11760 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11761 .channel_mode = alc262_modes,
11762 .input_mux = &alc262_capture_source,
11765 .mixers = { alc262_hippo_mixer },
11766 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11767 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11768 .dac_nids = alc262_dac_nids,
11770 .dig_out_nid = ALC262_DIGOUT_NID,
11771 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11772 .channel_mode = alc262_modes,
11773 .input_mux = &alc262_capture_source,
11774 .unsol_event = alc262_hippo_unsol_event,
11775 .setup = alc262_hippo_setup,
11776 .init_hook = alc262_hippo_automute,
11778 [ALC262_HIPPO_1] = {
11779 .mixers = { alc262_hippo1_mixer },
11780 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11782 .dac_nids = alc262_dac_nids,
11784 .dig_out_nid = ALC262_DIGOUT_NID,
11785 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11786 .channel_mode = alc262_modes,
11787 .input_mux = &alc262_capture_source,
11788 .unsol_event = alc262_hippo_unsol_event,
11789 .setup = alc262_hippo1_setup,
11790 .init_hook = alc262_hippo_automute,
11792 [ALC262_FUJITSU] = {
11793 .mixers = { alc262_fujitsu_mixer },
11794 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11795 alc262_fujitsu_unsol_verbs },
11796 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11797 .dac_nids = alc262_dac_nids,
11799 .dig_out_nid = ALC262_DIGOUT_NID,
11800 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11801 .channel_mode = alc262_modes,
11802 .input_mux = &alc262_fujitsu_capture_source,
11803 .unsol_event = alc262_fujitsu_unsol_event,
11804 .init_hook = alc262_fujitsu_init_hook,
11806 [ALC262_HP_BPC] = {
11807 .mixers = { alc262_HP_BPC_mixer },
11808 .init_verbs = { alc262_HP_BPC_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_HP_capture_source,
11815 .unsol_event = alc262_hp_bpc_unsol_event,
11816 .init_hook = alc262_hp_bpc_automute,
11818 [ALC262_HP_BPC_D7000_WF] = {
11819 .mixers = { alc262_HP_BPC_WildWest_mixer },
11820 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11821 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11822 .dac_nids = alc262_dac_nids,
11824 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11825 .channel_mode = alc262_modes,
11826 .input_mux = &alc262_HP_D7000_capture_source,
11827 .unsol_event = alc262_hp_wildwest_unsol_event,
11828 .init_hook = alc262_hp_wildwest_automute,
11830 [ALC262_HP_BPC_D7000_WL] = {
11831 .mixers = { alc262_HP_BPC_WildWest_mixer,
11832 alc262_HP_BPC_WildWest_option_mixer },
11833 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11834 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11835 .dac_nids = alc262_dac_nids,
11837 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11838 .channel_mode = alc262_modes,
11839 .input_mux = &alc262_HP_D7000_capture_source,
11840 .unsol_event = alc262_hp_wildwest_unsol_event,
11841 .init_hook = alc262_hp_wildwest_automute,
11843 [ALC262_HP_TC_T5735] = {
11844 .mixers = { alc262_hp_t5735_mixer },
11845 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11846 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11847 .dac_nids = alc262_dac_nids,
11849 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11850 .channel_mode = alc262_modes,
11851 .input_mux = &alc262_capture_source,
11852 .unsol_event = alc_automute_amp_unsol_event,
11853 .setup = alc262_hp_t5735_setup,
11854 .init_hook = alc_automute_amp,
11856 [ALC262_HP_RP5700] = {
11857 .mixers = { alc262_hp_rp5700_mixer },
11858 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11859 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11860 .dac_nids = alc262_dac_nids,
11861 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11862 .channel_mode = alc262_modes,
11863 .input_mux = &alc262_hp_rp5700_capture_source,
11865 [ALC262_BENQ_ED8] = {
11866 .mixers = { alc262_base_mixer },
11867 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11868 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11869 .dac_nids = alc262_dac_nids,
11871 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11872 .channel_mode = alc262_modes,
11873 .input_mux = &alc262_capture_source,
11875 [ALC262_SONY_ASSAMD] = {
11876 .mixers = { alc262_sony_mixer },
11877 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11878 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11879 .dac_nids = alc262_dac_nids,
11881 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11882 .channel_mode = alc262_modes,
11883 .input_mux = &alc262_capture_source,
11884 .unsol_event = alc262_hippo_unsol_event,
11885 .setup = alc262_hippo_setup,
11886 .init_hook = alc262_hippo_automute,
11888 [ALC262_BENQ_T31] = {
11889 .mixers = { alc262_benq_t31_mixer },
11890 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11891 alc_hp15_unsol_verbs },
11892 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11893 .dac_nids = alc262_dac_nids,
11895 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11896 .channel_mode = alc262_modes,
11897 .input_mux = &alc262_capture_source,
11898 .unsol_event = alc262_hippo_unsol_event,
11899 .setup = alc262_hippo_setup,
11900 .init_hook = alc262_hippo_automute,
11903 .mixers = { alc262_ultra_mixer },
11904 .cap_mixer = alc262_ultra_capture_mixer,
11905 .init_verbs = { alc262_ultra_verbs },
11906 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11907 .dac_nids = alc262_dac_nids,
11908 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11909 .channel_mode = alc262_modes,
11910 .input_mux = &alc262_ultra_capture_source,
11911 .adc_nids = alc262_adc_nids, /* ADC0 */
11912 .capsrc_nids = alc262_capsrc_nids,
11913 .num_adc_nids = 1, /* single ADC */
11914 .unsol_event = alc262_ultra_unsol_event,
11915 .init_hook = alc262_ultra_automute,
11917 [ALC262_LENOVO_3000] = {
11918 .mixers = { alc262_lenovo_3000_mixer },
11919 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11920 alc262_lenovo_3000_unsol_verbs,
11921 alc262_lenovo_3000_init_verbs },
11922 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11923 .dac_nids = alc262_dac_nids,
11925 .dig_out_nid = ALC262_DIGOUT_NID,
11926 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11927 .channel_mode = alc262_modes,
11928 .input_mux = &alc262_fujitsu_capture_source,
11929 .unsol_event = alc262_lenovo_3000_unsol_event,
11932 .mixers = { alc262_nec_mixer },
11933 .init_verbs = { alc262_nec_verbs },
11934 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11935 .dac_nids = alc262_dac_nids,
11937 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11938 .channel_mode = alc262_modes,
11939 .input_mux = &alc262_capture_source,
11941 [ALC262_TOSHIBA_S06] = {
11942 .mixers = { alc262_toshiba_s06_mixer },
11943 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11944 alc262_eapd_verbs },
11945 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11946 .capsrc_nids = alc262_dmic_capsrc_nids,
11947 .dac_nids = alc262_dac_nids,
11948 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11949 .num_adc_nids = 1, /* single ADC */
11950 .dig_out_nid = ALC262_DIGOUT_NID,
11951 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11952 .channel_mode = alc262_modes,
11953 .unsol_event = alc_sku_unsol_event,
11954 .setup = alc262_toshiba_s06_setup,
11955 .init_hook = alc_inithook,
11957 [ALC262_TOSHIBA_RX1] = {
11958 .mixers = { alc262_toshiba_rx1_mixer },
11959 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11960 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11961 .dac_nids = alc262_dac_nids,
11963 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11964 .channel_mode = alc262_modes,
11965 .input_mux = &alc262_capture_source,
11966 .unsol_event = alc262_hippo_unsol_event,
11967 .setup = alc262_hippo_setup,
11968 .init_hook = alc262_hippo_automute,
11971 .mixers = { alc262_tyan_mixer },
11972 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11973 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11974 .dac_nids = alc262_dac_nids,
11976 .dig_out_nid = ALC262_DIGOUT_NID,
11977 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11978 .channel_mode = alc262_modes,
11979 .input_mux = &alc262_capture_source,
11980 .unsol_event = alc_automute_amp_unsol_event,
11981 .setup = alc262_tyan_setup,
11982 .init_hook = alc_automute_amp,
11986 static int patch_alc262(struct hda_codec *codec)
11988 struct alc_spec *spec;
11992 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11996 codec->spec = spec;
11998 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12003 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12004 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12005 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12006 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12010 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12012 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12016 if (board_config < 0) {
12017 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12019 board_config = ALC262_AUTO;
12022 if (board_config == ALC262_AUTO) {
12023 /* automatic parse from the BIOS config */
12024 err = alc262_parse_auto_config(codec);
12030 "hda_codec: Cannot set up configuration "
12031 "from BIOS. Using base mode...\n");
12032 board_config = ALC262_BASIC;
12036 if (!spec->no_analog) {
12037 err = snd_hda_attach_beep_device(codec, 0x1);
12044 if (board_config != ALC262_AUTO)
12045 setup_preset(codec, &alc262_presets[board_config]);
12047 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12048 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12050 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12051 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12053 if (!spec->adc_nids && spec->input_mux) {
12055 /* check whether the digital-mic has to be supported */
12056 for (i = 0; i < spec->input_mux->num_items; i++) {
12057 if (spec->input_mux->items[i].index >= 9)
12060 if (i < spec->input_mux->num_items) {
12061 /* use only ADC0 */
12062 spec->adc_nids = alc262_dmic_adc_nids;
12063 spec->num_adc_nids = 1;
12064 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12066 /* all analog inputs */
12067 /* check whether NID 0x07 is valid */
12068 unsigned int wcap = get_wcaps(codec, 0x07);
12071 wcap = get_wcaps_type(wcap);
12072 if (wcap != AC_WID_AUD_IN) {
12073 spec->adc_nids = alc262_adc_nids_alt;
12074 spec->num_adc_nids =
12075 ARRAY_SIZE(alc262_adc_nids_alt);
12076 spec->capsrc_nids = alc262_capsrc_nids_alt;
12078 spec->adc_nids = alc262_adc_nids;
12079 spec->num_adc_nids =
12080 ARRAY_SIZE(alc262_adc_nids);
12081 spec->capsrc_nids = alc262_capsrc_nids;
12085 if (!spec->cap_mixer && !spec->no_analog)
12086 set_capture_mixer(codec);
12087 if (!spec->no_analog)
12088 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12090 spec->vmaster_nid = 0x0c;
12092 codec->patch_ops = alc_patch_ops;
12093 if (board_config == ALC262_AUTO)
12094 spec->init_hook = alc262_auto_init;
12095 #ifdef CONFIG_SND_HDA_POWER_SAVE
12096 if (!spec->loopback.amplist)
12097 spec->loopback.amplist = alc262_loopbacks;
12099 codec->proc_widget_hook = print_realtek_coef;
12105 * ALC268 channel source setting (2 channel)
12107 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12108 #define alc268_modes alc260_modes
12110 static hda_nid_t alc268_dac_nids[2] = {
12115 static hda_nid_t alc268_adc_nids[2] = {
12120 static hda_nid_t alc268_adc_nids_alt[1] = {
12125 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12127 static struct snd_kcontrol_new alc268_base_mixer[] = {
12128 /* output mixer control */
12129 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12130 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12131 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12134 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12135 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12139 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12140 /* output mixer control */
12141 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12143 ALC262_HIPPO_MASTER_SWITCH,
12144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12146 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12150 /* bind Beep switches of both NID 0x0f and 0x10 */
12151 static struct hda_bind_ctls alc268_bind_beep_sw = {
12152 .ops = &snd_hda_bind_sw,
12154 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12155 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12160 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12161 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12162 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12166 static struct hda_verb alc268_eapd_verbs[] = {
12167 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12168 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12172 /* Toshiba specific */
12173 static struct hda_verb alc268_toshiba_verbs[] = {
12174 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12178 /* Acer specific */
12179 /* bind volumes of both NID 0x02 and 0x03 */
12180 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12181 .ops = &snd_hda_bind_vol,
12183 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12184 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12189 /* mute/unmute internal speaker according to the hp jack and mute state */
12190 static void alc268_acer_automute(struct hda_codec *codec, int force)
12192 struct alc_spec *spec = codec->spec;
12195 if (force || !spec->sense_updated) {
12196 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12197 spec->sense_updated = 1;
12199 if (spec->jack_present)
12200 mute = HDA_AMP_MUTE; /* mute internal speaker */
12201 else /* unmute internal speaker if necessary */
12202 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12203 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12204 HDA_AMP_MUTE, mute);
12208 /* bind hp and internal speaker mute (with plug check) */
12209 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12210 struct snd_ctl_elem_value *ucontrol)
12212 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12213 long *valp = ucontrol->value.integer.value;
12216 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12218 alc268_acer_automute(codec, 0);
12222 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12223 /* output mixer control */
12224 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12227 .name = "Master Playback Switch",
12228 .subdevice = HDA_SUBDEV_AMP_FLAG,
12229 .info = snd_hda_mixer_amp_switch_info,
12230 .get = snd_hda_mixer_amp_switch_get,
12231 .put = alc268_acer_master_sw_put,
12232 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12234 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12238 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12239 /* output mixer control */
12240 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12242 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12243 .name = "Master Playback Switch",
12244 .subdevice = HDA_SUBDEV_AMP_FLAG,
12245 .info = snd_hda_mixer_amp_switch_info,
12246 .get = snd_hda_mixer_amp_switch_get,
12247 .put = alc268_acer_master_sw_put,
12248 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12251 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12252 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12256 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12257 /* output mixer control */
12258 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12261 .name = "Master Playback Switch",
12262 .subdevice = HDA_SUBDEV_AMP_FLAG,
12263 .info = snd_hda_mixer_amp_switch_info,
12264 .get = snd_hda_mixer_amp_switch_get,
12265 .put = alc268_acer_master_sw_put,
12266 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12269 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12273 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12274 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12277 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12278 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12283 static struct hda_verb alc268_acer_verbs[] = {
12284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12285 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12288 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12290 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12294 /* unsolicited event for HP jack sensing */
12295 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12296 #define alc268_toshiba_setup alc262_hippo_setup
12297 #define alc268_toshiba_automute alc262_hippo_automute
12299 static void alc268_acer_unsol_event(struct hda_codec *codec,
12302 if ((res >> 26) != ALC880_HP_EVENT)
12304 alc268_acer_automute(codec, 1);
12307 static void alc268_acer_init_hook(struct hda_codec *codec)
12309 alc268_acer_automute(codec, 1);
12312 /* toggle speaker-output according to the hp-jack state */
12313 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12315 unsigned int present;
12316 unsigned char bits;
12318 present = snd_hda_jack_detect(codec, 0x15);
12319 bits = present ? AMP_IN_MUTE(0) : 0;
12320 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12321 AMP_IN_MUTE(0), bits);
12322 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12323 AMP_IN_MUTE(0), bits);
12326 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12329 switch (res >> 26) {
12330 case ALC880_HP_EVENT:
12331 alc268_aspire_one_speaker_automute(codec);
12333 case ALC880_MIC_EVENT:
12334 alc_mic_automute(codec);
12339 static void alc268_acer_lc_setup(struct hda_codec *codec)
12341 struct alc_spec *spec = codec->spec;
12342 spec->ext_mic.pin = 0x18;
12343 spec->ext_mic.mux_idx = 0;
12344 spec->int_mic.pin = 0x12;
12345 spec->int_mic.mux_idx = 6;
12346 spec->auto_mic = 1;
12349 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12351 alc268_aspire_one_speaker_automute(codec);
12352 alc_mic_automute(codec);
12355 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12356 /* output mixer control */
12357 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12358 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12362 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12366 static struct hda_verb alc268_dell_verbs[] = {
12367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12370 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12374 /* mute/unmute internal speaker according to the hp jack and mute state */
12375 static void alc268_dell_setup(struct hda_codec *codec)
12377 struct alc_spec *spec = codec->spec;
12379 spec->autocfg.hp_pins[0] = 0x15;
12380 spec->autocfg.speaker_pins[0] = 0x14;
12381 spec->ext_mic.pin = 0x18;
12382 spec->ext_mic.mux_idx = 0;
12383 spec->int_mic.pin = 0x19;
12384 spec->int_mic.mux_idx = 1;
12385 spec->auto_mic = 1;
12388 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12389 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12390 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12393 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12394 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12395 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12396 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12400 static struct hda_verb alc267_quanta_il1_verbs[] = {
12401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12406 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12408 struct alc_spec *spec = codec->spec;
12409 spec->autocfg.hp_pins[0] = 0x15;
12410 spec->autocfg.speaker_pins[0] = 0x14;
12411 spec->ext_mic.pin = 0x18;
12412 spec->ext_mic.mux_idx = 0;
12413 spec->int_mic.pin = 0x19;
12414 spec->int_mic.mux_idx = 1;
12415 spec->auto_mic = 1;
12419 * generic initialization of ADC, input mixers and output mixers
12421 static struct hda_verb alc268_base_init_verbs[] = {
12422 /* Unmute DAC0-1 and set vol = 0 */
12423 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12424 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12427 * Set up output mixers (0x0c - 0x0e)
12429 /* set vol=0 to output mixers */
12430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12431 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12433 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12434 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12438 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12441 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12443 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12447 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12451 /* set PCBEEP vol = 0, mute connections */
12452 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12454 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12456 /* Unmute Selector 23h,24h and set the default input to mic-in */
12458 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12460 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12467 * generic initialization of ADC, input mixers and output mixers
12469 static struct hda_verb alc268_volume_init_verbs[] = {
12470 /* set output DAC */
12471 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12472 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12478 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12482 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12485 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12487 /* set PCBEEP vol = 0, mute connections */
12488 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12489 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12490 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12495 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12496 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12497 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12501 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12502 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12503 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12508 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12509 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12510 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12511 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12512 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12517 static struct hda_input_mux alc268_capture_source = {
12521 { "Front Mic", 0x1 },
12527 static struct hda_input_mux alc268_acer_capture_source = {
12531 { "Internal Mic", 0x1 },
12536 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12540 { "Internal Mic", 0x6 },
12545 #ifdef CONFIG_SND_DEBUG
12546 static struct snd_kcontrol_new alc268_test_mixer[] = {
12547 /* Volume widgets */
12548 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12549 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12550 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12551 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12552 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12553 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12554 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12555 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12556 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12557 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12558 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12559 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12560 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12561 /* The below appears problematic on some hardwares */
12562 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12563 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12564 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12565 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12566 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12568 /* Modes for retasking pin widgets */
12569 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12570 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12571 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12572 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12574 /* Controls for GPIO pins, assuming they are configured as outputs */
12575 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12576 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12577 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12578 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12580 /* Switches to allow the digital SPDIF output pin to be enabled.
12581 * The ALC268 does not have an SPDIF input.
12583 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12585 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12586 * this output to turn on an external amplifier.
12588 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12589 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12595 /* create input playback/capture controls for the given pin */
12596 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12597 const char *ctlname, int idx)
12613 if (spec->multiout.dac_nids[0] != dac &&
12614 spec->multiout.dac_nids[1] != dac) {
12615 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12616 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12620 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12624 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12625 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12627 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12628 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12634 /* add playback controls from the parsed DAC table */
12635 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12636 const struct auto_pin_cfg *cfg)
12641 spec->multiout.dac_nids = spec->private_dac_nids;
12643 nid = cfg->line_out_pins[0];
12646 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12650 err = alc268_new_analog_output(spec, nid, name, 0);
12655 nid = cfg->speaker_pins[0];
12657 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12658 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12662 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12666 nid = cfg->hp_pins[0];
12668 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12673 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12675 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12676 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12683 /* create playback/capture controls for input pins */
12684 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12685 const struct auto_pin_cfg *cfg)
12687 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12690 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12691 hda_nid_t nid, int pin_type)
12695 alc_set_pin_output(codec, nid, pin_type);
12696 if (nid == 0x14 || nid == 0x16)
12700 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12703 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12705 struct alc_spec *spec = codec->spec;
12706 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12708 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12709 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12713 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12715 struct alc_spec *spec = codec->spec;
12718 pin = spec->autocfg.hp_pins[0];
12720 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12721 pin = spec->autocfg.speaker_pins[0];
12723 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12726 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12728 struct alc_spec *spec = codec->spec;
12729 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12730 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12731 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12732 unsigned int dac_vol1, dac_vol2;
12734 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12735 snd_hda_codec_write(codec, speaker_nid, 0,
12736 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12737 /* mute mixer inputs from 0x1d */
12738 snd_hda_codec_write(codec, 0x0f, 0,
12739 AC_VERB_SET_AMP_GAIN_MUTE,
12741 snd_hda_codec_write(codec, 0x10, 0,
12742 AC_VERB_SET_AMP_GAIN_MUTE,
12745 /* unmute mixer inputs from 0x1d */
12746 snd_hda_codec_write(codec, 0x0f, 0,
12747 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12748 snd_hda_codec_write(codec, 0x10, 0,
12749 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12752 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12753 if (line_nid == 0x14)
12754 dac_vol2 = AMP_OUT_ZERO;
12755 else if (line_nid == 0x15)
12756 dac_vol1 = AMP_OUT_ZERO;
12757 if (hp_nid == 0x14)
12758 dac_vol2 = AMP_OUT_ZERO;
12759 else if (hp_nid == 0x15)
12760 dac_vol1 = AMP_OUT_ZERO;
12761 if (line_nid != 0x16 || hp_nid != 0x16 ||
12762 spec->autocfg.line_out_pins[1] != 0x16 ||
12763 spec->autocfg.line_out_pins[2] != 0x16)
12764 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12766 snd_hda_codec_write(codec, 0x02, 0,
12767 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12768 snd_hda_codec_write(codec, 0x03, 0,
12769 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12772 /* pcm configuration: identical with ALC880 */
12773 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12774 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12775 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12776 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12779 * BIOS auto configuration
12781 static int alc268_parse_auto_config(struct hda_codec *codec)
12783 struct alc_spec *spec = codec->spec;
12785 static hda_nid_t alc268_ignore[] = { 0 };
12787 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12791 if (!spec->autocfg.line_outs) {
12792 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12793 spec->multiout.max_channels = 2;
12794 spec->no_analog = 1;
12797 return 0; /* can't find valid BIOS pin config */
12799 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12802 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12806 spec->multiout.max_channels = 2;
12809 /* digital only support output */
12810 if (spec->autocfg.dig_outs) {
12811 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12812 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12814 if (spec->kctls.list)
12815 add_mixer(spec, spec->kctls.list);
12817 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12818 add_mixer(spec, alc268_beep_mixer);
12820 add_verb(spec, alc268_volume_init_verbs);
12821 spec->num_mux_defs = 2;
12822 spec->input_mux = &spec->private_imux[0];
12824 err = alc_auto_add_mic_boost(codec);
12828 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12833 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12835 /* init callback for auto-configuration model -- overriding the default init */
12836 static void alc268_auto_init(struct hda_codec *codec)
12838 struct alc_spec *spec = codec->spec;
12839 alc268_auto_init_multi_out(codec);
12840 alc268_auto_init_hp_out(codec);
12841 alc268_auto_init_mono_speaker_out(codec);
12842 alc268_auto_init_analog_input(codec);
12843 if (spec->unsol_event)
12844 alc_inithook(codec);
12848 * configuration and preset
12850 static const char *alc268_models[ALC268_MODEL_LAST] = {
12851 [ALC267_QUANTA_IL1] = "quanta-il1",
12852 [ALC268_3ST] = "3stack",
12853 [ALC268_TOSHIBA] = "toshiba",
12854 [ALC268_ACER] = "acer",
12855 [ALC268_ACER_DMIC] = "acer-dmic",
12856 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12857 [ALC268_DELL] = "dell",
12858 [ALC268_ZEPTO] = "zepto",
12859 #ifdef CONFIG_SND_DEBUG
12860 [ALC268_TEST] = "test",
12862 [ALC268_AUTO] = "auto",
12865 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12866 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12867 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12868 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12869 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12870 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12871 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12872 ALC268_ACER_ASPIRE_ONE),
12873 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12874 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12875 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12876 /* almost compatible with toshiba but with optional digital outs;
12877 * auto-probing seems working fine
12879 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12881 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12882 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12883 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12884 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12885 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12886 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12890 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12891 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12892 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12893 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12894 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12899 static struct alc_config_preset alc268_presets[] = {
12900 [ALC267_QUANTA_IL1] = {
12901 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12902 alc268_capture_nosrc_mixer },
12903 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12904 alc267_quanta_il1_verbs },
12905 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12906 .dac_nids = alc268_dac_nids,
12907 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12908 .adc_nids = alc268_adc_nids_alt,
12910 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12911 .channel_mode = alc268_modes,
12912 .unsol_event = alc_sku_unsol_event,
12913 .setup = alc267_quanta_il1_setup,
12914 .init_hook = alc_inithook,
12917 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12918 alc268_beep_mixer },
12919 .init_verbs = { alc268_base_init_verbs },
12920 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12921 .dac_nids = alc268_dac_nids,
12922 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12923 .adc_nids = alc268_adc_nids_alt,
12924 .capsrc_nids = alc268_capsrc_nids,
12926 .dig_out_nid = ALC268_DIGOUT_NID,
12927 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12928 .channel_mode = alc268_modes,
12929 .input_mux = &alc268_capture_source,
12931 [ALC268_TOSHIBA] = {
12932 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12933 alc268_beep_mixer },
12934 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12935 alc268_toshiba_verbs },
12936 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12937 .dac_nids = alc268_dac_nids,
12938 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12939 .adc_nids = alc268_adc_nids_alt,
12940 .capsrc_nids = alc268_capsrc_nids,
12942 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12943 .channel_mode = alc268_modes,
12944 .input_mux = &alc268_capture_source,
12945 .unsol_event = alc268_toshiba_unsol_event,
12946 .setup = alc268_toshiba_setup,
12947 .init_hook = alc268_toshiba_automute,
12950 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12951 alc268_beep_mixer },
12952 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12953 alc268_acer_verbs },
12954 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12955 .dac_nids = alc268_dac_nids,
12956 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12957 .adc_nids = alc268_adc_nids_alt,
12958 .capsrc_nids = alc268_capsrc_nids,
12960 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12961 .channel_mode = alc268_modes,
12962 .input_mux = &alc268_acer_capture_source,
12963 .unsol_event = alc268_acer_unsol_event,
12964 .init_hook = alc268_acer_init_hook,
12966 [ALC268_ACER_DMIC] = {
12967 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12968 alc268_beep_mixer },
12969 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12970 alc268_acer_verbs },
12971 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12972 .dac_nids = alc268_dac_nids,
12973 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12974 .adc_nids = alc268_adc_nids_alt,
12975 .capsrc_nids = alc268_capsrc_nids,
12977 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12978 .channel_mode = alc268_modes,
12979 .input_mux = &alc268_acer_dmic_capture_source,
12980 .unsol_event = alc268_acer_unsol_event,
12981 .init_hook = alc268_acer_init_hook,
12983 [ALC268_ACER_ASPIRE_ONE] = {
12984 .mixers = { alc268_acer_aspire_one_mixer,
12986 alc268_capture_nosrc_mixer },
12987 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12988 alc268_acer_aspire_one_verbs },
12989 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12990 .dac_nids = alc268_dac_nids,
12991 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12992 .adc_nids = alc268_adc_nids_alt,
12993 .capsrc_nids = alc268_capsrc_nids,
12995 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12996 .channel_mode = alc268_modes,
12997 .unsol_event = alc268_acer_lc_unsol_event,
12998 .setup = alc268_acer_lc_setup,
12999 .init_hook = alc268_acer_lc_init_hook,
13002 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13003 alc268_capture_nosrc_mixer },
13004 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13005 alc268_dell_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 .unsol_event = alc_sku_unsol_event,
13015 .setup = alc268_dell_setup,
13016 .init_hook = alc_inithook,
13019 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13020 alc268_beep_mixer },
13021 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13022 alc268_toshiba_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 .dig_out_nid = ALC268_DIGOUT_NID,
13030 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13031 .channel_mode = alc268_modes,
13032 .input_mux = &alc268_capture_source,
13033 .setup = alc268_toshiba_setup,
13034 .init_hook = alc268_toshiba_automute,
13036 #ifdef CONFIG_SND_DEBUG
13038 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13039 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13040 alc268_volume_init_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 .dig_out_nid = ALC268_DIGOUT_NID,
13048 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13049 .channel_mode = alc268_modes,
13050 .input_mux = &alc268_capture_source,
13055 static int patch_alc268(struct hda_codec *codec)
13057 struct alc_spec *spec;
13059 int i, has_beep, err;
13061 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13065 codec->spec = spec;
13067 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13071 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13072 board_config = snd_hda_check_board_codec_sid_config(codec,
13073 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13075 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13076 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13078 board_config = ALC268_AUTO;
13081 if (board_config == ALC268_AUTO) {
13082 /* automatic parse from the BIOS config */
13083 err = alc268_parse_auto_config(codec);
13089 "hda_codec: Cannot set up configuration "
13090 "from BIOS. Using base mode...\n");
13091 board_config = ALC268_3ST;
13095 if (board_config != ALC268_AUTO)
13096 setup_preset(codec, &alc268_presets[board_config]);
13098 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13099 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13100 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13102 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13105 for (i = 0; i < spec->num_mixers; i++) {
13106 if (spec->mixers[i] == alc268_beep_mixer) {
13113 err = snd_hda_attach_beep_device(codec, 0x1);
13118 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13119 /* override the amp caps for beep generator */
13120 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13121 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13122 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13123 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13124 (0 << AC_AMPCAP_MUTE_SHIFT));
13127 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13128 /* check whether NID 0x07 is valid */
13129 unsigned int wcap = get_wcaps(codec, 0x07);
13132 spec->capsrc_nids = alc268_capsrc_nids;
13134 wcap = get_wcaps_type(wcap);
13135 if (spec->auto_mic ||
13136 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13137 spec->adc_nids = alc268_adc_nids_alt;
13138 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13139 if (spec->auto_mic)
13140 fixup_automic_adc(codec);
13141 if (spec->auto_mic || spec->input_mux->num_items == 1)
13142 add_mixer(spec, alc268_capture_nosrc_mixer);
13144 add_mixer(spec, alc268_capture_alt_mixer);
13146 spec->adc_nids = alc268_adc_nids;
13147 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13148 add_mixer(spec, alc268_capture_mixer);
13150 /* set default input source */
13151 for (i = 0; i < spec->num_adc_nids; i++)
13152 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13153 0, AC_VERB_SET_CONNECT_SEL,
13154 i < spec->num_mux_defs ?
13155 spec->input_mux[i].items[0].index :
13156 spec->input_mux->items[0].index);
13159 spec->vmaster_nid = 0x02;
13161 codec->patch_ops = alc_patch_ops;
13162 if (board_config == ALC268_AUTO)
13163 spec->init_hook = alc268_auto_init;
13165 codec->proc_widget_hook = print_realtek_coef;
13171 * ALC269 channel source setting (2 channel)
13173 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13175 #define alc269_dac_nids alc260_dac_nids
13177 static hda_nid_t alc269_adc_nids[1] = {
13182 static hda_nid_t alc269_capsrc_nids[1] = {
13186 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13190 #define alc269_modes alc260_modes
13191 #define alc269_capture_source alc880_lg_lw_capture_source
13193 static struct snd_kcontrol_new alc269_base_mixer[] = {
13194 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13195 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13200 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13201 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13202 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13203 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13205 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13209 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13210 /* output mixer control */
13211 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13214 .name = "Master Playback Switch",
13215 .subdevice = HDA_SUBDEV_AMP_FLAG,
13216 .info = snd_hda_mixer_amp_switch_info,
13217 .get = snd_hda_mixer_amp_switch_get,
13218 .put = alc268_acer_master_sw_put,
13219 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13224 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13225 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13230 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13231 /* output mixer control */
13232 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13234 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13235 .name = "Master Playback Switch",
13236 .subdevice = HDA_SUBDEV_AMP_FLAG,
13237 .info = snd_hda_mixer_amp_switch_info,
13238 .get = snd_hda_mixer_amp_switch_get,
13239 .put = alc268_acer_master_sw_put,
13240 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13242 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13243 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13244 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13245 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13246 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13248 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13249 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13250 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13254 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13255 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13262 /* capture mixer elements */
13263 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13264 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13265 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13271 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13273 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13274 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13275 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13276 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13277 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13278 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13279 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13283 static struct hda_verb alc269_lifebook_verbs[] = {
13284 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13285 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13286 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13288 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13289 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13290 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13291 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13292 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13293 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13297 /* toggle speaker-output according to the hp-jack state */
13298 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13300 unsigned int present;
13301 unsigned char bits;
13303 present = snd_hda_jack_detect(codec, 0x15);
13304 bits = present ? AMP_IN_MUTE(0) : 0;
13305 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13306 AMP_IN_MUTE(0), bits);
13307 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13308 AMP_IN_MUTE(0), bits);
13310 snd_hda_codec_write(codec, 0x20, 0,
13311 AC_VERB_SET_COEF_INDEX, 0x0c);
13312 snd_hda_codec_write(codec, 0x20, 0,
13313 AC_VERB_SET_PROC_COEF, 0x680);
13315 snd_hda_codec_write(codec, 0x20, 0,
13316 AC_VERB_SET_COEF_INDEX, 0x0c);
13317 snd_hda_codec_write(codec, 0x20, 0,
13318 AC_VERB_SET_PROC_COEF, 0x480);
13321 /* toggle speaker-output according to the hp-jacks state */
13322 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13324 unsigned int present;
13325 unsigned char bits;
13327 /* Check laptop headphone socket */
13328 present = snd_hda_jack_detect(codec, 0x15);
13330 /* Check port replicator headphone socket */
13331 present |= snd_hda_jack_detect(codec, 0x1a);
13333 bits = present ? AMP_IN_MUTE(0) : 0;
13334 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13335 AMP_IN_MUTE(0), bits);
13336 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13337 AMP_IN_MUTE(0), bits);
13339 snd_hda_codec_write(codec, 0x20, 0,
13340 AC_VERB_SET_COEF_INDEX, 0x0c);
13341 snd_hda_codec_write(codec, 0x20, 0,
13342 AC_VERB_SET_PROC_COEF, 0x680);
13344 snd_hda_codec_write(codec, 0x20, 0,
13345 AC_VERB_SET_COEF_INDEX, 0x0c);
13346 snd_hda_codec_write(codec, 0x20, 0,
13347 AC_VERB_SET_PROC_COEF, 0x480);
13350 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13352 unsigned int present_laptop;
13353 unsigned int present_dock;
13355 present_laptop = snd_hda_jack_detect(codec, 0x18);
13356 present_dock = snd_hda_jack_detect(codec, 0x1b);
13358 /* Laptop mic port overrides dock mic port, design decision */
13360 snd_hda_codec_write(codec, 0x23, 0,
13361 AC_VERB_SET_CONNECT_SEL, 0x3);
13362 if (present_laptop)
13363 snd_hda_codec_write(codec, 0x23, 0,
13364 AC_VERB_SET_CONNECT_SEL, 0x0);
13365 if (!present_dock && !present_laptop)
13366 snd_hda_codec_write(codec, 0x23, 0,
13367 AC_VERB_SET_CONNECT_SEL, 0x1);
13370 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13373 switch (res >> 26) {
13374 case ALC880_HP_EVENT:
13375 alc269_quanta_fl1_speaker_automute(codec);
13377 case ALC880_MIC_EVENT:
13378 alc_mic_automute(codec);
13383 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13386 if ((res >> 26) == ALC880_HP_EVENT)
13387 alc269_lifebook_speaker_automute(codec);
13388 if ((res >> 26) == ALC880_MIC_EVENT)
13389 alc269_lifebook_mic_autoswitch(codec);
13392 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13394 struct alc_spec *spec = codec->spec;
13395 spec->ext_mic.pin = 0x18;
13396 spec->ext_mic.mux_idx = 0;
13397 spec->int_mic.pin = 0x19;
13398 spec->int_mic.mux_idx = 1;
13399 spec->auto_mic = 1;
13402 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13404 alc269_quanta_fl1_speaker_automute(codec);
13405 alc_mic_automute(codec);
13408 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13410 alc269_lifebook_speaker_automute(codec);
13411 alc269_lifebook_mic_autoswitch(codec);
13414 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13415 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13416 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13417 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13419 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13420 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13421 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13425 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13426 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13427 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13428 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13429 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13430 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13431 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13435 /* toggle speaker-output according to the hp-jack state */
13436 static void alc269_speaker_automute(struct hda_codec *codec)
13438 struct alc_spec *spec = codec->spec;
13439 unsigned int nid = spec->autocfg.hp_pins[0];
13440 unsigned int present;
13441 unsigned char bits;
13443 present = snd_hda_jack_detect(codec, nid);
13444 bits = present ? AMP_IN_MUTE(0) : 0;
13445 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13446 AMP_IN_MUTE(0), bits);
13447 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13448 AMP_IN_MUTE(0), bits);
13451 /* unsolicited event for HP jack sensing */
13452 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13455 switch (res >> 26) {
13456 case ALC880_HP_EVENT:
13457 alc269_speaker_automute(codec);
13459 case ALC880_MIC_EVENT:
13460 alc_mic_automute(codec);
13465 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13467 struct alc_spec *spec = codec->spec;
13468 spec->ext_mic.pin = 0x18;
13469 spec->ext_mic.mux_idx = 0;
13470 spec->int_mic.pin = 0x12;
13471 spec->int_mic.mux_idx = 5;
13472 spec->auto_mic = 1;
13475 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13477 struct alc_spec *spec = codec->spec;
13478 spec->ext_mic.pin = 0x18;
13479 spec->ext_mic.mux_idx = 0;
13480 spec->int_mic.pin = 0x19;
13481 spec->int_mic.mux_idx = 1;
13482 spec->auto_mic = 1;
13485 static void alc269_eeepc_inithook(struct hda_codec *codec)
13487 alc269_speaker_automute(codec);
13488 alc_mic_automute(codec);
13492 * generic initialization of ADC, input mixers and output mixers
13494 static struct hda_verb alc269_init_verbs[] = {
13496 * Unmute ADC0 and set the default input to mic-in
13498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13500 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13501 * analog-loopback mixer widget
13502 * Note: PASD motherboards uses the Line In 2 as the input for
13503 * front panel mic (mic 2)
13505 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13510 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13513 * Set up output mixers (0x0c - 0x0e)
13515 /* set vol=0 to output mixers */
13516 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13517 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13519 /* set up input amps for analog loopback */
13520 /* Amp Indices: DAC = 0, mixer = 1 */
13521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13522 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13524 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13526 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13528 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13529 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13530 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13531 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13533 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13534 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13536 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13538 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13539 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13540 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13541 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13542 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13544 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13545 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13547 /* FIXME: use matrix-type input source selection */
13548 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13549 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13556 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13557 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13561 #define alc269_auto_create_multi_out_ctls \
13562 alc268_auto_create_multi_out_ctls
13563 #define alc269_auto_create_input_ctls \
13564 alc268_auto_create_input_ctls
13566 #ifdef CONFIG_SND_HDA_POWER_SAVE
13567 #define alc269_loopbacks alc880_loopbacks
13570 /* pcm configuration: identical with ALC880 */
13571 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13572 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13573 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13574 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13576 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13580 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13581 /* NID is set in alc_build_pcms */
13583 .open = alc880_playback_pcm_open,
13584 .prepare = alc880_playback_pcm_prepare,
13585 .cleanup = alc880_playback_pcm_cleanup
13589 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13593 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13594 /* NID is set in alc_build_pcms */
13598 * BIOS auto configuration
13600 static int alc269_parse_auto_config(struct hda_codec *codec)
13602 struct alc_spec *spec = codec->spec;
13604 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13606 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13611 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13614 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13618 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13620 if (spec->autocfg.dig_outs)
13621 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13623 if (spec->kctls.list)
13624 add_mixer(spec, spec->kctls.list);
13626 add_verb(spec, alc269_init_verbs);
13627 spec->num_mux_defs = 1;
13628 spec->input_mux = &spec->private_imux[0];
13629 /* set default input source */
13630 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13631 0, AC_VERB_SET_CONNECT_SEL,
13632 spec->input_mux->items[0].index);
13634 err = alc_auto_add_mic_boost(codec);
13638 if (!spec->cap_mixer && !spec->no_analog)
13639 set_capture_mixer(codec);
13641 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13646 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13647 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13648 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13651 /* init callback for auto-configuration model -- overriding the default init */
13652 static void alc269_auto_init(struct hda_codec *codec)
13654 struct alc_spec *spec = codec->spec;
13655 alc269_auto_init_multi_out(codec);
13656 alc269_auto_init_hp_out(codec);
13657 alc269_auto_init_analog_input(codec);
13658 if (spec->unsol_event)
13659 alc_inithook(codec);
13663 * configuration and preset
13665 static const char *alc269_models[ALC269_MODEL_LAST] = {
13666 [ALC269_BASIC] = "basic",
13667 [ALC269_QUANTA_FL1] = "quanta",
13668 [ALC269_ASUS_AMIC] = "asus-amic",
13669 [ALC269_ASUS_DMIC] = "asus-dmic",
13670 [ALC269_FUJITSU] = "fujitsu",
13671 [ALC269_LIFEBOOK] = "lifebook",
13672 [ALC269_AUTO] = "auto",
13675 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13676 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13677 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13679 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13680 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13681 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13682 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13683 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13684 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13685 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13687 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13688 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13689 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13690 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13691 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13692 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13693 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13694 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13695 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13696 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13697 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13698 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13699 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13700 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13701 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13702 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13703 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13704 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13705 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13706 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13707 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13709 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13711 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13712 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13713 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13714 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13718 static struct alc_config_preset alc269_presets[] = {
13720 .mixers = { alc269_base_mixer },
13721 .init_verbs = { alc269_init_verbs },
13722 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13723 .dac_nids = alc269_dac_nids,
13725 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13726 .channel_mode = alc269_modes,
13727 .input_mux = &alc269_capture_source,
13729 [ALC269_QUANTA_FL1] = {
13730 .mixers = { alc269_quanta_fl1_mixer },
13731 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13732 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13733 .dac_nids = alc269_dac_nids,
13735 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13736 .channel_mode = alc269_modes,
13737 .input_mux = &alc269_capture_source,
13738 .unsol_event = alc269_quanta_fl1_unsol_event,
13739 .setup = alc269_quanta_fl1_setup,
13740 .init_hook = alc269_quanta_fl1_init_hook,
13742 [ALC269_ASUS_AMIC] = {
13743 .mixers = { alc269_eeepc_mixer },
13744 .cap_mixer = alc269_epc_capture_mixer,
13745 .init_verbs = { alc269_init_verbs,
13746 alc269_eeepc_amic_init_verbs },
13747 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13748 .dac_nids = alc269_dac_nids,
13750 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13751 .channel_mode = alc269_modes,
13752 .unsol_event = alc269_eeepc_unsol_event,
13753 .setup = alc269_eeepc_amic_setup,
13754 .init_hook = alc269_eeepc_inithook,
13756 [ALC269_ASUS_DMIC] = {
13757 .mixers = { alc269_eeepc_mixer },
13758 .cap_mixer = alc269_epc_capture_mixer,
13759 .init_verbs = { alc269_init_verbs,
13760 alc269_eeepc_dmic_init_verbs },
13761 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13762 .dac_nids = alc269_dac_nids,
13764 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13765 .channel_mode = alc269_modes,
13766 .unsol_event = alc269_eeepc_unsol_event,
13767 .setup = alc269_eeepc_dmic_setup,
13768 .init_hook = alc269_eeepc_inithook,
13770 [ALC269_FUJITSU] = {
13771 .mixers = { alc269_fujitsu_mixer },
13772 .cap_mixer = alc269_epc_capture_mixer,
13773 .init_verbs = { alc269_init_verbs,
13774 alc269_eeepc_dmic_init_verbs },
13775 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13776 .dac_nids = alc269_dac_nids,
13778 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13779 .channel_mode = alc269_modes,
13780 .unsol_event = alc269_eeepc_unsol_event,
13781 .setup = alc269_eeepc_dmic_setup,
13782 .init_hook = alc269_eeepc_inithook,
13784 [ALC269_LIFEBOOK] = {
13785 .mixers = { alc269_lifebook_mixer },
13786 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13787 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13788 .dac_nids = alc269_dac_nids,
13790 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13791 .channel_mode = alc269_modes,
13792 .input_mux = &alc269_capture_source,
13793 .unsol_event = alc269_lifebook_unsol_event,
13794 .init_hook = alc269_lifebook_init_hook,
13798 static int patch_alc269(struct hda_codec *codec)
13800 struct alc_spec *spec;
13804 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13808 codec->spec = spec;
13810 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13812 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13813 kfree(codec->chip_name);
13814 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13815 if (!codec->chip_name) {
13821 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13825 if (board_config < 0) {
13826 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13828 board_config = ALC269_AUTO;
13831 if (board_config == ALC269_AUTO) {
13832 /* automatic parse from the BIOS config */
13833 err = alc269_parse_auto_config(codec);
13839 "hda_codec: Cannot set up configuration "
13840 "from BIOS. Using base mode...\n");
13841 board_config = ALC269_BASIC;
13845 err = snd_hda_attach_beep_device(codec, 0x1);
13851 if (board_config != ALC269_AUTO)
13852 setup_preset(codec, &alc269_presets[board_config]);
13854 if (codec->subsystem_id == 0x17aa3bf8) {
13855 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13856 * fix the sample rate of analog I/O to 44.1kHz
13858 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13859 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13861 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13862 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13864 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13865 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13867 spec->adc_nids = alc269_adc_nids;
13868 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13869 spec->capsrc_nids = alc269_capsrc_nids;
13870 if (!spec->cap_mixer)
13871 set_capture_mixer(codec);
13872 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13874 spec->vmaster_nid = 0x02;
13876 codec->patch_ops = alc_patch_ops;
13877 if (board_config == ALC269_AUTO)
13878 spec->init_hook = alc269_auto_init;
13879 #ifdef CONFIG_SND_HDA_POWER_SAVE
13880 if (!spec->loopback.amplist)
13881 spec->loopback.amplist = alc269_loopbacks;
13883 codec->proc_widget_hook = print_realtek_coef;
13889 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13893 * set the path ways for 2 channel output
13894 * need to set the codec line out and mic 1 pin widgets to inputs
13896 static struct hda_verb alc861_threestack_ch2_init[] = {
13897 /* set pin widget 1Ah (line in) for input */
13898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13899 /* set pin widget 18h (mic1/2) for input, for mic also enable
13902 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13904 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13906 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13907 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13913 * need to set the codec line out and mic 1 pin widgets to outputs
13915 static struct hda_verb alc861_threestack_ch6_init[] = {
13916 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13917 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13918 /* set pin widget 18h (mic1) for output (CLFE)*/
13919 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13921 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13922 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13926 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13927 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13932 static struct hda_channel_mode alc861_threestack_modes[2] = {
13933 { 2, alc861_threestack_ch2_init },
13934 { 6, alc861_threestack_ch6_init },
13936 /* Set mic1 as input and unmute the mixer */
13937 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13938 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13939 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13942 /* Set mic1 as output and mute mixer */
13943 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13944 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13945 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13949 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13950 { 2, alc861_uniwill_m31_ch2_init },
13951 { 4, alc861_uniwill_m31_ch4_init },
13954 /* Set mic1 and line-in as input and unmute the mixer */
13955 static struct hda_verb alc861_asus_ch2_init[] = {
13956 /* set pin widget 1Ah (line in) for input */
13957 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13958 /* set pin widget 18h (mic1/2) for input, for mic also enable
13961 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13966 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13970 /* Set mic1 nad line-in as output and mute mixer */
13971 static struct hda_verb alc861_asus_ch6_init[] = {
13972 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13973 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13974 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13975 /* set pin widget 18h (mic1) for output (CLFE)*/
13976 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13977 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13978 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13979 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13981 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13983 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13984 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13989 static struct hda_channel_mode alc861_asus_modes[2] = {
13990 { 2, alc861_asus_ch2_init },
13991 { 6, alc861_asus_ch6_init },
13996 static struct snd_kcontrol_new alc861_base_mixer[] = {
13997 /* output mixer control */
13998 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13999 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14000 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14001 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14002 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14004 /*Input mixer control */
14005 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14006 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14007 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14008 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14009 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14010 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14011 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14012 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14013 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14014 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14019 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14020 /* output mixer control */
14021 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14022 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14023 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14024 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14025 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14027 /* Input mixer control */
14028 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14029 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14030 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14031 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14032 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14033 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14035 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14040 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14041 .name = "Channel Mode",
14042 .info = alc_ch_mode_info,
14043 .get = alc_ch_mode_get,
14044 .put = alc_ch_mode_put,
14045 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14050 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14051 /* output mixer control */
14052 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14054 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14059 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14060 /* output mixer control */
14061 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14062 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14063 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14064 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14065 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14067 /* Input mixer control */
14068 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14069 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14070 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14071 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14072 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14073 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14074 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14075 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14076 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14080 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14081 .name = "Channel Mode",
14082 .info = alc_ch_mode_info,
14083 .get = alc_ch_mode_get,
14084 .put = alc_ch_mode_put,
14085 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14090 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14091 /* output mixer control */
14092 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14093 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14094 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14095 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14096 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14098 /* Input mixer control */
14099 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14100 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14101 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14102 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14103 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14104 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14105 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14106 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14107 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14108 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14112 .name = "Channel Mode",
14113 .info = alc_ch_mode_info,
14114 .get = alc_ch_mode_get,
14115 .put = alc_ch_mode_put,
14116 .private_value = ARRAY_SIZE(alc861_asus_modes),
14121 /* additional mixer */
14122 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14123 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14124 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14129 * generic initialization of ADC, input mixers and output mixers
14131 static struct hda_verb alc861_base_init_verbs[] = {
14133 * Unmute ADC0 and set the default input to mic-in
14135 /* port-A for surround (rear panel) */
14136 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14137 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14138 /* port-B for mic-in (rear panel) with vref */
14139 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14140 /* port-C for line-in (rear panel) */
14141 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14142 /* port-D for Front */
14143 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14144 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14145 /* port-E for HP out (front panel) */
14146 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14147 /* route front PCM to HP */
14148 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14149 /* port-F for mic-in (front panel) with vref */
14150 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14151 /* port-G for CLFE (rear panel) */
14152 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14153 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14154 /* port-H for side (rear panel) */
14155 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14156 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14158 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14159 /* route front mic to ADC1*/
14160 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14163 /* Unmute DAC0~3 & spdif out*/
14164 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14165 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14166 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14167 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14168 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14170 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14171 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14172 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14173 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14174 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14176 /* Unmute Stereo Mixer 15 */
14177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14179 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14180 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14182 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14184 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14186 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14187 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14189 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14190 /* hp used DAC 3 (Front) */
14191 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14192 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14197 static struct hda_verb alc861_threestack_init_verbs[] = {
14199 * Unmute ADC0 and set the default input to mic-in
14201 /* port-A for surround (rear panel) */
14202 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14203 /* port-B for mic-in (rear panel) with vref */
14204 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14205 /* port-C for line-in (rear panel) */
14206 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14207 /* port-D for Front */
14208 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14209 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14210 /* port-E for HP out (front panel) */
14211 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14212 /* route front PCM to HP */
14213 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14214 /* port-F for mic-in (front panel) with vref */
14215 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14216 /* port-G for CLFE (rear panel) */
14217 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14218 /* port-H for side (rear panel) */
14219 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14221 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14222 /* route front mic to ADC1*/
14223 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14224 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14225 /* Unmute DAC0~3 & spdif out*/
14226 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14227 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14228 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14229 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14230 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14232 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14233 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14234 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14235 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14236 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14238 /* Unmute Stereo Mixer 15 */
14239 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14241 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14242 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14244 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14245 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14246 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14247 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14248 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14249 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14250 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14251 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14252 /* hp used DAC 3 (Front) */
14253 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14254 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14258 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14260 * Unmute ADC0 and set the default input to mic-in
14262 /* port-A for surround (rear panel) */
14263 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14264 /* port-B for mic-in (rear panel) with vref */
14265 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14266 /* port-C for line-in (rear panel) */
14267 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14268 /* port-D for Front */
14269 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14270 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14271 /* port-E for HP out (front panel) */
14272 /* this has to be set to VREF80 */
14273 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14274 /* route front PCM to HP */
14275 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14276 /* port-F for mic-in (front panel) with vref */
14277 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14278 /* port-G for CLFE (rear panel) */
14279 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14280 /* port-H for side (rear panel) */
14281 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14283 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14284 /* route front mic to ADC1*/
14285 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14286 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14287 /* Unmute DAC0~3 & spdif out*/
14288 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14289 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14290 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14291 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14294 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14295 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14296 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14297 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14298 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14300 /* Unmute Stereo Mixer 15 */
14301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14303 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14306 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14307 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14308 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14309 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14310 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14311 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14312 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14313 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14314 /* hp used DAC 3 (Front) */
14315 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14320 static struct hda_verb alc861_asus_init_verbs[] = {
14322 * Unmute ADC0 and set the default input to mic-in
14324 /* port-A for surround (rear panel)
14325 * according to codec#0 this is the HP jack
14327 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14328 /* route front PCM to HP */
14329 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14330 /* port-B for mic-in (rear panel) with vref */
14331 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14332 /* port-C for line-in (rear panel) */
14333 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14334 /* port-D for Front */
14335 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14336 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14337 /* port-E for HP out (front panel) */
14338 /* this has to be set to VREF80 */
14339 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14340 /* route front PCM to HP */
14341 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14342 /* port-F for mic-in (front panel) with vref */
14343 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14344 /* port-G for CLFE (rear panel) */
14345 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14346 /* port-H for side (rear panel) */
14347 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14349 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14350 /* route front mic to ADC1*/
14351 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14353 /* Unmute DAC0~3 & spdif out*/
14354 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14355 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14356 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14357 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14358 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14359 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14360 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14361 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14362 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14363 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14365 /* Unmute Stereo Mixer 15 */
14366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14368 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14371 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14372 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14373 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14374 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14376 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14377 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14378 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14379 /* hp used DAC 3 (Front) */
14380 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14381 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14385 /* additional init verbs for ASUS laptops */
14386 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14387 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14388 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14393 * generic initialization of ADC, input mixers and output mixers
14395 static struct hda_verb alc861_auto_init_verbs[] = {
14397 * Unmute ADC0 and set the default input to mic-in
14399 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14400 {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_MUTE},
14404 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14405 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14406 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14407 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14409 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14410 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14411 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14412 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14413 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14415 /* Unmute Stereo Mixer 15 */
14416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14419 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14421 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14422 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14423 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14424 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14425 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14426 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14427 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14432 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14433 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14434 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14436 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14437 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14439 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14444 static struct hda_verb alc861_toshiba_init_verbs[] = {
14445 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14450 /* toggle speaker-output according to the hp-jack state */
14451 static void alc861_toshiba_automute(struct hda_codec *codec)
14453 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14455 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14456 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14457 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14458 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14461 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14464 if ((res >> 26) == ALC880_HP_EVENT)
14465 alc861_toshiba_automute(codec);
14468 /* pcm configuration: identical with ALC880 */
14469 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14470 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14471 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14472 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14475 #define ALC861_DIGOUT_NID 0x07
14477 static struct hda_channel_mode alc861_8ch_modes[1] = {
14481 static hda_nid_t alc861_dac_nids[4] = {
14482 /* front, surround, clfe, side */
14483 0x03, 0x06, 0x05, 0x04
14486 static hda_nid_t alc660_dac_nids[3] = {
14487 /* front, clfe, surround */
14491 static hda_nid_t alc861_adc_nids[1] = {
14496 static struct hda_input_mux alc861_capture_source = {
14500 { "Front Mic", 0x3 },
14507 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14509 struct alc_spec *spec = codec->spec;
14510 hda_nid_t mix, srcs[5];
14513 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14515 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14518 for (i = 0; i < num; i++) {
14520 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14521 if (type != AC_WID_AUD_OUT)
14523 for (j = 0; j < spec->multiout.num_dacs; j++)
14524 if (spec->multiout.dac_nids[j] == srcs[i])
14526 if (j >= spec->multiout.num_dacs)
14532 /* fill in the dac_nids table from the parsed pin configuration */
14533 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14534 const struct auto_pin_cfg *cfg)
14536 struct alc_spec *spec = codec->spec;
14538 hda_nid_t nid, dac;
14540 spec->multiout.dac_nids = spec->private_dac_nids;
14541 for (i = 0; i < cfg->line_outs; i++) {
14542 nid = cfg->line_out_pins[i];
14543 dac = alc861_look_for_dac(codec, nid);
14546 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14551 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14552 hda_nid_t nid, unsigned int chs)
14554 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14555 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14558 /* add playback controls from the parsed DAC table */
14559 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14560 const struct auto_pin_cfg *cfg)
14562 struct alc_spec *spec = codec->spec;
14563 static const char *chname[4] = {
14564 "Front", "Surround", NULL /*CLFE*/, "Side"
14569 if (cfg->line_outs == 1) {
14570 const char *pfx = NULL;
14573 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14576 nid = spec->multiout.dac_nids[0];
14577 return alc861_create_out_sw(codec, pfx, nid, 3);
14581 for (i = 0; i < cfg->line_outs; i++) {
14582 nid = spec->multiout.dac_nids[i];
14587 err = alc861_create_out_sw(codec, "Center", nid, 1);
14590 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14594 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14602 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14604 struct alc_spec *spec = codec->spec;
14611 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14612 nid = alc861_look_for_dac(codec, pin);
14614 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14617 spec->multiout.hp_nid = nid;
14623 /* create playback/capture controls for input pins */
14624 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14625 const struct auto_pin_cfg *cfg)
14627 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14630 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14632 int pin_type, hda_nid_t dac)
14634 hda_nid_t mix, srcs[5];
14637 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14639 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14641 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14643 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14646 for (i = 0; i < num; i++) {
14648 if (srcs[i] == dac || srcs[i] == 0x15)
14649 mute = AMP_IN_UNMUTE(i);
14651 mute = AMP_IN_MUTE(i);
14652 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14657 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14659 struct alc_spec *spec = codec->spec;
14662 for (i = 0; i < spec->autocfg.line_outs; i++) {
14663 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14664 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14666 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14667 spec->multiout.dac_nids[i]);
14671 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14673 struct alc_spec *spec = codec->spec;
14675 if (spec->autocfg.hp_outs)
14676 alc861_auto_set_output_and_unmute(codec,
14677 spec->autocfg.hp_pins[0],
14679 spec->multiout.hp_nid);
14680 if (spec->autocfg.speaker_outs)
14681 alc861_auto_set_output_and_unmute(codec,
14682 spec->autocfg.speaker_pins[0],
14684 spec->multiout.dac_nids[0]);
14687 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14689 struct alc_spec *spec = codec->spec;
14692 for (i = 0; i < AUTO_PIN_LAST; i++) {
14693 hda_nid_t nid = spec->autocfg.input_pins[i];
14694 if (nid >= 0x0c && nid <= 0x11)
14695 alc_set_input_pin(codec, nid, i);
14699 /* parse the BIOS configuration and set up the alc_spec */
14700 /* return 1 if successful, 0 if the proper config is not found,
14701 * or a negative error code
14703 static int alc861_parse_auto_config(struct hda_codec *codec)
14705 struct alc_spec *spec = codec->spec;
14707 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14709 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14713 if (!spec->autocfg.line_outs)
14714 return 0; /* can't find valid BIOS pin config */
14716 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14719 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14722 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14725 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14729 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14731 if (spec->autocfg.dig_outs)
14732 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14734 if (spec->kctls.list)
14735 add_mixer(spec, spec->kctls.list);
14737 add_verb(spec, alc861_auto_init_verbs);
14739 spec->num_mux_defs = 1;
14740 spec->input_mux = &spec->private_imux[0];
14742 spec->adc_nids = alc861_adc_nids;
14743 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14744 set_capture_mixer(codec);
14746 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14751 /* additional initialization for auto-configuration model */
14752 static void alc861_auto_init(struct hda_codec *codec)
14754 struct alc_spec *spec = codec->spec;
14755 alc861_auto_init_multi_out(codec);
14756 alc861_auto_init_hp_out(codec);
14757 alc861_auto_init_analog_input(codec);
14758 if (spec->unsol_event)
14759 alc_inithook(codec);
14762 #ifdef CONFIG_SND_HDA_POWER_SAVE
14763 static struct hda_amp_list alc861_loopbacks[] = {
14764 { 0x15, HDA_INPUT, 0 },
14765 { 0x15, HDA_INPUT, 1 },
14766 { 0x15, HDA_INPUT, 2 },
14767 { 0x15, HDA_INPUT, 3 },
14774 * configuration and preset
14776 static const char *alc861_models[ALC861_MODEL_LAST] = {
14777 [ALC861_3ST] = "3stack",
14778 [ALC660_3ST] = "3stack-660",
14779 [ALC861_3ST_DIG] = "3stack-dig",
14780 [ALC861_6ST_DIG] = "6stack-dig",
14781 [ALC861_UNIWILL_M31] = "uniwill-m31",
14782 [ALC861_TOSHIBA] = "toshiba",
14783 [ALC861_ASUS] = "asus",
14784 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14785 [ALC861_AUTO] = "auto",
14788 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14789 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14790 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14791 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14792 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14793 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14794 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14795 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14796 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14797 * Any other models that need this preset?
14799 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14800 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14801 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14802 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14803 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14804 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14805 /* FIXME: the below seems conflict */
14806 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14807 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14808 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14812 static struct alc_config_preset alc861_presets[] = {
14814 .mixers = { alc861_3ST_mixer },
14815 .init_verbs = { alc861_threestack_init_verbs },
14816 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14817 .dac_nids = alc861_dac_nids,
14818 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14819 .channel_mode = alc861_threestack_modes,
14821 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14822 .adc_nids = alc861_adc_nids,
14823 .input_mux = &alc861_capture_source,
14825 [ALC861_3ST_DIG] = {
14826 .mixers = { alc861_base_mixer },
14827 .init_verbs = { alc861_threestack_init_verbs },
14828 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14829 .dac_nids = alc861_dac_nids,
14830 .dig_out_nid = ALC861_DIGOUT_NID,
14831 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14832 .channel_mode = alc861_threestack_modes,
14834 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14835 .adc_nids = alc861_adc_nids,
14836 .input_mux = &alc861_capture_source,
14838 [ALC861_6ST_DIG] = {
14839 .mixers = { alc861_base_mixer },
14840 .init_verbs = { alc861_base_init_verbs },
14841 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14842 .dac_nids = alc861_dac_nids,
14843 .dig_out_nid = ALC861_DIGOUT_NID,
14844 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14845 .channel_mode = alc861_8ch_modes,
14846 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14847 .adc_nids = alc861_adc_nids,
14848 .input_mux = &alc861_capture_source,
14851 .mixers = { alc861_3ST_mixer },
14852 .init_verbs = { alc861_threestack_init_verbs },
14853 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14854 .dac_nids = alc660_dac_nids,
14855 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14856 .channel_mode = alc861_threestack_modes,
14858 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14859 .adc_nids = alc861_adc_nids,
14860 .input_mux = &alc861_capture_source,
14862 [ALC861_UNIWILL_M31] = {
14863 .mixers = { alc861_uniwill_m31_mixer },
14864 .init_verbs = { alc861_uniwill_m31_init_verbs },
14865 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14866 .dac_nids = alc861_dac_nids,
14867 .dig_out_nid = ALC861_DIGOUT_NID,
14868 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14869 .channel_mode = alc861_uniwill_m31_modes,
14871 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14872 .adc_nids = alc861_adc_nids,
14873 .input_mux = &alc861_capture_source,
14875 [ALC861_TOSHIBA] = {
14876 .mixers = { alc861_toshiba_mixer },
14877 .init_verbs = { alc861_base_init_verbs,
14878 alc861_toshiba_init_verbs },
14879 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14880 .dac_nids = alc861_dac_nids,
14881 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14882 .channel_mode = alc883_3ST_2ch_modes,
14883 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14884 .adc_nids = alc861_adc_nids,
14885 .input_mux = &alc861_capture_source,
14886 .unsol_event = alc861_toshiba_unsol_event,
14887 .init_hook = alc861_toshiba_automute,
14890 .mixers = { alc861_asus_mixer },
14891 .init_verbs = { alc861_asus_init_verbs },
14892 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14893 .dac_nids = alc861_dac_nids,
14894 .dig_out_nid = ALC861_DIGOUT_NID,
14895 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14896 .channel_mode = alc861_asus_modes,
14899 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14900 .adc_nids = alc861_adc_nids,
14901 .input_mux = &alc861_capture_source,
14903 [ALC861_ASUS_LAPTOP] = {
14904 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14905 .init_verbs = { alc861_asus_init_verbs,
14906 alc861_asus_laptop_init_verbs },
14907 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14908 .dac_nids = alc861_dac_nids,
14909 .dig_out_nid = ALC861_DIGOUT_NID,
14910 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14911 .channel_mode = alc883_3ST_2ch_modes,
14913 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14914 .adc_nids = alc861_adc_nids,
14915 .input_mux = &alc861_capture_source,
14919 /* Pin config fixes */
14921 PINFIX_FSC_AMILO_PI1505,
14924 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14925 { 0x0b, 0x0221101f }, /* HP */
14926 { 0x0f, 0x90170310 }, /* speaker */
14930 static const struct alc_fixup alc861_fixups[] = {
14931 [PINFIX_FSC_AMILO_PI1505] = {
14932 .pins = alc861_fsc_amilo_pi1505_pinfix
14936 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14937 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14941 static int patch_alc861(struct hda_codec *codec)
14943 struct alc_spec *spec;
14947 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14951 codec->spec = spec;
14953 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14957 if (board_config < 0) {
14958 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14960 board_config = ALC861_AUTO;
14963 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14965 if (board_config == ALC861_AUTO) {
14966 /* automatic parse from the BIOS config */
14967 err = alc861_parse_auto_config(codec);
14973 "hda_codec: Cannot set up configuration "
14974 "from BIOS. Using base mode...\n");
14975 board_config = ALC861_3ST_DIG;
14979 err = snd_hda_attach_beep_device(codec, 0x23);
14985 if (board_config != ALC861_AUTO)
14986 setup_preset(codec, &alc861_presets[board_config]);
14988 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14989 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14991 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14992 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14994 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14996 spec->vmaster_nid = 0x03;
14998 codec->patch_ops = alc_patch_ops;
14999 if (board_config == ALC861_AUTO) {
15000 spec->init_hook = alc861_auto_init;
15001 #ifdef CONFIG_SND_HDA_POWER_SAVE
15002 spec->power_hook = alc_power_eapd;
15005 #ifdef CONFIG_SND_HDA_POWER_SAVE
15006 if (!spec->loopback.amplist)
15007 spec->loopback.amplist = alc861_loopbacks;
15009 codec->proc_widget_hook = print_realtek_coef;
15015 * ALC861-VD support
15019 * In addition, an independent DAC
15021 #define ALC861VD_DIGOUT_NID 0x06
15023 static hda_nid_t alc861vd_dac_nids[4] = {
15024 /* front, surr, clfe, side surr */
15025 0x02, 0x03, 0x04, 0x05
15028 /* dac_nids for ALC660vd are in a different order - according to
15029 * Realtek's driver.
15030 * This should probably result in a different mixer for 6stack models
15031 * of ALC660vd codecs, but for now there is only 3stack mixer
15032 * - and it is the same as in 861vd.
15033 * adc_nids in ALC660vd are (is) the same as in 861vd
15035 static hda_nid_t alc660vd_dac_nids[3] = {
15036 /* front, rear, clfe, rear_surr */
15040 static hda_nid_t alc861vd_adc_nids[1] = {
15045 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15048 /* FIXME: should be a matrix-type input source selection */
15049 static struct hda_input_mux alc861vd_capture_source = {
15053 { "Front Mic", 0x1 },
15059 static struct hda_input_mux alc861vd_dallas_capture_source = {
15062 { "Ext Mic", 0x0 },
15063 { "Int Mic", 0x1 },
15067 static struct hda_input_mux alc861vd_hp_capture_source = {
15070 { "Front Mic", 0x0 },
15071 { "ATAPI Mic", 0x1 },
15078 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15085 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15086 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15087 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15088 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15089 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15096 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15097 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15098 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15099 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15100 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15104 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15105 { 6, alc861vd_6stack_ch6_init },
15106 { 8, alc861vd_6stack_ch8_init },
15109 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15112 .name = "Channel Mode",
15113 .info = alc_ch_mode_info,
15114 .get = alc_ch_mode_get,
15115 .put = alc_ch_mode_put,
15120 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15121 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15123 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15124 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15125 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15127 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15128 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15130 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15132 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15134 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15135 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15137 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15138 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15142 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15146 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15148 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15151 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15153 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15154 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15159 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15160 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15163 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15165 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15166 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15167 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15169 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15170 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15171 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15173 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15174 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15182 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15183 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15184 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15185 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15187 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15191 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15193 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15194 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15195 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15197 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15198 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15203 /* Pin assignment: Speaker=0x14, HP = 0x15,
15204 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15206 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15207 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15208 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15209 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15210 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15211 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15212 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15213 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15214 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15215 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15216 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15220 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15221 * Front Mic=0x18, ATAPI Mic = 0x19,
15223 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15224 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15227 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15228 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15229 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15230 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15231 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15237 * generic initialization of ADC, input mixers and output mixers
15239 static struct hda_verb alc861vd_volume_init_verbs[] = {
15241 * Unmute ADC0 and set the default input to mic-in
15243 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15244 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15246 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15247 * the analog-loopback mixer widget
15249 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15254 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15256 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15263 * Set up output mixers (0x02 - 0x05)
15265 /* set vol=0 to output mixers */
15266 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15267 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15268 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15269 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15271 /* set up input amps for analog loopback */
15272 /* Amp Indices: DAC = 0, mixer = 1 */
15273 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15274 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15275 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15276 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15278 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15280 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15286 * 3-stack pin configuration:
15287 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15289 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15291 * Set pin mode and muting
15293 /* set front pin widgets 0x14 for output */
15294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15295 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15296 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15298 /* Mic (rear) pin: input vref at 80% */
15299 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15301 /* Front Mic pin: input vref at 80% */
15302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15304 /* Line In pin: input */
15305 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15306 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15307 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15308 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15309 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15310 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15311 /* CD pin widget for input */
15312 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15318 * 6-stack pin configuration:
15320 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15322 * Set pin mode and muting
15324 /* set front pin widgets 0x14 for output */
15325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15327 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15329 /* Rear Pin: output 1 (0x0d) */
15330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15332 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15333 /* CLFE Pin: output 2 (0x0e) */
15334 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15335 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15336 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15337 /* Side Pin: output 3 (0x0f) */
15338 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15339 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15340 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15342 /* Mic (rear) pin: input vref at 80% */
15343 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15344 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15345 /* Front Mic pin: input vref at 80% */
15346 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15347 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15348 /* Line In pin: input */
15349 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15350 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15351 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15352 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15353 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15354 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15355 /* CD pin widget for input */
15356 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15361 static struct hda_verb alc861vd_eapd_verbs[] = {
15362 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15366 static struct hda_verb alc660vd_eapd_verbs[] = {
15367 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15368 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15372 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15374 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15376 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15381 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15383 unsigned int present;
15384 unsigned char bits;
15386 present = snd_hda_jack_detect(codec, 0x18);
15387 bits = present ? HDA_AMP_MUTE : 0;
15389 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15390 HDA_AMP_MUTE, bits);
15393 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15395 struct alc_spec *spec = codec->spec;
15396 spec->autocfg.hp_pins[0] = 0x1b;
15397 spec->autocfg.speaker_pins[0] = 0x14;
15400 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15402 alc_automute_amp(codec);
15403 alc861vd_lenovo_mic_automute(codec);
15406 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15409 switch (res >> 26) {
15410 case ALC880_MIC_EVENT:
15411 alc861vd_lenovo_mic_automute(codec);
15414 alc_automute_amp_unsol_event(codec, res);
15419 static struct hda_verb alc861vd_dallas_verbs[] = {
15420 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15421 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15422 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15423 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15426 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15428 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15432 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15434 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15435 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15437 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15438 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15439 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15440 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15441 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15443 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15444 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15445 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15446 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15447 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15449 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15450 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15457 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15458 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15459 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15464 /* toggle speaker-output according to the hp-jack state */
15465 static void alc861vd_dallas_setup(struct hda_codec *codec)
15467 struct alc_spec *spec = codec->spec;
15469 spec->autocfg.hp_pins[0] = 0x15;
15470 spec->autocfg.speaker_pins[0] = 0x14;
15473 #ifdef CONFIG_SND_HDA_POWER_SAVE
15474 #define alc861vd_loopbacks alc880_loopbacks
15477 /* pcm configuration: identical with ALC880 */
15478 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15479 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15480 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15481 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15484 * configuration and preset
15486 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15487 [ALC660VD_3ST] = "3stack-660",
15488 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15489 [ALC660VD_ASUS_V1S] = "asus-v1s",
15490 [ALC861VD_3ST] = "3stack",
15491 [ALC861VD_3ST_DIG] = "3stack-digout",
15492 [ALC861VD_6ST_DIG] = "6stack-digout",
15493 [ALC861VD_LENOVO] = "lenovo",
15494 [ALC861VD_DALLAS] = "dallas",
15495 [ALC861VD_HP] = "hp",
15496 [ALC861VD_AUTO] = "auto",
15499 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15500 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15501 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15502 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15503 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15504 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15505 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15506 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15507 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15508 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15509 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15510 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15511 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15512 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15513 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15514 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15518 static struct alc_config_preset alc861vd_presets[] = {
15520 .mixers = { alc861vd_3st_mixer },
15521 .init_verbs = { alc861vd_volume_init_verbs,
15522 alc861vd_3stack_init_verbs },
15523 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15524 .dac_nids = alc660vd_dac_nids,
15525 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15526 .channel_mode = alc861vd_3stack_2ch_modes,
15527 .input_mux = &alc861vd_capture_source,
15529 [ALC660VD_3ST_DIG] = {
15530 .mixers = { alc861vd_3st_mixer },
15531 .init_verbs = { alc861vd_volume_init_verbs,
15532 alc861vd_3stack_init_verbs },
15533 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15534 .dac_nids = alc660vd_dac_nids,
15535 .dig_out_nid = ALC861VD_DIGOUT_NID,
15536 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15537 .channel_mode = alc861vd_3stack_2ch_modes,
15538 .input_mux = &alc861vd_capture_source,
15541 .mixers = { alc861vd_3st_mixer },
15542 .init_verbs = { alc861vd_volume_init_verbs,
15543 alc861vd_3stack_init_verbs },
15544 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15545 .dac_nids = alc861vd_dac_nids,
15546 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15547 .channel_mode = alc861vd_3stack_2ch_modes,
15548 .input_mux = &alc861vd_capture_source,
15550 [ALC861VD_3ST_DIG] = {
15551 .mixers = { alc861vd_3st_mixer },
15552 .init_verbs = { alc861vd_volume_init_verbs,
15553 alc861vd_3stack_init_verbs },
15554 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15555 .dac_nids = alc861vd_dac_nids,
15556 .dig_out_nid = ALC861VD_DIGOUT_NID,
15557 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15558 .channel_mode = alc861vd_3stack_2ch_modes,
15559 .input_mux = &alc861vd_capture_source,
15561 [ALC861VD_6ST_DIG] = {
15562 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15563 .init_verbs = { alc861vd_volume_init_verbs,
15564 alc861vd_6stack_init_verbs },
15565 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15566 .dac_nids = alc861vd_dac_nids,
15567 .dig_out_nid = ALC861VD_DIGOUT_NID,
15568 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15569 .channel_mode = alc861vd_6stack_modes,
15570 .input_mux = &alc861vd_capture_source,
15572 [ALC861VD_LENOVO] = {
15573 .mixers = { alc861vd_lenovo_mixer },
15574 .init_verbs = { alc861vd_volume_init_verbs,
15575 alc861vd_3stack_init_verbs,
15576 alc861vd_eapd_verbs,
15577 alc861vd_lenovo_unsol_verbs },
15578 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15579 .dac_nids = alc660vd_dac_nids,
15580 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15581 .channel_mode = alc861vd_3stack_2ch_modes,
15582 .input_mux = &alc861vd_capture_source,
15583 .unsol_event = alc861vd_lenovo_unsol_event,
15584 .setup = alc861vd_lenovo_setup,
15585 .init_hook = alc861vd_lenovo_init_hook,
15587 [ALC861VD_DALLAS] = {
15588 .mixers = { alc861vd_dallas_mixer },
15589 .init_verbs = { alc861vd_dallas_verbs },
15590 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15591 .dac_nids = alc861vd_dac_nids,
15592 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15593 .channel_mode = alc861vd_3stack_2ch_modes,
15594 .input_mux = &alc861vd_dallas_capture_source,
15595 .unsol_event = alc_automute_amp_unsol_event,
15596 .setup = alc861vd_dallas_setup,
15597 .init_hook = alc_automute_amp,
15600 .mixers = { alc861vd_hp_mixer },
15601 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15602 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15603 .dac_nids = alc861vd_dac_nids,
15604 .dig_out_nid = ALC861VD_DIGOUT_NID,
15605 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15606 .channel_mode = alc861vd_3stack_2ch_modes,
15607 .input_mux = &alc861vd_hp_capture_source,
15608 .unsol_event = alc_automute_amp_unsol_event,
15609 .setup = alc861vd_dallas_setup,
15610 .init_hook = alc_automute_amp,
15612 [ALC660VD_ASUS_V1S] = {
15613 .mixers = { alc861vd_lenovo_mixer },
15614 .init_verbs = { alc861vd_volume_init_verbs,
15615 alc861vd_3stack_init_verbs,
15616 alc861vd_eapd_verbs,
15617 alc861vd_lenovo_unsol_verbs },
15618 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15619 .dac_nids = alc660vd_dac_nids,
15620 .dig_out_nid = ALC861VD_DIGOUT_NID,
15621 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15622 .channel_mode = alc861vd_3stack_2ch_modes,
15623 .input_mux = &alc861vd_capture_source,
15624 .unsol_event = alc861vd_lenovo_unsol_event,
15625 .setup = alc861vd_lenovo_setup,
15626 .init_hook = alc861vd_lenovo_init_hook,
15631 * BIOS auto configuration
15633 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15634 const struct auto_pin_cfg *cfg)
15636 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15640 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15641 hda_nid_t nid, int pin_type, int dac_idx)
15643 alc_set_pin_output(codec, nid, pin_type);
15646 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15648 struct alc_spec *spec = codec->spec;
15651 for (i = 0; i <= HDA_SIDE; i++) {
15652 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15653 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15655 alc861vd_auto_set_output_and_unmute(codec, nid,
15661 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15663 struct alc_spec *spec = codec->spec;
15666 pin = spec->autocfg.hp_pins[0];
15667 if (pin) /* connect to front and use dac 0 */
15668 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15669 pin = spec->autocfg.speaker_pins[0];
15671 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15674 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15676 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15678 struct alc_spec *spec = codec->spec;
15681 for (i = 0; i < AUTO_PIN_LAST; i++) {
15682 hda_nid_t nid = spec->autocfg.input_pins[i];
15683 if (alc_is_input_pin(codec, nid)) {
15684 alc_set_input_pin(codec, nid, i);
15685 if (nid != ALC861VD_PIN_CD_NID &&
15686 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15687 snd_hda_codec_write(codec, nid, 0,
15688 AC_VERB_SET_AMP_GAIN_MUTE,
15694 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15696 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15697 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15699 /* add playback controls from the parsed DAC table */
15700 /* Based on ALC880 version. But ALC861VD has separate,
15701 * different NIDs for mute/unmute switch and volume control */
15702 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15703 const struct auto_pin_cfg *cfg)
15705 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15706 hda_nid_t nid_v, nid_s;
15709 for (i = 0; i < cfg->line_outs; i++) {
15710 if (!spec->multiout.dac_nids[i])
15712 nid_v = alc861vd_idx_to_mixer_vol(
15714 spec->multiout.dac_nids[i]));
15715 nid_s = alc861vd_idx_to_mixer_switch(
15717 spec->multiout.dac_nids[i]));
15721 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15723 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15727 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15729 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15733 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15735 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15739 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15741 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15747 if (cfg->line_outs == 1 &&
15748 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15755 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15756 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15760 if (cfg->line_outs == 1 &&
15761 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15763 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15764 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15773 /* add playback controls for speaker and HP outputs */
15774 /* Based on ALC880 version. But ALC861VD has separate,
15775 * different NIDs for mute/unmute switch and volume control */
15776 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15777 hda_nid_t pin, const char *pfx)
15779 hda_nid_t nid_v, nid_s;
15785 if (alc880_is_fixed_pin(pin)) {
15786 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15787 /* specify the DAC as the extra output */
15788 if (!spec->multiout.hp_nid)
15789 spec->multiout.hp_nid = nid_v;
15791 spec->multiout.extra_out_nid[0] = nid_v;
15792 /* control HP volume/switch on the output mixer amp */
15793 nid_v = alc861vd_idx_to_mixer_vol(
15794 alc880_fixed_pin_idx(pin));
15795 nid_s = alc861vd_idx_to_mixer_switch(
15796 alc880_fixed_pin_idx(pin));
15798 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15799 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15802 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15803 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15806 } else if (alc880_is_multi_pin(pin)) {
15807 /* set manual connection */
15808 /* we have only a switch on HP-out PIN */
15809 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15810 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15817 /* parse the BIOS configuration and set up the alc_spec
15818 * return 1 if successful, 0 if the proper config is not found,
15819 * or a negative error code
15820 * Based on ALC880 version - had to change it to override
15821 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15822 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15824 struct alc_spec *spec = codec->spec;
15826 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15828 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15832 if (!spec->autocfg.line_outs)
15833 return 0; /* can't find valid BIOS pin config */
15835 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15838 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15841 err = alc861vd_auto_create_extra_out(spec,
15842 spec->autocfg.speaker_pins[0],
15846 err = alc861vd_auto_create_extra_out(spec,
15847 spec->autocfg.hp_pins[0],
15851 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15855 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15857 if (spec->autocfg.dig_outs)
15858 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15860 if (spec->kctls.list)
15861 add_mixer(spec, spec->kctls.list);
15863 add_verb(spec, alc861vd_volume_init_verbs);
15865 spec->num_mux_defs = 1;
15866 spec->input_mux = &spec->private_imux[0];
15868 err = alc_auto_add_mic_boost(codec);
15872 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15877 /* additional initialization for auto-configuration model */
15878 static void alc861vd_auto_init(struct hda_codec *codec)
15880 struct alc_spec *spec = codec->spec;
15881 alc861vd_auto_init_multi_out(codec);
15882 alc861vd_auto_init_hp_out(codec);
15883 alc861vd_auto_init_analog_input(codec);
15884 alc861vd_auto_init_input_src(codec);
15885 if (spec->unsol_event)
15886 alc_inithook(codec);
15890 ALC660VD_FIX_ASUS_GPIO1
15894 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15895 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15896 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15897 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15901 static const struct alc_fixup alc861vd_fixups[] = {
15902 [ALC660VD_FIX_ASUS_GPIO1] = {
15903 .verbs = alc660vd_fix_asus_gpio1_verbs,
15907 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15908 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15912 static int patch_alc861vd(struct hda_codec *codec)
15914 struct alc_spec *spec;
15915 int err, board_config;
15917 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15921 codec->spec = spec;
15923 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15927 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15928 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15930 board_config = ALC861VD_AUTO;
15933 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15935 if (board_config == ALC861VD_AUTO) {
15936 /* automatic parse from the BIOS config */
15937 err = alc861vd_parse_auto_config(codec);
15943 "hda_codec: Cannot set up configuration "
15944 "from BIOS. Using base mode...\n");
15945 board_config = ALC861VD_3ST;
15949 err = snd_hda_attach_beep_device(codec, 0x23);
15955 if (board_config != ALC861VD_AUTO)
15956 setup_preset(codec, &alc861vd_presets[board_config]);
15958 if (codec->vendor_id == 0x10ec0660) {
15959 /* always turn on EAPD */
15960 add_verb(spec, alc660vd_eapd_verbs);
15963 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15964 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15966 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15967 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15969 if (!spec->adc_nids) {
15970 spec->adc_nids = alc861vd_adc_nids;
15971 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15973 if (!spec->capsrc_nids)
15974 spec->capsrc_nids = alc861vd_capsrc_nids;
15976 set_capture_mixer(codec);
15977 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15979 spec->vmaster_nid = 0x02;
15981 codec->patch_ops = alc_patch_ops;
15983 if (board_config == ALC861VD_AUTO)
15984 spec->init_hook = alc861vd_auto_init;
15985 #ifdef CONFIG_SND_HDA_POWER_SAVE
15986 if (!spec->loopback.amplist)
15987 spec->loopback.amplist = alc861vd_loopbacks;
15989 codec->proc_widget_hook = print_realtek_coef;
15997 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15998 * configuration. Each pin widget can choose any input DACs and a mixer.
15999 * Each ADC is connected from a mixer of all inputs. This makes possible
16000 * 6-channel independent captures.
16002 * In addition, an independent DAC for the multi-playback (not used in this
16005 #define ALC662_DIGOUT_NID 0x06
16006 #define ALC662_DIGIN_NID 0x0a
16008 static hda_nid_t alc662_dac_nids[4] = {
16009 /* front, rear, clfe, rear_surr */
16013 static hda_nid_t alc272_dac_nids[2] = {
16017 static hda_nid_t alc662_adc_nids[2] = {
16022 static hda_nid_t alc272_adc_nids[1] = {
16027 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16028 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16032 /* FIXME: should be a matrix-type input source selection */
16033 static struct hda_input_mux alc662_capture_source = {
16037 { "Front Mic", 0x1 },
16043 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16051 static struct hda_input_mux alc663_capture_source = {
16055 { "Front Mic", 0x1 },
16060 #if 0 /* set to 1 for testing other input sources below */
16061 static struct hda_input_mux alc272_nc10_capture_source = {
16064 { "Autoselect Mic", 0x0 },
16065 { "Internal Mic", 0x1 },
16066 { "In-0x02", 0x2 },
16067 { "In-0x03", 0x3 },
16068 { "In-0x04", 0x4 },
16069 { "In-0x05", 0x5 },
16070 { "In-0x06", 0x6 },
16071 { "In-0x07", 0x7 },
16072 { "In-0x08", 0x8 },
16073 { "In-0x09", 0x9 },
16074 { "In-0x0a", 0x0a },
16075 { "In-0x0b", 0x0b },
16076 { "In-0x0c", 0x0c },
16077 { "In-0x0d", 0x0d },
16078 { "In-0x0e", 0x0e },
16079 { "In-0x0f", 0x0f },
16087 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16094 static struct hda_verb alc662_3ST_ch2_init[] = {
16095 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16096 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16105 static struct hda_verb alc662_3ST_ch6_init[] = {
16106 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16107 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16108 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16109 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16110 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16111 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16115 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16116 { 2, alc662_3ST_ch2_init },
16117 { 6, alc662_3ST_ch6_init },
16123 static struct hda_verb alc662_sixstack_ch6_init[] = {
16124 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16125 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16126 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16133 static struct hda_verb alc662_sixstack_ch8_init[] = {
16134 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16135 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16136 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16140 static struct hda_channel_mode alc662_5stack_modes[2] = {
16141 { 2, alc662_sixstack_ch6_init },
16142 { 6, alc662_sixstack_ch8_init },
16145 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16146 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16149 static struct snd_kcontrol_new alc662_base_mixer[] = {
16150 /* output mixer control */
16151 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16152 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16153 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16154 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16155 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16156 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16157 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16158 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16159 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16161 /*Input mixer control */
16162 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16163 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16164 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16165 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16166 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16167 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16168 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16169 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16173 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16174 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16175 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16179 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16180 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16181 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16182 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16183 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16184 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16188 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16189 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16190 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16191 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16192 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16193 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16194 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16195 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16196 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16204 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16205 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16209 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16210 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16211 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16212 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16213 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16214 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16222 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16223 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16224 ALC262_HIPPO_MASTER_SWITCH,
16226 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16227 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16228 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16230 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16231 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16232 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16236 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16237 ALC262_HIPPO_MASTER_SWITCH,
16238 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16239 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16240 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16241 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16242 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16250 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16251 .ops = &snd_hda_bind_vol,
16253 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16254 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16259 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16260 .ops = &snd_hda_bind_sw,
16262 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16263 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16268 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16269 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16270 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16272 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16276 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16277 .ops = &snd_hda_bind_sw,
16279 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16280 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16281 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16286 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16287 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16288 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16289 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16290 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16291 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16292 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16297 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16298 .ops = &snd_hda_bind_sw,
16300 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16301 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16302 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16307 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16308 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16309 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16310 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16312 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16313 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16317 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16318 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16319 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16320 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16321 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16322 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16323 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16324 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16328 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16329 .ops = &snd_hda_bind_vol,
16331 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16332 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16337 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16338 .ops = &snd_hda_bind_sw,
16340 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16341 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16346 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16347 HDA_BIND_VOL("Master Playback Volume",
16348 &alc663_asus_two_bind_master_vol),
16349 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16350 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16357 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16358 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16359 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16361 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16362 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16363 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16367 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16370 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16371 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16376 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16377 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16381 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16382 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16383 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16384 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16386 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16387 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16388 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16389 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16390 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16391 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16395 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16396 .ops = &snd_hda_bind_sw,
16398 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16399 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16400 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16401 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16402 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16407 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16408 .ops = &snd_hda_bind_sw,
16410 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16411 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16416 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16417 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16418 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16419 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16420 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16421 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16422 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16423 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16424 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16425 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16429 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16430 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16431 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16432 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16433 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16434 HDA_CODEC_MUTE("Headphone2 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),
16441 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16444 .name = "Channel Mode",
16445 .info = alc_ch_mode_info,
16446 .get = alc_ch_mode_get,
16447 .put = alc_ch_mode_put,
16452 static struct hda_verb alc662_init_verbs[] = {
16453 /* ADC: mute amp left and right */
16454 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16455 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16456 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16461 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16462 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16464 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16467 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16468 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16469 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16471 /* Front Pin: output 0 (0x0c) */
16472 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16473 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16475 /* Rear Pin: output 1 (0x0d) */
16476 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16477 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16479 /* CLFE Pin: output 2 (0x0e) */
16480 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16481 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16483 /* Mic (rear) pin: input vref at 80% */
16484 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16485 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16486 /* Front Mic pin: input vref at 80% */
16487 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16488 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16489 /* Line In pin: input */
16490 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16491 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16492 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16493 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16494 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16495 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16496 /* CD pin widget for input */
16497 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16499 /* FIXME: use matrix-type input source selection */
16500 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16502 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16505 /* always trun on EAPD */
16506 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16507 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16512 static struct hda_verb alc662_sue_init_verbs[] = {
16513 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16514 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16518 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16519 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16520 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16524 /* Set Unsolicited Event*/
16525 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16527 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16532 * generic initialization of ADC, input mixers and output mixers
16534 static struct hda_verb alc662_auto_init_verbs[] = {
16536 * Unmute ADC and set the default input to mic-in
16538 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16541 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16543 * Note: PASD motherboards uses the Line In 2 as the input for front
16544 * panel mic (mic 2)
16546 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16550 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16551 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16554 * Set up output mixers (0x0c - 0x0f)
16556 /* set vol=0 to output mixers */
16557 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16558 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16559 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16561 /* set up input amps for analog loopback */
16562 /* Amp Indices: DAC = 0, mixer = 1 */
16563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16564 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16571 /* FIXME: use matrix-type input source selection */
16572 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16574 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16575 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16579 /* additional verbs for ALC663 */
16580 static struct hda_verb alc663_auto_init_verbs[] = {
16581 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16582 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16586 static struct hda_verb alc663_m51va_init_verbs[] = {
16587 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16589 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16590 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16591 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16594 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16595 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16599 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16600 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16601 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16602 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16603 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16606 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16610 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16612 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16613 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16614 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16615 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16617 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16618 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16622 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16623 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16624 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16625 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16626 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16627 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16628 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16629 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16633 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16634 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16635 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16636 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16637 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16638 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16639 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16640 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16641 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16642 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
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},
16645 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16649 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16651 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16652 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16653 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16654 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16655 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16656 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16657 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16658 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16659 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16660 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16661 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16665 static struct hda_verb alc663_g71v_init_verbs[] = {
16666 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16667 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16668 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16670 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16671 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16672 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16674 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16675 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16676 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16680 static struct hda_verb alc663_g50v_init_verbs[] = {
16681 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16682 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16683 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16685 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16686 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16690 static struct hda_verb alc662_ecs_init_verbs[] = {
16691 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16692 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16693 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16694 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16698 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16699 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16700 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16701 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16702 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16703 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16704 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16705 {0x21, 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(9)},
16708 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16709 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16713 static struct hda_verb alc272_dell_init_verbs[] = {
16714 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16715 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16716 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16717 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16718 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16719 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16720 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16721 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16723 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16724 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16728 static struct hda_verb alc663_mode7_init_verbs[] = {
16729 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16731 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16732 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16734 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16735 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16736 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16737 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16738 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16739 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16740 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16741 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16742 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16743 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16747 static struct hda_verb alc663_mode8_init_verbs[] = {
16748 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16749 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16750 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16751 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16752 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16753 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16756 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16757 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16758 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16759 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16760 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16761 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16762 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16763 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16767 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16768 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16769 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16773 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16774 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16775 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16779 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16781 unsigned int present;
16782 unsigned char bits;
16784 present = snd_hda_jack_detect(codec, 0x14);
16785 bits = present ? HDA_AMP_MUTE : 0;
16787 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16788 HDA_AMP_MUTE, bits);
16791 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16793 unsigned int present;
16794 unsigned char bits;
16796 present = snd_hda_jack_detect(codec, 0x1b);
16797 bits = present ? HDA_AMP_MUTE : 0;
16799 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16800 HDA_AMP_MUTE, bits);
16801 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16802 HDA_AMP_MUTE, bits);
16805 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16808 if ((res >> 26) == ALC880_HP_EVENT)
16809 alc662_lenovo_101e_all_automute(codec);
16810 if ((res >> 26) == ALC880_FRONT_EVENT)
16811 alc662_lenovo_101e_ispeaker_automute(codec);
16814 /* unsolicited event for HP jack sensing */
16815 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16818 if ((res >> 26) == ALC880_MIC_EVENT)
16819 alc_mic_automute(codec);
16821 alc262_hippo_unsol_event(codec, res);
16824 static void alc662_eeepc_setup(struct hda_codec *codec)
16826 struct alc_spec *spec = codec->spec;
16828 alc262_hippo1_setup(codec);
16829 spec->ext_mic.pin = 0x18;
16830 spec->ext_mic.mux_idx = 0;
16831 spec->int_mic.pin = 0x19;
16832 spec->int_mic.mux_idx = 1;
16833 spec->auto_mic = 1;
16836 static void alc662_eeepc_inithook(struct hda_codec *codec)
16838 alc262_hippo_automute(codec);
16839 alc_mic_automute(codec);
16842 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16844 struct alc_spec *spec = codec->spec;
16846 spec->autocfg.hp_pins[0] = 0x14;
16847 spec->autocfg.speaker_pins[0] = 0x1b;
16850 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16852 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16854 unsigned int present;
16855 unsigned char bits;
16857 present = snd_hda_jack_detect(codec, 0x21);
16858 bits = present ? HDA_AMP_MUTE : 0;
16859 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16860 AMP_IN_MUTE(0), bits);
16861 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16862 AMP_IN_MUTE(0), bits);
16865 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16867 unsigned int present;
16868 unsigned char bits;
16870 present = snd_hda_jack_detect(codec, 0x21);
16871 bits = present ? HDA_AMP_MUTE : 0;
16872 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16873 AMP_IN_MUTE(0), bits);
16874 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16875 AMP_IN_MUTE(0), bits);
16876 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16877 AMP_IN_MUTE(0), bits);
16878 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16879 AMP_IN_MUTE(0), bits);
16882 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16884 unsigned int present;
16885 unsigned char bits;
16887 present = snd_hda_jack_detect(codec, 0x15);
16888 bits = present ? HDA_AMP_MUTE : 0;
16889 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16890 AMP_IN_MUTE(0), bits);
16891 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16892 AMP_IN_MUTE(0), bits);
16893 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16894 AMP_IN_MUTE(0), bits);
16895 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16896 AMP_IN_MUTE(0), bits);
16899 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16901 unsigned int present;
16902 unsigned char bits;
16904 present = snd_hda_jack_detect(codec, 0x1b);
16905 bits = present ? 0 : PIN_OUT;
16906 snd_hda_codec_write(codec, 0x14, 0,
16907 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16910 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16912 unsigned int present1, present2;
16914 present1 = snd_hda_jack_detect(codec, 0x21);
16915 present2 = snd_hda_jack_detect(codec, 0x15);
16917 if (present1 || present2) {
16918 snd_hda_codec_write_cache(codec, 0x14, 0,
16919 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16921 snd_hda_codec_write_cache(codec, 0x14, 0,
16922 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16926 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16928 unsigned int present1, present2;
16930 present1 = snd_hda_jack_detect(codec, 0x1b);
16931 present2 = snd_hda_jack_detect(codec, 0x15);
16933 if (present1 || present2) {
16934 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16935 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16936 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16937 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16939 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16940 AMP_IN_MUTE(0), 0);
16941 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16942 AMP_IN_MUTE(0), 0);
16946 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16948 unsigned int present1, present2;
16950 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16951 AC_VERB_GET_PIN_SENSE, 0)
16952 & AC_PINSENSE_PRESENCE;
16953 present2 = snd_hda_codec_read(codec, 0x21, 0,
16954 AC_VERB_GET_PIN_SENSE, 0)
16955 & AC_PINSENSE_PRESENCE;
16957 if (present1 || present2) {
16958 snd_hda_codec_write_cache(codec, 0x14, 0,
16959 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16960 snd_hda_codec_write_cache(codec, 0x17, 0,
16961 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16963 snd_hda_codec_write_cache(codec, 0x14, 0,
16964 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16965 snd_hda_codec_write_cache(codec, 0x17, 0,
16966 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16970 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16972 unsigned int present1, present2;
16974 present1 = snd_hda_codec_read(codec, 0x21, 0,
16975 AC_VERB_GET_PIN_SENSE, 0)
16976 & AC_PINSENSE_PRESENCE;
16977 present2 = snd_hda_codec_read(codec, 0x15, 0,
16978 AC_VERB_GET_PIN_SENSE, 0)
16979 & AC_PINSENSE_PRESENCE;
16981 if (present1 || present2) {
16982 snd_hda_codec_write_cache(codec, 0x14, 0,
16983 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16984 snd_hda_codec_write_cache(codec, 0x17, 0,
16985 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16987 snd_hda_codec_write_cache(codec, 0x14, 0,
16988 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16989 snd_hda_codec_write_cache(codec, 0x17, 0,
16990 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16994 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16997 switch (res >> 26) {
16998 case ALC880_HP_EVENT:
16999 alc663_m51va_speaker_automute(codec);
17001 case ALC880_MIC_EVENT:
17002 alc_mic_automute(codec);
17007 static void alc663_m51va_setup(struct hda_codec *codec)
17009 struct alc_spec *spec = codec->spec;
17010 spec->ext_mic.pin = 0x18;
17011 spec->ext_mic.mux_idx = 0;
17012 spec->int_mic.pin = 0x12;
17013 spec->int_mic.mux_idx = 9;
17014 spec->auto_mic = 1;
17017 static void alc663_m51va_inithook(struct hda_codec *codec)
17019 alc663_m51va_speaker_automute(codec);
17020 alc_mic_automute(codec);
17023 /* ***************** Mode1 ******************************/
17024 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17026 static void alc663_mode1_setup(struct hda_codec *codec)
17028 struct alc_spec *spec = codec->spec;
17029 spec->ext_mic.pin = 0x18;
17030 spec->ext_mic.mux_idx = 0;
17031 spec->int_mic.pin = 0x19;
17032 spec->int_mic.mux_idx = 1;
17033 spec->auto_mic = 1;
17036 #define alc663_mode1_inithook alc663_m51va_inithook
17038 /* ***************** Mode2 ******************************/
17039 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17042 switch (res >> 26) {
17043 case ALC880_HP_EVENT:
17044 alc662_f5z_speaker_automute(codec);
17046 case ALC880_MIC_EVENT:
17047 alc_mic_automute(codec);
17052 #define alc662_mode2_setup alc663_mode1_setup
17054 static void alc662_mode2_inithook(struct hda_codec *codec)
17056 alc662_f5z_speaker_automute(codec);
17057 alc_mic_automute(codec);
17059 /* ***************** Mode3 ******************************/
17060 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17063 switch (res >> 26) {
17064 case ALC880_HP_EVENT:
17065 alc663_two_hp_m1_speaker_automute(codec);
17067 case ALC880_MIC_EVENT:
17068 alc_mic_automute(codec);
17073 #define alc663_mode3_setup alc663_mode1_setup
17075 static void alc663_mode3_inithook(struct hda_codec *codec)
17077 alc663_two_hp_m1_speaker_automute(codec);
17078 alc_mic_automute(codec);
17080 /* ***************** Mode4 ******************************/
17081 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17084 switch (res >> 26) {
17085 case ALC880_HP_EVENT:
17086 alc663_21jd_two_speaker_automute(codec);
17088 case ALC880_MIC_EVENT:
17089 alc_mic_automute(codec);
17094 #define alc663_mode4_setup alc663_mode1_setup
17096 static void alc663_mode4_inithook(struct hda_codec *codec)
17098 alc663_21jd_two_speaker_automute(codec);
17099 alc_mic_automute(codec);
17101 /* ***************** Mode5 ******************************/
17102 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17105 switch (res >> 26) {
17106 case ALC880_HP_EVENT:
17107 alc663_15jd_two_speaker_automute(codec);
17109 case ALC880_MIC_EVENT:
17110 alc_mic_automute(codec);
17115 #define alc663_mode5_setup alc663_mode1_setup
17117 static void alc663_mode5_inithook(struct hda_codec *codec)
17119 alc663_15jd_two_speaker_automute(codec);
17120 alc_mic_automute(codec);
17122 /* ***************** Mode6 ******************************/
17123 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17126 switch (res >> 26) {
17127 case ALC880_HP_EVENT:
17128 alc663_two_hp_m2_speaker_automute(codec);
17130 case ALC880_MIC_EVENT:
17131 alc_mic_automute(codec);
17136 #define alc663_mode6_setup alc663_mode1_setup
17138 static void alc663_mode6_inithook(struct hda_codec *codec)
17140 alc663_two_hp_m2_speaker_automute(codec);
17141 alc_mic_automute(codec);
17144 /* ***************** Mode7 ******************************/
17145 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17148 switch (res >> 26) {
17149 case ALC880_HP_EVENT:
17150 alc663_two_hp_m7_speaker_automute(codec);
17152 case ALC880_MIC_EVENT:
17153 alc_mic_automute(codec);
17158 #define alc663_mode7_setup alc663_mode1_setup
17160 static void alc663_mode7_inithook(struct hda_codec *codec)
17162 alc663_two_hp_m7_speaker_automute(codec);
17163 alc_mic_automute(codec);
17166 /* ***************** Mode8 ******************************/
17167 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17170 switch (res >> 26) {
17171 case ALC880_HP_EVENT:
17172 alc663_two_hp_m8_speaker_automute(codec);
17174 case ALC880_MIC_EVENT:
17175 alc_mic_automute(codec);
17180 #define alc663_mode8_setup alc663_m51va_setup
17182 static void alc663_mode8_inithook(struct hda_codec *codec)
17184 alc663_two_hp_m8_speaker_automute(codec);
17185 alc_mic_automute(codec);
17188 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17190 unsigned int present;
17191 unsigned char bits;
17193 present = snd_hda_jack_detect(codec, 0x21);
17194 bits = present ? HDA_AMP_MUTE : 0;
17195 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17196 HDA_AMP_MUTE, bits);
17197 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17198 HDA_AMP_MUTE, bits);
17201 static void alc663_g71v_front_automute(struct hda_codec *codec)
17203 unsigned int present;
17204 unsigned char bits;
17206 present = snd_hda_jack_detect(codec, 0x15);
17207 bits = present ? HDA_AMP_MUTE : 0;
17208 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17209 HDA_AMP_MUTE, bits);
17212 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17215 switch (res >> 26) {
17216 case ALC880_HP_EVENT:
17217 alc663_g71v_hp_automute(codec);
17219 case ALC880_FRONT_EVENT:
17220 alc663_g71v_front_automute(codec);
17222 case ALC880_MIC_EVENT:
17223 alc_mic_automute(codec);
17228 #define alc663_g71v_setup alc663_m51va_setup
17230 static void alc663_g71v_inithook(struct hda_codec *codec)
17232 alc663_g71v_front_automute(codec);
17233 alc663_g71v_hp_automute(codec);
17234 alc_mic_automute(codec);
17237 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17240 switch (res >> 26) {
17241 case ALC880_HP_EVENT:
17242 alc663_m51va_speaker_automute(codec);
17244 case ALC880_MIC_EVENT:
17245 alc_mic_automute(codec);
17250 #define alc663_g50v_setup alc663_m51va_setup
17252 static void alc663_g50v_inithook(struct hda_codec *codec)
17254 alc663_m51va_speaker_automute(codec);
17255 alc_mic_automute(codec);
17258 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17259 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17260 ALC262_HIPPO_MASTER_SWITCH,
17262 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17263 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17264 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17266 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17267 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17268 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17272 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17273 /* Master Playback automatically created from Speaker and Headphone */
17274 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17275 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17276 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17277 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17279 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17280 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17281 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17283 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17284 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17285 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17289 #ifdef CONFIG_SND_HDA_POWER_SAVE
17290 #define alc662_loopbacks alc880_loopbacks
17294 /* pcm configuration: identical with ALC880 */
17295 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17296 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17297 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17298 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17301 * configuration and preset
17303 static const char *alc662_models[ALC662_MODEL_LAST] = {
17304 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17305 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17306 [ALC662_3ST_6ch] = "3stack-6ch",
17307 [ALC662_5ST_DIG] = "6stack-dig",
17308 [ALC662_LENOVO_101E] = "lenovo-101e",
17309 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17310 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17311 [ALC662_ECS] = "ecs",
17312 [ALC663_ASUS_M51VA] = "m51va",
17313 [ALC663_ASUS_G71V] = "g71v",
17314 [ALC663_ASUS_H13] = "h13",
17315 [ALC663_ASUS_G50V] = "g50v",
17316 [ALC663_ASUS_MODE1] = "asus-mode1",
17317 [ALC662_ASUS_MODE2] = "asus-mode2",
17318 [ALC663_ASUS_MODE3] = "asus-mode3",
17319 [ALC663_ASUS_MODE4] = "asus-mode4",
17320 [ALC663_ASUS_MODE5] = "asus-mode5",
17321 [ALC663_ASUS_MODE6] = "asus-mode6",
17322 [ALC663_ASUS_MODE7] = "asus-mode7",
17323 [ALC663_ASUS_MODE8] = "asus-mode8",
17324 [ALC272_DELL] = "dell",
17325 [ALC272_DELL_ZM1] = "dell-zm1",
17326 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17327 [ALC662_AUTO] = "auto",
17330 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17331 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17332 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17333 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17334 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17335 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17336 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17337 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17338 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17339 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17340 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17341 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17342 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17343 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17344 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17345 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17346 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17347 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17348 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17349 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17350 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17351 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17352 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17353 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17354 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17355 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17356 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17357 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17358 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17359 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17360 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17361 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17362 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17363 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17364 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17365 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17366 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17367 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17368 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17369 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17370 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17371 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17372 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17373 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17374 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17375 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17376 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17377 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17378 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17379 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17380 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17381 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17382 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17383 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17384 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17385 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17386 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17387 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17388 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17389 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17390 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17391 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17392 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17393 ALC662_3ST_6ch_DIG),
17394 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17395 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17396 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17397 ALC662_3ST_6ch_DIG),
17398 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17399 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17400 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17401 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17402 ALC662_3ST_6ch_DIG),
17403 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17405 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17409 static struct alc_config_preset alc662_presets[] = {
17410 [ALC662_3ST_2ch_DIG] = {
17411 .mixers = { alc662_3ST_2ch_mixer },
17412 .init_verbs = { alc662_init_verbs },
17413 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17414 .dac_nids = alc662_dac_nids,
17415 .dig_out_nid = ALC662_DIGOUT_NID,
17416 .dig_in_nid = ALC662_DIGIN_NID,
17417 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17418 .channel_mode = alc662_3ST_2ch_modes,
17419 .input_mux = &alc662_capture_source,
17421 [ALC662_3ST_6ch_DIG] = {
17422 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17423 .init_verbs = { alc662_init_verbs },
17424 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17425 .dac_nids = alc662_dac_nids,
17426 .dig_out_nid = ALC662_DIGOUT_NID,
17427 .dig_in_nid = ALC662_DIGIN_NID,
17428 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17429 .channel_mode = alc662_3ST_6ch_modes,
17431 .input_mux = &alc662_capture_source,
17433 [ALC662_3ST_6ch] = {
17434 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17435 .init_verbs = { alc662_init_verbs },
17436 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17437 .dac_nids = alc662_dac_nids,
17438 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17439 .channel_mode = alc662_3ST_6ch_modes,
17441 .input_mux = &alc662_capture_source,
17443 [ALC662_5ST_DIG] = {
17444 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17445 .init_verbs = { alc662_init_verbs },
17446 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17447 .dac_nids = alc662_dac_nids,
17448 .dig_out_nid = ALC662_DIGOUT_NID,
17449 .dig_in_nid = ALC662_DIGIN_NID,
17450 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17451 .channel_mode = alc662_5stack_modes,
17452 .input_mux = &alc662_capture_source,
17454 [ALC662_LENOVO_101E] = {
17455 .mixers = { alc662_lenovo_101e_mixer },
17456 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17457 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17458 .dac_nids = alc662_dac_nids,
17459 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17460 .channel_mode = alc662_3ST_2ch_modes,
17461 .input_mux = &alc662_lenovo_101e_capture_source,
17462 .unsol_event = alc662_lenovo_101e_unsol_event,
17463 .init_hook = alc662_lenovo_101e_all_automute,
17465 [ALC662_ASUS_EEEPC_P701] = {
17466 .mixers = { alc662_eeepc_p701_mixer },
17467 .init_verbs = { alc662_init_verbs,
17468 alc662_eeepc_sue_init_verbs },
17469 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17470 .dac_nids = alc662_dac_nids,
17471 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17472 .channel_mode = alc662_3ST_2ch_modes,
17473 .unsol_event = alc662_eeepc_unsol_event,
17474 .setup = alc662_eeepc_setup,
17475 .init_hook = alc662_eeepc_inithook,
17477 [ALC662_ASUS_EEEPC_EP20] = {
17478 .mixers = { alc662_eeepc_ep20_mixer,
17479 alc662_chmode_mixer },
17480 .init_verbs = { alc662_init_verbs,
17481 alc662_eeepc_ep20_sue_init_verbs },
17482 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17483 .dac_nids = alc662_dac_nids,
17484 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17485 .channel_mode = alc662_3ST_6ch_modes,
17486 .input_mux = &alc662_lenovo_101e_capture_source,
17487 .unsol_event = alc662_eeepc_unsol_event,
17488 .setup = alc662_eeepc_ep20_setup,
17489 .init_hook = alc662_eeepc_ep20_inithook,
17492 .mixers = { alc662_ecs_mixer },
17493 .init_verbs = { alc662_init_verbs,
17494 alc662_ecs_init_verbs },
17495 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17498 .channel_mode = alc662_3ST_2ch_modes,
17499 .unsol_event = alc662_eeepc_unsol_event,
17500 .setup = alc662_eeepc_setup,
17501 .init_hook = alc662_eeepc_inithook,
17503 [ALC663_ASUS_M51VA] = {
17504 .mixers = { alc663_m51va_mixer },
17505 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17506 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17507 .dac_nids = alc662_dac_nids,
17508 .dig_out_nid = ALC662_DIGOUT_NID,
17509 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17510 .channel_mode = alc662_3ST_2ch_modes,
17511 .unsol_event = alc663_m51va_unsol_event,
17512 .setup = alc663_m51va_setup,
17513 .init_hook = alc663_m51va_inithook,
17515 [ALC663_ASUS_G71V] = {
17516 .mixers = { alc663_g71v_mixer },
17517 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17518 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17519 .dac_nids = alc662_dac_nids,
17520 .dig_out_nid = ALC662_DIGOUT_NID,
17521 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17522 .channel_mode = alc662_3ST_2ch_modes,
17523 .unsol_event = alc663_g71v_unsol_event,
17524 .setup = alc663_g71v_setup,
17525 .init_hook = alc663_g71v_inithook,
17527 [ALC663_ASUS_H13] = {
17528 .mixers = { alc663_m51va_mixer },
17529 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17530 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17531 .dac_nids = alc662_dac_nids,
17532 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17533 .channel_mode = alc662_3ST_2ch_modes,
17534 .unsol_event = alc663_m51va_unsol_event,
17535 .init_hook = alc663_m51va_inithook,
17537 [ALC663_ASUS_G50V] = {
17538 .mixers = { alc663_g50v_mixer },
17539 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17540 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17541 .dac_nids = alc662_dac_nids,
17542 .dig_out_nid = ALC662_DIGOUT_NID,
17543 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17544 .channel_mode = alc662_3ST_6ch_modes,
17545 .input_mux = &alc663_capture_source,
17546 .unsol_event = alc663_g50v_unsol_event,
17547 .setup = alc663_g50v_setup,
17548 .init_hook = alc663_g50v_inithook,
17550 [ALC663_ASUS_MODE1] = {
17551 .mixers = { alc663_m51va_mixer },
17552 .cap_mixer = alc662_auto_capture_mixer,
17553 .init_verbs = { alc662_init_verbs,
17554 alc663_21jd_amic_init_verbs },
17555 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17557 .dac_nids = alc662_dac_nids,
17558 .dig_out_nid = ALC662_DIGOUT_NID,
17559 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17560 .channel_mode = alc662_3ST_2ch_modes,
17561 .unsol_event = alc663_mode1_unsol_event,
17562 .setup = alc663_mode1_setup,
17563 .init_hook = alc663_mode1_inithook,
17565 [ALC662_ASUS_MODE2] = {
17566 .mixers = { alc662_1bjd_mixer },
17567 .cap_mixer = alc662_auto_capture_mixer,
17568 .init_verbs = { alc662_init_verbs,
17569 alc662_1bjd_amic_init_verbs },
17570 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17571 .dac_nids = alc662_dac_nids,
17572 .dig_out_nid = ALC662_DIGOUT_NID,
17573 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17574 .channel_mode = alc662_3ST_2ch_modes,
17575 .unsol_event = alc662_mode2_unsol_event,
17576 .setup = alc662_mode2_setup,
17577 .init_hook = alc662_mode2_inithook,
17579 [ALC663_ASUS_MODE3] = {
17580 .mixers = { alc663_two_hp_m1_mixer },
17581 .cap_mixer = alc662_auto_capture_mixer,
17582 .init_verbs = { alc662_init_verbs,
17583 alc663_two_hp_amic_m1_init_verbs },
17584 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17586 .dac_nids = alc662_dac_nids,
17587 .dig_out_nid = ALC662_DIGOUT_NID,
17588 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17589 .channel_mode = alc662_3ST_2ch_modes,
17590 .unsol_event = alc663_mode3_unsol_event,
17591 .setup = alc663_mode3_setup,
17592 .init_hook = alc663_mode3_inithook,
17594 [ALC663_ASUS_MODE4] = {
17595 .mixers = { alc663_asus_21jd_clfe_mixer },
17596 .cap_mixer = alc662_auto_capture_mixer,
17597 .init_verbs = { alc662_init_verbs,
17598 alc663_21jd_amic_init_verbs},
17599 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17601 .dac_nids = alc662_dac_nids,
17602 .dig_out_nid = ALC662_DIGOUT_NID,
17603 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17604 .channel_mode = alc662_3ST_2ch_modes,
17605 .unsol_event = alc663_mode4_unsol_event,
17606 .setup = alc663_mode4_setup,
17607 .init_hook = alc663_mode4_inithook,
17609 [ALC663_ASUS_MODE5] = {
17610 .mixers = { alc663_asus_15jd_clfe_mixer },
17611 .cap_mixer = alc662_auto_capture_mixer,
17612 .init_verbs = { alc662_init_verbs,
17613 alc663_15jd_amic_init_verbs },
17614 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17616 .dac_nids = alc662_dac_nids,
17617 .dig_out_nid = ALC662_DIGOUT_NID,
17618 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17619 .channel_mode = alc662_3ST_2ch_modes,
17620 .unsol_event = alc663_mode5_unsol_event,
17621 .setup = alc663_mode5_setup,
17622 .init_hook = alc663_mode5_inithook,
17624 [ALC663_ASUS_MODE6] = {
17625 .mixers = { alc663_two_hp_m2_mixer },
17626 .cap_mixer = alc662_auto_capture_mixer,
17627 .init_verbs = { alc662_init_verbs,
17628 alc663_two_hp_amic_m2_init_verbs },
17629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17631 .dac_nids = alc662_dac_nids,
17632 .dig_out_nid = ALC662_DIGOUT_NID,
17633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17634 .channel_mode = alc662_3ST_2ch_modes,
17635 .unsol_event = alc663_mode6_unsol_event,
17636 .setup = alc663_mode6_setup,
17637 .init_hook = alc663_mode6_inithook,
17639 [ALC663_ASUS_MODE7] = {
17640 .mixers = { alc663_mode7_mixer },
17641 .cap_mixer = alc662_auto_capture_mixer,
17642 .init_verbs = { alc662_init_verbs,
17643 alc663_mode7_init_verbs },
17644 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17646 .dac_nids = alc662_dac_nids,
17647 .dig_out_nid = ALC662_DIGOUT_NID,
17648 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17649 .channel_mode = alc662_3ST_2ch_modes,
17650 .unsol_event = alc663_mode7_unsol_event,
17651 .setup = alc663_mode7_setup,
17652 .init_hook = alc663_mode7_inithook,
17654 [ALC663_ASUS_MODE8] = {
17655 .mixers = { alc663_mode8_mixer },
17656 .cap_mixer = alc662_auto_capture_mixer,
17657 .init_verbs = { alc662_init_verbs,
17658 alc663_mode8_init_verbs },
17659 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17661 .dac_nids = alc662_dac_nids,
17662 .dig_out_nid = ALC662_DIGOUT_NID,
17663 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17664 .channel_mode = alc662_3ST_2ch_modes,
17665 .unsol_event = alc663_mode8_unsol_event,
17666 .setup = alc663_mode8_setup,
17667 .init_hook = alc663_mode8_inithook,
17670 .mixers = { alc663_m51va_mixer },
17671 .cap_mixer = alc272_auto_capture_mixer,
17672 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17673 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17674 .dac_nids = alc662_dac_nids,
17675 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17676 .adc_nids = alc272_adc_nids,
17677 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17678 .capsrc_nids = alc272_capsrc_nids,
17679 .channel_mode = alc662_3ST_2ch_modes,
17680 .unsol_event = alc663_m51va_unsol_event,
17681 .setup = alc663_m51va_setup,
17682 .init_hook = alc663_m51va_inithook,
17684 [ALC272_DELL_ZM1] = {
17685 .mixers = { alc663_m51va_mixer },
17686 .cap_mixer = alc662_auto_capture_mixer,
17687 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17688 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17689 .dac_nids = alc662_dac_nids,
17690 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17691 .adc_nids = alc662_adc_nids,
17693 .capsrc_nids = alc662_capsrc_nids,
17694 .channel_mode = alc662_3ST_2ch_modes,
17695 .unsol_event = alc663_m51va_unsol_event,
17696 .setup = alc663_m51va_setup,
17697 .init_hook = alc663_m51va_inithook,
17699 [ALC272_SAMSUNG_NC10] = {
17700 .mixers = { alc272_nc10_mixer },
17701 .init_verbs = { alc662_init_verbs,
17702 alc663_21jd_amic_init_verbs },
17703 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17704 .dac_nids = alc272_dac_nids,
17705 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17706 .channel_mode = alc662_3ST_2ch_modes,
17707 /*.input_mux = &alc272_nc10_capture_source,*/
17708 .unsol_event = alc663_mode4_unsol_event,
17709 .setup = alc663_mode4_setup,
17710 .init_hook = alc663_mode4_inithook,
17716 * BIOS auto configuration
17719 /* convert from MIX nid to DAC */
17720 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17724 else if (nid >= 0x0c && nid <= 0x0e)
17725 return nid - 0x0c + 0x02;
17730 /* get MIX nid connected to the given pin targeted to DAC */
17731 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17737 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17738 for (i = 0; i < num; i++) {
17739 if (alc662_mix_to_dac(mix[i]) == dac)
17745 /* look for an empty DAC slot */
17746 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17748 struct alc_spec *spec = codec->spec;
17752 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17755 for (i = 0; i < num; i++) {
17756 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17759 for (j = 0; j < spec->multiout.num_dacs; j++)
17760 if (spec->multiout.dac_nids[j] == nid)
17762 if (j >= spec->multiout.num_dacs)
17768 /* fill in the dac_nids table from the parsed pin configuration */
17769 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17770 const struct auto_pin_cfg *cfg)
17772 struct alc_spec *spec = codec->spec;
17776 spec->multiout.dac_nids = spec->private_dac_nids;
17777 for (i = 0; i < cfg->line_outs; i++) {
17778 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17781 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17786 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17787 hda_nid_t nid, unsigned int chs)
17789 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17790 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17793 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17794 hda_nid_t nid, unsigned int chs)
17796 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17797 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17800 #define alc662_add_stereo_vol(spec, pfx, nid) \
17801 alc662_add_vol_ctl(spec, pfx, nid, 3)
17802 #define alc662_add_stereo_sw(spec, pfx, nid) \
17803 alc662_add_sw_ctl(spec, pfx, nid, 3)
17805 /* add playback controls from the parsed DAC table */
17806 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17807 const struct auto_pin_cfg *cfg)
17809 struct alc_spec *spec = codec->spec;
17810 static const char *chname[4] = {
17811 "Front", "Surround", NULL /*CLFE*/, "Side"
17813 hda_nid_t nid, mix;
17816 for (i = 0; i < cfg->line_outs; i++) {
17817 nid = spec->multiout.dac_nids[i];
17820 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17825 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17828 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17831 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17834 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17839 if (cfg->line_outs == 1 &&
17840 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17847 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17850 if (cfg->line_outs == 1 &&
17851 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17853 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17861 /* add playback controls for speaker and HP outputs */
17862 /* return DAC nid if any new DAC is assigned */
17863 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17866 struct alc_spec *spec = codec->spec;
17867 hda_nid_t nid, mix;
17872 nid = alc662_look_for_dac(codec, pin);
17874 /* the corresponding DAC is already occupied */
17875 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17876 return 0; /* no way */
17877 /* create a switch only */
17878 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17879 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17882 mix = alc662_dac_to_mix(codec, pin, nid);
17885 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17888 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17894 /* create playback/capture controls for input pins */
17895 #define alc662_auto_create_input_ctls \
17896 alc882_auto_create_input_ctls
17898 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17899 hda_nid_t nid, int pin_type,
17905 alc_set_pin_output(codec, nid, pin_type);
17906 /* need the manual connection? */
17907 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17910 for (i = 0; i < num; i++) {
17911 if (alc662_mix_to_dac(srcs[i]) != dac)
17913 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17918 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17920 struct alc_spec *spec = codec->spec;
17921 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17924 for (i = 0; i <= HDA_SIDE; i++) {
17925 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17927 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17928 spec->multiout.dac_nids[i]);
17932 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17934 struct alc_spec *spec = codec->spec;
17937 pin = spec->autocfg.hp_pins[0];
17939 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17940 spec->multiout.hp_nid);
17941 pin = spec->autocfg.speaker_pins[0];
17943 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17944 spec->multiout.extra_out_nid[0]);
17947 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17949 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17951 struct alc_spec *spec = codec->spec;
17954 for (i = 0; i < AUTO_PIN_LAST; i++) {
17955 hda_nid_t nid = spec->autocfg.input_pins[i];
17956 if (alc_is_input_pin(codec, nid)) {
17957 alc_set_input_pin(codec, nid, i);
17958 if (nid != ALC662_PIN_CD_NID &&
17959 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17960 snd_hda_codec_write(codec, nid, 0,
17961 AC_VERB_SET_AMP_GAIN_MUTE,
17967 #define alc662_auto_init_input_src alc882_auto_init_input_src
17969 static int alc662_parse_auto_config(struct hda_codec *codec)
17971 struct alc_spec *spec = codec->spec;
17973 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17975 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17979 if (!spec->autocfg.line_outs)
17980 return 0; /* can't find valid BIOS pin config */
17982 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17985 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17988 err = alc662_auto_create_extra_out(codec,
17989 spec->autocfg.speaker_pins[0],
17994 spec->multiout.extra_out_nid[0] = err;
17995 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
18000 spec->multiout.hp_nid = err;
18001 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18005 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18007 if (spec->autocfg.dig_outs)
18008 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18010 if (spec->kctls.list)
18011 add_mixer(spec, spec->kctls.list);
18013 spec->num_mux_defs = 1;
18014 spec->input_mux = &spec->private_imux[0];
18016 add_verb(spec, alc662_auto_init_verbs);
18017 if (codec->vendor_id == 0x10ec0663)
18018 add_verb(spec, alc663_auto_init_verbs);
18020 err = alc_auto_add_mic_boost(codec);
18024 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18029 /* additional initialization for auto-configuration model */
18030 static void alc662_auto_init(struct hda_codec *codec)
18032 struct alc_spec *spec = codec->spec;
18033 alc662_auto_init_multi_out(codec);
18034 alc662_auto_init_hp_out(codec);
18035 alc662_auto_init_analog_input(codec);
18036 alc662_auto_init_input_src(codec);
18037 if (spec->unsol_event)
18038 alc_inithook(codec);
18041 static int patch_alc662(struct hda_codec *codec)
18043 struct alc_spec *spec;
18044 int err, board_config;
18046 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18050 codec->spec = spec;
18052 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18054 if (alc_read_coef_idx(codec, 0)==0x8020){
18055 kfree(codec->chip_name);
18056 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18057 if (!codec->chip_name) {
18063 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18066 if (board_config < 0) {
18067 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18069 board_config = ALC662_AUTO;
18072 if (board_config == ALC662_AUTO) {
18073 /* automatic parse from the BIOS config */
18074 err = alc662_parse_auto_config(codec);
18080 "hda_codec: Cannot set up configuration "
18081 "from BIOS. Using base mode...\n");
18082 board_config = ALC662_3ST_2ch_DIG;
18086 err = snd_hda_attach_beep_device(codec, 0x1);
18092 if (board_config != ALC662_AUTO)
18093 setup_preset(codec, &alc662_presets[board_config]);
18095 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18096 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18098 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18099 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18101 if (!spec->adc_nids) {
18102 spec->adc_nids = alc662_adc_nids;
18103 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18105 if (!spec->capsrc_nids)
18106 spec->capsrc_nids = alc662_capsrc_nids;
18108 if (!spec->cap_mixer)
18109 set_capture_mixer(codec);
18110 if (codec->vendor_id == 0x10ec0662)
18111 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18113 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18115 spec->vmaster_nid = 0x02;
18117 codec->patch_ops = alc_patch_ops;
18118 if (board_config == ALC662_AUTO)
18119 spec->init_hook = alc662_auto_init;
18120 #ifdef CONFIG_SND_HDA_POWER_SAVE
18121 if (!spec->loopback.amplist)
18122 spec->loopback.amplist = alc662_loopbacks;
18124 codec->proc_widget_hook = print_realtek_coef;
18129 static int patch_alc888(struct hda_codec *codec)
18131 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18132 kfree(codec->chip_name);
18133 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18134 if (!codec->chip_name) {
18138 return patch_alc662(codec);
18140 return patch_alc882(codec);
18146 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18147 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18148 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18149 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18150 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18151 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18152 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18153 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18154 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18155 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18156 .patch = patch_alc861 },
18157 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18158 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18159 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18160 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18161 .patch = patch_alc882 },
18162 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18163 .patch = patch_alc662 },
18164 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18165 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18166 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18167 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18168 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18169 .patch = patch_alc882 },
18170 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18171 .patch = patch_alc882 },
18172 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18173 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18174 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18175 .patch = patch_alc882 },
18176 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18177 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18178 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18179 {} /* terminator */
18182 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18184 MODULE_LICENSE("GPL");
18185 MODULE_DESCRIPTION("Realtek HD-audio codec");
18187 static struct hda_codec_preset_list realtek_list = {
18188 .preset = snd_hda_preset_realtek,
18189 .owner = THIS_MODULE,
18192 static int __init patch_realtek_init(void)
18194 return snd_hda_add_codec_preset(&realtek_list);
18197 static void __exit patch_realtek_exit(void)
18199 snd_hda_delete_codec_preset(&realtek_list);
18202 module_init(patch_realtek_init)
18203 module_exit(patch_realtek_exit)