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, int power);
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, int power);
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;
1838 #ifdef CONFIG_SND_HDA_POWER_SAVE
1839 static void alc889_power_eapd(struct hda_codec *codec, int power)
1841 snd_hda_codec_write(codec, 0x14, 0,
1842 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1843 snd_hda_codec_write(codec, 0x15, 0,
1844 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1849 * ALC880 3-stack model
1851 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1852 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1853 * F-Mic = 0x1b, HP = 0x19
1856 static hda_nid_t alc880_dac_nids[4] = {
1857 /* front, rear, clfe, rear_surr */
1858 0x02, 0x05, 0x04, 0x03
1861 static hda_nid_t alc880_adc_nids[3] = {
1866 /* The datasheet says the node 0x07 is connected from inputs,
1867 * but it shows zero connection in the real implementation on some devices.
1868 * Note: this is a 915GAV bug, fixed on 915GLV
1870 static hda_nid_t alc880_adc_nids_alt[2] = {
1875 #define ALC880_DIGOUT_NID 0x06
1876 #define ALC880_DIGIN_NID 0x0a
1878 static struct hda_input_mux alc880_capture_source = {
1882 { "Front Mic", 0x3 },
1888 /* channel source setting (2/6 channel selection for 3-stack) */
1890 static struct hda_verb alc880_threestack_ch2_init[] = {
1891 /* set line-in to input, mute it */
1892 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1893 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1894 /* set mic-in to input vref 80%, mute it */
1895 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1896 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1901 static struct hda_verb alc880_threestack_ch6_init[] = {
1902 /* set line-in to output, unmute it */
1903 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1904 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1905 /* set mic-in to output, unmute it */
1906 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1907 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1911 static struct hda_channel_mode alc880_threestack_modes[2] = {
1912 { 2, alc880_threestack_ch2_init },
1913 { 6, alc880_threestack_ch6_init },
1916 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1919 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1920 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1931 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1932 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1933 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1936 .name = "Channel Mode",
1937 .info = alc_ch_mode_info,
1938 .get = alc_ch_mode_get,
1939 .put = alc_ch_mode_put,
1944 /* capture mixer elements */
1945 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1946 struct snd_ctl_elem_info *uinfo)
1948 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1949 struct alc_spec *spec = codec->spec;
1952 mutex_lock(&codec->control_mutex);
1953 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1955 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1956 mutex_unlock(&codec->control_mutex);
1960 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1961 unsigned int size, unsigned int __user *tlv)
1963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1964 struct alc_spec *spec = codec->spec;
1967 mutex_lock(&codec->control_mutex);
1968 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1970 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1971 mutex_unlock(&codec->control_mutex);
1975 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol);
1978 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1979 struct snd_ctl_elem_value *ucontrol,
1982 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1983 struct alc_spec *spec = codec->spec;
1984 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1987 mutex_lock(&codec->control_mutex);
1988 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1990 err = func(kcontrol, ucontrol);
1991 mutex_unlock(&codec->control_mutex);
1995 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1996 struct snd_ctl_elem_value *ucontrol)
1998 return alc_cap_getput_caller(kcontrol, ucontrol,
1999 snd_hda_mixer_amp_volume_get);
2002 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2003 struct snd_ctl_elem_value *ucontrol)
2005 return alc_cap_getput_caller(kcontrol, ucontrol,
2006 snd_hda_mixer_amp_volume_put);
2009 /* capture mixer elements */
2010 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2012 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2013 struct snd_ctl_elem_value *ucontrol)
2015 return alc_cap_getput_caller(kcontrol, ucontrol,
2016 snd_hda_mixer_amp_switch_get);
2019 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2020 struct snd_ctl_elem_value *ucontrol)
2022 return alc_cap_getput_caller(kcontrol, ucontrol,
2023 snd_hda_mixer_amp_switch_put);
2026 #define _DEFINE_CAPMIX(num) \
2028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2029 .name = "Capture Switch", \
2030 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2032 .info = alc_cap_sw_info, \
2033 .get = alc_cap_sw_get, \
2034 .put = alc_cap_sw_put, \
2037 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2038 .name = "Capture Volume", \
2039 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2040 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2041 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2043 .info = alc_cap_vol_info, \
2044 .get = alc_cap_vol_get, \
2045 .put = alc_cap_vol_put, \
2046 .tlv = { .c = alc_cap_vol_tlv }, \
2049 #define _DEFINE_CAPSRC(num) \
2051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2052 /* .name = "Capture Source", */ \
2053 .name = "Input Source", \
2055 .info = alc_mux_enum_info, \
2056 .get = alc_mux_enum_get, \
2057 .put = alc_mux_enum_put, \
2060 #define DEFINE_CAPMIX(num) \
2061 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2062 _DEFINE_CAPMIX(num), \
2063 _DEFINE_CAPSRC(num), \
2067 #define DEFINE_CAPMIX_NOSRC(num) \
2068 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2069 _DEFINE_CAPMIX(num), \
2073 /* up to three ADCs */
2077 DEFINE_CAPMIX_NOSRC(1);
2078 DEFINE_CAPMIX_NOSRC(2);
2079 DEFINE_CAPMIX_NOSRC(3);
2082 * ALC880 5-stack model
2084 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2086 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2087 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2090 /* additional mixers to alc880_three_stack_mixer */
2091 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2092 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2093 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2097 /* channel source setting (6/8 channel selection for 5-stack) */
2099 static struct hda_verb alc880_fivestack_ch6_init[] = {
2100 /* set line-in to input, mute it */
2101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2107 static struct hda_verb alc880_fivestack_ch8_init[] = {
2108 /* set line-in to output, unmute it */
2109 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2110 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2114 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2115 { 6, alc880_fivestack_ch6_init },
2116 { 8, alc880_fivestack_ch8_init },
2121 * ALC880 6-stack model
2123 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2124 * Side = 0x05 (0x0f)
2125 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2126 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2129 static hda_nid_t alc880_6st_dac_nids[4] = {
2130 /* front, rear, clfe, rear_surr */
2131 0x02, 0x03, 0x04, 0x05
2134 static struct hda_input_mux alc880_6stack_capture_source = {
2138 { "Front Mic", 0x1 },
2144 /* fixed 8-channels */
2145 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2149 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2150 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2151 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2152 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2153 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2154 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2155 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2156 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2157 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2158 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2159 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2166 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2167 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2170 .name = "Channel Mode",
2171 .info = alc_ch_mode_info,
2172 .get = alc_ch_mode_get,
2173 .put = alc_ch_mode_put,
2182 * W810 has rear IO for:
2185 * Center/LFE (DAC 04)
2188 * The system also has a pair of internal speakers, and a headphone jack.
2189 * These are both connected to Line2 on the codec, hence to DAC 02.
2191 * There is a variable resistor to control the speaker or headphone
2192 * volume. This is a hardware-only device without a software API.
2194 * Plugging headphones in will disable the internal speakers. This is
2195 * implemented in hardware, not via the driver using jack sense. In
2196 * a similar fashion, plugging into the rear socket marked "front" will
2197 * disable both the speakers and headphones.
2199 * For input, there's a microphone jack, and an "audio in" jack.
2200 * These may not do anything useful with this driver yet, because I
2201 * haven't setup any initialization verbs for these yet...
2204 static hda_nid_t alc880_w810_dac_nids[3] = {
2205 /* front, rear/surround, clfe */
2209 /* fixed 6 channels */
2210 static struct hda_channel_mode alc880_w810_modes[1] = {
2214 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2215 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2216 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2217 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2221 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2222 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2223 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2232 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2233 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2237 static hda_nid_t alc880_z71v_dac_nids[1] = {
2240 #define ALC880_Z71V_HP_DAC 0x03
2242 /* fixed 2 channels */
2243 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2247 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2248 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2249 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2251 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2252 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2253 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2261 * ALC880 F1734 model
2263 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2264 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2267 static hda_nid_t alc880_f1734_dac_nids[1] = {
2270 #define ALC880_F1734_HP_DAC 0x02
2272 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2274 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2275 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2284 static struct hda_input_mux alc880_f1734_capture_source = {
2296 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2297 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2298 * Mic = 0x18, Line = 0x1a
2301 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2302 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2304 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2306 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2308 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2320 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2321 .name = "Channel Mode",
2322 .info = alc_ch_mode_info,
2323 .get = alc_ch_mode_get,
2324 .put = alc_ch_mode_put,
2330 * ALC880 ASUS W1V model
2332 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2333 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2334 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2337 /* additional mixers to alc880_asus_mixer */
2338 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2339 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2340 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2345 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2350 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2354 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2359 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2363 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2365 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2368 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2369 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2371 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2377 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2378 .name = "Channel Mode",
2379 .info = alc_ch_mode_info,
2380 .get = alc_ch_mode_get,
2381 .put = alc_ch_mode_put,
2386 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2387 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2388 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2389 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2390 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2393 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2394 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2395 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2396 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2400 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2401 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2402 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2404 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2411 * virtual master controls
2415 * slave controls for virtual master
2417 static const char *alc_slave_vols[] = {
2418 "Front Playback Volume",
2419 "Surround Playback Volume",
2420 "Center Playback Volume",
2421 "LFE Playback Volume",
2422 "Side Playback Volume",
2423 "Headphone Playback Volume",
2424 "Speaker Playback Volume",
2425 "Mono Playback Volume",
2426 "Line-Out Playback Volume",
2427 "PCM Playback Volume",
2431 static const char *alc_slave_sws[] = {
2432 "Front Playback Switch",
2433 "Surround Playback Switch",
2434 "Center Playback Switch",
2435 "LFE Playback Switch",
2436 "Side Playback Switch",
2437 "Headphone Playback Switch",
2438 "Speaker Playback Switch",
2439 "Mono Playback Switch",
2440 "IEC958 Playback Switch",
2441 "Line-Out Playback Switch",
2442 "PCM Playback Switch",
2447 * build control elements
2450 #define NID_MAPPING (-1)
2452 #define SUBDEV_SPEAKER_ (0 << 6)
2453 #define SUBDEV_HP_ (1 << 6)
2454 #define SUBDEV_LINE_ (2 << 6)
2455 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2456 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2457 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2459 static void alc_free_kctls(struct hda_codec *codec);
2461 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2462 /* additional beep mixers; the actual parameters are overwritten at build */
2463 static struct snd_kcontrol_new alc_beep_mixer[] = {
2464 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2465 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2470 static int alc_build_controls(struct hda_codec *codec)
2472 struct alc_spec *spec = codec->spec;
2473 struct snd_kcontrol *kctl;
2474 struct snd_kcontrol_new *knew;
2479 for (i = 0; i < spec->num_mixers; i++) {
2480 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2484 if (spec->cap_mixer) {
2485 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2489 if (spec->multiout.dig_out_nid) {
2490 err = snd_hda_create_spdif_out_ctls(codec,
2491 spec->multiout.dig_out_nid);
2494 if (!spec->no_analog) {
2495 err = snd_hda_create_spdif_share_sw(codec,
2499 spec->multiout.share_spdif = 1;
2502 if (spec->dig_in_nid) {
2503 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2508 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2509 /* create beep controls if needed */
2510 if (spec->beep_amp) {
2511 struct snd_kcontrol_new *knew;
2512 for (knew = alc_beep_mixer; knew->name; knew++) {
2513 struct snd_kcontrol *kctl;
2514 kctl = snd_ctl_new1(knew, codec);
2517 kctl->private_value = spec->beep_amp;
2518 err = snd_hda_ctl_add(codec, 0, kctl);
2525 /* if we have no master control, let's create it */
2526 if (!spec->no_analog &&
2527 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2528 unsigned int vmaster_tlv[4];
2529 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2530 HDA_OUTPUT, vmaster_tlv);
2531 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2532 vmaster_tlv, alc_slave_vols);
2536 if (!spec->no_analog &&
2537 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2538 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2539 NULL, alc_slave_sws);
2544 alc_free_kctls(codec); /* no longer needed */
2546 /* assign Capture Source enums to NID */
2547 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2549 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2550 for (i = 0; kctl && i < kctl->count; i++) {
2551 hda_nid_t *nids = spec->capsrc_nids;
2553 nids = spec->adc_nids;
2554 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2558 if (spec->cap_mixer) {
2559 const char *kname = kctl ? kctl->id.name : NULL;
2560 for (knew = spec->cap_mixer; knew->name; knew++) {
2561 if (kname && strcmp(knew->name, kname) == 0)
2563 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2564 for (i = 0; kctl && i < kctl->count; i++) {
2565 err = snd_hda_add_nid(codec, kctl, i,
2573 /* other nid->control mapping */
2574 for (i = 0; i < spec->num_mixers; i++) {
2575 for (knew = spec->mixers[i]; knew->name; knew++) {
2576 if (knew->iface != NID_MAPPING)
2578 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2581 u = knew->subdevice;
2582 for (j = 0; j < 4; j++, u >>= 8) {
2587 case SUBDEV_SPEAKER_:
2588 nid = spec->autocfg.speaker_pins[nid];
2591 nid = spec->autocfg.line_out_pins[nid];
2594 nid = spec->autocfg.hp_pins[nid];
2599 err = snd_hda_add_nid(codec, kctl, 0, nid);
2603 u = knew->private_value;
2604 for (j = 0; j < 4; j++, u >>= 8) {
2608 err = snd_hda_add_nid(codec, kctl, 0, nid);
2619 * initialize the codec volumes, etc
2623 * generic initialization of ADC, input mixers and output mixers
2625 static struct hda_verb alc880_volume_init_verbs[] = {
2627 * Unmute ADC0-2 and set the default input to mic-in
2629 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2630 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2631 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2632 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2633 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2634 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2636 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2638 * Note: PASD motherboards uses the Line In 2 as the input for front
2641 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2651 * Set up output mixers (0x0c - 0x0f)
2653 /* set vol=0 to output mixers */
2654 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2655 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2656 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2657 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2658 /* set up input amps for analog loopback */
2659 /* Amp Indices: DAC = 0, mixer = 1 */
2660 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2662 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2664 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2673 * 3-stack pin configuration:
2674 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2676 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2678 * preset connection lists of input pins
2679 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2681 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2682 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2683 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2686 * Set pin mode and muting
2688 /* set front pin widgets 0x14 for output */
2689 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2690 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2691 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2692 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2693 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2694 /* Mic2 (as headphone out) for HP output */
2695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2697 /* Line In pin widget for input */
2698 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2699 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2700 /* Line2 (as front mic) pin widget for input and vref at 80% */
2701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2703 /* CD pin widget for input */
2704 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2710 * 5-stack pin configuration:
2711 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2712 * line-in/side = 0x1a, f-mic = 0x1b
2714 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2716 * preset connection lists of input pins
2717 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2719 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2720 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2723 * Set pin mode and muting
2725 /* set pin widgets 0x14-0x17 for output */
2726 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2730 /* unmute pins for output (no gain on this amp) */
2731 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2736 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2737 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2738 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2739 /* Mic2 (as headphone out) for HP output */
2740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2741 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2742 /* Line In pin widget for input */
2743 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2744 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2745 /* Line2 (as front mic) pin widget for input and vref at 80% */
2746 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2747 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2748 /* CD pin widget for input */
2749 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2755 * W810 pin configuration:
2756 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2758 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2759 /* hphone/speaker input selector: front DAC */
2760 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2762 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2763 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2764 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2765 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2766 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2767 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2769 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2770 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2776 * Z71V pin configuration:
2777 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2779 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2781 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2782 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2783 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2786 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2787 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2788 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2794 * 6-stack pin configuration:
2795 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2796 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2798 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2799 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2801 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2802 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2805 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2807 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2808 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2810 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2811 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2812 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2813 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2814 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2815 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2816 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2817 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2818 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2824 * Uniwill pin configuration:
2825 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2828 static struct hda_verb alc880_uniwill_init_verbs[] = {
2829 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2831 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2832 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2833 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2834 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2835 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2836 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2837 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2838 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2839 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2841 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2843 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2846 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2848 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2849 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2850 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2851 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2852 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2853 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2854 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2856 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2864 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2866 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2867 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2870 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2872 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2874 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2875 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2877 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2879 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2882 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2883 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2884 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2885 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2886 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2887 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2889 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2895 static struct hda_verb alc880_beep_init_verbs[] = {
2896 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2900 /* auto-toggle front mic */
2901 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2903 unsigned int present;
2906 present = snd_hda_jack_detect(codec, 0x18);
2907 bits = present ? HDA_AMP_MUTE : 0;
2908 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2911 static void alc880_uniwill_setup(struct hda_codec *codec)
2913 struct alc_spec *spec = codec->spec;
2915 spec->autocfg.hp_pins[0] = 0x14;
2916 spec->autocfg.speaker_pins[0] = 0x15;
2917 spec->autocfg.speaker_pins[0] = 0x16;
2920 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2922 alc_automute_amp(codec);
2923 alc880_uniwill_mic_automute(codec);
2926 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2929 /* Looks like the unsol event is incompatible with the standard
2930 * definition. 4bit tag is placed at 28 bit!
2932 switch (res >> 28) {
2933 case ALC880_MIC_EVENT:
2934 alc880_uniwill_mic_automute(codec);
2937 alc_automute_amp_unsol_event(codec, res);
2942 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2944 struct alc_spec *spec = codec->spec;
2946 spec->autocfg.hp_pins[0] = 0x14;
2947 spec->autocfg.speaker_pins[0] = 0x15;
2950 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2952 unsigned int present;
2954 present = snd_hda_codec_read(codec, 0x21, 0,
2955 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2956 present &= HDA_AMP_VOLMASK;
2957 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2958 HDA_AMP_VOLMASK, present);
2959 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2960 HDA_AMP_VOLMASK, present);
2963 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2966 /* Looks like the unsol event is incompatible with the standard
2967 * definition. 4bit tag is placed at 28 bit!
2969 if ((res >> 28) == ALC880_DCVOL_EVENT)
2970 alc880_uniwill_p53_dcvol_automute(codec);
2972 alc_automute_amp_unsol_event(codec, res);
2976 * F1734 pin configuration:
2977 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2979 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2980 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2981 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2982 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2983 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2984 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2988 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2989 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2991 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2992 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2997 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2998 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3001 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3002 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3008 * ASUS pin configuration:
3009 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3011 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3012 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3013 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3014 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3015 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3017 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3018 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3020 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3022 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3023 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3024 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3026 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3028 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3030 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3033 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3034 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3039 /* Enable GPIO mask and set output */
3040 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3041 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3042 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3044 /* Clevo m520g init */
3045 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3046 /* headphone output */
3047 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3050 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3052 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3053 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3056 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3057 /* Mic1 (rear panel) */
3058 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3059 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3060 /* Mic2 (front panel) */
3061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3062 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3065 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3066 /* change to EAPD mode */
3067 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3068 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3073 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3074 /* change to EAPD mode */
3075 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3076 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3078 /* Headphone output */
3079 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3081 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3082 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3084 /* Line In pin widget for input */
3085 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3086 /* CD pin widget for input */
3087 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3088 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3089 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3091 /* change to EAPD mode */
3092 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3093 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3099 * LG m1 express dual
3102 * Rear Line-In/Out (blue): 0x14
3103 * Build-in Mic-In: 0x15
3105 * HP-Out (green): 0x1b
3106 * Mic-In/Out (red): 0x19
3110 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3111 static hda_nid_t alc880_lg_dac_nids[3] = {
3115 /* seems analog CD is not working */
3116 static struct hda_input_mux alc880_lg_capture_source = {
3121 { "Internal Mic", 0x6 },
3125 /* 2,4,6 channel modes */
3126 static struct hda_verb alc880_lg_ch2_init[] = {
3127 /* set line-in and mic-in to input */
3128 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3129 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3133 static struct hda_verb alc880_lg_ch4_init[] = {
3134 /* set line-in to out and mic-in to input */
3135 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3136 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3140 static struct hda_verb alc880_lg_ch6_init[] = {
3141 /* set line-in and mic-in to output */
3142 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3143 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3147 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3148 { 2, alc880_lg_ch2_init },
3149 { 4, alc880_lg_ch4_init },
3150 { 6, alc880_lg_ch6_init },
3153 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3155 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3157 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3159 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3160 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3161 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3166 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3167 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3170 .name = "Channel Mode",
3171 .info = alc_ch_mode_info,
3172 .get = alc_ch_mode_get,
3173 .put = alc_ch_mode_put,
3178 static struct hda_verb alc880_lg_init_verbs[] = {
3179 /* set capture source to mic-in */
3180 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3181 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3182 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3183 /* mute all amp mixer inputs */
3184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3187 /* line-in to input */
3188 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3189 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3191 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3192 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3195 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3196 /* mic-in to input */
3197 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3198 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3199 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3201 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3202 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3203 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3209 /* toggle speaker-output according to the hp-jack state */
3210 static void alc880_lg_setup(struct hda_codec *codec)
3212 struct alc_spec *spec = codec->spec;
3214 spec->autocfg.hp_pins[0] = 0x1b;
3215 spec->autocfg.speaker_pins[0] = 0x17;
3224 * Built-in Mic-In: 0x19
3230 static struct hda_input_mux alc880_lg_lw_capture_source = {
3234 { "Internal Mic", 0x1 },
3239 #define alc880_lg_lw_modes alc880_threestack_modes
3241 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3243 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3244 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3245 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3246 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3247 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3248 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3249 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3254 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3255 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3257 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3258 .name = "Channel Mode",
3259 .info = alc_ch_mode_info,
3260 .get = alc_ch_mode_get,
3261 .put = alc_ch_mode_put,
3266 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3267 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3268 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3269 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3271 /* set capture source to mic-in */
3272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3273 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3274 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3275 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3277 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3278 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3281 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3282 /* mic-in to input */
3283 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3284 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3286 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3287 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3289 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3293 /* toggle speaker-output according to the hp-jack state */
3294 static void alc880_lg_lw_setup(struct hda_codec *codec)
3296 struct alc_spec *spec = codec->spec;
3298 spec->autocfg.hp_pins[0] = 0x1b;
3299 spec->autocfg.speaker_pins[0] = 0x14;
3302 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3303 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3304 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3306 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3307 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3308 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3312 static struct hda_input_mux alc880_medion_rim_capture_source = {
3316 { "Internal Mic", 0x1 },
3320 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3321 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3323 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3324 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3326 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3329 /* Mic2 (as headphone out) for HP output */
3330 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3331 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3332 /* Internal Speaker */
3333 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3334 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3336 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3337 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3339 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3343 /* toggle speaker-output according to the hp-jack state */
3344 static void alc880_medion_rim_automute(struct hda_codec *codec)
3346 struct alc_spec *spec = codec->spec;
3347 alc_automute_amp(codec);
3349 if (spec->jack_present)
3350 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3352 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3355 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3358 /* Looks like the unsol event is incompatible with the standard
3359 * definition. 4bit tag is placed at 28 bit!
3361 if ((res >> 28) == ALC880_HP_EVENT)
3362 alc880_medion_rim_automute(codec);
3365 static void alc880_medion_rim_setup(struct hda_codec *codec)
3367 struct alc_spec *spec = codec->spec;
3369 spec->autocfg.hp_pins[0] = 0x14;
3370 spec->autocfg.speaker_pins[0] = 0x1b;
3373 #ifdef CONFIG_SND_HDA_POWER_SAVE
3374 static struct hda_amp_list alc880_loopbacks[] = {
3375 { 0x0b, HDA_INPUT, 0 },
3376 { 0x0b, HDA_INPUT, 1 },
3377 { 0x0b, HDA_INPUT, 2 },
3378 { 0x0b, HDA_INPUT, 3 },
3379 { 0x0b, HDA_INPUT, 4 },
3383 static struct hda_amp_list alc880_lg_loopbacks[] = {
3384 { 0x0b, HDA_INPUT, 1 },
3385 { 0x0b, HDA_INPUT, 6 },
3386 { 0x0b, HDA_INPUT, 7 },
3395 static int alc_init(struct hda_codec *codec)
3397 struct alc_spec *spec = codec->spec;
3401 alc_auto_init_amp(codec, spec->init_amp);
3403 for (i = 0; i < spec->num_init_verbs; i++)
3404 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3406 if (spec->init_hook)
3407 spec->init_hook(codec);
3412 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3414 struct alc_spec *spec = codec->spec;
3416 if (spec->unsol_event)
3417 spec->unsol_event(codec, res);
3420 #ifdef CONFIG_SND_HDA_POWER_SAVE
3421 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3423 struct alc_spec *spec = codec->spec;
3424 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3429 * Analog playback callbacks
3431 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3432 struct hda_codec *codec,
3433 struct snd_pcm_substream *substream)
3435 struct alc_spec *spec = codec->spec;
3436 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3440 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3441 struct hda_codec *codec,
3442 unsigned int stream_tag,
3443 unsigned int format,
3444 struct snd_pcm_substream *substream)
3446 struct alc_spec *spec = codec->spec;
3447 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3448 stream_tag, format, substream);
3451 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3452 struct hda_codec *codec,
3453 struct snd_pcm_substream *substream)
3455 struct alc_spec *spec = codec->spec;
3456 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3462 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3463 struct hda_codec *codec,
3464 struct snd_pcm_substream *substream)
3466 struct alc_spec *spec = codec->spec;
3467 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3470 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3471 struct hda_codec *codec,
3472 unsigned int stream_tag,
3473 unsigned int format,
3474 struct snd_pcm_substream *substream)
3476 struct alc_spec *spec = codec->spec;
3477 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3478 stream_tag, format, substream);
3481 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3482 struct hda_codec *codec,
3483 struct snd_pcm_substream *substream)
3485 struct alc_spec *spec = codec->spec;
3486 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3489 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3490 struct hda_codec *codec,
3491 struct snd_pcm_substream *substream)
3493 struct alc_spec *spec = codec->spec;
3494 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3500 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3501 struct hda_codec *codec,
3502 unsigned int stream_tag,
3503 unsigned int format,
3504 struct snd_pcm_substream *substream)
3506 struct alc_spec *spec = codec->spec;
3508 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3509 stream_tag, 0, format);
3513 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3514 struct hda_codec *codec,
3515 struct snd_pcm_substream *substream)
3517 struct alc_spec *spec = codec->spec;
3519 snd_hda_codec_cleanup_stream(codec,
3520 spec->adc_nids[substream->number + 1]);
3527 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3531 /* NID is set in alc_build_pcms */
3533 .open = alc880_playback_pcm_open,
3534 .prepare = alc880_playback_pcm_prepare,
3535 .cleanup = alc880_playback_pcm_cleanup
3539 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3543 /* NID is set in alc_build_pcms */
3546 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3550 /* NID is set in alc_build_pcms */
3553 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3554 .substreams = 2, /* can be overridden */
3557 /* NID is set in alc_build_pcms */
3559 .prepare = alc880_alt_capture_pcm_prepare,
3560 .cleanup = alc880_alt_capture_pcm_cleanup
3564 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3568 /* NID is set in alc_build_pcms */
3570 .open = alc880_dig_playback_pcm_open,
3571 .close = alc880_dig_playback_pcm_close,
3572 .prepare = alc880_dig_playback_pcm_prepare,
3573 .cleanup = alc880_dig_playback_pcm_cleanup
3577 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3581 /* NID is set in alc_build_pcms */
3584 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3585 static struct hda_pcm_stream alc_pcm_null_stream = {
3591 static int alc_build_pcms(struct hda_codec *codec)
3593 struct alc_spec *spec = codec->spec;
3594 struct hda_pcm *info = spec->pcm_rec;
3597 codec->num_pcms = 1;
3598 codec->pcm_info = info;
3600 if (spec->no_analog)
3603 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3604 "%s Analog", codec->chip_name);
3605 info->name = spec->stream_name_analog;
3607 if (spec->stream_analog_playback) {
3608 if (snd_BUG_ON(!spec->multiout.dac_nids))
3610 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3613 if (spec->stream_analog_capture) {
3614 if (snd_BUG_ON(!spec->adc_nids))
3616 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3617 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3620 if (spec->channel_mode) {
3621 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3622 for (i = 0; i < spec->num_channel_mode; i++) {
3623 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3624 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3630 /* SPDIF for stream index #1 */
3631 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3632 snprintf(spec->stream_name_digital,
3633 sizeof(spec->stream_name_digital),
3634 "%s Digital", codec->chip_name);
3635 codec->num_pcms = 2;
3636 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3637 info = spec->pcm_rec + 1;
3638 info->name = spec->stream_name_digital;
3639 if (spec->dig_out_type)
3640 info->pcm_type = spec->dig_out_type;
3642 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3643 if (spec->multiout.dig_out_nid &&
3644 spec->stream_digital_playback) {
3645 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3646 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3648 if (spec->dig_in_nid &&
3649 spec->stream_digital_capture) {
3650 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3651 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3653 /* FIXME: do we need this for all Realtek codec models? */
3654 codec->spdif_status_reset = 1;
3657 if (spec->no_analog)
3660 /* If the use of more than one ADC is requested for the current
3661 * model, configure a second analog capture-only PCM.
3663 /* Additional Analaog capture for index #2 */
3664 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3665 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3666 codec->num_pcms = 3;
3667 info = spec->pcm_rec + 2;
3668 info->name = spec->stream_name_analog;
3669 if (spec->alt_dac_nid) {
3670 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3671 *spec->stream_analog_alt_playback;
3672 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3675 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3676 alc_pcm_null_stream;
3677 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3679 if (spec->num_adc_nids > 1) {
3680 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3681 *spec->stream_analog_alt_capture;
3682 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3684 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3685 spec->num_adc_nids - 1;
3687 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3688 alc_pcm_null_stream;
3689 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3696 static void alc_free_kctls(struct hda_codec *codec)
3698 struct alc_spec *spec = codec->spec;
3700 if (spec->kctls.list) {
3701 struct snd_kcontrol_new *kctl = spec->kctls.list;
3703 for (i = 0; i < spec->kctls.used; i++)
3704 kfree(kctl[i].name);
3706 snd_array_free(&spec->kctls);
3709 static void alc_free(struct hda_codec *codec)
3711 struct alc_spec *spec = codec->spec;
3716 alc_free_kctls(codec);
3718 snd_hda_detach_beep_device(codec);
3721 #ifdef CONFIG_SND_HDA_POWER_SAVE
3722 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3724 struct alc_spec *spec = codec->spec;
3725 if (spec && spec->power_hook)
3726 spec->power_hook(codec, 0);
3731 #ifdef SND_HDA_NEEDS_RESUME
3732 static int alc_resume(struct hda_codec *codec)
3734 #ifdef CONFIG_SND_HDA_POWER_SAVE
3735 struct alc_spec *spec = codec->spec;
3737 codec->patch_ops.init(codec);
3738 snd_hda_codec_resume_amp(codec);
3739 snd_hda_codec_resume_cache(codec);
3740 #ifdef CONFIG_SND_HDA_POWER_SAVE
3741 if (spec && spec->power_hook)
3742 spec->power_hook(codec, 1);
3750 static struct hda_codec_ops alc_patch_ops = {
3751 .build_controls = alc_build_controls,
3752 .build_pcms = alc_build_pcms,
3755 .unsol_event = alc_unsol_event,
3756 #ifdef SND_HDA_NEEDS_RESUME
3757 .resume = alc_resume,
3759 #ifdef CONFIG_SND_HDA_POWER_SAVE
3760 .suspend = alc_suspend,
3761 .check_power_status = alc_check_power_status,
3767 * Test configuration for debugging
3769 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3772 #ifdef CONFIG_SND_DEBUG
3773 static hda_nid_t alc880_test_dac_nids[4] = {
3774 0x02, 0x03, 0x04, 0x05
3777 static struct hda_input_mux alc880_test_capture_source = {
3786 { "Surround", 0x6 },
3790 static struct hda_channel_mode alc880_test_modes[4] = {
3797 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3798 struct snd_ctl_elem_info *uinfo)
3800 static char *texts[] = {
3801 "N/A", "Line Out", "HP Out",
3802 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3804 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3806 uinfo->value.enumerated.items = 8;
3807 if (uinfo->value.enumerated.item >= 8)
3808 uinfo->value.enumerated.item = 7;
3809 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3813 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3814 struct snd_ctl_elem_value *ucontrol)
3816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3817 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3818 unsigned int pin_ctl, item = 0;
3820 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3821 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3822 if (pin_ctl & AC_PINCTL_OUT_EN) {
3823 if (pin_ctl & AC_PINCTL_HP_EN)
3827 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3828 switch (pin_ctl & AC_PINCTL_VREFEN) {
3829 case AC_PINCTL_VREF_HIZ: item = 3; break;
3830 case AC_PINCTL_VREF_50: item = 4; break;
3831 case AC_PINCTL_VREF_GRD: item = 5; break;
3832 case AC_PINCTL_VREF_80: item = 6; break;
3833 case AC_PINCTL_VREF_100: item = 7; break;
3836 ucontrol->value.enumerated.item[0] = item;
3840 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3841 struct snd_ctl_elem_value *ucontrol)
3843 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3844 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3845 static unsigned int ctls[] = {
3846 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3847 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3848 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3849 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3850 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3851 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3853 unsigned int old_ctl, new_ctl;
3855 old_ctl = snd_hda_codec_read(codec, nid, 0,
3856 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3857 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3858 if (old_ctl != new_ctl) {
3860 snd_hda_codec_write_cache(codec, nid, 0,
3861 AC_VERB_SET_PIN_WIDGET_CONTROL,
3863 val = ucontrol->value.enumerated.item[0] >= 3 ?
3865 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3872 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3873 struct snd_ctl_elem_info *uinfo)
3875 static char *texts[] = {
3876 "Front", "Surround", "CLFE", "Side"
3878 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3880 uinfo->value.enumerated.items = 4;
3881 if (uinfo->value.enumerated.item >= 4)
3882 uinfo->value.enumerated.item = 3;
3883 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3887 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3888 struct snd_ctl_elem_value *ucontrol)
3890 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3891 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3894 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3895 ucontrol->value.enumerated.item[0] = sel & 3;
3899 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3900 struct snd_ctl_elem_value *ucontrol)
3902 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3903 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3906 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3907 if (ucontrol->value.enumerated.item[0] != sel) {
3908 sel = ucontrol->value.enumerated.item[0] & 3;
3909 snd_hda_codec_write_cache(codec, nid, 0,
3910 AC_VERB_SET_CONNECT_SEL, sel);
3916 #define PIN_CTL_TEST(xname,nid) { \
3917 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3919 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3920 .info = alc_test_pin_ctl_info, \
3921 .get = alc_test_pin_ctl_get, \
3922 .put = alc_test_pin_ctl_put, \
3923 .private_value = nid \
3926 #define PIN_SRC_TEST(xname,nid) { \
3927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3929 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3930 .info = alc_test_pin_src_info, \
3931 .get = alc_test_pin_src_get, \
3932 .put = alc_test_pin_src_put, \
3933 .private_value = nid \
3936 static struct snd_kcontrol_new alc880_test_mixer[] = {
3937 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3938 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3939 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3940 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3941 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3942 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3943 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3944 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3945 PIN_CTL_TEST("Front Pin Mode", 0x14),
3946 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3947 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3948 PIN_CTL_TEST("Side Pin Mode", 0x17),
3949 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3950 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3951 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3952 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3953 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3954 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3955 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3956 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3957 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3958 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3959 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3960 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3961 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3962 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3963 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3964 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3965 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3966 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3968 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3969 .name = "Channel Mode",
3970 .info = alc_ch_mode_info,
3971 .get = alc_ch_mode_get,
3972 .put = alc_ch_mode_put,
3977 static struct hda_verb alc880_test_init_verbs[] = {
3978 /* Unmute inputs of 0x0c - 0x0f */
3979 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3981 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3982 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3983 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3985 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3986 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3987 /* Vol output for 0x0c-0x0f */
3988 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3989 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3991 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3992 /* Set output pins 0x14-0x17 */
3993 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3994 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3995 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3996 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3997 /* Unmute output pins 0x14-0x17 */
3998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3999 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4000 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4001 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4002 /* Set input pins 0x18-0x1c */
4003 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4004 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4005 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4007 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4008 /* Mute input pins 0x18-0x1b */
4009 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4010 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4011 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4012 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4014 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4015 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4016 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4017 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4018 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4019 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4020 /* Analog input/passthru */
4021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4033 static const char *alc880_models[ALC880_MODEL_LAST] = {
4034 [ALC880_3ST] = "3stack",
4035 [ALC880_TCL_S700] = "tcl",
4036 [ALC880_3ST_DIG] = "3stack-digout",
4037 [ALC880_CLEVO] = "clevo",
4038 [ALC880_5ST] = "5stack",
4039 [ALC880_5ST_DIG] = "5stack-digout",
4040 [ALC880_W810] = "w810",
4041 [ALC880_Z71V] = "z71v",
4042 [ALC880_6ST] = "6stack",
4043 [ALC880_6ST_DIG] = "6stack-digout",
4044 [ALC880_ASUS] = "asus",
4045 [ALC880_ASUS_W1V] = "asus-w1v",
4046 [ALC880_ASUS_DIG] = "asus-dig",
4047 [ALC880_ASUS_DIG2] = "asus-dig2",
4048 [ALC880_UNIWILL_DIG] = "uniwill",
4049 [ALC880_UNIWILL_P53] = "uniwill-p53",
4050 [ALC880_FUJITSU] = "fujitsu",
4051 [ALC880_F1734] = "F1734",
4053 [ALC880_LG_LW] = "lg-lw",
4054 [ALC880_MEDION_RIM] = "medion",
4055 #ifdef CONFIG_SND_DEBUG
4056 [ALC880_TEST] = "test",
4058 [ALC880_AUTO] = "auto",
4061 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4062 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4063 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4064 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4065 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4066 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4067 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4068 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4069 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4070 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4071 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4072 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4073 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4074 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4075 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4076 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4077 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4078 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4079 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4080 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4081 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4082 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4086 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4087 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4088 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4089 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4090 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4091 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4092 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4093 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4094 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4095 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4096 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4097 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4098 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4099 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4100 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4101 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4102 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4103 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4104 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4105 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4106 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4107 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4108 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4109 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4110 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4111 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4112 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4113 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4114 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4115 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4116 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4117 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4118 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4119 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4120 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4121 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4122 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4123 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4124 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4125 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4126 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4127 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4128 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4132 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4133 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4138 * ALC880 codec presets
4140 static struct alc_config_preset alc880_presets[] = {
4142 .mixers = { alc880_three_stack_mixer },
4143 .init_verbs = { alc880_volume_init_verbs,
4144 alc880_pin_3stack_init_verbs },
4145 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4146 .dac_nids = alc880_dac_nids,
4147 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4148 .channel_mode = alc880_threestack_modes,
4150 .input_mux = &alc880_capture_source,
4152 [ALC880_3ST_DIG] = {
4153 .mixers = { alc880_three_stack_mixer },
4154 .init_verbs = { alc880_volume_init_verbs,
4155 alc880_pin_3stack_init_verbs },
4156 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4157 .dac_nids = alc880_dac_nids,
4158 .dig_out_nid = ALC880_DIGOUT_NID,
4159 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4160 .channel_mode = alc880_threestack_modes,
4162 .input_mux = &alc880_capture_source,
4164 [ALC880_TCL_S700] = {
4165 .mixers = { alc880_tcl_s700_mixer },
4166 .init_verbs = { alc880_volume_init_verbs,
4167 alc880_pin_tcl_S700_init_verbs,
4168 alc880_gpio2_init_verbs },
4169 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4170 .dac_nids = alc880_dac_nids,
4171 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4172 .num_adc_nids = 1, /* single ADC */
4174 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4175 .channel_mode = alc880_2_jack_modes,
4176 .input_mux = &alc880_capture_source,
4179 .mixers = { alc880_three_stack_mixer,
4180 alc880_five_stack_mixer},
4181 .init_verbs = { alc880_volume_init_verbs,
4182 alc880_pin_5stack_init_verbs },
4183 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4184 .dac_nids = alc880_dac_nids,
4185 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4186 .channel_mode = alc880_fivestack_modes,
4187 .input_mux = &alc880_capture_source,
4189 [ALC880_5ST_DIG] = {
4190 .mixers = { alc880_three_stack_mixer,
4191 alc880_five_stack_mixer },
4192 .init_verbs = { alc880_volume_init_verbs,
4193 alc880_pin_5stack_init_verbs },
4194 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4195 .dac_nids = alc880_dac_nids,
4196 .dig_out_nid = ALC880_DIGOUT_NID,
4197 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4198 .channel_mode = alc880_fivestack_modes,
4199 .input_mux = &alc880_capture_source,
4202 .mixers = { alc880_six_stack_mixer },
4203 .init_verbs = { alc880_volume_init_verbs,
4204 alc880_pin_6stack_init_verbs },
4205 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4206 .dac_nids = alc880_6st_dac_nids,
4207 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4208 .channel_mode = alc880_sixstack_modes,
4209 .input_mux = &alc880_6stack_capture_source,
4211 [ALC880_6ST_DIG] = {
4212 .mixers = { alc880_six_stack_mixer },
4213 .init_verbs = { alc880_volume_init_verbs,
4214 alc880_pin_6stack_init_verbs },
4215 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4216 .dac_nids = alc880_6st_dac_nids,
4217 .dig_out_nid = ALC880_DIGOUT_NID,
4218 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4219 .channel_mode = alc880_sixstack_modes,
4220 .input_mux = &alc880_6stack_capture_source,
4223 .mixers = { alc880_w810_base_mixer },
4224 .init_verbs = { alc880_volume_init_verbs,
4225 alc880_pin_w810_init_verbs,
4226 alc880_gpio2_init_verbs },
4227 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4228 .dac_nids = alc880_w810_dac_nids,
4229 .dig_out_nid = ALC880_DIGOUT_NID,
4230 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4231 .channel_mode = alc880_w810_modes,
4232 .input_mux = &alc880_capture_source,
4235 .mixers = { alc880_z71v_mixer },
4236 .init_verbs = { alc880_volume_init_verbs,
4237 alc880_pin_z71v_init_verbs },
4238 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4239 .dac_nids = alc880_z71v_dac_nids,
4240 .dig_out_nid = ALC880_DIGOUT_NID,
4242 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4243 .channel_mode = alc880_2_jack_modes,
4244 .input_mux = &alc880_capture_source,
4247 .mixers = { alc880_f1734_mixer },
4248 .init_verbs = { alc880_volume_init_verbs,
4249 alc880_pin_f1734_init_verbs },
4250 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4251 .dac_nids = alc880_f1734_dac_nids,
4253 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4254 .channel_mode = alc880_2_jack_modes,
4255 .input_mux = &alc880_f1734_capture_source,
4256 .unsol_event = alc880_uniwill_p53_unsol_event,
4257 .setup = alc880_uniwill_p53_setup,
4258 .init_hook = alc_automute_amp,
4261 .mixers = { alc880_asus_mixer },
4262 .init_verbs = { alc880_volume_init_verbs,
4263 alc880_pin_asus_init_verbs,
4264 alc880_gpio1_init_verbs },
4265 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4266 .dac_nids = alc880_asus_dac_nids,
4267 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4268 .channel_mode = alc880_asus_modes,
4270 .input_mux = &alc880_capture_source,
4272 [ALC880_ASUS_DIG] = {
4273 .mixers = { alc880_asus_mixer },
4274 .init_verbs = { alc880_volume_init_verbs,
4275 alc880_pin_asus_init_verbs,
4276 alc880_gpio1_init_verbs },
4277 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4278 .dac_nids = alc880_asus_dac_nids,
4279 .dig_out_nid = ALC880_DIGOUT_NID,
4280 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4281 .channel_mode = alc880_asus_modes,
4283 .input_mux = &alc880_capture_source,
4285 [ALC880_ASUS_DIG2] = {
4286 .mixers = { alc880_asus_mixer },
4287 .init_verbs = { alc880_volume_init_verbs,
4288 alc880_pin_asus_init_verbs,
4289 alc880_gpio2_init_verbs }, /* use GPIO2 */
4290 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4291 .dac_nids = alc880_asus_dac_nids,
4292 .dig_out_nid = ALC880_DIGOUT_NID,
4293 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4294 .channel_mode = alc880_asus_modes,
4296 .input_mux = &alc880_capture_source,
4298 [ALC880_ASUS_W1V] = {
4299 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4300 .init_verbs = { alc880_volume_init_verbs,
4301 alc880_pin_asus_init_verbs,
4302 alc880_gpio1_init_verbs },
4303 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4304 .dac_nids = alc880_asus_dac_nids,
4305 .dig_out_nid = ALC880_DIGOUT_NID,
4306 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4307 .channel_mode = alc880_asus_modes,
4309 .input_mux = &alc880_capture_source,
4311 [ALC880_UNIWILL_DIG] = {
4312 .mixers = { alc880_asus_mixer },
4313 .init_verbs = { alc880_volume_init_verbs,
4314 alc880_pin_asus_init_verbs },
4315 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4316 .dac_nids = alc880_asus_dac_nids,
4317 .dig_out_nid = ALC880_DIGOUT_NID,
4318 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4319 .channel_mode = alc880_asus_modes,
4321 .input_mux = &alc880_capture_source,
4323 [ALC880_UNIWILL] = {
4324 .mixers = { alc880_uniwill_mixer },
4325 .init_verbs = { alc880_volume_init_verbs,
4326 alc880_uniwill_init_verbs },
4327 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4328 .dac_nids = alc880_asus_dac_nids,
4329 .dig_out_nid = ALC880_DIGOUT_NID,
4330 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4331 .channel_mode = alc880_threestack_modes,
4333 .input_mux = &alc880_capture_source,
4334 .unsol_event = alc880_uniwill_unsol_event,
4335 .setup = alc880_uniwill_setup,
4336 .init_hook = alc880_uniwill_init_hook,
4338 [ALC880_UNIWILL_P53] = {
4339 .mixers = { alc880_uniwill_p53_mixer },
4340 .init_verbs = { alc880_volume_init_verbs,
4341 alc880_uniwill_p53_init_verbs },
4342 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4343 .dac_nids = alc880_asus_dac_nids,
4344 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4345 .channel_mode = alc880_threestack_modes,
4346 .input_mux = &alc880_capture_source,
4347 .unsol_event = alc880_uniwill_p53_unsol_event,
4348 .setup = alc880_uniwill_p53_setup,
4349 .init_hook = alc_automute_amp,
4351 [ALC880_FUJITSU] = {
4352 .mixers = { alc880_fujitsu_mixer },
4353 .init_verbs = { alc880_volume_init_verbs,
4354 alc880_uniwill_p53_init_verbs,
4355 alc880_beep_init_verbs },
4356 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4357 .dac_nids = alc880_dac_nids,
4358 .dig_out_nid = ALC880_DIGOUT_NID,
4359 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4360 .channel_mode = alc880_2_jack_modes,
4361 .input_mux = &alc880_capture_source,
4362 .unsol_event = alc880_uniwill_p53_unsol_event,
4363 .setup = alc880_uniwill_p53_setup,
4364 .init_hook = alc_automute_amp,
4367 .mixers = { alc880_three_stack_mixer },
4368 .init_verbs = { alc880_volume_init_verbs,
4369 alc880_pin_clevo_init_verbs },
4370 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4371 .dac_nids = alc880_dac_nids,
4373 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4374 .channel_mode = alc880_threestack_modes,
4376 .input_mux = &alc880_capture_source,
4379 .mixers = { alc880_lg_mixer },
4380 .init_verbs = { alc880_volume_init_verbs,
4381 alc880_lg_init_verbs },
4382 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4383 .dac_nids = alc880_lg_dac_nids,
4384 .dig_out_nid = ALC880_DIGOUT_NID,
4385 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4386 .channel_mode = alc880_lg_ch_modes,
4388 .input_mux = &alc880_lg_capture_source,
4389 .unsol_event = alc_automute_amp_unsol_event,
4390 .setup = alc880_lg_setup,
4391 .init_hook = alc_automute_amp,
4392 #ifdef CONFIG_SND_HDA_POWER_SAVE
4393 .loopbacks = alc880_lg_loopbacks,
4397 .mixers = { alc880_lg_lw_mixer },
4398 .init_verbs = { alc880_volume_init_verbs,
4399 alc880_lg_lw_init_verbs },
4400 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4401 .dac_nids = alc880_dac_nids,
4402 .dig_out_nid = ALC880_DIGOUT_NID,
4403 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4404 .channel_mode = alc880_lg_lw_modes,
4405 .input_mux = &alc880_lg_lw_capture_source,
4406 .unsol_event = alc_automute_amp_unsol_event,
4407 .setup = alc880_lg_lw_setup,
4408 .init_hook = alc_automute_amp,
4410 [ALC880_MEDION_RIM] = {
4411 .mixers = { alc880_medion_rim_mixer },
4412 .init_verbs = { alc880_volume_init_verbs,
4413 alc880_medion_rim_init_verbs,
4414 alc_gpio2_init_verbs },
4415 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4416 .dac_nids = alc880_dac_nids,
4417 .dig_out_nid = ALC880_DIGOUT_NID,
4418 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4419 .channel_mode = alc880_2_jack_modes,
4420 .input_mux = &alc880_medion_rim_capture_source,
4421 .unsol_event = alc880_medion_rim_unsol_event,
4422 .setup = alc880_medion_rim_setup,
4423 .init_hook = alc880_medion_rim_automute,
4425 #ifdef CONFIG_SND_DEBUG
4427 .mixers = { alc880_test_mixer },
4428 .init_verbs = { alc880_test_init_verbs },
4429 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4430 .dac_nids = alc880_test_dac_nids,
4431 .dig_out_nid = ALC880_DIGOUT_NID,
4432 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4433 .channel_mode = alc880_test_modes,
4434 .input_mux = &alc880_test_capture_source,
4440 * Automatic parse of I/O pins from the BIOS configuration
4445 ALC_CTL_WIDGET_MUTE,
4448 static struct snd_kcontrol_new alc880_control_templates[] = {
4449 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4450 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4451 HDA_BIND_MUTE(NULL, 0, 0, 0),
4454 /* add dynamic controls */
4455 static int add_control(struct alc_spec *spec, int type, const char *name,
4458 struct snd_kcontrol_new *knew;
4460 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4461 knew = snd_array_new(&spec->kctls);
4464 *knew = alc880_control_templates[type];
4465 knew->name = kstrdup(name, GFP_KERNEL);
4468 if (get_amp_nid_(val))
4469 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4470 knew->private_value = val;
4474 static int add_control_with_pfx(struct alc_spec *spec, int type,
4475 const char *pfx, const char *dir,
4476 const char *sfx, unsigned long val)
4479 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4480 return add_control(spec, type, name, val);
4483 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4484 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4485 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4486 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4488 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4489 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4490 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4491 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4492 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4493 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4494 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4495 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4496 #define ALC880_PIN_CD_NID 0x1c
4498 /* fill in the dac_nids table from the parsed pin configuration */
4499 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4500 const struct auto_pin_cfg *cfg)
4506 memset(assigned, 0, sizeof(assigned));
4507 spec->multiout.dac_nids = spec->private_dac_nids;
4509 /* check the pins hardwired to audio widget */
4510 for (i = 0; i < cfg->line_outs; i++) {
4511 nid = cfg->line_out_pins[i];
4512 if (alc880_is_fixed_pin(nid)) {
4513 int idx = alc880_fixed_pin_idx(nid);
4514 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4518 /* left pins can be connect to any audio widget */
4519 for (i = 0; i < cfg->line_outs; i++) {
4520 nid = cfg->line_out_pins[i];
4521 if (alc880_is_fixed_pin(nid))
4523 /* search for an empty channel */
4524 for (j = 0; j < cfg->line_outs; j++) {
4526 spec->multiout.dac_nids[i] =
4527 alc880_idx_to_dac(j);
4533 spec->multiout.num_dacs = cfg->line_outs;
4537 /* add playback controls from the parsed DAC table */
4538 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4539 const struct auto_pin_cfg *cfg)
4541 static const char *chname[4] = {
4542 "Front", "Surround", NULL /*CLFE*/, "Side"
4547 for (i = 0; i < cfg->line_outs; i++) {
4548 if (!spec->multiout.dac_nids[i])
4550 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4553 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4555 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4559 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4561 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4565 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4567 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4571 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4573 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4579 if (cfg->line_outs == 1 &&
4580 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4584 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4585 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4589 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4590 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4599 /* add playback controls for speaker and HP outputs */
4600 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4609 if (alc880_is_fixed_pin(pin)) {
4610 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4611 /* specify the DAC as the extra output */
4612 if (!spec->multiout.hp_nid)
4613 spec->multiout.hp_nid = nid;
4615 spec->multiout.extra_out_nid[0] = nid;
4616 /* control HP volume/switch on the output mixer amp */
4617 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4618 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4619 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4622 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4623 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4626 } else if (alc880_is_multi_pin(pin)) {
4627 /* set manual connection */
4628 /* we have only a switch on HP-out PIN */
4629 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4630 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4637 /* create input playback/capture controls for the given pin */
4638 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4639 const char *ctlname,
4640 int idx, hda_nid_t mix_nid)
4644 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4645 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4648 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4649 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4655 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4657 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4658 return (pincap & AC_PINCAP_IN) != 0;
4661 /* create playback/capture controls for input pins */
4662 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4663 const struct auto_pin_cfg *cfg,
4665 hda_nid_t cap1, hda_nid_t cap2)
4667 struct alc_spec *spec = codec->spec;
4668 struct hda_input_mux *imux = &spec->private_imux[0];
4671 for (i = 0; i < AUTO_PIN_LAST; i++) {
4674 pin = cfg->input_pins[i];
4675 if (!alc_is_input_pin(codec, pin))
4679 idx = get_connection_index(codec, mixer, pin);
4681 err = new_analog_input(spec, pin,
4682 auto_pin_cfg_labels[i],
4691 idx = get_connection_index(codec, cap1, pin);
4692 if (idx < 0 && cap2)
4693 idx = get_connection_index(codec, cap2, pin);
4695 imux->items[imux->num_items].label =
4696 auto_pin_cfg_labels[i];
4697 imux->items[imux->num_items].index = idx;
4704 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4705 const struct auto_pin_cfg *cfg)
4707 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4710 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4711 unsigned int pin_type)
4713 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4716 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4720 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4721 hda_nid_t nid, int pin_type,
4724 alc_set_pin_output(codec, nid, pin_type);
4725 /* need the manual connection? */
4726 if (alc880_is_multi_pin(nid)) {
4727 struct alc_spec *spec = codec->spec;
4728 int idx = alc880_multi_pin_idx(nid);
4729 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4730 AC_VERB_SET_CONNECT_SEL,
4731 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4735 static int get_pin_type(int line_out_type)
4737 if (line_out_type == AUTO_PIN_HP_OUT)
4743 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4745 struct alc_spec *spec = codec->spec;
4748 for (i = 0; i < spec->autocfg.line_outs; i++) {
4749 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4750 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4751 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4755 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4757 struct alc_spec *spec = codec->spec;
4760 pin = spec->autocfg.speaker_pins[0];
4761 if (pin) /* connect to front */
4762 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4763 pin = spec->autocfg.hp_pins[0];
4764 if (pin) /* connect to front */
4765 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4768 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4770 struct alc_spec *spec = codec->spec;
4773 for (i = 0; i < AUTO_PIN_LAST; i++) {
4774 hda_nid_t nid = spec->autocfg.input_pins[i];
4775 if (alc_is_input_pin(codec, nid)) {
4776 alc_set_input_pin(codec, nid, i);
4777 if (nid != ALC880_PIN_CD_NID &&
4778 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4779 snd_hda_codec_write(codec, nid, 0,
4780 AC_VERB_SET_AMP_GAIN_MUTE,
4786 /* parse the BIOS configuration and set up the alc_spec */
4787 /* return 1 if successful, 0 if the proper config is not found,
4788 * or a negative error code
4790 static int alc880_parse_auto_config(struct hda_codec *codec)
4792 struct alc_spec *spec = codec->spec;
4794 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4796 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4800 if (!spec->autocfg.line_outs)
4801 return 0; /* can't find valid BIOS pin config */
4803 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4806 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4809 err = alc880_auto_create_extra_out(spec,
4810 spec->autocfg.speaker_pins[0],
4814 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4818 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4822 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4824 /* check multiple SPDIF-out (for recent codecs) */
4825 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4827 err = snd_hda_get_connections(codec,
4828 spec->autocfg.dig_out_pins[i],
4833 spec->multiout.dig_out_nid = dig_nid;
4835 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4836 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4838 spec->slave_dig_outs[i - 1] = dig_nid;
4841 if (spec->autocfg.dig_in_pin)
4842 spec->dig_in_nid = ALC880_DIGIN_NID;
4844 if (spec->kctls.list)
4845 add_mixer(spec, spec->kctls.list);
4847 add_verb(spec, alc880_volume_init_verbs);
4849 spec->num_mux_defs = 1;
4850 spec->input_mux = &spec->private_imux[0];
4852 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4857 /* additional initialization for auto-configuration model */
4858 static void alc880_auto_init(struct hda_codec *codec)
4860 struct alc_spec *spec = codec->spec;
4861 alc880_auto_init_multi_out(codec);
4862 alc880_auto_init_extra_out(codec);
4863 alc880_auto_init_analog_input(codec);
4864 if (spec->unsol_event)
4865 alc_inithook(codec);
4868 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4869 * one of two digital mic pins, e.g. on ALC272
4871 static void fixup_automic_adc(struct hda_codec *codec)
4873 struct alc_spec *spec = codec->spec;
4876 for (i = 0; i < spec->num_adc_nids; i++) {
4877 hda_nid_t cap = spec->capsrc_nids ?
4878 spec->capsrc_nids[i] : spec->adc_nids[i];
4881 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4884 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4887 spec->int_mic.mux_idx = iidx;
4888 spec->ext_mic.mux_idx = eidx;
4889 if (spec->capsrc_nids)
4890 spec->capsrc_nids += i;
4891 spec->adc_nids += i;
4892 spec->num_adc_nids = 1;
4895 snd_printd(KERN_INFO "hda_codec: %s: "
4896 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4897 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4898 spec->auto_mic = 0; /* disable auto-mic to be sure */
4901 static void set_capture_mixer(struct hda_codec *codec)
4903 struct alc_spec *spec = codec->spec;
4904 static struct snd_kcontrol_new *caps[2][3] = {
4905 { alc_capture_mixer_nosrc1,
4906 alc_capture_mixer_nosrc2,
4907 alc_capture_mixer_nosrc3 },
4908 { alc_capture_mixer1,
4910 alc_capture_mixer3 },
4912 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4914 if (spec->auto_mic) {
4916 fixup_automic_adc(codec);
4917 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4921 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4925 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4926 #define set_beep_amp(spec, nid, idx, dir) \
4927 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4929 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4933 * OK, here we have finally the patch for ALC880
4936 static int patch_alc880(struct hda_codec *codec)
4938 struct alc_spec *spec;
4942 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4948 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4951 if (board_config < 0) {
4952 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4954 board_config = ALC880_AUTO;
4957 if (board_config == ALC880_AUTO) {
4958 /* automatic parse from the BIOS config */
4959 err = alc880_parse_auto_config(codec);
4965 "hda_codec: Cannot set up configuration "
4966 "from BIOS. Using 3-stack mode...\n");
4967 board_config = ALC880_3ST;
4971 err = snd_hda_attach_beep_device(codec, 0x1);
4977 if (board_config != ALC880_AUTO)
4978 setup_preset(codec, &alc880_presets[board_config]);
4980 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4981 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4982 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4984 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4985 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4987 if (!spec->adc_nids && spec->input_mux) {
4988 /* check whether NID 0x07 is valid */
4989 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4991 wcap = get_wcaps_type(wcap);
4992 if (wcap != AC_WID_AUD_IN) {
4993 spec->adc_nids = alc880_adc_nids_alt;
4994 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4996 spec->adc_nids = alc880_adc_nids;
4997 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5000 set_capture_mixer(codec);
5001 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5003 spec->vmaster_nid = 0x0c;
5005 codec->patch_ops = alc_patch_ops;
5006 if (board_config == ALC880_AUTO)
5007 spec->init_hook = alc880_auto_init;
5008 #ifdef CONFIG_SND_HDA_POWER_SAVE
5009 if (!spec->loopback.amplist)
5010 spec->loopback.amplist = alc880_loopbacks;
5012 codec->proc_widget_hook = print_realtek_coef;
5022 static hda_nid_t alc260_dac_nids[1] = {
5027 static hda_nid_t alc260_adc_nids[1] = {
5032 static hda_nid_t alc260_adc_nids_alt[1] = {
5037 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5038 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5040 static hda_nid_t alc260_dual_adc_nids[2] = {
5045 #define ALC260_DIGOUT_NID 0x03
5046 #define ALC260_DIGIN_NID 0x06
5048 static struct hda_input_mux alc260_capture_source = {
5052 { "Front Mic", 0x1 },
5058 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5059 * headphone jack and the internal CD lines since these are the only pins at
5060 * which audio can appear. For flexibility, also allow the option of
5061 * recording the mixer output on the second ADC (ADC0 doesn't have a
5062 * connection to the mixer output).
5064 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5068 { "Mic/Line", 0x0 },
5070 { "Headphone", 0x2 },
5076 { "Mic/Line", 0x0 },
5078 { "Headphone", 0x2 },
5085 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5086 * the Fujitsu S702x, but jacks are marked differently.
5088 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5095 { "Headphone", 0x5 },
5104 { "Headphone", 0x6 },
5110 /* Maxdata Favorit 100XS */
5111 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5115 { "Line/Mic", 0x0 },
5122 { "Line/Mic", 0x0 },
5130 * This is just place-holder, so there's something for alc_build_pcms to look
5131 * at when it calculates the maximum number of channels. ALC260 has no mixer
5132 * element which allows changing the channel mode, so the verb list is
5135 static struct hda_channel_mode alc260_modes[1] = {
5140 /* Mixer combinations
5142 * basic: base_output + input + pc_beep + capture
5143 * HP: base_output + input + capture_alt
5144 * HP_3013: hp_3013 + input + capture
5145 * fujitsu: fujitsu + capture
5146 * acer: acer + capture
5149 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5150 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5151 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5152 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5153 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5154 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5155 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5159 static struct snd_kcontrol_new alc260_input_mixer[] = {
5160 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5161 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5162 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5163 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5165 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5166 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5167 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5171 /* update HP, line and mono out pins according to the master switch */
5172 static void alc260_hp_master_update(struct hda_codec *codec,
5173 hda_nid_t hp, hda_nid_t line,
5176 struct alc_spec *spec = codec->spec;
5177 unsigned int val = spec->master_sw ? PIN_HP : 0;
5178 /* change HP and line-out pins */
5179 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5181 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5183 /* mono (speaker) depending on the HP jack sense */
5184 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5185 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5189 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5190 struct snd_ctl_elem_value *ucontrol)
5192 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5193 struct alc_spec *spec = codec->spec;
5194 *ucontrol->value.integer.value = spec->master_sw;
5198 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5199 struct snd_ctl_elem_value *ucontrol)
5201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5202 struct alc_spec *spec = codec->spec;
5203 int val = !!*ucontrol->value.integer.value;
5204 hda_nid_t hp, line, mono;
5206 if (val == spec->master_sw)
5208 spec->master_sw = val;
5209 hp = (kcontrol->private_value >> 16) & 0xff;
5210 line = (kcontrol->private_value >> 8) & 0xff;
5211 mono = kcontrol->private_value & 0xff;
5212 alc260_hp_master_update(codec, hp, line, mono);
5216 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5219 .name = "Master Playback Switch",
5220 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5221 .info = snd_ctl_boolean_mono_info,
5222 .get = alc260_hp_master_sw_get,
5223 .put = alc260_hp_master_sw_put,
5224 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5226 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5227 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5228 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5229 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5230 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5232 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5236 static struct hda_verb alc260_hp_unsol_verbs[] = {
5237 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5241 static void alc260_hp_automute(struct hda_codec *codec)
5243 struct alc_spec *spec = codec->spec;
5245 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5246 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5249 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5251 if ((res >> 26) == ALC880_HP_EVENT)
5252 alc260_hp_automute(codec);
5255 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5257 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5258 .name = "Master Playback Switch",
5259 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5260 .info = snd_ctl_boolean_mono_info,
5261 .get = alc260_hp_master_sw_get,
5262 .put = alc260_hp_master_sw_put,
5263 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5265 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5266 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5267 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5268 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5269 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5270 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5271 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5272 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5276 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5277 .ops = &snd_hda_bind_vol,
5279 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5280 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5281 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5286 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5287 .ops = &snd_hda_bind_sw,
5289 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5290 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5295 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5296 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5297 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5298 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5299 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5303 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5304 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5308 static void alc260_hp_3013_automute(struct hda_codec *codec)
5310 struct alc_spec *spec = codec->spec;
5312 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5313 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5316 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5319 if ((res >> 26) == ALC880_HP_EVENT)
5320 alc260_hp_3013_automute(codec);
5323 static void alc260_hp_3012_automute(struct hda_codec *codec)
5325 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5327 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5329 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5331 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5335 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5338 if ((res >> 26) == ALC880_HP_EVENT)
5339 alc260_hp_3012_automute(codec);
5342 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5343 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5345 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5346 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5347 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5348 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5349 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5350 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5351 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5352 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5353 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5354 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5355 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5359 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5360 * versions of the ALC260 don't act on requests to enable mic bias from NID
5361 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5362 * datasheet doesn't mention this restriction. At this stage it's not clear
5363 * whether this behaviour is intentional or is a hardware bug in chip
5364 * revisions available in early 2006. Therefore for now allow the
5365 * "Headphone Jack Mode" control to span all choices, but if it turns out
5366 * that the lack of mic bias for this NID is intentional we could change the
5367 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5369 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5370 * don't appear to make the mic bias available from the "line" jack, even
5371 * though the NID used for this jack (0x14) can supply it. The theory is
5372 * that perhaps Acer have included blocking capacitors between the ALC260
5373 * and the output jack. If this turns out to be the case for all such
5374 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5375 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5377 * The C20x Tablet series have a mono internal speaker which is controlled
5378 * via the chip's Mono sum widget and pin complex, so include the necessary
5379 * controls for such models. On models without a "mono speaker" the control
5380 * won't do anything.
5382 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5383 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5384 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5385 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5386 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5388 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5390 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5391 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5392 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5393 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5394 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5395 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5396 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5397 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5401 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5403 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5404 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5405 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5406 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5407 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5408 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5409 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5413 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5414 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5416 static struct snd_kcontrol_new alc260_will_mixer[] = {
5417 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5418 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5419 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5420 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5421 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5422 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5423 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5424 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5425 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5426 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5430 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5431 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5433 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5434 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5435 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5436 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5437 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5438 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5439 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5440 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
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),
5448 * initialization verbs
5450 static struct hda_verb alc260_init_verbs[] = {
5451 /* Line In pin widget for input */
5452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5453 /* CD pin widget for input */
5454 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5455 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5456 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5457 /* Mic2 (front panel) pin widget for input and vref at 80% */
5458 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5459 /* LINE-2 is used for line-out in rear */
5460 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5461 /* select line-out */
5462 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5464 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5466 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5468 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5469 /* mute capture amp left and right */
5470 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5471 /* set connection select to line in (default select for this ADC) */
5472 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5473 /* mute capture amp left and right */
5474 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5475 /* set connection select to line in (default select for this ADC) */
5476 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5477 /* set vol=0 Line-Out mixer amp left and right */
5478 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5479 /* unmute pin widget amp left and right (no gain on this amp) */
5480 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5481 /* set vol=0 HP mixer amp left and right */
5482 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5483 /* unmute pin widget amp left and right (no gain on this amp) */
5484 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5485 /* set vol=0 Mono mixer amp left and right */
5486 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5487 /* unmute pin widget amp left and right (no gain on this amp) */
5488 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5489 /* unmute LINE-2 out pin */
5490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5491 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5494 /* mute analog inputs */
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5500 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5501 /* mute Front out path */
5502 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5504 /* mute Headphone out path */
5505 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5507 /* mute Mono out path */
5508 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5509 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5513 #if 0 /* should be identical with alc260_init_verbs? */
5514 static struct hda_verb alc260_hp_init_verbs[] = {
5515 /* Headphone and output */
5516 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5518 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5519 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5520 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5521 /* Mic2 (front panel) pin widget for input and vref at 80% */
5522 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5523 /* Line In pin widget for input */
5524 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5525 /* Line-2 pin widget for output */
5526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5527 /* CD pin widget for input */
5528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5529 /* unmute amp left and right */
5530 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5531 /* set connection select to line in (default select for this ADC) */
5532 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5533 /* unmute Line-Out mixer amp left and right (volume = 0) */
5534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5535 /* mute pin widget amp left and right (no gain on this amp) */
5536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5537 /* unmute HP mixer amp left and right (volume = 0) */
5538 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5539 /* mute pin widget amp left and right (no gain on this amp) */
5540 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5541 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5544 /* mute analog inputs */
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5550 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5551 /* Unmute Front out path */
5552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5554 /* Unmute Headphone out path */
5555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5557 /* Unmute Mono out path */
5558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5564 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5565 /* Line out and output */
5566 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5568 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5569 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5570 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5571 /* Mic2 (front panel) pin widget for input and vref at 80% */
5572 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5573 /* Line In pin widget for input */
5574 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5575 /* Headphone pin widget for output */
5576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5577 /* CD pin widget for input */
5578 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5579 /* unmute amp left and right */
5580 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5581 /* set connection select to line in (default select for this ADC) */
5582 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5583 /* unmute Line-Out mixer amp left and right (volume = 0) */
5584 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5585 /* mute pin widget amp left and right (no gain on this amp) */
5586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5587 /* unmute HP mixer amp left and right (volume = 0) */
5588 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5589 /* mute pin widget amp left and right (no gain on this amp) */
5590 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5591 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5594 /* mute analog inputs */
5595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5600 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5601 /* Unmute Front out path */
5602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5604 /* Unmute Headphone out path */
5605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5607 /* Unmute Mono out path */
5608 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5609 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5613 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5614 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5615 * audio = 0x16, internal speaker = 0x10.
5617 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5618 /* Disable all GPIOs */
5619 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5620 /* Internal speaker is connected to headphone pin */
5621 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5622 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5624 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5625 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5626 /* Ensure all other unused pins are disabled and muted. */
5627 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5628 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5630 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5632 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5633 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5634 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5636 /* Disable digital (SPDIF) pins */
5637 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5638 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5640 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5641 * when acting as an output.
5643 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5645 /* Start with output sum widgets muted and their output gains at min */
5646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5648 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5650 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5651 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5653 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5654 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5656 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5657 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5658 /* Unmute Line1 pin widget output buffer since it starts as an output.
5659 * If the pin mode is changed by the user the pin mode control will
5660 * take care of enabling the pin's input/output buffers as needed.
5661 * Therefore there's no need to enable the input buffer at this
5664 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5665 /* Unmute input buffer of pin widget used for Line-in (no equiv
5668 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5670 /* Mute capture amp left and right */
5671 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5672 /* Set ADC connection select to match default mixer setting - line
5675 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5677 /* Do the same for the second ADC: mute capture input amp and
5678 * set ADC connection to line in (on mic1 pin)
5680 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5681 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5683 /* Mute all inputs to mixer widget (even unconnected ones) */
5684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5696 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5697 * similar laptops (adapted from Fujitsu init verbs).
5699 static struct hda_verb alc260_acer_init_verbs[] = {
5700 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5701 * the headphone jack. Turn this on and rely on the standard mute
5702 * methods whenever the user wants to turn these outputs off.
5704 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5705 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5706 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5707 /* Internal speaker/Headphone jack is connected to Line-out pin */
5708 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5709 /* Internal microphone/Mic jack is connected to Mic1 pin */
5710 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5711 /* Line In jack is connected to Line1 pin */
5712 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5713 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5714 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5715 /* Ensure all other unused pins are disabled and muted. */
5716 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5717 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5719 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5721 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5722 /* Disable digital (SPDIF) pins */
5723 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5724 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5726 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5727 * bus when acting as outputs.
5729 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5730 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5732 /* Start with output sum widgets muted and their output gains at min */
5733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5734 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5740 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5741 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5743 /* Unmute Line-out pin widget amp left and right
5744 * (no equiv mixer ctrl)
5746 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5747 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5748 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5749 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5750 * inputs. If the pin mode is changed by the user the pin mode control
5751 * will take care of enabling the pin's input/output buffers as needed.
5752 * Therefore there's no need to enable the input buffer at this
5755 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5756 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5758 /* Mute capture amp left and right */
5759 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5760 /* Set ADC connection select to match default mixer setting - mic
5763 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5765 /* Do similar with the second ADC: mute capture input amp and
5766 * set ADC connection to mic to match ALSA's default state.
5768 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5771 /* Mute all inputs to mixer widget (even unconnected ones) */
5772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5784 /* Initialisation sequence for Maxdata Favorit 100XS
5785 * (adapted from Acer init verbs).
5787 static struct hda_verb alc260_favorit100_init_verbs[] = {
5788 /* GPIO 0 enables the output jack.
5789 * Turn this on and rely on the standard mute
5790 * methods whenever the user wants to turn these outputs off.
5792 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5793 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5794 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5795 /* Line/Mic input jack is connected to Mic1 pin */
5796 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5797 /* Ensure all other unused pins are disabled and muted. */
5798 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5799 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5801 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5802 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5803 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5804 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5807 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5808 /* Disable digital (SPDIF) pins */
5809 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5810 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5812 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5813 * bus when acting as outputs.
5815 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5816 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5818 /* Start with output sum widgets muted and their output gains at min */
5819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5823 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5824 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5825 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5826 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5827 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5829 /* Unmute Line-out pin widget amp left and right
5830 * (no equiv mixer ctrl)
5832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5833 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5834 * inputs. If the pin mode is changed by the user the pin mode control
5835 * will take care of enabling the pin's input/output buffers as needed.
5836 * Therefore there's no need to enable the input buffer at this
5839 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5841 /* Mute capture amp left and right */
5842 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5843 /* Set ADC connection select to match default mixer setting - mic
5846 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5848 /* Do similar with the second ADC: mute capture input amp and
5849 * set ADC connection to mic to match ALSA's default state.
5851 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5852 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5854 /* Mute all inputs to mixer widget (even unconnected ones) */
5855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5867 static struct hda_verb alc260_will_verbs[] = {
5868 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5869 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5870 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5871 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5872 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5873 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5877 static struct hda_verb alc260_replacer_672v_verbs[] = {
5878 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5879 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5880 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5882 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5883 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5884 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5886 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5890 /* toggle speaker-output according to the hp-jack state */
5891 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5893 unsigned int present;
5895 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5896 present = snd_hda_jack_detect(codec, 0x0f);
5898 snd_hda_codec_write_cache(codec, 0x01, 0,
5899 AC_VERB_SET_GPIO_DATA, 1);
5900 snd_hda_codec_write_cache(codec, 0x0f, 0,
5901 AC_VERB_SET_PIN_WIDGET_CONTROL,
5904 snd_hda_codec_write_cache(codec, 0x01, 0,
5905 AC_VERB_SET_GPIO_DATA, 0);
5906 snd_hda_codec_write_cache(codec, 0x0f, 0,
5907 AC_VERB_SET_PIN_WIDGET_CONTROL,
5912 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5915 if ((res >> 26) == ALC880_HP_EVENT)
5916 alc260_replacer_672v_automute(codec);
5919 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5920 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5922 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5923 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5924 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5925 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5926 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5927 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5928 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5929 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5933 /* Test configuration for debugging, modelled after the ALC880 test
5936 #ifdef CONFIG_SND_DEBUG
5937 static hda_nid_t alc260_test_dac_nids[1] = {
5940 static hda_nid_t alc260_test_adc_nids[2] = {
5943 /* For testing the ALC260, each input MUX needs its own definition since
5944 * the signal assignments are different. This assumes that the first ADC
5947 static struct hda_input_mux alc260_test_capture_sources[2] = {
5951 { "MIC1 pin", 0x0 },
5952 { "MIC2 pin", 0x1 },
5953 { "LINE1 pin", 0x2 },
5954 { "LINE2 pin", 0x3 },
5956 { "LINE-OUT pin", 0x5 },
5957 { "HP-OUT pin", 0x6 },
5963 { "MIC1 pin", 0x0 },
5964 { "MIC2 pin", 0x1 },
5965 { "LINE1 pin", 0x2 },
5966 { "LINE2 pin", 0x3 },
5969 { "LINE-OUT pin", 0x6 },
5970 { "HP-OUT pin", 0x7 },
5974 static struct snd_kcontrol_new alc260_test_mixer[] = {
5975 /* Output driver widgets */
5976 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5977 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5978 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5979 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5980 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5981 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5983 /* Modes for retasking pin widgets
5984 * Note: the ALC260 doesn't seem to act on requests to enable mic
5985 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5986 * mention this restriction. At this stage it's not clear whether
5987 * this behaviour is intentional or is a hardware bug in chip
5988 * revisions available at least up until early 2006. Therefore for
5989 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5990 * choices, but if it turns out that the lack of mic bias for these
5991 * NIDs is intentional we could change their modes from
5992 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5994 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5995 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5996 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5997 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5998 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5999 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6001 /* Loopback mixer controls */
6002 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6003 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6004 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6005 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6006 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6007 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6008 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6009 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6010 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6011 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6012 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6013 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6014 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6015 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6017 /* Controls for GPIO pins, assuming they are configured as outputs */
6018 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6019 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6020 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6021 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6023 /* Switches to allow the digital IO pins to be enabled. The datasheet
6024 * is ambigious as to which NID is which; testing on laptops which
6025 * make this output available should provide clarification.
6027 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6028 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6030 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6031 * this output to turn on an external amplifier.
6033 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6034 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6038 static struct hda_verb alc260_test_init_verbs[] = {
6039 /* Enable all GPIOs as outputs with an initial value of 0 */
6040 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6041 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6042 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6044 /* Enable retasking pins as output, initially without power amp */
6045 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6046 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6047 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6048 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6049 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6050 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6052 /* Disable digital (SPDIF) pins initially, but users can enable
6053 * them via a mixer switch. In the case of SPDIF-out, this initverb
6054 * payload also sets the generation to 0, output to be in "consumer"
6055 * PCM format, copyright asserted, no pre-emphasis and no validity
6058 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6059 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6061 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6062 * OUT1 sum bus when acting as an output.
6064 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6065 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6066 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6067 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6069 /* Start with output sum widgets muted and their output gains at min */
6070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6080 /* Unmute retasking pin widget output buffers since the default
6081 * state appears to be output. As the pin mode is changed by the
6082 * user the pin mode control will take care of enabling the pin's
6083 * input/output buffers as needed.
6085 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6086 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6087 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6088 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6089 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6090 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6091 /* Also unmute the mono-out pin widget */
6092 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6094 /* Mute capture amp left and right */
6095 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6096 /* Set ADC connection select to match default mixer setting (mic1
6099 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6101 /* Do the same for the second ADC: mute capture input amp and
6102 * set ADC connection to mic1 pin
6104 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6105 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6107 /* Mute all inputs to mixer widget (even unconnected ones) */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6121 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6122 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6124 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6125 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6128 * for BIOS auto-configuration
6131 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6132 const char *pfx, int *vol_bits)
6135 unsigned long vol_val, sw_val;
6138 if (nid >= 0x0f && nid < 0x11) {
6139 nid_vol = nid - 0x7;
6140 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6141 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6142 } else if (nid == 0x11) {
6143 nid_vol = nid - 0x7;
6144 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6145 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6146 } else if (nid >= 0x12 && nid <= 0x15) {
6148 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6149 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6153 if (!(*vol_bits & (1 << nid_vol))) {
6154 /* first control for the volume widget */
6155 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6158 *vol_bits |= (1 << nid_vol);
6160 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6166 /* add playback controls from the parsed DAC table */
6167 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6168 const struct auto_pin_cfg *cfg)
6174 spec->multiout.num_dacs = 1;
6175 spec->multiout.dac_nids = spec->private_dac_nids;
6176 spec->multiout.dac_nids[0] = 0x02;
6178 nid = cfg->line_out_pins[0];
6181 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6183 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6187 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6192 nid = cfg->speaker_pins[0];
6194 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6199 nid = cfg->hp_pins[0];
6201 err = alc260_add_playback_controls(spec, nid, "Headphone",
6209 /* create playback/capture controls for input pins */
6210 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6211 const struct auto_pin_cfg *cfg)
6213 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6216 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6217 hda_nid_t nid, int pin_type,
6220 alc_set_pin_output(codec, nid, pin_type);
6221 /* need the manual connection? */
6223 int idx = nid - 0x12;
6224 snd_hda_codec_write(codec, idx + 0x0b, 0,
6225 AC_VERB_SET_CONNECT_SEL, sel_idx);
6229 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6231 struct alc_spec *spec = codec->spec;
6234 nid = spec->autocfg.line_out_pins[0];
6236 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6237 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6240 nid = spec->autocfg.speaker_pins[0];
6242 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6244 nid = spec->autocfg.hp_pins[0];
6246 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6249 #define ALC260_PIN_CD_NID 0x16
6250 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6252 struct alc_spec *spec = codec->spec;
6255 for (i = 0; i < AUTO_PIN_LAST; i++) {
6256 hda_nid_t nid = spec->autocfg.input_pins[i];
6258 alc_set_input_pin(codec, nid, i);
6259 if (nid != ALC260_PIN_CD_NID &&
6260 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6261 snd_hda_codec_write(codec, nid, 0,
6262 AC_VERB_SET_AMP_GAIN_MUTE,
6269 * generic initialization of ADC, input mixers and output mixers
6271 static struct hda_verb alc260_volume_init_verbs[] = {
6273 * Unmute ADC0-1 and set the default input to mic-in
6275 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6276 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6277 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6278 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6280 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6282 * Note: PASD motherboards uses the Line In 2 as the input for
6283 * front panel mic (mic 2)
6285 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6286 /* mute analog inputs */
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6294 * Set up output mixers (0x08 - 0x0a)
6296 /* set vol=0 to output mixers */
6297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6298 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6299 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 /* set up input amps for analog loopback */
6301 /* Amp Indices: DAC = 0, mixer = 1 */
6302 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6304 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6306 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6307 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6312 static int alc260_parse_auto_config(struct hda_codec *codec)
6314 struct alc_spec *spec = codec->spec;
6316 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6318 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6322 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6325 if (!spec->kctls.list)
6326 return 0; /* can't find valid BIOS pin config */
6327 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6331 spec->multiout.max_channels = 2;
6333 if (spec->autocfg.dig_outs)
6334 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6335 if (spec->kctls.list)
6336 add_mixer(spec, spec->kctls.list);
6338 add_verb(spec, alc260_volume_init_verbs);
6340 spec->num_mux_defs = 1;
6341 spec->input_mux = &spec->private_imux[0];
6343 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6348 /* additional initialization for auto-configuration model */
6349 static void alc260_auto_init(struct hda_codec *codec)
6351 struct alc_spec *spec = codec->spec;
6352 alc260_auto_init_multi_out(codec);
6353 alc260_auto_init_analog_input(codec);
6354 if (spec->unsol_event)
6355 alc_inithook(codec);
6358 #ifdef CONFIG_SND_HDA_POWER_SAVE
6359 static struct hda_amp_list alc260_loopbacks[] = {
6360 { 0x07, HDA_INPUT, 0 },
6361 { 0x07, HDA_INPUT, 1 },
6362 { 0x07, HDA_INPUT, 2 },
6363 { 0x07, HDA_INPUT, 3 },
6364 { 0x07, HDA_INPUT, 4 },
6370 * ALC260 configurations
6372 static const char *alc260_models[ALC260_MODEL_LAST] = {
6373 [ALC260_BASIC] = "basic",
6375 [ALC260_HP_3013] = "hp-3013",
6376 [ALC260_HP_DC7600] = "hp-dc7600",
6377 [ALC260_FUJITSU_S702X] = "fujitsu",
6378 [ALC260_ACER] = "acer",
6379 [ALC260_WILL] = "will",
6380 [ALC260_REPLACER_672V] = "replacer",
6381 [ALC260_FAVORIT100] = "favorit100",
6382 #ifdef CONFIG_SND_DEBUG
6383 [ALC260_TEST] = "test",
6385 [ALC260_AUTO] = "auto",
6388 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6389 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6390 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6391 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6392 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6393 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6394 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6395 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6396 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6397 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6398 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6399 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6400 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6401 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6402 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6403 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6404 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6405 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6406 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6407 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6408 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6412 static struct alc_config_preset alc260_presets[] = {
6414 .mixers = { alc260_base_output_mixer,
6415 alc260_input_mixer },
6416 .init_verbs = { alc260_init_verbs },
6417 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6418 .dac_nids = alc260_dac_nids,
6419 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6420 .adc_nids = alc260_adc_nids,
6421 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6422 .channel_mode = alc260_modes,
6423 .input_mux = &alc260_capture_source,
6426 .mixers = { alc260_hp_output_mixer,
6427 alc260_input_mixer },
6428 .init_verbs = { alc260_init_verbs,
6429 alc260_hp_unsol_verbs },
6430 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6431 .dac_nids = alc260_dac_nids,
6432 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6433 .adc_nids = alc260_adc_nids_alt,
6434 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6435 .channel_mode = alc260_modes,
6436 .input_mux = &alc260_capture_source,
6437 .unsol_event = alc260_hp_unsol_event,
6438 .init_hook = alc260_hp_automute,
6440 [ALC260_HP_DC7600] = {
6441 .mixers = { alc260_hp_dc7600_mixer,
6442 alc260_input_mixer },
6443 .init_verbs = { alc260_init_verbs,
6444 alc260_hp_dc7600_verbs },
6445 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6446 .dac_nids = alc260_dac_nids,
6447 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6448 .adc_nids = alc260_adc_nids_alt,
6449 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6450 .channel_mode = alc260_modes,
6451 .input_mux = &alc260_capture_source,
6452 .unsol_event = alc260_hp_3012_unsol_event,
6453 .init_hook = alc260_hp_3012_automute,
6455 [ALC260_HP_3013] = {
6456 .mixers = { alc260_hp_3013_mixer,
6457 alc260_input_mixer },
6458 .init_verbs = { alc260_hp_3013_init_verbs,
6459 alc260_hp_3013_unsol_verbs },
6460 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6461 .dac_nids = alc260_dac_nids,
6462 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6463 .adc_nids = alc260_adc_nids_alt,
6464 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6465 .channel_mode = alc260_modes,
6466 .input_mux = &alc260_capture_source,
6467 .unsol_event = alc260_hp_3013_unsol_event,
6468 .init_hook = alc260_hp_3013_automute,
6470 [ALC260_FUJITSU_S702X] = {
6471 .mixers = { alc260_fujitsu_mixer },
6472 .init_verbs = { alc260_fujitsu_init_verbs },
6473 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6474 .dac_nids = alc260_dac_nids,
6475 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6476 .adc_nids = alc260_dual_adc_nids,
6477 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6478 .channel_mode = alc260_modes,
6479 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6480 .input_mux = alc260_fujitsu_capture_sources,
6483 .mixers = { alc260_acer_mixer },
6484 .init_verbs = { alc260_acer_init_verbs },
6485 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6486 .dac_nids = alc260_dac_nids,
6487 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6488 .adc_nids = alc260_dual_adc_nids,
6489 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6490 .channel_mode = alc260_modes,
6491 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6492 .input_mux = alc260_acer_capture_sources,
6494 [ALC260_FAVORIT100] = {
6495 .mixers = { alc260_favorit100_mixer },
6496 .init_verbs = { alc260_favorit100_init_verbs },
6497 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6498 .dac_nids = alc260_dac_nids,
6499 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6500 .adc_nids = alc260_dual_adc_nids,
6501 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6502 .channel_mode = alc260_modes,
6503 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6504 .input_mux = alc260_favorit100_capture_sources,
6507 .mixers = { alc260_will_mixer },
6508 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6509 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6510 .dac_nids = alc260_dac_nids,
6511 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6512 .adc_nids = alc260_adc_nids,
6513 .dig_out_nid = ALC260_DIGOUT_NID,
6514 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6515 .channel_mode = alc260_modes,
6516 .input_mux = &alc260_capture_source,
6518 [ALC260_REPLACER_672V] = {
6519 .mixers = { alc260_replacer_672v_mixer },
6520 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6521 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6522 .dac_nids = alc260_dac_nids,
6523 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6524 .adc_nids = alc260_adc_nids,
6525 .dig_out_nid = ALC260_DIGOUT_NID,
6526 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6527 .channel_mode = alc260_modes,
6528 .input_mux = &alc260_capture_source,
6529 .unsol_event = alc260_replacer_672v_unsol_event,
6530 .init_hook = alc260_replacer_672v_automute,
6532 #ifdef CONFIG_SND_DEBUG
6534 .mixers = { alc260_test_mixer },
6535 .init_verbs = { alc260_test_init_verbs },
6536 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6537 .dac_nids = alc260_test_dac_nids,
6538 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6539 .adc_nids = alc260_test_adc_nids,
6540 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6541 .channel_mode = alc260_modes,
6542 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6543 .input_mux = alc260_test_capture_sources,
6548 static int patch_alc260(struct hda_codec *codec)
6550 struct alc_spec *spec;
6551 int err, board_config;
6553 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6559 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6562 if (board_config < 0) {
6563 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6565 board_config = ALC260_AUTO;
6568 if (board_config == ALC260_AUTO) {
6569 /* automatic parse from the BIOS config */
6570 err = alc260_parse_auto_config(codec);
6576 "hda_codec: Cannot set up configuration "
6577 "from BIOS. Using base mode...\n");
6578 board_config = ALC260_BASIC;
6582 err = snd_hda_attach_beep_device(codec, 0x1);
6588 if (board_config != ALC260_AUTO)
6589 setup_preset(codec, &alc260_presets[board_config]);
6591 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6592 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6594 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6595 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6597 if (!spec->adc_nids && spec->input_mux) {
6598 /* check whether NID 0x04 is valid */
6599 unsigned int wcap = get_wcaps(codec, 0x04);
6600 wcap = get_wcaps_type(wcap);
6602 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6603 spec->adc_nids = alc260_adc_nids_alt;
6604 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6606 spec->adc_nids = alc260_adc_nids;
6607 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6610 set_capture_mixer(codec);
6611 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6613 spec->vmaster_nid = 0x08;
6615 codec->patch_ops = alc_patch_ops;
6616 if (board_config == ALC260_AUTO)
6617 spec->init_hook = alc260_auto_init;
6618 #ifdef CONFIG_SND_HDA_POWER_SAVE
6619 if (!spec->loopback.amplist)
6620 spec->loopback.amplist = alc260_loopbacks;
6622 codec->proc_widget_hook = print_realtek_coef;
6629 * ALC882/883/885/888/889 support
6631 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6632 * configuration. Each pin widget can choose any input DACs and a mixer.
6633 * Each ADC is connected from a mixer of all inputs. This makes possible
6634 * 6-channel independent captures.
6636 * In addition, an independent DAC for the multi-playback (not used in this
6639 #define ALC882_DIGOUT_NID 0x06
6640 #define ALC882_DIGIN_NID 0x0a
6641 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6642 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6643 #define ALC1200_DIGOUT_NID 0x10
6646 static struct hda_channel_mode alc882_ch_modes[1] = {
6651 static hda_nid_t alc882_dac_nids[4] = {
6652 /* front, rear, clfe, rear_surr */
6653 0x02, 0x03, 0x04, 0x05
6655 #define alc883_dac_nids alc882_dac_nids
6658 #define alc882_adc_nids alc880_adc_nids
6659 #define alc882_adc_nids_alt alc880_adc_nids_alt
6660 #define alc883_adc_nids alc882_adc_nids_alt
6661 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6662 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6663 #define alc889_adc_nids alc880_adc_nids
6665 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6666 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6667 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6668 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6669 #define alc889_capsrc_nids alc882_capsrc_nids
6672 /* FIXME: should be a matrix-type input source selection */
6674 static struct hda_input_mux alc882_capture_source = {
6678 { "Front Mic", 0x1 },
6684 #define alc883_capture_source alc882_capture_source
6686 static struct hda_input_mux alc889_capture_source = {
6689 { "Front Mic", 0x0 },
6695 static struct hda_input_mux mb5_capture_source = {
6704 static struct hda_input_mux alc883_3stack_6ch_intel = {
6708 { "Front Mic", 0x0 },
6714 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6722 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6732 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6740 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6744 { "Front Mic", 0x1 },
6749 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6757 static struct hda_input_mux alc889A_mb31_capture_source = {
6761 /* Front Mic (0x01) unused */
6763 /* Line 2 (0x03) unused */
6764 /* CD (0x04) unused? */
6771 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6778 static struct hda_verb alc882_3ST_ch2_init[] = {
6779 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6780 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6781 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6782 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6789 static struct hda_verb alc882_3ST_ch4_init[] = {
6790 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6791 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6792 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6793 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6794 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6801 static struct hda_verb alc882_3ST_ch6_init[] = {
6802 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6803 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6804 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6805 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6806 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6807 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6811 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6812 { 2, alc882_3ST_ch2_init },
6813 { 4, alc882_3ST_ch4_init },
6814 { 6, alc882_3ST_ch6_init },
6817 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6822 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6823 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6824 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6825 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6826 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6827 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6834 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6835 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6836 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6837 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6838 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6839 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6840 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6847 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6848 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6849 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6851 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6852 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6853 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6854 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6858 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6859 { 2, alc883_3ST_ch2_clevo_init },
6860 { 4, alc883_3ST_ch4_clevo_init },
6861 { 6, alc883_3ST_ch6_clevo_init },
6868 static struct hda_verb alc882_sixstack_ch6_init[] = {
6869 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6870 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6871 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6872 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6879 static struct hda_verb alc882_sixstack_ch8_init[] = {
6880 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6881 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6882 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6888 { 6, alc882_sixstack_ch6_init },
6889 { 8, alc882_sixstack_ch8_init },
6893 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6899 static struct hda_verb alc885_mbp_ch2_init[] = {
6900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6901 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6902 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6909 static struct hda_verb alc885_mbp_ch4_init[] = {
6910 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6911 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6912 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6913 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6914 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6918 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6919 { 2, alc885_mbp_ch2_init },
6920 { 4, alc885_mbp_ch4_init },
6925 * Speakers/Woofer/HP = Front
6928 static struct hda_verb alc885_mb5_ch2_init[] = {
6929 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6930 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6936 * Speakers/HP = Front
6940 static struct hda_verb alc885_mb5_ch6_init[] = {
6941 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6942 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6943 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6947 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6948 { 2, alc885_mb5_ch2_init },
6949 { 6, alc885_mb5_ch6_init },
6956 static struct hda_verb alc883_4ST_ch2_init[] = {
6957 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6958 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6959 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6960 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6961 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6962 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6969 static struct hda_verb alc883_4ST_ch4_init[] = {
6970 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6971 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6972 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6973 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6974 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6975 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6976 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6983 static struct hda_verb alc883_4ST_ch6_init[] = {
6984 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6985 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6986 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6987 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6988 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6989 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6990 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6991 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6998 static struct hda_verb alc883_4ST_ch8_init[] = {
6999 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7000 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7001 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7002 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7003 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7004 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7005 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7006 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7007 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7011 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7012 { 2, alc883_4ST_ch2_init },
7013 { 4, alc883_4ST_ch4_init },
7014 { 6, alc883_4ST_ch6_init },
7015 { 8, alc883_4ST_ch8_init },
7022 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7023 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7024 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7025 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7026 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7033 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7034 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7035 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7036 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7037 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7038 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7045 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7046 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7047 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7048 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7049 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7050 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7051 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7055 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7056 { 2, alc883_3ST_ch2_intel_init },
7057 { 4, alc883_3ST_ch4_intel_init },
7058 { 6, alc883_3ST_ch6_intel_init },
7064 static struct hda_verb alc889_ch2_intel_init[] = {
7065 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7066 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7067 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7068 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7069 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7070 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7077 static struct hda_verb alc889_ch6_intel_init[] = {
7078 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7079 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7080 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7081 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7082 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7083 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7090 static struct hda_verb alc889_ch8_intel_init[] = {
7091 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7092 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7093 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7094 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7095 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7096 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7097 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7101 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7102 { 2, alc889_ch2_intel_init },
7103 { 6, alc889_ch6_intel_init },
7104 { 8, alc889_ch8_intel_init },
7110 static struct hda_verb alc883_sixstack_ch6_init[] = {
7111 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7112 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7113 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7114 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7121 static struct hda_verb alc883_sixstack_ch8_init[] = {
7122 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7123 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7124 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7125 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7129 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7130 { 6, alc883_sixstack_ch6_init },
7131 { 8, alc883_sixstack_ch8_init },
7135 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7136 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7138 static struct snd_kcontrol_new alc882_base_mixer[] = {
7139 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7140 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7141 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7142 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7143 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7144 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7145 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7146 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7147 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7148 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7150 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7151 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7153 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7154 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7156 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7157 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7158 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7159 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7163 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7164 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7165 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7167 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7168 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7169 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7170 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7171 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7172 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7173 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7178 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7179 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7180 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7181 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7182 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7183 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7184 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7185 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7186 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7188 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7190 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7191 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7196 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7197 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7198 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7199 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7200 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7201 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7202 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7204 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7210 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7211 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7212 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7213 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7214 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7216 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7217 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7219 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7223 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7224 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7225 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7226 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7227 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7228 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7230 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7232 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7235 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7236 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7240 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7241 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7243 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7245 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7246 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7247 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7252 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7253 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7256 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7260 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7261 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7262 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7263 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7267 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7268 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7269 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7274 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7277 .name = "Channel Mode",
7278 .info = alc_ch_mode_info,
7279 .get = alc_ch_mode_get,
7280 .put = alc_ch_mode_put,
7285 static struct hda_verb alc882_base_init_verbs[] = {
7286 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7299 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7300 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7303 /* mute analog input loopbacks */
7304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7310 /* Front Pin: output 0 (0x0c) */
7311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7313 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7314 /* Rear Pin: output 1 (0x0d) */
7315 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7316 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7317 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7318 /* CLFE Pin: output 2 (0x0e) */
7319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7320 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7321 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7322 /* Side Pin: output 3 (0x0f) */
7323 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7324 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7325 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7326 /* Mic (rear) pin: input vref at 80% */
7327 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7328 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7329 /* Front Mic pin: input vref at 80% */
7330 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7331 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7332 /* Line In pin: input */
7333 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7334 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7335 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7336 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7337 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7338 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7339 /* CD pin widget for input */
7340 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7342 /* FIXME: use matrix-type input source selection */
7343 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7354 /* ADC2: mute amp left and right */
7355 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7356 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7357 /* ADC3: mute amp left and right */
7358 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7359 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7364 static struct hda_verb alc882_adc1_init_verbs[] = {
7365 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7370 /* ADC1: mute amp left and right */
7371 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7372 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7376 static struct hda_verb alc882_eapd_verbs[] = {
7377 /* change to EAPD mode */
7378 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7379 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7383 static struct hda_verb alc889_eapd_verbs[] = {
7384 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7385 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7389 static struct hda_verb alc_hp15_unsol_verbs[] = {
7390 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7391 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7395 static struct hda_verb alc885_init_verbs[] = {
7396 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7410 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7413 /* mute analog input loopbacks */
7414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7418 /* Front HP Pin: output 0 (0x0c) */
7419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7420 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7421 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7422 /* Front Pin: output 0 (0x0c) */
7423 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7425 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7426 /* Rear Pin: output 1 (0x0d) */
7427 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7428 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7429 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7430 /* CLFE Pin: output 2 (0x0e) */
7431 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7432 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7433 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7434 /* Side Pin: output 3 (0x0f) */
7435 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7436 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7437 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7438 /* Mic (rear) pin: input vref at 80% */
7439 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7440 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7441 /* Front Mic pin: input vref at 80% */
7442 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7444 /* Line In pin: input */
7445 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7446 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7448 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7461 /* ADC2: mute amp left and right */
7462 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7463 /* ADC3: mute amp left and right */
7464 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7469 static struct hda_verb alc885_init_input_verbs[] = {
7470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7477 /* Unmute Selector 24h and set the default input to front mic */
7478 static struct hda_verb alc889_init_input_verbs[] = {
7479 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7485 #define alc883_init_verbs alc882_base_init_verbs
7488 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7489 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7490 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7491 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7493 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7494 /* FIXME: this looks suspicious...
7495 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7496 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7501 static struct hda_verb alc882_macpro_init_verbs[] = {
7502 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7506 /* Front Pin: output 0 (0x0c) */
7507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7508 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7509 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7510 /* Front Mic pin: input vref at 80% */
7511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7512 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7513 /* Speaker: output */
7514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7515 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7516 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7517 /* Headphone output (output 0 - 0x0c) */
7518 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7519 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7520 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7522 /* FIXME: use matrix-type input source selection */
7523 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7524 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7532 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7539 /* ADC1: mute amp left and right */
7540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7541 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7542 /* ADC2: mute amp left and right */
7543 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7544 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7545 /* ADC3: mute amp left and right */
7546 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7547 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7553 static struct hda_verb alc885_mb5_init_verbs[] = {
7555 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7556 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7557 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7558 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7563 /* Surround mixer */
7564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7570 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7572 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7574 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7575 /* Front Pin (0x0c) */
7576 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7577 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7578 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7579 /* LFE Pin (0x0e) */
7580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7581 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7582 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7584 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7585 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7586 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7587 /* Front Mic pin: input vref at 80% */
7588 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7589 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7592 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7601 /* Macbook Pro rev3 */
7602 static struct hda_verb alc885_mbp3_init_verbs[] = {
7603 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7610 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7613 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7615 /* Front Pin: output 0 (0x0c) */
7616 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7617 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7618 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7619 /* HP Pin: output 0 (0x0e) */
7620 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7621 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7622 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7624 /* Mic (rear) pin: input vref at 80% */
7625 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7626 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7627 /* Front Mic pin: input vref at 80% */
7628 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7629 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7630 /* Line In pin: use output 1 when in LineOut mode */
7631 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7632 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7633 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7635 /* FIXME: use matrix-type input source selection */
7636 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7637 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7652 /* ADC1: mute amp left and right */
7653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7654 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7655 /* ADC2: mute amp left and right */
7656 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7657 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7658 /* ADC3: mute amp left and right */
7659 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7660 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7666 static struct hda_verb alc885_imac91_init_verbs[] = {
7667 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7674 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7675 /* HP Pin: output 0 (0x0c) */
7676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7677 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7678 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7679 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7680 /* Internal Speakers: output 0 (0x0d) */
7681 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7684 /* Mic (rear) pin: input vref at 80% */
7685 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7686 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7687 /* Front Mic pin: input vref at 80% */
7688 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7689 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7690 /* Line In pin: use output 1 when in LineOut mode */
7691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7692 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7693 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7695 /* FIXME: use matrix-type input source selection */
7696 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7697 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7712 /* ADC1: mute amp left and right */
7713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7714 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7715 /* ADC2: mute amp left and right */
7716 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7717 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7718 /* ADC3: mute amp left and right */
7719 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7720 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7725 /* iMac 24 mixer. */
7726 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7727 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7728 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7732 /* iMac 24 init verbs. */
7733 static struct hda_verb alc885_imac24_init_verbs[] = {
7734 /* Internal speakers: output 0 (0x0c) */
7735 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7736 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7737 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7738 /* Internal speakers: output 0 (0x0c) */
7739 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7740 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7741 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7742 /* Headphone: output 0 (0x0c) */
7743 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7744 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7745 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7746 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7747 /* Front Mic: input vref at 80% */
7748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7753 /* Toggle speaker-output according to the hp-jack state */
7754 static void alc885_imac24_setup(struct hda_codec *codec)
7756 struct alc_spec *spec = codec->spec;
7758 spec->autocfg.hp_pins[0] = 0x14;
7759 spec->autocfg.speaker_pins[0] = 0x18;
7760 spec->autocfg.speaker_pins[1] = 0x1a;
7763 static void alc885_mbp3_setup(struct hda_codec *codec)
7765 struct alc_spec *spec = codec->spec;
7767 spec->autocfg.hp_pins[0] = 0x15;
7768 spec->autocfg.speaker_pins[0] = 0x14;
7771 static void alc885_imac91_automute(struct hda_codec *codec)
7773 unsigned int present;
7775 present = snd_hda_codec_read(codec, 0x14, 0,
7776 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7777 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7778 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7779 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7780 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7784 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7787 /* Headphone insertion or removal. */
7788 if ((res >> 26) == ALC880_HP_EVENT)
7789 alc885_imac91_automute(codec);
7792 static struct hda_verb alc882_targa_verbs[] = {
7793 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7796 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7797 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7799 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7800 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7801 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7803 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7807 /* toggle speaker-output according to the hp-jack state */
7808 static void alc882_targa_automute(struct hda_codec *codec)
7810 struct alc_spec *spec = codec->spec;
7811 alc_automute_amp(codec);
7812 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7813 spec->jack_present ? 1 : 3);
7816 static void alc882_targa_setup(struct hda_codec *codec)
7818 struct alc_spec *spec = codec->spec;
7820 spec->autocfg.hp_pins[0] = 0x14;
7821 spec->autocfg.speaker_pins[0] = 0x1b;
7824 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7826 if ((res >> 26) == ALC880_HP_EVENT)
7827 alc882_targa_automute(codec);
7830 static struct hda_verb alc882_asus_a7j_verbs[] = {
7831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7835 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7838 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7840 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7842 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7843 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7844 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7848 static struct hda_verb alc882_asus_a7m_verbs[] = {
7849 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7854 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7856 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7857 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7858 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7860 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7861 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7862 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7866 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7868 unsigned int gpiostate, gpiomask, gpiodir;
7870 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7871 AC_VERB_GET_GPIO_DATA, 0);
7874 gpiostate |= (1 << pin);
7876 gpiostate &= ~(1 << pin);
7878 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7879 AC_VERB_GET_GPIO_MASK, 0);
7880 gpiomask |= (1 << pin);
7882 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7883 AC_VERB_GET_GPIO_DIRECTION, 0);
7884 gpiodir |= (1 << pin);
7887 snd_hda_codec_write(codec, codec->afg, 0,
7888 AC_VERB_SET_GPIO_MASK, gpiomask);
7889 snd_hda_codec_write(codec, codec->afg, 0,
7890 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7894 snd_hda_codec_write(codec, codec->afg, 0,
7895 AC_VERB_SET_GPIO_DATA, gpiostate);
7898 /* set up GPIO at initialization */
7899 static void alc885_macpro_init_hook(struct hda_codec *codec)
7901 alc882_gpio_mute(codec, 0, 0);
7902 alc882_gpio_mute(codec, 1, 0);
7905 /* set up GPIO and update auto-muting at initialization */
7906 static void alc885_imac24_init_hook(struct hda_codec *codec)
7908 alc885_macpro_init_hook(codec);
7909 alc_automute_amp(codec);
7913 * generic initialization of ADC, input mixers and output mixers
7915 static struct hda_verb alc883_auto_init_verbs[] = {
7917 * Unmute ADC0-2 and set the default input to mic-in
7919 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7920 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7921 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7922 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7924 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7926 * Note: PASD motherboards uses the Line In 2 as the input for
7927 * front panel mic (mic 2)
7929 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7937 * Set up output mixers (0x0c - 0x0f)
7939 /* set vol=0 to output mixers */
7940 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7941 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7942 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7943 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7944 /* set up input amps for analog loopback */
7945 /* Amp Indices: DAC = 0, mixer = 1 */
7946 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7948 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7950 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7952 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7954 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7955 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7957 /* FIXME: use matrix-type input source selection */
7958 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7960 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7973 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7974 static struct hda_verb alc889A_mb31_ch2_init[] = {
7975 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7976 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7977 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7978 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7982 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7983 static struct hda_verb alc889A_mb31_ch4_init[] = {
7984 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7985 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7986 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7987 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7991 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7992 static struct hda_verb alc889A_mb31_ch5_init[] = {
7993 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7994 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7995 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7996 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8000 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8001 static struct hda_verb alc889A_mb31_ch6_init[] = {
8002 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8003 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8004 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8005 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8009 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8010 { 2, alc889A_mb31_ch2_init },
8011 { 4, alc889A_mb31_ch4_init },
8012 { 5, alc889A_mb31_ch5_init },
8013 { 6, alc889A_mb31_ch6_init },
8016 static struct hda_verb alc883_medion_eapd_verbs[] = {
8017 /* eanable EAPD on medion laptop */
8018 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8019 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8023 #define alc883_base_mixer alc882_base_mixer
8025 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8026 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8027 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8028 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8029 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8030 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8031 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8032 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8033 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8035 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8036 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8038 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8042 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8043 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8050 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8052 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8056 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8057 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8058 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8060 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8061 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8063 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8066 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8070 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8071 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8072 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8073 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8074 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8075 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8077 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8080 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8083 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8087 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8092 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8094 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8095 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8096 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8097 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8098 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8104 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8105 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8106 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8110 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8111 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8112 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8113 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8114 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8115 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8117 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8118 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8119 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8121 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8122 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8124 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8125 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8127 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8128 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8130 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8134 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8135 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8136 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8137 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8138 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8139 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8141 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8142 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8143 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8145 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8146 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8147 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8148 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8149 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8151 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8152 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8153 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8154 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8158 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8159 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8160 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8161 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8162 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8163 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8164 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8165 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8166 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8168 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8169 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8171 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8175 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8177 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8181 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8182 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8183 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8184 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8185 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8186 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8187 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8188 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8189 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8191 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8192 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8193 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8195 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8197 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8202 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8203 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8204 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8206 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8207 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8208 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8209 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8210 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8212 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8214 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8218 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8219 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8220 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8221 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8223 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8227 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8229 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8230 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8231 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8232 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8233 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8239 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8240 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8241 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8242 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8243 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8244 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8247 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8248 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8252 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8253 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8256 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8257 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8259 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8260 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8261 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8265 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8267 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8269 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8270 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8271 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8277 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8278 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8279 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8280 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8281 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8282 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8283 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8284 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8285 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8286 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8292 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8293 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8294 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8295 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8296 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8297 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8298 0x0d, 1, 0x0, HDA_OUTPUT),
8299 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8301 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8302 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8303 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8304 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8305 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8307 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8309 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8310 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8313 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8317 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8319 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8320 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8323 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8325 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8326 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8327 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8328 /* Output switches */
8329 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8330 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8331 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8333 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8334 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8337 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8338 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8339 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8343 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8344 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8345 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8346 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8347 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8348 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8349 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8353 static struct hda_bind_ctls alc883_bind_cap_vol = {
8354 .ops = &snd_hda_bind_vol,
8356 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8357 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8362 static struct hda_bind_ctls alc883_bind_cap_switch = {
8363 .ops = &snd_hda_bind_sw,
8365 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8366 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8371 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8372 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8373 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8375 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8376 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8379 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8383 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8384 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8385 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8388 /* .name = "Capture Source", */
8389 .name = "Input Source",
8391 .info = alc_mux_enum_info,
8392 .get = alc_mux_enum_get,
8393 .put = alc_mux_enum_put,
8398 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8401 .name = "Channel Mode",
8402 .info = alc_ch_mode_info,
8403 .get = alc_ch_mode_get,
8404 .put = alc_ch_mode_put,
8409 /* toggle speaker-output according to the hp-jack state */
8410 static void alc883_mitac_setup(struct hda_codec *codec)
8412 struct alc_spec *spec = codec->spec;
8414 spec->autocfg.hp_pins[0] = 0x15;
8415 spec->autocfg.speaker_pins[0] = 0x14;
8416 spec->autocfg.speaker_pins[1] = 0x17;
8419 /* auto-toggle front mic */
8421 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8423 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8425 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8429 static struct hda_verb alc883_mitac_verbs[] = {
8431 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8432 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8434 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8435 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8437 /* enable unsolicited event */
8438 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8439 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8444 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8446 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8447 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8449 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8451 /* enable unsolicited event */
8453 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8454 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8460 static struct hda_verb alc883_clevo_m720_verbs[] = {
8462 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8463 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8465 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8468 /* enable unsolicited event */
8469 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8470 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8475 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8477 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8478 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8481 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8483 /* enable unsolicited event */
8484 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8489 static struct hda_verb alc883_targa_verbs[] = {
8490 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8493 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8494 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8496 /* Connect Line-Out side jack (SPDIF) to Side */
8497 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8499 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8500 /* Connect Mic jack to CLFE */
8501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8504 /* Connect Line-in jack to Surround */
8505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8507 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8508 /* Connect HP out jack to Front */
8509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8511 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8513 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8518 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8519 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8520 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8521 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8525 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8528 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8529 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8533 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8534 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8536 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8537 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8538 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8542 static struct hda_verb alc883_haier_w66_verbs[] = {
8543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8548 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8550 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8551 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8555 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8556 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8558 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8559 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8560 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8561 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8562 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8563 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8567 static struct hda_verb alc888_6st_dell_verbs[] = {
8568 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8572 static struct hda_verb alc883_vaiott_verbs[] = {
8574 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8577 /* enable unsolicited event */
8578 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8583 static void alc888_3st_hp_setup(struct hda_codec *codec)
8585 struct alc_spec *spec = codec->spec;
8587 spec->autocfg.hp_pins[0] = 0x1b;
8588 spec->autocfg.speaker_pins[0] = 0x14;
8589 spec->autocfg.speaker_pins[1] = 0x16;
8590 spec->autocfg.speaker_pins[2] = 0x18;
8593 static struct hda_verb alc888_3st_hp_verbs[] = {
8594 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8595 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8596 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8597 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8604 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8605 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8606 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8607 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8608 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8615 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8616 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8617 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8618 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8619 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8620 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8627 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8628 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8629 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8630 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8631 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8632 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8633 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8637 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8638 { 2, alc888_3st_hp_2ch_init },
8639 { 4, alc888_3st_hp_4ch_init },
8640 { 6, alc888_3st_hp_6ch_init },
8643 /* toggle front-jack and RCA according to the hp-jack state */
8644 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8646 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8648 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8649 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8650 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8651 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8654 /* toggle RCA according to the front-jack state */
8655 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8657 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8659 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8660 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8663 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8666 if ((res >> 26) == ALC880_HP_EVENT)
8667 alc888_lenovo_ms7195_front_automute(codec);
8668 if ((res >> 26) == ALC880_FRONT_EVENT)
8669 alc888_lenovo_ms7195_rca_automute(codec);
8672 static struct hda_verb alc883_medion_md2_verbs[] = {
8673 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8676 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8678 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8682 /* toggle speaker-output according to the hp-jack state */
8683 static void alc883_medion_md2_setup(struct hda_codec *codec)
8685 struct alc_spec *spec = codec->spec;
8687 spec->autocfg.hp_pins[0] = 0x14;
8688 spec->autocfg.speaker_pins[0] = 0x15;
8691 /* toggle speaker-output according to the hp-jack state */
8692 #define alc883_targa_init_hook alc882_targa_init_hook
8693 #define alc883_targa_unsol_event alc882_targa_unsol_event
8695 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8697 unsigned int present;
8699 present = snd_hda_jack_detect(codec, 0x18);
8700 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8701 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8704 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8706 struct alc_spec *spec = codec->spec;
8708 spec->autocfg.hp_pins[0] = 0x15;
8709 spec->autocfg.speaker_pins[0] = 0x14;
8712 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8714 alc_automute_amp(codec);
8715 alc883_clevo_m720_mic_automute(codec);
8718 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8721 switch (res >> 26) {
8722 case ALC880_MIC_EVENT:
8723 alc883_clevo_m720_mic_automute(codec);
8726 alc_automute_amp_unsol_event(codec, res);
8731 /* toggle speaker-output according to the hp-jack state */
8732 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8734 struct alc_spec *spec = codec->spec;
8736 spec->autocfg.hp_pins[0] = 0x14;
8737 spec->autocfg.speaker_pins[0] = 0x15;
8740 static void alc883_haier_w66_setup(struct hda_codec *codec)
8742 struct alc_spec *spec = codec->spec;
8744 spec->autocfg.hp_pins[0] = 0x1b;
8745 spec->autocfg.speaker_pins[0] = 0x14;
8748 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8750 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8752 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8753 HDA_AMP_MUTE, bits);
8756 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8758 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8760 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8761 HDA_AMP_MUTE, bits);
8762 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8763 HDA_AMP_MUTE, bits);
8766 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8769 if ((res >> 26) == ALC880_HP_EVENT)
8770 alc883_lenovo_101e_all_automute(codec);
8771 if ((res >> 26) == ALC880_FRONT_EVENT)
8772 alc883_lenovo_101e_ispeaker_automute(codec);
8775 /* toggle speaker-output according to the hp-jack state */
8776 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8778 struct alc_spec *spec = codec->spec;
8780 spec->autocfg.hp_pins[0] = 0x14;
8781 spec->autocfg.speaker_pins[0] = 0x15;
8782 spec->autocfg.speaker_pins[1] = 0x16;
8785 static struct hda_verb alc883_acer_eapd_verbs[] = {
8786 /* HP Pin: output 0 (0x0c) */
8787 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8788 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8789 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8790 /* Front Pin: output 0 (0x0c) */
8791 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8792 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8794 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8795 /* eanable EAPD on medion laptop */
8796 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8797 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8798 /* enable unsolicited event */
8799 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8803 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8804 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8805 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8806 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8810 static void alc888_6st_dell_setup(struct hda_codec *codec)
8812 struct alc_spec *spec = codec->spec;
8814 spec->autocfg.hp_pins[0] = 0x1b;
8815 spec->autocfg.speaker_pins[0] = 0x14;
8816 spec->autocfg.speaker_pins[1] = 0x15;
8817 spec->autocfg.speaker_pins[2] = 0x16;
8818 spec->autocfg.speaker_pins[3] = 0x17;
8821 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8823 struct alc_spec *spec = codec->spec;
8825 spec->autocfg.hp_pins[0] = 0x1b;
8826 spec->autocfg.speaker_pins[0] = 0x14;
8827 spec->autocfg.speaker_pins[1] = 0x15;
8828 spec->autocfg.speaker_pins[2] = 0x16;
8829 spec->autocfg.speaker_pins[3] = 0x17;
8830 spec->autocfg.speaker_pins[4] = 0x1a;
8833 static void alc883_vaiott_setup(struct hda_codec *codec)
8835 struct alc_spec *spec = codec->spec;
8837 spec->autocfg.hp_pins[0] = 0x15;
8838 spec->autocfg.speaker_pins[0] = 0x14;
8839 spec->autocfg.speaker_pins[1] = 0x17;
8842 static struct hda_verb alc888_asus_m90v_verbs[] = {
8843 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8844 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8846 /* enable unsolicited event */
8847 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8848 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8852 static void alc883_mode2_setup(struct hda_codec *codec)
8854 struct alc_spec *spec = codec->spec;
8856 spec->autocfg.hp_pins[0] = 0x1b;
8857 spec->autocfg.speaker_pins[0] = 0x14;
8858 spec->autocfg.speaker_pins[1] = 0x15;
8859 spec->autocfg.speaker_pins[2] = 0x16;
8860 spec->ext_mic.pin = 0x18;
8861 spec->int_mic.pin = 0x19;
8862 spec->ext_mic.mux_idx = 0;
8863 spec->int_mic.mux_idx = 1;
8867 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8868 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8869 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8870 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8871 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8873 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8874 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8875 /* enable unsolicited event */
8876 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8880 static void alc883_eee1601_inithook(struct hda_codec *codec)
8882 struct alc_spec *spec = codec->spec;
8884 spec->autocfg.hp_pins[0] = 0x14;
8885 spec->autocfg.speaker_pins[0] = 0x1b;
8886 alc_automute_pin(codec);
8889 static struct hda_verb alc889A_mb31_verbs[] = {
8890 /* Init rear pin (used as headphone output) */
8891 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8893 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8894 /* Init line pin (used as output in 4ch and 6ch mode) */
8895 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8896 /* Init line 2 pin (used as headphone out by default) */
8897 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8898 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8902 /* Mute speakers according to the headphone jack state */
8903 static void alc889A_mb31_automute(struct hda_codec *codec)
8905 unsigned int present;
8907 /* Mute only in 2ch or 4ch mode */
8908 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8910 present = snd_hda_jack_detect(codec, 0x15);
8911 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8912 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8913 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8914 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8918 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8920 if ((res >> 26) == ALC880_HP_EVENT)
8921 alc889A_mb31_automute(codec);
8925 #ifdef CONFIG_SND_HDA_POWER_SAVE
8926 #define alc882_loopbacks alc880_loopbacks
8929 /* pcm configuration: identical with ALC880 */
8930 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8931 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8932 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8933 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8935 static hda_nid_t alc883_slave_dig_outs[] = {
8936 ALC1200_DIGOUT_NID, 0,
8939 static hda_nid_t alc1200_slave_dig_outs[] = {
8940 ALC883_DIGOUT_NID, 0,
8944 * configuration and preset
8946 static const char *alc882_models[ALC882_MODEL_LAST] = {
8947 [ALC882_3ST_DIG] = "3stack-dig",
8948 [ALC882_6ST_DIG] = "6stack-dig",
8949 [ALC882_ARIMA] = "arima",
8950 [ALC882_W2JC] = "w2jc",
8951 [ALC882_TARGA] = "targa",
8952 [ALC882_ASUS_A7J] = "asus-a7j",
8953 [ALC882_ASUS_A7M] = "asus-a7m",
8954 [ALC885_MACPRO] = "macpro",
8955 [ALC885_MB5] = "mb5",
8956 [ALC885_MBP3] = "mbp3",
8957 [ALC885_IMAC24] = "imac24",
8958 [ALC885_IMAC91] = "imac91",
8959 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8960 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8961 [ALC883_3ST_6ch] = "3stack-6ch",
8962 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8963 [ALC883_TARGA_DIG] = "targa-dig",
8964 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8965 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8966 [ALC883_ACER] = "acer",
8967 [ALC883_ACER_ASPIRE] = "acer-aspire",
8968 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8969 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8970 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8971 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8972 [ALC883_MEDION] = "medion",
8973 [ALC883_MEDION_MD2] = "medion-md2",
8974 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8975 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8976 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8977 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8978 [ALC888_LENOVO_SKY] = "lenovo-sky",
8979 [ALC883_HAIER_W66] = "haier-w66",
8980 [ALC888_3ST_HP] = "3stack-hp",
8981 [ALC888_6ST_DELL] = "6stack-dell",
8982 [ALC883_MITAC] = "mitac",
8983 [ALC883_CLEVO_M540R] = "clevo-m540r",
8984 [ALC883_CLEVO_M720] = "clevo-m720",
8985 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8986 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8987 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8988 [ALC889A_INTEL] = "intel-alc889a",
8989 [ALC889_INTEL] = "intel-x58",
8990 [ALC1200_ASUS_P5Q] = "asus-p5q",
8991 [ALC889A_MB31] = "mb31",
8992 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8993 [ALC882_AUTO] = "auto",
8996 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8997 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8999 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9000 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9001 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9002 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9003 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9004 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9005 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9006 ALC888_ACER_ASPIRE_4930G),
9007 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9008 ALC888_ACER_ASPIRE_4930G),
9009 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9010 ALC888_ACER_ASPIRE_8930G),
9011 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9012 ALC888_ACER_ASPIRE_8930G),
9013 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9014 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9015 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9016 ALC888_ACER_ASPIRE_6530G),
9017 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9018 ALC888_ACER_ASPIRE_6530G),
9019 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9020 ALC888_ACER_ASPIRE_7730G),
9021 /* default Acer -- disabled as it causes more problems.
9022 * model=auto should work fine now
9024 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9026 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9028 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9029 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9030 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9031 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9032 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9033 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9035 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9036 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9037 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9038 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9039 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9040 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9041 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9042 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9043 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9044 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9045 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9047 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9048 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9049 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9050 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9051 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9052 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9053 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9054 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9055 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9057 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9058 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9059 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9060 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9061 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9062 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9063 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9064 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9065 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9066 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9067 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9068 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9069 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9070 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9071 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9072 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9073 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9074 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9075 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9076 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9077 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9080 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9081 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9082 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9083 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9084 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9085 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9087 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9088 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9089 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9090 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9091 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9092 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9093 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9094 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9095 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9096 ALC883_FUJITSU_PI2515),
9097 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9098 ALC888_FUJITSU_XA3530),
9099 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9100 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9101 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9102 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9103 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9104 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9105 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9106 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9107 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9109 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9110 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9111 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9112 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9113 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9114 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9115 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9120 /* codec SSID table for Intel Mac */
9121 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9122 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9123 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9124 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9125 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9126 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9127 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9128 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9129 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9130 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9131 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9132 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9133 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9134 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9135 * so apparently no perfect solution yet
9137 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9138 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9142 static struct alc_config_preset alc882_presets[] = {
9143 [ALC882_3ST_DIG] = {
9144 .mixers = { alc882_base_mixer },
9145 .init_verbs = { alc882_base_init_verbs,
9146 alc882_adc1_init_verbs },
9147 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9148 .dac_nids = alc882_dac_nids,
9149 .dig_out_nid = ALC882_DIGOUT_NID,
9150 .dig_in_nid = ALC882_DIGIN_NID,
9151 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9152 .channel_mode = alc882_ch_modes,
9154 .input_mux = &alc882_capture_source,
9156 [ALC882_6ST_DIG] = {
9157 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9158 .init_verbs = { alc882_base_init_verbs,
9159 alc882_adc1_init_verbs },
9160 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9161 .dac_nids = alc882_dac_nids,
9162 .dig_out_nid = ALC882_DIGOUT_NID,
9163 .dig_in_nid = ALC882_DIGIN_NID,
9164 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9165 .channel_mode = alc882_sixstack_modes,
9166 .input_mux = &alc882_capture_source,
9169 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9170 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9171 alc882_eapd_verbs },
9172 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9173 .dac_nids = alc882_dac_nids,
9174 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9175 .channel_mode = alc882_sixstack_modes,
9176 .input_mux = &alc882_capture_source,
9179 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9180 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9181 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9182 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9183 .dac_nids = alc882_dac_nids,
9184 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9185 .channel_mode = alc880_threestack_modes,
9187 .input_mux = &alc882_capture_source,
9188 .dig_out_nid = ALC882_DIGOUT_NID,
9191 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9192 .init_verbs = { alc885_mbp3_init_verbs,
9193 alc880_gpio1_init_verbs },
9195 .dac_nids = alc882_dac_nids,
9197 .channel_mode = alc885_mbp_4ch_modes,
9198 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9199 .input_mux = &alc882_capture_source,
9200 .dig_out_nid = ALC882_DIGOUT_NID,
9201 .dig_in_nid = ALC882_DIGIN_NID,
9202 .unsol_event = alc_automute_amp_unsol_event,
9203 .setup = alc885_mbp3_setup,
9204 .init_hook = alc_automute_amp,
9207 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9208 .init_verbs = { alc885_mb5_init_verbs,
9209 alc880_gpio1_init_verbs },
9210 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9211 .dac_nids = alc882_dac_nids,
9212 .channel_mode = alc885_mb5_6ch_modes,
9213 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9214 .input_mux = &mb5_capture_source,
9215 .dig_out_nid = ALC882_DIGOUT_NID,
9216 .dig_in_nid = ALC882_DIGIN_NID,
9219 .mixers = { alc882_macpro_mixer },
9220 .init_verbs = { alc882_macpro_init_verbs },
9221 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9222 .dac_nids = alc882_dac_nids,
9223 .dig_out_nid = ALC882_DIGOUT_NID,
9224 .dig_in_nid = ALC882_DIGIN_NID,
9225 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9226 .channel_mode = alc882_ch_modes,
9227 .input_mux = &alc882_capture_source,
9228 .init_hook = alc885_macpro_init_hook,
9231 .mixers = { alc885_imac24_mixer },
9232 .init_verbs = { alc885_imac24_init_verbs },
9233 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9234 .dac_nids = alc882_dac_nids,
9235 .dig_out_nid = ALC882_DIGOUT_NID,
9236 .dig_in_nid = ALC882_DIGIN_NID,
9237 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9238 .channel_mode = alc882_ch_modes,
9239 .input_mux = &alc882_capture_source,
9240 .unsol_event = alc_automute_amp_unsol_event,
9241 .setup = alc885_imac24_setup,
9242 .init_hook = alc885_imac24_init_hook,
9245 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9246 .init_verbs = { alc885_imac91_init_verbs,
9247 alc880_gpio1_init_verbs },
9248 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9249 .dac_nids = alc882_dac_nids,
9250 .channel_mode = alc885_mbp_4ch_modes,
9251 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9252 .input_mux = &alc882_capture_source,
9253 .dig_out_nid = ALC882_DIGOUT_NID,
9254 .dig_in_nid = ALC882_DIGIN_NID,
9255 .unsol_event = alc885_imac91_unsol_event,
9256 .init_hook = alc885_imac91_automute,
9259 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9260 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9261 alc880_gpio3_init_verbs, alc882_targa_verbs},
9262 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9263 .dac_nids = alc882_dac_nids,
9264 .dig_out_nid = ALC882_DIGOUT_NID,
9265 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9266 .adc_nids = alc882_adc_nids,
9267 .capsrc_nids = alc882_capsrc_nids,
9268 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9269 .channel_mode = alc882_3ST_6ch_modes,
9271 .input_mux = &alc882_capture_source,
9272 .unsol_event = alc882_targa_unsol_event,
9273 .setup = alc882_targa_setup,
9274 .init_hook = alc882_targa_automute,
9276 [ALC882_ASUS_A7J] = {
9277 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9278 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9279 alc882_asus_a7j_verbs},
9280 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9281 .dac_nids = alc882_dac_nids,
9282 .dig_out_nid = ALC882_DIGOUT_NID,
9283 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9284 .adc_nids = alc882_adc_nids,
9285 .capsrc_nids = alc882_capsrc_nids,
9286 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9287 .channel_mode = alc882_3ST_6ch_modes,
9289 .input_mux = &alc882_capture_source,
9291 [ALC882_ASUS_A7M] = {
9292 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9293 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9294 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9295 alc882_asus_a7m_verbs },
9296 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9297 .dac_nids = alc882_dac_nids,
9298 .dig_out_nid = ALC882_DIGOUT_NID,
9299 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9300 .channel_mode = alc880_threestack_modes,
9302 .input_mux = &alc882_capture_source,
9304 [ALC883_3ST_2ch_DIG] = {
9305 .mixers = { alc883_3ST_2ch_mixer },
9306 .init_verbs = { alc883_init_verbs },
9307 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9308 .dac_nids = alc883_dac_nids,
9309 .dig_out_nid = ALC883_DIGOUT_NID,
9310 .dig_in_nid = ALC883_DIGIN_NID,
9311 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9312 .channel_mode = alc883_3ST_2ch_modes,
9313 .input_mux = &alc883_capture_source,
9315 [ALC883_3ST_6ch_DIG] = {
9316 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9317 .init_verbs = { alc883_init_verbs },
9318 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9319 .dac_nids = alc883_dac_nids,
9320 .dig_out_nid = ALC883_DIGOUT_NID,
9321 .dig_in_nid = ALC883_DIGIN_NID,
9322 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9323 .channel_mode = alc883_3ST_6ch_modes,
9325 .input_mux = &alc883_capture_source,
9327 [ALC883_3ST_6ch] = {
9328 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9329 .init_verbs = { alc883_init_verbs },
9330 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9331 .dac_nids = alc883_dac_nids,
9332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9333 .channel_mode = alc883_3ST_6ch_modes,
9335 .input_mux = &alc883_capture_source,
9337 [ALC883_3ST_6ch_INTEL] = {
9338 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9339 .init_verbs = { alc883_init_verbs },
9340 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9341 .dac_nids = alc883_dac_nids,
9342 .dig_out_nid = ALC883_DIGOUT_NID,
9343 .dig_in_nid = ALC883_DIGIN_NID,
9344 .slave_dig_outs = alc883_slave_dig_outs,
9345 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9346 .channel_mode = alc883_3ST_6ch_intel_modes,
9348 .input_mux = &alc883_3stack_6ch_intel,
9351 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9352 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9353 alc_hp15_unsol_verbs },
9354 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9355 .dac_nids = alc883_dac_nids,
9356 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9357 .adc_nids = alc889_adc_nids,
9358 .dig_out_nid = ALC883_DIGOUT_NID,
9359 .dig_in_nid = ALC883_DIGIN_NID,
9360 .slave_dig_outs = alc883_slave_dig_outs,
9361 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9362 .channel_mode = alc889_8ch_intel_modes,
9363 .capsrc_nids = alc889_capsrc_nids,
9364 .input_mux = &alc889_capture_source,
9365 .setup = alc889_automute_setup,
9366 .init_hook = alc_automute_amp,
9367 .unsol_event = alc_automute_amp_unsol_event,
9371 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9372 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9373 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9374 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9375 .dac_nids = alc883_dac_nids,
9376 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9377 .adc_nids = alc889_adc_nids,
9378 .dig_out_nid = ALC883_DIGOUT_NID,
9379 .dig_in_nid = ALC883_DIGIN_NID,
9380 .slave_dig_outs = alc883_slave_dig_outs,
9381 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9382 .channel_mode = alc889_8ch_intel_modes,
9383 .capsrc_nids = alc889_capsrc_nids,
9384 .input_mux = &alc889_capture_source,
9385 .setup = alc889_automute_setup,
9386 .init_hook = alc889_intel_init_hook,
9387 .unsol_event = alc_automute_amp_unsol_event,
9390 [ALC883_6ST_DIG] = {
9391 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9392 .init_verbs = { alc883_init_verbs },
9393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9394 .dac_nids = alc883_dac_nids,
9395 .dig_out_nid = ALC883_DIGOUT_NID,
9396 .dig_in_nid = ALC883_DIGIN_NID,
9397 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9398 .channel_mode = alc883_sixstack_modes,
9399 .input_mux = &alc883_capture_source,
9401 [ALC883_TARGA_DIG] = {
9402 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9403 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9404 alc883_targa_verbs},
9405 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9406 .dac_nids = alc883_dac_nids,
9407 .dig_out_nid = ALC883_DIGOUT_NID,
9408 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9409 .channel_mode = alc883_3ST_6ch_modes,
9411 .input_mux = &alc883_capture_source,
9412 .unsol_event = alc883_targa_unsol_event,
9413 .setup = alc882_targa_setup,
9414 .init_hook = alc882_targa_automute,
9416 [ALC883_TARGA_2ch_DIG] = {
9417 .mixers = { alc883_targa_2ch_mixer},
9418 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9419 alc883_targa_verbs},
9420 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9421 .dac_nids = alc883_dac_nids,
9422 .adc_nids = alc883_adc_nids_alt,
9423 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9424 .capsrc_nids = alc883_capsrc_nids,
9425 .dig_out_nid = ALC883_DIGOUT_NID,
9426 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9427 .channel_mode = alc883_3ST_2ch_modes,
9428 .input_mux = &alc883_capture_source,
9429 .unsol_event = alc883_targa_unsol_event,
9430 .setup = alc882_targa_setup,
9431 .init_hook = alc882_targa_automute,
9433 [ALC883_TARGA_8ch_DIG] = {
9434 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9435 alc883_chmode_mixer },
9436 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9437 alc883_targa_verbs },
9438 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9439 .dac_nids = alc883_dac_nids,
9440 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9441 .adc_nids = alc883_adc_nids_rev,
9442 .capsrc_nids = alc883_capsrc_nids_rev,
9443 .dig_out_nid = ALC883_DIGOUT_NID,
9444 .dig_in_nid = ALC883_DIGIN_NID,
9445 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9446 .channel_mode = alc883_4ST_8ch_modes,
9448 .input_mux = &alc883_capture_source,
9449 .unsol_event = alc883_targa_unsol_event,
9450 .setup = alc882_targa_setup,
9451 .init_hook = alc882_targa_automute,
9454 .mixers = { alc883_base_mixer },
9455 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9456 * and the headphone jack. Turn this on and rely on the
9457 * standard mute methods whenever the user wants to turn
9458 * these outputs off.
9460 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9461 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9462 .dac_nids = alc883_dac_nids,
9463 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9464 .channel_mode = alc883_3ST_2ch_modes,
9465 .input_mux = &alc883_capture_source,
9467 [ALC883_ACER_ASPIRE] = {
9468 .mixers = { alc883_acer_aspire_mixer },
9469 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9470 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9471 .dac_nids = alc883_dac_nids,
9472 .dig_out_nid = ALC883_DIGOUT_NID,
9473 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9474 .channel_mode = alc883_3ST_2ch_modes,
9475 .input_mux = &alc883_capture_source,
9476 .unsol_event = alc_automute_amp_unsol_event,
9477 .setup = alc883_acer_aspire_setup,
9478 .init_hook = alc_automute_amp,
9480 [ALC888_ACER_ASPIRE_4930G] = {
9481 .mixers = { alc888_base_mixer,
9482 alc883_chmode_mixer },
9483 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9484 alc888_acer_aspire_4930g_verbs },
9485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9486 .dac_nids = alc883_dac_nids,
9487 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9488 .adc_nids = alc883_adc_nids_rev,
9489 .capsrc_nids = alc883_capsrc_nids_rev,
9490 .dig_out_nid = ALC883_DIGOUT_NID,
9491 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9492 .channel_mode = alc883_3ST_6ch_modes,
9495 ARRAY_SIZE(alc888_2_capture_sources),
9496 .input_mux = alc888_2_capture_sources,
9497 .unsol_event = alc_automute_amp_unsol_event,
9498 .setup = alc888_acer_aspire_4930g_setup,
9499 .init_hook = alc_automute_amp,
9501 [ALC888_ACER_ASPIRE_6530G] = {
9502 .mixers = { alc888_acer_aspire_6530_mixer },
9503 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9504 alc888_acer_aspire_6530g_verbs },
9505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9506 .dac_nids = alc883_dac_nids,
9507 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9508 .adc_nids = alc883_adc_nids_rev,
9509 .capsrc_nids = alc883_capsrc_nids_rev,
9510 .dig_out_nid = ALC883_DIGOUT_NID,
9511 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9512 .channel_mode = alc883_3ST_2ch_modes,
9514 ARRAY_SIZE(alc888_2_capture_sources),
9515 .input_mux = alc888_acer_aspire_6530_sources,
9516 .unsol_event = alc_automute_amp_unsol_event,
9517 .setup = alc888_acer_aspire_6530g_setup,
9518 .init_hook = alc_automute_amp,
9520 [ALC888_ACER_ASPIRE_8930G] = {
9521 .mixers = { alc889_acer_aspire_8930g_mixer,
9522 alc883_chmode_mixer },
9523 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9524 alc889_acer_aspire_8930g_verbs,
9526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9527 .dac_nids = alc883_dac_nids,
9528 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9529 .adc_nids = alc889_adc_nids,
9530 .capsrc_nids = alc889_capsrc_nids,
9531 .dig_out_nid = ALC883_DIGOUT_NID,
9532 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9533 .channel_mode = alc883_3ST_6ch_modes,
9535 .const_channel_count = 6,
9537 ARRAY_SIZE(alc889_capture_sources),
9538 .input_mux = alc889_capture_sources,
9539 .unsol_event = alc_automute_amp_unsol_event,
9540 .setup = alc889_acer_aspire_8930g_setup,
9541 .init_hook = alc_automute_amp,
9542 #ifdef CONFIG_SND_HDA_POWER_SAVE
9543 .power_hook = alc889_power_eapd,
9546 [ALC888_ACER_ASPIRE_7730G] = {
9547 .mixers = { alc883_3ST_6ch_mixer,
9548 alc883_chmode_mixer },
9549 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9550 alc888_acer_aspire_7730G_verbs },
9551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9552 .dac_nids = alc883_dac_nids,
9553 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9554 .adc_nids = alc883_adc_nids_rev,
9555 .capsrc_nids = alc883_capsrc_nids_rev,
9556 .dig_out_nid = ALC883_DIGOUT_NID,
9557 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9558 .channel_mode = alc883_3ST_6ch_modes,
9560 .const_channel_count = 6,
9561 .input_mux = &alc883_capture_source,
9562 .unsol_event = alc_automute_amp_unsol_event,
9563 .setup = alc888_acer_aspire_6530g_setup,
9564 .init_hook = alc_automute_amp,
9567 .mixers = { alc883_fivestack_mixer,
9568 alc883_chmode_mixer },
9569 .init_verbs = { alc883_init_verbs,
9570 alc883_medion_eapd_verbs },
9571 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9572 .dac_nids = alc883_dac_nids,
9573 .adc_nids = alc883_adc_nids_alt,
9574 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9575 .capsrc_nids = alc883_capsrc_nids,
9576 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9577 .channel_mode = alc883_sixstack_modes,
9578 .input_mux = &alc883_capture_source,
9580 [ALC883_MEDION_MD2] = {
9581 .mixers = { alc883_medion_md2_mixer},
9582 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9583 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9584 .dac_nids = alc883_dac_nids,
9585 .dig_out_nid = ALC883_DIGOUT_NID,
9586 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9587 .channel_mode = alc883_3ST_2ch_modes,
9588 .input_mux = &alc883_capture_source,
9589 .unsol_event = alc_automute_amp_unsol_event,
9590 .setup = alc883_medion_md2_setup,
9591 .init_hook = alc_automute_amp,
9593 [ALC883_LAPTOP_EAPD] = {
9594 .mixers = { alc883_base_mixer },
9595 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9596 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9597 .dac_nids = alc883_dac_nids,
9598 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9599 .channel_mode = alc883_3ST_2ch_modes,
9600 .input_mux = &alc883_capture_source,
9602 [ALC883_CLEVO_M540R] = {
9603 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9604 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9605 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9606 .dac_nids = alc883_dac_nids,
9607 .dig_out_nid = ALC883_DIGOUT_NID,
9608 .dig_in_nid = ALC883_DIGIN_NID,
9609 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9610 .channel_mode = alc883_3ST_6ch_clevo_modes,
9612 .input_mux = &alc883_capture_source,
9613 /* This machine has the hardware HP auto-muting, thus
9614 * we need no software mute via unsol event
9617 [ALC883_CLEVO_M720] = {
9618 .mixers = { alc883_clevo_m720_mixer },
9619 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9620 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9621 .dac_nids = alc883_dac_nids,
9622 .dig_out_nid = ALC883_DIGOUT_NID,
9623 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9624 .channel_mode = alc883_3ST_2ch_modes,
9625 .input_mux = &alc883_capture_source,
9626 .unsol_event = alc883_clevo_m720_unsol_event,
9627 .setup = alc883_clevo_m720_setup,
9628 .init_hook = alc883_clevo_m720_init_hook,
9630 [ALC883_LENOVO_101E_2ch] = {
9631 .mixers = { alc883_lenovo_101e_2ch_mixer},
9632 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9633 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9634 .dac_nids = alc883_dac_nids,
9635 .adc_nids = alc883_adc_nids_alt,
9636 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9637 .capsrc_nids = alc883_capsrc_nids,
9638 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9639 .channel_mode = alc883_3ST_2ch_modes,
9640 .input_mux = &alc883_lenovo_101e_capture_source,
9641 .unsol_event = alc883_lenovo_101e_unsol_event,
9642 .init_hook = alc883_lenovo_101e_all_automute,
9644 [ALC883_LENOVO_NB0763] = {
9645 .mixers = { alc883_lenovo_nb0763_mixer },
9646 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9647 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9648 .dac_nids = alc883_dac_nids,
9649 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9650 .channel_mode = alc883_3ST_2ch_modes,
9652 .input_mux = &alc883_lenovo_nb0763_capture_source,
9653 .unsol_event = alc_automute_amp_unsol_event,
9654 .setup = alc883_medion_md2_setup,
9655 .init_hook = alc_automute_amp,
9657 [ALC888_LENOVO_MS7195_DIG] = {
9658 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9659 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9660 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9661 .dac_nids = alc883_dac_nids,
9662 .dig_out_nid = ALC883_DIGOUT_NID,
9663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9664 .channel_mode = alc883_3ST_6ch_modes,
9666 .input_mux = &alc883_capture_source,
9667 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9668 .init_hook = alc888_lenovo_ms7195_front_automute,
9670 [ALC883_HAIER_W66] = {
9671 .mixers = { alc883_targa_2ch_mixer},
9672 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9673 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9674 .dac_nids = alc883_dac_nids,
9675 .dig_out_nid = ALC883_DIGOUT_NID,
9676 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9677 .channel_mode = alc883_3ST_2ch_modes,
9678 .input_mux = &alc883_capture_source,
9679 .unsol_event = alc_automute_amp_unsol_event,
9680 .setup = alc883_haier_w66_setup,
9681 .init_hook = alc_automute_amp,
9684 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9685 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9686 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9687 .dac_nids = alc883_dac_nids,
9688 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9689 .channel_mode = alc888_3st_hp_modes,
9691 .input_mux = &alc883_capture_source,
9692 .unsol_event = alc_automute_amp_unsol_event,
9693 .setup = alc888_3st_hp_setup,
9694 .init_hook = alc_automute_amp,
9696 [ALC888_6ST_DELL] = {
9697 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9698 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9699 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9700 .dac_nids = alc883_dac_nids,
9701 .dig_out_nid = ALC883_DIGOUT_NID,
9702 .dig_in_nid = ALC883_DIGIN_NID,
9703 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9704 .channel_mode = alc883_sixstack_modes,
9705 .input_mux = &alc883_capture_source,
9706 .unsol_event = alc_automute_amp_unsol_event,
9707 .setup = alc888_6st_dell_setup,
9708 .init_hook = alc_automute_amp,
9711 .mixers = { alc883_mitac_mixer },
9712 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9713 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9714 .dac_nids = alc883_dac_nids,
9715 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9716 .channel_mode = alc883_3ST_2ch_modes,
9717 .input_mux = &alc883_capture_source,
9718 .unsol_event = alc_automute_amp_unsol_event,
9719 .setup = alc883_mitac_setup,
9720 .init_hook = alc_automute_amp,
9722 [ALC883_FUJITSU_PI2515] = {
9723 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9724 .init_verbs = { alc883_init_verbs,
9725 alc883_2ch_fujitsu_pi2515_verbs},
9726 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9727 .dac_nids = alc883_dac_nids,
9728 .dig_out_nid = ALC883_DIGOUT_NID,
9729 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9730 .channel_mode = alc883_3ST_2ch_modes,
9731 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9732 .unsol_event = alc_automute_amp_unsol_event,
9733 .setup = alc883_2ch_fujitsu_pi2515_setup,
9734 .init_hook = alc_automute_amp,
9736 [ALC888_FUJITSU_XA3530] = {
9737 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9738 .init_verbs = { alc883_init_verbs,
9739 alc888_fujitsu_xa3530_verbs },
9740 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9741 .dac_nids = alc883_dac_nids,
9742 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9743 .adc_nids = alc883_adc_nids_rev,
9744 .capsrc_nids = alc883_capsrc_nids_rev,
9745 .dig_out_nid = ALC883_DIGOUT_NID,
9746 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9747 .channel_mode = alc888_4ST_8ch_intel_modes,
9749 ARRAY_SIZE(alc888_2_capture_sources),
9750 .input_mux = alc888_2_capture_sources,
9751 .unsol_event = alc_automute_amp_unsol_event,
9752 .setup = alc888_fujitsu_xa3530_setup,
9753 .init_hook = alc_automute_amp,
9755 [ALC888_LENOVO_SKY] = {
9756 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9757 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9758 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9759 .dac_nids = alc883_dac_nids,
9760 .dig_out_nid = ALC883_DIGOUT_NID,
9761 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9762 .channel_mode = alc883_sixstack_modes,
9764 .input_mux = &alc883_lenovo_sky_capture_source,
9765 .unsol_event = alc_automute_amp_unsol_event,
9766 .setup = alc888_lenovo_sky_setup,
9767 .init_hook = alc_automute_amp,
9769 [ALC888_ASUS_M90V] = {
9770 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9771 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9772 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9773 .dac_nids = alc883_dac_nids,
9774 .dig_out_nid = ALC883_DIGOUT_NID,
9775 .dig_in_nid = ALC883_DIGIN_NID,
9776 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9777 .channel_mode = alc883_3ST_6ch_modes,
9779 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9780 .unsol_event = alc_sku_unsol_event,
9781 .setup = alc883_mode2_setup,
9782 .init_hook = alc_inithook,
9784 [ALC888_ASUS_EEE1601] = {
9785 .mixers = { alc883_asus_eee1601_mixer },
9786 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9787 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9788 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9789 .dac_nids = alc883_dac_nids,
9790 .dig_out_nid = ALC883_DIGOUT_NID,
9791 .dig_in_nid = ALC883_DIGIN_NID,
9792 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9793 .channel_mode = alc883_3ST_2ch_modes,
9795 .input_mux = &alc883_asus_eee1601_capture_source,
9796 .unsol_event = alc_sku_unsol_event,
9797 .init_hook = alc883_eee1601_inithook,
9799 [ALC1200_ASUS_P5Q] = {
9800 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9801 .init_verbs = { alc883_init_verbs },
9802 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9803 .dac_nids = alc883_dac_nids,
9804 .dig_out_nid = ALC1200_DIGOUT_NID,
9805 .dig_in_nid = ALC883_DIGIN_NID,
9806 .slave_dig_outs = alc1200_slave_dig_outs,
9807 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9808 .channel_mode = alc883_sixstack_modes,
9809 .input_mux = &alc883_capture_source,
9812 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9813 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9814 alc880_gpio1_init_verbs },
9815 .adc_nids = alc883_adc_nids,
9816 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9817 .capsrc_nids = alc883_capsrc_nids,
9818 .dac_nids = alc883_dac_nids,
9819 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9820 .channel_mode = alc889A_mb31_6ch_modes,
9821 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9822 .input_mux = &alc889A_mb31_capture_source,
9823 .dig_out_nid = ALC883_DIGOUT_NID,
9824 .unsol_event = alc889A_mb31_unsol_event,
9825 .init_hook = alc889A_mb31_automute,
9827 [ALC883_SONY_VAIO_TT] = {
9828 .mixers = { alc883_vaiott_mixer },
9829 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9830 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9831 .dac_nids = alc883_dac_nids,
9832 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9833 .channel_mode = alc883_3ST_2ch_modes,
9834 .input_mux = &alc883_capture_source,
9835 .unsol_event = alc_automute_amp_unsol_event,
9836 .setup = alc883_vaiott_setup,
9837 .init_hook = alc_automute_amp,
9846 PINFIX_ABIT_AW9D_MAX
9849 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9850 { 0x15, 0x01080104 }, /* side */
9851 { 0x16, 0x01011012 }, /* rear */
9852 { 0x17, 0x01016011 }, /* clfe */
9856 static const struct alc_fixup alc882_fixups[] = {
9857 [PINFIX_ABIT_AW9D_MAX] = {
9858 .pins = alc882_abit_aw9d_pinfix
9862 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9863 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9868 * BIOS auto configuration
9870 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9871 const struct auto_pin_cfg *cfg)
9873 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9876 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9877 hda_nid_t nid, int pin_type,
9881 struct alc_spec *spec = codec->spec;
9884 alc_set_pin_output(codec, nid, pin_type);
9885 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9888 idx = spec->multiout.dac_nids[dac_idx] - 2;
9889 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9893 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9895 struct alc_spec *spec = codec->spec;
9898 for (i = 0; i <= HDA_SIDE; i++) {
9899 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9900 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9902 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9907 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9909 struct alc_spec *spec = codec->spec;
9912 pin = spec->autocfg.hp_pins[0];
9913 if (pin) /* connect to front */
9915 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9916 pin = spec->autocfg.speaker_pins[0];
9918 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9921 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9923 struct alc_spec *spec = codec->spec;
9926 for (i = 0; i < AUTO_PIN_LAST; i++) {
9927 hda_nid_t nid = spec->autocfg.input_pins[i];
9930 alc_set_input_pin(codec, nid, i);
9931 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9932 snd_hda_codec_write(codec, nid, 0,
9933 AC_VERB_SET_AMP_GAIN_MUTE,
9938 static void alc882_auto_init_input_src(struct hda_codec *codec)
9940 struct alc_spec *spec = codec->spec;
9943 for (c = 0; c < spec->num_adc_nids; c++) {
9944 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9945 hda_nid_t nid = spec->capsrc_nids[c];
9946 unsigned int mux_idx;
9947 const struct hda_input_mux *imux;
9948 int conns, mute, idx, item;
9950 conns = snd_hda_get_connections(codec, nid, conn_list,
9951 ARRAY_SIZE(conn_list));
9954 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9955 imux = &spec->input_mux[mux_idx];
9956 for (idx = 0; idx < conns; idx++) {
9957 /* if the current connection is the selected one,
9958 * unmute it as default - otherwise mute it
9960 mute = AMP_IN_MUTE(idx);
9961 for (item = 0; item < imux->num_items; item++) {
9962 if (imux->items[item].index == idx) {
9963 if (spec->cur_mux[c] == item)
9964 mute = AMP_IN_UNMUTE(idx);
9968 /* check if we have a selector or mixer
9969 * we could check for the widget type instead, but
9970 * just check for Amp-In presence (in case of mixer
9971 * without amp-in there is something wrong, this
9972 * function shouldn't be used or capsrc nid is wrong)
9974 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9975 snd_hda_codec_write(codec, nid, 0,
9976 AC_VERB_SET_AMP_GAIN_MUTE,
9978 else if (mute != AMP_IN_MUTE(idx))
9979 snd_hda_codec_write(codec, nid, 0,
9980 AC_VERB_SET_CONNECT_SEL,
9986 /* add mic boosts if needed */
9987 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9989 struct alc_spec *spec = codec->spec;
9993 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9994 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9995 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9997 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10001 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10002 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10003 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10005 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10012 /* almost identical with ALC880 parser... */
10013 static int alc882_parse_auto_config(struct hda_codec *codec)
10015 struct alc_spec *spec = codec->spec;
10016 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10019 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10023 if (!spec->autocfg.line_outs)
10024 return 0; /* can't find valid BIOS pin config */
10026 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10029 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10032 err = alc880_auto_create_extra_out(spec,
10033 spec->autocfg.speaker_pins[0],
10037 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10041 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10045 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10047 /* check multiple SPDIF-out (for recent codecs) */
10048 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10050 err = snd_hda_get_connections(codec,
10051 spec->autocfg.dig_out_pins[i],
10056 spec->multiout.dig_out_nid = dig_nid;
10058 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10059 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10061 spec->slave_dig_outs[i - 1] = dig_nid;
10064 if (spec->autocfg.dig_in_pin)
10065 spec->dig_in_nid = ALC880_DIGIN_NID;
10067 if (spec->kctls.list)
10068 add_mixer(spec, spec->kctls.list);
10070 add_verb(spec, alc883_auto_init_verbs);
10071 /* if ADC 0x07 is available, initialize it, too */
10072 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10073 add_verb(spec, alc882_adc1_init_verbs);
10075 spec->num_mux_defs = 1;
10076 spec->input_mux = &spec->private_imux[0];
10078 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10080 err = alc_auto_add_mic_boost(codec);
10084 return 1; /* config found */
10087 /* additional initialization for auto-configuration model */
10088 static void alc882_auto_init(struct hda_codec *codec)
10090 struct alc_spec *spec = codec->spec;
10091 alc882_auto_init_multi_out(codec);
10092 alc882_auto_init_hp_out(codec);
10093 alc882_auto_init_analog_input(codec);
10094 alc882_auto_init_input_src(codec);
10095 if (spec->unsol_event)
10096 alc_inithook(codec);
10099 static int patch_alc882(struct hda_codec *codec)
10101 struct alc_spec *spec;
10102 int err, board_config;
10104 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10108 codec->spec = spec;
10110 switch (codec->vendor_id) {
10115 /* ALC883 and variants */
10116 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10120 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10124 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10125 board_config = snd_hda_check_board_codec_sid_config(codec,
10126 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10128 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10129 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10131 board_config = ALC882_AUTO;
10134 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10136 if (board_config == ALC882_AUTO) {
10137 /* automatic parse from the BIOS config */
10138 err = alc882_parse_auto_config(codec);
10144 "hda_codec: Cannot set up configuration "
10145 "from BIOS. Using base mode...\n");
10146 board_config = ALC882_3ST_DIG;
10150 err = snd_hda_attach_beep_device(codec, 0x1);
10156 if (board_config != ALC882_AUTO)
10157 setup_preset(codec, &alc882_presets[board_config]);
10159 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10160 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10161 /* FIXME: setup DAC5 */
10162 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10163 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10165 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10166 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10168 if (codec->vendor_id == 0x10ec0888)
10169 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10171 if (!spec->adc_nids && spec->input_mux) {
10173 spec->num_adc_nids = 0;
10174 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10175 const struct hda_input_mux *imux = spec->input_mux;
10177 hda_nid_t items[16];
10178 hda_nid_t nid = alc882_adc_nids[i];
10179 unsigned int wcap = get_wcaps(codec, nid);
10181 wcap = get_wcaps_type(wcap);
10182 if (wcap != AC_WID_AUD_IN)
10184 spec->private_adc_nids[spec->num_adc_nids] = nid;
10185 err = snd_hda_get_connections(codec, nid, &cap, 1);
10188 err = snd_hda_get_connections(codec, cap, items,
10189 ARRAY_SIZE(items));
10192 for (j = 0; j < imux->num_items; j++)
10193 if (imux->items[j].index >= err)
10195 if (j < imux->num_items)
10197 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10198 spec->num_adc_nids++;
10200 spec->adc_nids = spec->private_adc_nids;
10201 spec->capsrc_nids = spec->private_capsrc_nids;
10204 set_capture_mixer(codec);
10205 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10207 spec->vmaster_nid = 0x0c;
10209 codec->patch_ops = alc_patch_ops;
10210 if (board_config == ALC882_AUTO)
10211 spec->init_hook = alc882_auto_init;
10212 #ifdef CONFIG_SND_HDA_POWER_SAVE
10213 if (!spec->loopback.amplist)
10214 spec->loopback.amplist = alc882_loopbacks;
10216 codec->proc_widget_hook = print_realtek_coef;
10226 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10227 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10229 #define alc262_dac_nids alc260_dac_nids
10230 #define alc262_adc_nids alc882_adc_nids
10231 #define alc262_adc_nids_alt alc882_adc_nids_alt
10232 #define alc262_capsrc_nids alc882_capsrc_nids
10233 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10235 #define alc262_modes alc260_modes
10236 #define alc262_capture_source alc882_capture_source
10238 static hda_nid_t alc262_dmic_adc_nids[1] = {
10243 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10245 static struct snd_kcontrol_new alc262_base_mixer[] = {
10246 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10247 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10248 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10249 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10250 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10251 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10256 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10257 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10260 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10261 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10265 /* update HP, line and mono-out pins according to the master switch */
10266 static void alc262_hp_master_update(struct hda_codec *codec)
10268 struct alc_spec *spec = codec->spec;
10269 int val = spec->master_sw;
10271 /* HP & line-out */
10272 snd_hda_codec_write_cache(codec, 0x1b, 0,
10273 AC_VERB_SET_PIN_WIDGET_CONTROL,
10275 snd_hda_codec_write_cache(codec, 0x15, 0,
10276 AC_VERB_SET_PIN_WIDGET_CONTROL,
10278 /* mono (speaker) depending on the HP jack sense */
10279 val = val && !spec->jack_present;
10280 snd_hda_codec_write_cache(codec, 0x16, 0,
10281 AC_VERB_SET_PIN_WIDGET_CONTROL,
10282 val ? PIN_OUT : 0);
10285 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10287 struct alc_spec *spec = codec->spec;
10289 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10290 alc262_hp_master_update(codec);
10293 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10295 if ((res >> 26) != ALC880_HP_EVENT)
10297 alc262_hp_bpc_automute(codec);
10300 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10302 struct alc_spec *spec = codec->spec;
10304 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10305 alc262_hp_master_update(codec);
10308 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10311 if ((res >> 26) != ALC880_HP_EVENT)
10313 alc262_hp_wildwest_automute(codec);
10316 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10318 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10319 struct snd_ctl_elem_value *ucontrol)
10321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10322 struct alc_spec *spec = codec->spec;
10323 int val = !!*ucontrol->value.integer.value;
10325 if (val == spec->master_sw)
10327 spec->master_sw = val;
10328 alc262_hp_master_update(codec);
10332 #define ALC262_HP_MASTER_SWITCH \
10334 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10335 .name = "Master Playback Switch", \
10336 .info = snd_ctl_boolean_mono_info, \
10337 .get = alc262_hp_master_sw_get, \
10338 .put = alc262_hp_master_sw_put, \
10341 .iface = NID_MAPPING, \
10342 .name = "Master Playback Switch", \
10343 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10347 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10348 ALC262_HP_MASTER_SWITCH,
10349 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10350 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10351 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10352 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10354 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10356 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10357 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10358 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10359 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10360 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10361 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10362 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10363 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10364 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10365 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10366 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10367 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10371 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10372 ALC262_HP_MASTER_SWITCH,
10373 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10375 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10376 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10377 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10379 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10381 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10382 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10384 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10385 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10386 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10387 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10391 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10392 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10393 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10394 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10398 /* mute/unmute internal speaker according to the hp jack and mute state */
10399 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10401 struct alc_spec *spec = codec->spec;
10403 spec->autocfg.hp_pins[0] = 0x15;
10404 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10407 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10408 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10409 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10410 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10411 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10414 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10418 static struct hda_verb alc262_hp_t5735_verbs[] = {
10419 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10422 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10426 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10427 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10428 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10429 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10430 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10432 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10436 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10437 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10438 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10441 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10442 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10446 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10450 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10457 /* bind hp and internal speaker mute (with plug check) as master switch */
10458 static void alc262_hippo_master_update(struct hda_codec *codec)
10460 struct alc_spec *spec = codec->spec;
10461 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10462 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10463 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10467 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10468 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10469 HDA_AMP_MUTE, mute);
10470 /* mute internal speaker per jack sense */
10471 if (spec->jack_present)
10472 mute = HDA_AMP_MUTE;
10474 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10475 HDA_AMP_MUTE, mute);
10476 if (speaker_nid && speaker_nid != line_nid)
10477 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10478 HDA_AMP_MUTE, mute);
10481 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10483 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10484 struct snd_ctl_elem_value *ucontrol)
10486 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10487 struct alc_spec *spec = codec->spec;
10488 int val = !!*ucontrol->value.integer.value;
10490 if (val == spec->master_sw)
10492 spec->master_sw = val;
10493 alc262_hippo_master_update(codec);
10497 #define ALC262_HIPPO_MASTER_SWITCH \
10499 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10500 .name = "Master Playback Switch", \
10501 .info = snd_ctl_boolean_mono_info, \
10502 .get = alc262_hippo_master_sw_get, \
10503 .put = alc262_hippo_master_sw_put, \
10506 .iface = NID_MAPPING, \
10507 .name = "Master Playback Switch", \
10508 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10509 (SUBDEV_SPEAKER(0) << 16), \
10512 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10513 ALC262_HIPPO_MASTER_SWITCH,
10514 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10515 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10516 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10517 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10518 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10519 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10520 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10521 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10522 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10523 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10524 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10525 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10529 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10530 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10531 ALC262_HIPPO_MASTER_SWITCH,
10532 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10533 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10534 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10535 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10537 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10538 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10540 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10545 /* mute/unmute internal speaker according to the hp jack and mute state */
10546 static void alc262_hippo_automute(struct hda_codec *codec)
10548 struct alc_spec *spec = codec->spec;
10549 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10551 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10552 alc262_hippo_master_update(codec);
10555 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10557 if ((res >> 26) != ALC880_HP_EVENT)
10559 alc262_hippo_automute(codec);
10562 static void alc262_hippo_setup(struct hda_codec *codec)
10564 struct alc_spec *spec = codec->spec;
10566 spec->autocfg.hp_pins[0] = 0x15;
10567 spec->autocfg.speaker_pins[0] = 0x14;
10570 static void alc262_hippo1_setup(struct hda_codec *codec)
10572 struct alc_spec *spec = codec->spec;
10574 spec->autocfg.hp_pins[0] = 0x1b;
10575 spec->autocfg.speaker_pins[0] = 0x14;
10579 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10580 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10581 ALC262_HIPPO_MASTER_SWITCH,
10582 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10583 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10585 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10589 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10590 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10591 ALC262_HIPPO_MASTER_SWITCH,
10592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10595 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10596 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10600 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10601 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10602 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10603 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10604 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10606 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10608 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10609 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10611 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10612 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10616 static struct hda_verb alc262_tyan_verbs[] = {
10617 /* Headphone automute */
10618 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10619 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10622 /* P11 AUX_IN, white 4-pin connector */
10623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10624 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10625 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10626 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10631 /* unsolicited event for HP jack sensing */
10632 static void alc262_tyan_setup(struct hda_codec *codec)
10634 struct alc_spec *spec = codec->spec;
10636 spec->autocfg.hp_pins[0] = 0x1b;
10637 spec->autocfg.speaker_pins[0] = 0x15;
10641 #define alc262_capture_mixer alc882_capture_mixer
10642 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10645 * generic initialization of ADC, input mixers and output mixers
10647 static struct hda_verb alc262_init_verbs[] = {
10649 * Unmute ADC0-2 and set the default input to mic-in
10651 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10652 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10653 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10655 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10656 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10658 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10660 * Note: PASD motherboards uses the Line In 2 as the input for
10661 * front panel mic (mic 2)
10663 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10667 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10671 * Set up output mixers (0x0c - 0x0e)
10673 /* set vol=0 to output mixers */
10674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10675 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10676 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10677 /* set up input amps for analog loopback */
10678 /* Amp Indices: DAC = 0, mixer = 1 */
10679 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10681 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10683 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10687 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10688 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10689 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10690 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10691 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10693 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10694 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10695 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10699 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10702 /* FIXME: use matrix-type input source selection */
10703 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10704 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10723 static struct hda_verb alc262_eapd_verbs[] = {
10724 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10725 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10729 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10730 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10731 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10734 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10735 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10739 static struct hda_verb alc262_sony_unsol_verbs[] = {
10740 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10741 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10742 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10744 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10745 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10749 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10750 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10751 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10752 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10753 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10754 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10758 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10759 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10761 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10762 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10763 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10765 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10766 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10770 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10772 struct alc_spec *spec = codec->spec;
10774 spec->autocfg.hp_pins[0] = 0x15;
10775 spec->autocfg.speaker_pins[0] = 0x14;
10776 spec->ext_mic.pin = 0x18;
10777 spec->ext_mic.mux_idx = 0;
10778 spec->int_mic.pin = 0x12;
10779 spec->int_mic.mux_idx = 9;
10780 spec->auto_mic = 1;
10786 * 0x16 = internal speaker
10787 * 0x18 = external mic
10790 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10791 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10792 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10794 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10795 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10796 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10798 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10799 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10803 static struct hda_verb alc262_nec_verbs[] = {
10804 /* Unmute Speaker */
10805 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10808 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10809 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10811 /* External mic to headphone */
10812 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10813 /* External mic to speaker */
10814 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10820 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10821 * 0x1b = port replicator headphone out
10824 #define ALC_HP_EVENT 0x37
10826 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10827 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10828 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10829 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10830 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10834 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10835 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10836 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10840 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10841 /* Front Mic pin: input vref at 50% */
10842 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10843 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10847 static struct hda_input_mux alc262_fujitsu_capture_source = {
10851 { "Int Mic", 0x1 },
10856 static struct hda_input_mux alc262_HP_capture_source = {
10860 { "Front Mic", 0x1 },
10867 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10871 { "Front Mic", 0x2 },
10877 /* mute/unmute internal speaker according to the hp jacks and mute state */
10878 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10880 struct alc_spec *spec = codec->spec;
10883 if (force || !spec->sense_updated) {
10884 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10885 snd_hda_jack_detect(codec, 0x1b);
10886 spec->sense_updated = 1;
10888 /* unmute internal speaker only if both HPs are unplugged and
10889 * master switch is on
10891 if (spec->jack_present)
10892 mute = HDA_AMP_MUTE;
10894 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10895 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10896 HDA_AMP_MUTE, mute);
10899 /* unsolicited event for HP jack sensing */
10900 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10903 if ((res >> 26) != ALC_HP_EVENT)
10905 alc262_fujitsu_automute(codec, 1);
10908 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10910 alc262_fujitsu_automute(codec, 1);
10913 /* bind volumes of both NID 0x0c and 0x0d */
10914 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10915 .ops = &snd_hda_bind_vol,
10917 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10918 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10923 /* mute/unmute internal speaker according to the hp jack and mute state */
10924 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10926 struct alc_spec *spec = codec->spec;
10929 if (force || !spec->sense_updated) {
10930 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10931 spec->sense_updated = 1;
10933 if (spec->jack_present) {
10934 /* mute internal speaker */
10935 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10936 HDA_AMP_MUTE, HDA_AMP_MUTE);
10937 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10938 HDA_AMP_MUTE, HDA_AMP_MUTE);
10940 /* unmute internal speaker if necessary */
10941 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10942 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10943 HDA_AMP_MUTE, mute);
10944 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10945 HDA_AMP_MUTE, mute);
10949 /* unsolicited event for HP jack sensing */
10950 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10953 if ((res >> 26) != ALC_HP_EVENT)
10955 alc262_lenovo_3000_automute(codec, 1);
10958 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10959 int dir, int idx, long *valp)
10963 for (i = 0; i < 2; i++, valp++)
10964 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10966 *valp ? 0 : HDA_AMP_MUTE);
10970 /* bind hp and internal speaker mute (with plug check) */
10971 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10972 struct snd_ctl_elem_value *ucontrol)
10974 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10975 long *valp = ucontrol->value.integer.value;
10978 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10979 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10981 alc262_fujitsu_automute(codec, 0);
10985 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10986 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10988 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10989 .name = "Master Playback Switch",
10990 .subdevice = HDA_SUBDEV_AMP_FLAG,
10991 .info = snd_hda_mixer_amp_switch_info,
10992 .get = snd_hda_mixer_amp_switch_get,
10993 .put = alc262_fujitsu_master_sw_put,
10994 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10997 .iface = NID_MAPPING,
10998 .name = "Master Playback Switch",
10999 .private_value = 0x1b,
11001 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11002 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11003 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11004 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11005 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11006 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11007 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11008 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11012 /* bind hp and internal speaker mute (with plug check) */
11013 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11014 struct snd_ctl_elem_value *ucontrol)
11016 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11017 long *valp = ucontrol->value.integer.value;
11020 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11022 alc262_lenovo_3000_automute(codec, 0);
11026 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11027 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11029 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11030 .name = "Master Playback Switch",
11031 .subdevice = HDA_SUBDEV_AMP_FLAG,
11032 .info = snd_hda_mixer_amp_switch_info,
11033 .get = snd_hda_mixer_amp_switch_get,
11034 .put = alc262_lenovo_3000_master_sw_put,
11035 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11037 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11038 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11039 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11040 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11041 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11042 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11043 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11044 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11048 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11049 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11050 ALC262_HIPPO_MASTER_SWITCH,
11051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11052 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11056 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11060 /* additional init verbs for Benq laptops */
11061 static struct hda_verb alc262_EAPD_verbs[] = {
11062 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11063 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11067 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11068 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11069 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11071 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11072 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11076 /* Samsung Q1 Ultra Vista model setup */
11077 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11078 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11079 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11082 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11083 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11087 static struct hda_verb alc262_ultra_verbs[] = {
11089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11093 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11094 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11096 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11099 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11101 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11102 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11104 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11105 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11106 /* ADC, choose mic */
11107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11120 /* mute/unmute internal speaker according to the hp jack and mute state */
11121 static void alc262_ultra_automute(struct hda_codec *codec)
11123 struct alc_spec *spec = codec->spec;
11127 /* auto-mute only when HP is used as HP */
11128 if (!spec->cur_mux[0]) {
11129 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11130 if (spec->jack_present)
11131 mute = HDA_AMP_MUTE;
11133 /* mute/unmute internal speaker */
11134 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11135 HDA_AMP_MUTE, mute);
11136 /* mute/unmute HP */
11137 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11138 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11141 /* unsolicited event for HP jack sensing */
11142 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11145 if ((res >> 26) != ALC880_HP_EVENT)
11147 alc262_ultra_automute(codec);
11150 static struct hda_input_mux alc262_ultra_capture_source = {
11154 { "Headphone", 0x7 },
11158 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11159 struct snd_ctl_elem_value *ucontrol)
11161 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11162 struct alc_spec *spec = codec->spec;
11165 ret = alc_mux_enum_put(kcontrol, ucontrol);
11168 /* reprogram the HP pin as mic or HP according to the input source */
11169 snd_hda_codec_write_cache(codec, 0x15, 0,
11170 AC_VERB_SET_PIN_WIDGET_CONTROL,
11171 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11172 alc262_ultra_automute(codec); /* mute/unmute HP */
11176 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11177 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11178 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11180 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11181 .name = "Capture Source",
11182 .info = alc_mux_enum_info,
11183 .get = alc_mux_enum_get,
11184 .put = alc262_ultra_mux_enum_put,
11187 .iface = NID_MAPPING,
11188 .name = "Capture Source",
11189 .private_value = 0x15,
11194 /* We use two mixers depending on the output pin; 0x16 is a mono output
11195 * and thus it's bound with a different mixer.
11196 * This function returns which mixer amp should be used.
11198 static int alc262_check_volbit(hda_nid_t nid)
11202 else if (nid == 0x16)
11208 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11209 const char *pfx, int *vbits)
11214 vbit = alc262_check_volbit(nid);
11217 if (*vbits & vbit) /* a volume control for this mixer already there */
11221 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11223 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11224 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11227 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11235 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11237 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11238 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11241 /* add playback controls from the parsed DAC table */
11242 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11243 const struct auto_pin_cfg *cfg)
11249 spec->multiout.num_dacs = 1; /* only use one dac */
11250 spec->multiout.dac_nids = spec->private_dac_nids;
11251 spec->multiout.dac_nids[0] = 2;
11253 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11255 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11259 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11262 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11265 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11269 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11270 alc262_check_volbit(cfg->speaker_pins[0]) |
11271 alc262_check_volbit(cfg->hp_pins[0]);
11272 if (vbits == 1 || vbits == 2)
11273 pfx = "Master"; /* only one mixer is used */
11274 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11279 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11282 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11286 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11293 #define alc262_auto_create_input_ctls \
11294 alc880_auto_create_input_ctls
11297 * generic initialization of ADC, input mixers and output mixers
11299 static struct hda_verb alc262_volume_init_verbs[] = {
11301 * Unmute ADC0-2 and set the default input to mic-in
11303 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11305 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11306 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11307 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11308 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11310 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11312 * Note: PASD motherboards uses the Line In 2 as the input for
11313 * front panel mic (mic 2)
11315 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11323 * Set up output mixers (0x0c - 0x0f)
11325 /* set vol=0 to output mixers */
11326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11327 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11330 /* set up input amps for analog loopback */
11331 /* Amp Indices: DAC = 0, mixer = 1 */
11332 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11334 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11336 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11339 /* FIXME: use matrix-type input source selection */
11340 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11341 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11360 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11362 * Unmute ADC0-2 and set the default input to mic-in
11364 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11366 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11367 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11368 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11369 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11371 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11373 * Note: PASD motherboards uses the Line In 2 as the input for
11374 * front panel mic (mic 2)
11376 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11386 * Set up output mixers (0x0c - 0x0e)
11388 /* set vol=0 to output mixers */
11389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11390 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11391 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11393 /* set up input amps for analog loopback */
11394 /* Amp Indices: DAC = 0, mixer = 1 */
11395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11397 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11399 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11402 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11403 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11404 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11406 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11409 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11410 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11413 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11414 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11415 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11416 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11419 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11420 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11421 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11422 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11423 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11426 /* FIXME: use matrix-type input source selection */
11427 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11428 /* Input mixer1: only unmute Mic */
11429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11439 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11459 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11464 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11466 * Unmute ADC0-2 and set the default input to mic-in
11468 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11469 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11470 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11471 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11472 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11473 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11475 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11477 * Note: PASD motherboards uses the Line In 2 as the input for front
11478 * panel mic (mic 2)
11480 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11481 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11490 * Set up output mixers (0x0c - 0x0e)
11492 /* set vol=0 to output mixers */
11493 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11494 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11495 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11497 /* set up input amps for analog loopback */
11498 /* Amp Indices: DAC = 0, mixer = 1 */
11499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11513 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11515 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11518 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11519 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11521 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11522 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11523 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11524 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11525 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11526 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11528 /* FIXME: use matrix-type input source selection */
11529 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11530 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11536 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11537 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11544 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11545 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11552 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11555 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11560 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11563 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11564 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11566 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11568 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11569 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11571 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11572 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11573 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11578 #ifdef CONFIG_SND_HDA_POWER_SAVE
11579 #define alc262_loopbacks alc880_loopbacks
11582 /* pcm configuration: identical with ALC880 */
11583 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11584 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11585 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11586 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11589 * BIOS auto configuration
11591 static int alc262_parse_auto_config(struct hda_codec *codec)
11593 struct alc_spec *spec = codec->spec;
11595 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11597 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11601 if (!spec->autocfg.line_outs) {
11602 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11603 spec->multiout.max_channels = 2;
11604 spec->no_analog = 1;
11607 return 0; /* can't find valid BIOS pin config */
11609 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11612 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11616 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11619 if (spec->autocfg.dig_outs) {
11620 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11621 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11623 if (spec->autocfg.dig_in_pin)
11624 spec->dig_in_nid = ALC262_DIGIN_NID;
11626 if (spec->kctls.list)
11627 add_mixer(spec, spec->kctls.list);
11629 add_verb(spec, alc262_volume_init_verbs);
11630 spec->num_mux_defs = 1;
11631 spec->input_mux = &spec->private_imux[0];
11633 err = alc_auto_add_mic_boost(codec);
11637 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11642 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11643 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11644 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11645 #define alc262_auto_init_input_src alc882_auto_init_input_src
11648 /* init callback for auto-configuration model -- overriding the default init */
11649 static void alc262_auto_init(struct hda_codec *codec)
11651 struct alc_spec *spec = codec->spec;
11652 alc262_auto_init_multi_out(codec);
11653 alc262_auto_init_hp_out(codec);
11654 alc262_auto_init_analog_input(codec);
11655 alc262_auto_init_input_src(codec);
11656 if (spec->unsol_event)
11657 alc_inithook(codec);
11661 * configuration and preset
11663 static const char *alc262_models[ALC262_MODEL_LAST] = {
11664 [ALC262_BASIC] = "basic",
11665 [ALC262_HIPPO] = "hippo",
11666 [ALC262_HIPPO_1] = "hippo_1",
11667 [ALC262_FUJITSU] = "fujitsu",
11668 [ALC262_HP_BPC] = "hp-bpc",
11669 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11670 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11671 [ALC262_HP_RP5700] = "hp-rp5700",
11672 [ALC262_BENQ_ED8] = "benq",
11673 [ALC262_BENQ_T31] = "benq-t31",
11674 [ALC262_SONY_ASSAMD] = "sony-assamd",
11675 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11676 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11677 [ALC262_ULTRA] = "ultra",
11678 [ALC262_LENOVO_3000] = "lenovo-3000",
11679 [ALC262_NEC] = "nec",
11680 [ALC262_TYAN] = "tyan",
11681 [ALC262_AUTO] = "auto",
11684 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11685 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11686 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11687 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11689 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11691 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11693 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11694 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11695 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11696 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11697 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11698 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11699 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11700 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11701 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11702 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11703 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11704 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11705 ALC262_HP_TC_T5735),
11706 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11707 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11708 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11709 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11710 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11711 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11712 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11713 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11714 #if 0 /* disable the quirk since model=auto works better in recent versions */
11715 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11716 ALC262_SONY_ASSAMD),
11718 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11719 ALC262_TOSHIBA_RX1),
11720 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11721 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11722 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11723 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11724 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11726 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11727 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11728 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11729 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11730 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11734 static struct alc_config_preset alc262_presets[] = {
11736 .mixers = { alc262_base_mixer },
11737 .init_verbs = { alc262_init_verbs },
11738 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11739 .dac_nids = alc262_dac_nids,
11741 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11742 .channel_mode = alc262_modes,
11743 .input_mux = &alc262_capture_source,
11746 .mixers = { alc262_hippo_mixer },
11747 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11748 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11749 .dac_nids = alc262_dac_nids,
11751 .dig_out_nid = ALC262_DIGOUT_NID,
11752 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11753 .channel_mode = alc262_modes,
11754 .input_mux = &alc262_capture_source,
11755 .unsol_event = alc262_hippo_unsol_event,
11756 .setup = alc262_hippo_setup,
11757 .init_hook = alc262_hippo_automute,
11759 [ALC262_HIPPO_1] = {
11760 .mixers = { alc262_hippo1_mixer },
11761 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11762 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11763 .dac_nids = alc262_dac_nids,
11765 .dig_out_nid = ALC262_DIGOUT_NID,
11766 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11767 .channel_mode = alc262_modes,
11768 .input_mux = &alc262_capture_source,
11769 .unsol_event = alc262_hippo_unsol_event,
11770 .setup = alc262_hippo1_setup,
11771 .init_hook = alc262_hippo_automute,
11773 [ALC262_FUJITSU] = {
11774 .mixers = { alc262_fujitsu_mixer },
11775 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11776 alc262_fujitsu_unsol_verbs },
11777 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11778 .dac_nids = alc262_dac_nids,
11780 .dig_out_nid = ALC262_DIGOUT_NID,
11781 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11782 .channel_mode = alc262_modes,
11783 .input_mux = &alc262_fujitsu_capture_source,
11784 .unsol_event = alc262_fujitsu_unsol_event,
11785 .init_hook = alc262_fujitsu_init_hook,
11787 [ALC262_HP_BPC] = {
11788 .mixers = { alc262_HP_BPC_mixer },
11789 .init_verbs = { alc262_HP_BPC_init_verbs },
11790 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11791 .dac_nids = alc262_dac_nids,
11793 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11794 .channel_mode = alc262_modes,
11795 .input_mux = &alc262_HP_capture_source,
11796 .unsol_event = alc262_hp_bpc_unsol_event,
11797 .init_hook = alc262_hp_bpc_automute,
11799 [ALC262_HP_BPC_D7000_WF] = {
11800 .mixers = { alc262_HP_BPC_WildWest_mixer },
11801 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11802 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11803 .dac_nids = alc262_dac_nids,
11805 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11806 .channel_mode = alc262_modes,
11807 .input_mux = &alc262_HP_D7000_capture_source,
11808 .unsol_event = alc262_hp_wildwest_unsol_event,
11809 .init_hook = alc262_hp_wildwest_automute,
11811 [ALC262_HP_BPC_D7000_WL] = {
11812 .mixers = { alc262_HP_BPC_WildWest_mixer,
11813 alc262_HP_BPC_WildWest_option_mixer },
11814 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11815 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11816 .dac_nids = alc262_dac_nids,
11818 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11819 .channel_mode = alc262_modes,
11820 .input_mux = &alc262_HP_D7000_capture_source,
11821 .unsol_event = alc262_hp_wildwest_unsol_event,
11822 .init_hook = alc262_hp_wildwest_automute,
11824 [ALC262_HP_TC_T5735] = {
11825 .mixers = { alc262_hp_t5735_mixer },
11826 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11827 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11828 .dac_nids = alc262_dac_nids,
11830 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11831 .channel_mode = alc262_modes,
11832 .input_mux = &alc262_capture_source,
11833 .unsol_event = alc_automute_amp_unsol_event,
11834 .setup = alc262_hp_t5735_setup,
11835 .init_hook = alc_automute_amp,
11837 [ALC262_HP_RP5700] = {
11838 .mixers = { alc262_hp_rp5700_mixer },
11839 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11840 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11841 .dac_nids = alc262_dac_nids,
11842 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11843 .channel_mode = alc262_modes,
11844 .input_mux = &alc262_hp_rp5700_capture_source,
11846 [ALC262_BENQ_ED8] = {
11847 .mixers = { alc262_base_mixer },
11848 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11849 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11850 .dac_nids = alc262_dac_nids,
11852 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11853 .channel_mode = alc262_modes,
11854 .input_mux = &alc262_capture_source,
11856 [ALC262_SONY_ASSAMD] = {
11857 .mixers = { alc262_sony_mixer },
11858 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11859 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11860 .dac_nids = alc262_dac_nids,
11862 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11863 .channel_mode = alc262_modes,
11864 .input_mux = &alc262_capture_source,
11865 .unsol_event = alc262_hippo_unsol_event,
11866 .setup = alc262_hippo_setup,
11867 .init_hook = alc262_hippo_automute,
11869 [ALC262_BENQ_T31] = {
11870 .mixers = { alc262_benq_t31_mixer },
11871 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11872 alc_hp15_unsol_verbs },
11873 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11874 .dac_nids = alc262_dac_nids,
11876 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11877 .channel_mode = alc262_modes,
11878 .input_mux = &alc262_capture_source,
11879 .unsol_event = alc262_hippo_unsol_event,
11880 .setup = alc262_hippo_setup,
11881 .init_hook = alc262_hippo_automute,
11884 .mixers = { alc262_ultra_mixer },
11885 .cap_mixer = alc262_ultra_capture_mixer,
11886 .init_verbs = { alc262_ultra_verbs },
11887 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11888 .dac_nids = alc262_dac_nids,
11889 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11890 .channel_mode = alc262_modes,
11891 .input_mux = &alc262_ultra_capture_source,
11892 .adc_nids = alc262_adc_nids, /* ADC0 */
11893 .capsrc_nids = alc262_capsrc_nids,
11894 .num_adc_nids = 1, /* single ADC */
11895 .unsol_event = alc262_ultra_unsol_event,
11896 .init_hook = alc262_ultra_automute,
11898 [ALC262_LENOVO_3000] = {
11899 .mixers = { alc262_lenovo_3000_mixer },
11900 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11901 alc262_lenovo_3000_unsol_verbs,
11902 alc262_lenovo_3000_init_verbs },
11903 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11904 .dac_nids = alc262_dac_nids,
11906 .dig_out_nid = ALC262_DIGOUT_NID,
11907 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11908 .channel_mode = alc262_modes,
11909 .input_mux = &alc262_fujitsu_capture_source,
11910 .unsol_event = alc262_lenovo_3000_unsol_event,
11913 .mixers = { alc262_nec_mixer },
11914 .init_verbs = { alc262_nec_verbs },
11915 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11916 .dac_nids = alc262_dac_nids,
11918 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11919 .channel_mode = alc262_modes,
11920 .input_mux = &alc262_capture_source,
11922 [ALC262_TOSHIBA_S06] = {
11923 .mixers = { alc262_toshiba_s06_mixer },
11924 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11925 alc262_eapd_verbs },
11926 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11927 .capsrc_nids = alc262_dmic_capsrc_nids,
11928 .dac_nids = alc262_dac_nids,
11929 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11930 .num_adc_nids = 1, /* single ADC */
11931 .dig_out_nid = ALC262_DIGOUT_NID,
11932 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11933 .channel_mode = alc262_modes,
11934 .unsol_event = alc_sku_unsol_event,
11935 .setup = alc262_toshiba_s06_setup,
11936 .init_hook = alc_inithook,
11938 [ALC262_TOSHIBA_RX1] = {
11939 .mixers = { alc262_toshiba_rx1_mixer },
11940 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11941 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11942 .dac_nids = alc262_dac_nids,
11944 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11945 .channel_mode = alc262_modes,
11946 .input_mux = &alc262_capture_source,
11947 .unsol_event = alc262_hippo_unsol_event,
11948 .setup = alc262_hippo_setup,
11949 .init_hook = alc262_hippo_automute,
11952 .mixers = { alc262_tyan_mixer },
11953 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11954 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11955 .dac_nids = alc262_dac_nids,
11957 .dig_out_nid = ALC262_DIGOUT_NID,
11958 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11959 .channel_mode = alc262_modes,
11960 .input_mux = &alc262_capture_source,
11961 .unsol_event = alc_automute_amp_unsol_event,
11962 .setup = alc262_tyan_setup,
11963 .init_hook = alc_automute_amp,
11967 static int patch_alc262(struct hda_codec *codec)
11969 struct alc_spec *spec;
11973 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11977 codec->spec = spec;
11979 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11984 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11985 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11986 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11987 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11991 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11993 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11997 if (board_config < 0) {
11998 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12000 board_config = ALC262_AUTO;
12003 if (board_config == ALC262_AUTO) {
12004 /* automatic parse from the BIOS config */
12005 err = alc262_parse_auto_config(codec);
12011 "hda_codec: Cannot set up configuration "
12012 "from BIOS. Using base mode...\n");
12013 board_config = ALC262_BASIC;
12017 if (!spec->no_analog) {
12018 err = snd_hda_attach_beep_device(codec, 0x1);
12025 if (board_config != ALC262_AUTO)
12026 setup_preset(codec, &alc262_presets[board_config]);
12028 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12029 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12031 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12032 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12034 if (!spec->adc_nids && spec->input_mux) {
12036 /* check whether the digital-mic has to be supported */
12037 for (i = 0; i < spec->input_mux->num_items; i++) {
12038 if (spec->input_mux->items[i].index >= 9)
12041 if (i < spec->input_mux->num_items) {
12042 /* use only ADC0 */
12043 spec->adc_nids = alc262_dmic_adc_nids;
12044 spec->num_adc_nids = 1;
12045 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12047 /* all analog inputs */
12048 /* check whether NID 0x07 is valid */
12049 unsigned int wcap = get_wcaps(codec, 0x07);
12052 wcap = get_wcaps_type(wcap);
12053 if (wcap != AC_WID_AUD_IN) {
12054 spec->adc_nids = alc262_adc_nids_alt;
12055 spec->num_adc_nids =
12056 ARRAY_SIZE(alc262_adc_nids_alt);
12057 spec->capsrc_nids = alc262_capsrc_nids_alt;
12059 spec->adc_nids = alc262_adc_nids;
12060 spec->num_adc_nids =
12061 ARRAY_SIZE(alc262_adc_nids);
12062 spec->capsrc_nids = alc262_capsrc_nids;
12066 if (!spec->cap_mixer && !spec->no_analog)
12067 set_capture_mixer(codec);
12068 if (!spec->no_analog)
12069 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12071 spec->vmaster_nid = 0x0c;
12073 codec->patch_ops = alc_patch_ops;
12074 if (board_config == ALC262_AUTO)
12075 spec->init_hook = alc262_auto_init;
12076 #ifdef CONFIG_SND_HDA_POWER_SAVE
12077 if (!spec->loopback.amplist)
12078 spec->loopback.amplist = alc262_loopbacks;
12080 codec->proc_widget_hook = print_realtek_coef;
12086 * ALC268 channel source setting (2 channel)
12088 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12089 #define alc268_modes alc260_modes
12091 static hda_nid_t alc268_dac_nids[2] = {
12096 static hda_nid_t alc268_adc_nids[2] = {
12101 static hda_nid_t alc268_adc_nids_alt[1] = {
12106 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12108 static struct snd_kcontrol_new alc268_base_mixer[] = {
12109 /* output mixer control */
12110 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12111 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12112 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12113 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12114 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12115 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12116 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12120 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12121 /* output mixer control */
12122 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12123 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12124 ALC262_HIPPO_MASTER_SWITCH,
12125 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12126 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12127 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12131 /* bind Beep switches of both NID 0x0f and 0x10 */
12132 static struct hda_bind_ctls alc268_bind_beep_sw = {
12133 .ops = &snd_hda_bind_sw,
12135 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12136 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12141 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12142 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12143 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12147 static struct hda_verb alc268_eapd_verbs[] = {
12148 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12149 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12153 /* Toshiba specific */
12154 static struct hda_verb alc268_toshiba_verbs[] = {
12155 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12159 /* Acer specific */
12160 /* bind volumes of both NID 0x02 and 0x03 */
12161 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12162 .ops = &snd_hda_bind_vol,
12164 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12165 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12170 /* mute/unmute internal speaker according to the hp jack and mute state */
12171 static void alc268_acer_automute(struct hda_codec *codec, int force)
12173 struct alc_spec *spec = codec->spec;
12176 if (force || !spec->sense_updated) {
12177 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12178 spec->sense_updated = 1;
12180 if (spec->jack_present)
12181 mute = HDA_AMP_MUTE; /* mute internal speaker */
12182 else /* unmute internal speaker if necessary */
12183 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12184 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12185 HDA_AMP_MUTE, mute);
12189 /* bind hp and internal speaker mute (with plug check) */
12190 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12191 struct snd_ctl_elem_value *ucontrol)
12193 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12194 long *valp = ucontrol->value.integer.value;
12197 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12199 alc268_acer_automute(codec, 0);
12203 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12204 /* output mixer control */
12205 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12207 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12208 .name = "Master Playback Switch",
12209 .subdevice = HDA_SUBDEV_AMP_FLAG,
12210 .info = snd_hda_mixer_amp_switch_info,
12211 .get = snd_hda_mixer_amp_switch_get,
12212 .put = alc268_acer_master_sw_put,
12213 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12215 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12219 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12220 /* output mixer control */
12221 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12223 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12224 .name = "Master Playback Switch",
12225 .subdevice = HDA_SUBDEV_AMP_FLAG,
12226 .info = snd_hda_mixer_amp_switch_info,
12227 .get = snd_hda_mixer_amp_switch_get,
12228 .put = alc268_acer_master_sw_put,
12229 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12232 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12237 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12238 /* output mixer control */
12239 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12242 .name = "Master Playback Switch",
12243 .subdevice = HDA_SUBDEV_AMP_FLAG,
12244 .info = snd_hda_mixer_amp_switch_info,
12245 .get = snd_hda_mixer_amp_switch_get,
12246 .put = alc268_acer_master_sw_put,
12247 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12250 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12254 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12255 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12257 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12258 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12259 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12260 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12264 static struct hda_verb alc268_acer_verbs[] = {
12265 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12266 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12271 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12275 /* unsolicited event for HP jack sensing */
12276 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12277 #define alc268_toshiba_setup alc262_hippo_setup
12278 #define alc268_toshiba_automute alc262_hippo_automute
12280 static void alc268_acer_unsol_event(struct hda_codec *codec,
12283 if ((res >> 26) != ALC880_HP_EVENT)
12285 alc268_acer_automute(codec, 1);
12288 static void alc268_acer_init_hook(struct hda_codec *codec)
12290 alc268_acer_automute(codec, 1);
12293 /* toggle speaker-output according to the hp-jack state */
12294 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12296 unsigned int present;
12297 unsigned char bits;
12299 present = snd_hda_jack_detect(codec, 0x15);
12300 bits = present ? AMP_IN_MUTE(0) : 0;
12301 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12302 AMP_IN_MUTE(0), bits);
12303 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12304 AMP_IN_MUTE(0), bits);
12307 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12310 switch (res >> 26) {
12311 case ALC880_HP_EVENT:
12312 alc268_aspire_one_speaker_automute(codec);
12314 case ALC880_MIC_EVENT:
12315 alc_mic_automute(codec);
12320 static void alc268_acer_lc_setup(struct hda_codec *codec)
12322 struct alc_spec *spec = codec->spec;
12323 spec->ext_mic.pin = 0x18;
12324 spec->ext_mic.mux_idx = 0;
12325 spec->int_mic.pin = 0x12;
12326 spec->int_mic.mux_idx = 6;
12327 spec->auto_mic = 1;
12330 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12332 alc268_aspire_one_speaker_automute(codec);
12333 alc_mic_automute(codec);
12336 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12337 /* output mixer control */
12338 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12339 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12341 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12342 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12343 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12347 static struct hda_verb alc268_dell_verbs[] = {
12348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12350 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12351 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12355 /* mute/unmute internal speaker according to the hp jack and mute state */
12356 static void alc268_dell_setup(struct hda_codec *codec)
12358 struct alc_spec *spec = codec->spec;
12360 spec->autocfg.hp_pins[0] = 0x15;
12361 spec->autocfg.speaker_pins[0] = 0x14;
12362 spec->ext_mic.pin = 0x18;
12363 spec->ext_mic.mux_idx = 0;
12364 spec->int_mic.pin = 0x19;
12365 spec->int_mic.mux_idx = 1;
12366 spec->auto_mic = 1;
12369 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12370 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12371 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12372 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12375 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12376 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12377 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12381 static struct hda_verb alc267_quanta_il1_verbs[] = {
12382 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12383 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12387 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12389 struct alc_spec *spec = codec->spec;
12390 spec->autocfg.hp_pins[0] = 0x15;
12391 spec->autocfg.speaker_pins[0] = 0x14;
12392 spec->ext_mic.pin = 0x18;
12393 spec->ext_mic.mux_idx = 0;
12394 spec->int_mic.pin = 0x19;
12395 spec->int_mic.mux_idx = 1;
12396 spec->auto_mic = 1;
12400 * generic initialization of ADC, input mixers and output mixers
12402 static struct hda_verb alc268_base_init_verbs[] = {
12403 /* Unmute DAC0-1 and set vol = 0 */
12404 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12405 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12408 * Set up output mixers (0x0c - 0x0e)
12410 /* set vol=0 to output mixers */
12411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12412 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12414 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12415 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12419 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12421 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12422 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12423 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12424 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12426 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12428 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12429 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12432 /* set PCBEEP vol = 0, mute connections */
12433 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12434 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12435 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12437 /* Unmute Selector 23h,24h and set the default input to mic-in */
12439 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12441 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12448 * generic initialization of ADC, input mixers and output mixers
12450 static struct hda_verb alc268_volume_init_verbs[] = {
12451 /* set output DAC */
12452 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12453 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12455 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12458 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12459 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12461 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12462 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12463 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12466 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12468 /* set PCBEEP vol = 0, mute connections */
12469 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12470 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12471 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12476 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12477 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12478 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12482 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12483 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12484 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12489 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12490 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12491 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12492 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12493 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12498 static struct hda_input_mux alc268_capture_source = {
12502 { "Front Mic", 0x1 },
12508 static struct hda_input_mux alc268_acer_capture_source = {
12512 { "Internal Mic", 0x1 },
12517 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12521 { "Internal Mic", 0x6 },
12526 #ifdef CONFIG_SND_DEBUG
12527 static struct snd_kcontrol_new alc268_test_mixer[] = {
12528 /* Volume widgets */
12529 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12530 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12531 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12532 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12533 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12534 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12535 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12536 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12537 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12538 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12539 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12540 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12541 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12542 /* The below appears problematic on some hardwares */
12543 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12544 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12545 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12546 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12547 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12549 /* Modes for retasking pin widgets */
12550 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12551 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12552 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12553 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12555 /* Controls for GPIO pins, assuming they are configured as outputs */
12556 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12557 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12558 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12559 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12561 /* Switches to allow the digital SPDIF output pin to be enabled.
12562 * The ALC268 does not have an SPDIF input.
12564 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12566 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12567 * this output to turn on an external amplifier.
12569 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12570 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12576 /* create input playback/capture controls for the given pin */
12577 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12578 const char *ctlname, int idx)
12594 if (spec->multiout.dac_nids[0] != dac &&
12595 spec->multiout.dac_nids[1] != dac) {
12596 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12597 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12601 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12605 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12606 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12608 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12609 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12615 /* add playback controls from the parsed DAC table */
12616 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12617 const struct auto_pin_cfg *cfg)
12622 spec->multiout.dac_nids = spec->private_dac_nids;
12624 nid = cfg->line_out_pins[0];
12627 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12631 err = alc268_new_analog_output(spec, nid, name, 0);
12636 nid = cfg->speaker_pins[0];
12638 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12639 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12643 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12647 nid = cfg->hp_pins[0];
12649 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12654 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12656 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12657 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12664 /* create playback/capture controls for input pins */
12665 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12666 const struct auto_pin_cfg *cfg)
12668 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12671 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12672 hda_nid_t nid, int pin_type)
12676 alc_set_pin_output(codec, nid, pin_type);
12677 if (nid == 0x14 || nid == 0x16)
12681 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12684 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12686 struct alc_spec *spec = codec->spec;
12687 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12689 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12690 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12694 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12696 struct alc_spec *spec = codec->spec;
12699 pin = spec->autocfg.hp_pins[0];
12701 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12702 pin = spec->autocfg.speaker_pins[0];
12704 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12707 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12709 struct alc_spec *spec = codec->spec;
12710 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12711 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12712 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12713 unsigned int dac_vol1, dac_vol2;
12715 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12716 snd_hda_codec_write(codec, speaker_nid, 0,
12717 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12718 /* mute mixer inputs from 0x1d */
12719 snd_hda_codec_write(codec, 0x0f, 0,
12720 AC_VERB_SET_AMP_GAIN_MUTE,
12722 snd_hda_codec_write(codec, 0x10, 0,
12723 AC_VERB_SET_AMP_GAIN_MUTE,
12726 /* unmute mixer inputs from 0x1d */
12727 snd_hda_codec_write(codec, 0x0f, 0,
12728 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12729 snd_hda_codec_write(codec, 0x10, 0,
12730 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12733 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12734 if (line_nid == 0x14)
12735 dac_vol2 = AMP_OUT_ZERO;
12736 else if (line_nid == 0x15)
12737 dac_vol1 = AMP_OUT_ZERO;
12738 if (hp_nid == 0x14)
12739 dac_vol2 = AMP_OUT_ZERO;
12740 else if (hp_nid == 0x15)
12741 dac_vol1 = AMP_OUT_ZERO;
12742 if (line_nid != 0x16 || hp_nid != 0x16 ||
12743 spec->autocfg.line_out_pins[1] != 0x16 ||
12744 spec->autocfg.line_out_pins[2] != 0x16)
12745 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12747 snd_hda_codec_write(codec, 0x02, 0,
12748 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12749 snd_hda_codec_write(codec, 0x03, 0,
12750 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12753 /* pcm configuration: identical with ALC880 */
12754 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12755 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12756 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12757 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12760 * BIOS auto configuration
12762 static int alc268_parse_auto_config(struct hda_codec *codec)
12764 struct alc_spec *spec = codec->spec;
12766 static hda_nid_t alc268_ignore[] = { 0 };
12768 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12772 if (!spec->autocfg.line_outs) {
12773 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12774 spec->multiout.max_channels = 2;
12775 spec->no_analog = 1;
12778 return 0; /* can't find valid BIOS pin config */
12780 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12783 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12787 spec->multiout.max_channels = 2;
12790 /* digital only support output */
12791 if (spec->autocfg.dig_outs) {
12792 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12793 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12795 if (spec->kctls.list)
12796 add_mixer(spec, spec->kctls.list);
12798 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12799 add_mixer(spec, alc268_beep_mixer);
12801 add_verb(spec, alc268_volume_init_verbs);
12802 spec->num_mux_defs = 2;
12803 spec->input_mux = &spec->private_imux[0];
12805 err = alc_auto_add_mic_boost(codec);
12809 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12814 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12816 /* init callback for auto-configuration model -- overriding the default init */
12817 static void alc268_auto_init(struct hda_codec *codec)
12819 struct alc_spec *spec = codec->spec;
12820 alc268_auto_init_multi_out(codec);
12821 alc268_auto_init_hp_out(codec);
12822 alc268_auto_init_mono_speaker_out(codec);
12823 alc268_auto_init_analog_input(codec);
12824 if (spec->unsol_event)
12825 alc_inithook(codec);
12829 * configuration and preset
12831 static const char *alc268_models[ALC268_MODEL_LAST] = {
12832 [ALC267_QUANTA_IL1] = "quanta-il1",
12833 [ALC268_3ST] = "3stack",
12834 [ALC268_TOSHIBA] = "toshiba",
12835 [ALC268_ACER] = "acer",
12836 [ALC268_ACER_DMIC] = "acer-dmic",
12837 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12838 [ALC268_DELL] = "dell",
12839 [ALC268_ZEPTO] = "zepto",
12840 #ifdef CONFIG_SND_DEBUG
12841 [ALC268_TEST] = "test",
12843 [ALC268_AUTO] = "auto",
12846 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12847 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12848 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12849 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12850 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12851 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12852 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12853 ALC268_ACER_ASPIRE_ONE),
12854 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12855 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12856 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12857 /* almost compatible with toshiba but with optional digital outs;
12858 * auto-probing seems working fine
12860 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12862 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12863 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12864 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12865 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12866 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12867 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12871 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12872 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12873 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12874 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12875 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12880 static struct alc_config_preset alc268_presets[] = {
12881 [ALC267_QUANTA_IL1] = {
12882 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12883 alc268_capture_nosrc_mixer },
12884 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12885 alc267_quanta_il1_verbs },
12886 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12887 .dac_nids = alc268_dac_nids,
12888 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12889 .adc_nids = alc268_adc_nids_alt,
12891 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12892 .channel_mode = alc268_modes,
12893 .unsol_event = alc_sku_unsol_event,
12894 .setup = alc267_quanta_il1_setup,
12895 .init_hook = alc_inithook,
12898 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12899 alc268_beep_mixer },
12900 .init_verbs = { alc268_base_init_verbs },
12901 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12902 .dac_nids = alc268_dac_nids,
12903 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12904 .adc_nids = alc268_adc_nids_alt,
12905 .capsrc_nids = alc268_capsrc_nids,
12907 .dig_out_nid = ALC268_DIGOUT_NID,
12908 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12909 .channel_mode = alc268_modes,
12910 .input_mux = &alc268_capture_source,
12912 [ALC268_TOSHIBA] = {
12913 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12914 alc268_beep_mixer },
12915 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12916 alc268_toshiba_verbs },
12917 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12918 .dac_nids = alc268_dac_nids,
12919 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12920 .adc_nids = alc268_adc_nids_alt,
12921 .capsrc_nids = alc268_capsrc_nids,
12923 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12924 .channel_mode = alc268_modes,
12925 .input_mux = &alc268_capture_source,
12926 .unsol_event = alc268_toshiba_unsol_event,
12927 .setup = alc268_toshiba_setup,
12928 .init_hook = alc268_toshiba_automute,
12931 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12932 alc268_beep_mixer },
12933 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12934 alc268_acer_verbs },
12935 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12936 .dac_nids = alc268_dac_nids,
12937 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12938 .adc_nids = alc268_adc_nids_alt,
12939 .capsrc_nids = alc268_capsrc_nids,
12941 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12942 .channel_mode = alc268_modes,
12943 .input_mux = &alc268_acer_capture_source,
12944 .unsol_event = alc268_acer_unsol_event,
12945 .init_hook = alc268_acer_init_hook,
12947 [ALC268_ACER_DMIC] = {
12948 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12949 alc268_beep_mixer },
12950 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12951 alc268_acer_verbs },
12952 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12953 .dac_nids = alc268_dac_nids,
12954 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12955 .adc_nids = alc268_adc_nids_alt,
12956 .capsrc_nids = alc268_capsrc_nids,
12958 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12959 .channel_mode = alc268_modes,
12960 .input_mux = &alc268_acer_dmic_capture_source,
12961 .unsol_event = alc268_acer_unsol_event,
12962 .init_hook = alc268_acer_init_hook,
12964 [ALC268_ACER_ASPIRE_ONE] = {
12965 .mixers = { alc268_acer_aspire_one_mixer,
12967 alc268_capture_nosrc_mixer },
12968 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12969 alc268_acer_aspire_one_verbs },
12970 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12971 .dac_nids = alc268_dac_nids,
12972 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12973 .adc_nids = alc268_adc_nids_alt,
12974 .capsrc_nids = alc268_capsrc_nids,
12976 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12977 .channel_mode = alc268_modes,
12978 .unsol_event = alc268_acer_lc_unsol_event,
12979 .setup = alc268_acer_lc_setup,
12980 .init_hook = alc268_acer_lc_init_hook,
12983 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12984 alc268_capture_nosrc_mixer },
12985 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12986 alc268_dell_verbs },
12987 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12988 .dac_nids = alc268_dac_nids,
12989 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12990 .adc_nids = alc268_adc_nids_alt,
12991 .capsrc_nids = alc268_capsrc_nids,
12993 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12994 .channel_mode = alc268_modes,
12995 .unsol_event = alc_sku_unsol_event,
12996 .setup = alc268_dell_setup,
12997 .init_hook = alc_inithook,
13000 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13001 alc268_beep_mixer },
13002 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13003 alc268_toshiba_verbs },
13004 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13005 .dac_nids = alc268_dac_nids,
13006 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13007 .adc_nids = alc268_adc_nids_alt,
13008 .capsrc_nids = alc268_capsrc_nids,
13010 .dig_out_nid = ALC268_DIGOUT_NID,
13011 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13012 .channel_mode = alc268_modes,
13013 .input_mux = &alc268_capture_source,
13014 .setup = alc268_toshiba_setup,
13015 .init_hook = alc268_toshiba_automute,
13017 #ifdef CONFIG_SND_DEBUG
13019 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13020 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13021 alc268_volume_init_verbs },
13022 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13023 .dac_nids = alc268_dac_nids,
13024 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13025 .adc_nids = alc268_adc_nids_alt,
13026 .capsrc_nids = alc268_capsrc_nids,
13028 .dig_out_nid = ALC268_DIGOUT_NID,
13029 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13030 .channel_mode = alc268_modes,
13031 .input_mux = &alc268_capture_source,
13036 static int patch_alc268(struct hda_codec *codec)
13038 struct alc_spec *spec;
13040 int i, has_beep, err;
13042 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13046 codec->spec = spec;
13048 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13052 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13053 board_config = snd_hda_check_board_codec_sid_config(codec,
13054 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13056 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13057 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13059 board_config = ALC268_AUTO;
13062 if (board_config == ALC268_AUTO) {
13063 /* automatic parse from the BIOS config */
13064 err = alc268_parse_auto_config(codec);
13070 "hda_codec: Cannot set up configuration "
13071 "from BIOS. Using base mode...\n");
13072 board_config = ALC268_3ST;
13076 if (board_config != ALC268_AUTO)
13077 setup_preset(codec, &alc268_presets[board_config]);
13079 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13080 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13081 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13083 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13086 for (i = 0; i < spec->num_mixers; i++) {
13087 if (spec->mixers[i] == alc268_beep_mixer) {
13094 err = snd_hda_attach_beep_device(codec, 0x1);
13099 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13100 /* override the amp caps for beep generator */
13101 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13102 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13103 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13104 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13105 (0 << AC_AMPCAP_MUTE_SHIFT));
13108 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13109 /* check whether NID 0x07 is valid */
13110 unsigned int wcap = get_wcaps(codec, 0x07);
13113 spec->capsrc_nids = alc268_capsrc_nids;
13115 wcap = get_wcaps_type(wcap);
13116 if (spec->auto_mic ||
13117 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13118 spec->adc_nids = alc268_adc_nids_alt;
13119 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13120 if (spec->auto_mic)
13121 fixup_automic_adc(codec);
13122 if (spec->auto_mic || spec->input_mux->num_items == 1)
13123 add_mixer(spec, alc268_capture_nosrc_mixer);
13125 add_mixer(spec, alc268_capture_alt_mixer);
13127 spec->adc_nids = alc268_adc_nids;
13128 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13129 add_mixer(spec, alc268_capture_mixer);
13131 /* set default input source */
13132 for (i = 0; i < spec->num_adc_nids; i++)
13133 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13134 0, AC_VERB_SET_CONNECT_SEL,
13135 i < spec->num_mux_defs ?
13136 spec->input_mux[i].items[0].index :
13137 spec->input_mux->items[0].index);
13140 spec->vmaster_nid = 0x02;
13142 codec->patch_ops = alc_patch_ops;
13143 if (board_config == ALC268_AUTO)
13144 spec->init_hook = alc268_auto_init;
13146 codec->proc_widget_hook = print_realtek_coef;
13152 * ALC269 channel source setting (2 channel)
13154 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13156 #define alc269_dac_nids alc260_dac_nids
13158 static hda_nid_t alc269_adc_nids[1] = {
13163 static hda_nid_t alc269_capsrc_nids[1] = {
13167 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13171 #define alc269_modes alc260_modes
13172 #define alc269_capture_source alc880_lg_lw_capture_source
13174 static struct snd_kcontrol_new alc269_base_mixer[] = {
13175 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13176 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13182 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13183 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13184 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13186 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13190 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13191 /* output mixer control */
13192 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13194 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13195 .name = "Master Playback Switch",
13196 .subdevice = HDA_SUBDEV_AMP_FLAG,
13197 .info = snd_hda_mixer_amp_switch_info,
13198 .get = snd_hda_mixer_amp_switch_get,
13199 .put = alc268_acer_master_sw_put,
13200 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13204 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13205 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13206 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13207 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13211 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13212 /* output mixer control */
13213 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13216 .name = "Master Playback Switch",
13217 .subdevice = HDA_SUBDEV_AMP_FLAG,
13218 .info = snd_hda_mixer_amp_switch_info,
13219 .get = snd_hda_mixer_amp_switch_get,
13220 .put = alc268_acer_master_sw_put,
13221 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13225 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13227 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13228 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13229 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13230 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13231 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13235 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13236 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13237 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13238 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13239 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13243 /* capture mixer elements */
13244 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13245 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13246 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13252 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13254 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13255 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13258 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13259 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13260 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13264 static struct hda_verb alc269_lifebook_verbs[] = {
13265 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13266 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13267 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13269 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13270 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13272 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13273 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13274 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13278 /* toggle speaker-output according to the hp-jack state */
13279 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13281 unsigned int present;
13282 unsigned char bits;
13284 present = snd_hda_jack_detect(codec, 0x15);
13285 bits = present ? AMP_IN_MUTE(0) : 0;
13286 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13287 AMP_IN_MUTE(0), bits);
13288 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13289 AMP_IN_MUTE(0), bits);
13291 snd_hda_codec_write(codec, 0x20, 0,
13292 AC_VERB_SET_COEF_INDEX, 0x0c);
13293 snd_hda_codec_write(codec, 0x20, 0,
13294 AC_VERB_SET_PROC_COEF, 0x680);
13296 snd_hda_codec_write(codec, 0x20, 0,
13297 AC_VERB_SET_COEF_INDEX, 0x0c);
13298 snd_hda_codec_write(codec, 0x20, 0,
13299 AC_VERB_SET_PROC_COEF, 0x480);
13302 /* toggle speaker-output according to the hp-jacks state */
13303 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13305 unsigned int present;
13306 unsigned char bits;
13308 /* Check laptop headphone socket */
13309 present = snd_hda_jack_detect(codec, 0x15);
13311 /* Check port replicator headphone socket */
13312 present |= snd_hda_jack_detect(codec, 0x1a);
13314 bits = present ? AMP_IN_MUTE(0) : 0;
13315 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13316 AMP_IN_MUTE(0), bits);
13317 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13318 AMP_IN_MUTE(0), bits);
13320 snd_hda_codec_write(codec, 0x20, 0,
13321 AC_VERB_SET_COEF_INDEX, 0x0c);
13322 snd_hda_codec_write(codec, 0x20, 0,
13323 AC_VERB_SET_PROC_COEF, 0x680);
13325 snd_hda_codec_write(codec, 0x20, 0,
13326 AC_VERB_SET_COEF_INDEX, 0x0c);
13327 snd_hda_codec_write(codec, 0x20, 0,
13328 AC_VERB_SET_PROC_COEF, 0x480);
13331 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13333 unsigned int present_laptop;
13334 unsigned int present_dock;
13336 present_laptop = snd_hda_jack_detect(codec, 0x18);
13337 present_dock = snd_hda_jack_detect(codec, 0x1b);
13339 /* Laptop mic port overrides dock mic port, design decision */
13341 snd_hda_codec_write(codec, 0x23, 0,
13342 AC_VERB_SET_CONNECT_SEL, 0x3);
13343 if (present_laptop)
13344 snd_hda_codec_write(codec, 0x23, 0,
13345 AC_VERB_SET_CONNECT_SEL, 0x0);
13346 if (!present_dock && !present_laptop)
13347 snd_hda_codec_write(codec, 0x23, 0,
13348 AC_VERB_SET_CONNECT_SEL, 0x1);
13351 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13354 switch (res >> 26) {
13355 case ALC880_HP_EVENT:
13356 alc269_quanta_fl1_speaker_automute(codec);
13358 case ALC880_MIC_EVENT:
13359 alc_mic_automute(codec);
13364 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13367 if ((res >> 26) == ALC880_HP_EVENT)
13368 alc269_lifebook_speaker_automute(codec);
13369 if ((res >> 26) == ALC880_MIC_EVENT)
13370 alc269_lifebook_mic_autoswitch(codec);
13373 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13375 struct alc_spec *spec = codec->spec;
13376 spec->ext_mic.pin = 0x18;
13377 spec->ext_mic.mux_idx = 0;
13378 spec->int_mic.pin = 0x19;
13379 spec->int_mic.mux_idx = 1;
13380 spec->auto_mic = 1;
13383 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13385 alc269_quanta_fl1_speaker_automute(codec);
13386 alc_mic_automute(codec);
13389 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13391 alc269_lifebook_speaker_automute(codec);
13392 alc269_lifebook_mic_autoswitch(codec);
13395 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13396 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13397 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13398 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13399 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13400 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13401 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13402 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13406 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13407 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13408 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13409 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13410 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13411 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13412 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13416 /* toggle speaker-output according to the hp-jack state */
13417 static void alc269_speaker_automute(struct hda_codec *codec)
13419 struct alc_spec *spec = codec->spec;
13420 unsigned int nid = spec->autocfg.hp_pins[0];
13421 unsigned int present;
13422 unsigned char bits;
13424 present = snd_hda_jack_detect(codec, nid);
13425 bits = present ? AMP_IN_MUTE(0) : 0;
13426 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13427 AMP_IN_MUTE(0), bits);
13428 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13429 AMP_IN_MUTE(0), bits);
13432 /* unsolicited event for HP jack sensing */
13433 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13436 switch (res >> 26) {
13437 case ALC880_HP_EVENT:
13438 alc269_speaker_automute(codec);
13440 case ALC880_MIC_EVENT:
13441 alc_mic_automute(codec);
13446 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13448 struct alc_spec *spec = codec->spec;
13449 spec->ext_mic.pin = 0x18;
13450 spec->ext_mic.mux_idx = 0;
13451 spec->int_mic.pin = 0x12;
13452 spec->int_mic.mux_idx = 5;
13453 spec->auto_mic = 1;
13456 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13458 struct alc_spec *spec = codec->spec;
13459 spec->ext_mic.pin = 0x18;
13460 spec->ext_mic.mux_idx = 0;
13461 spec->int_mic.pin = 0x19;
13462 spec->int_mic.mux_idx = 1;
13463 spec->auto_mic = 1;
13466 static void alc269_eeepc_inithook(struct hda_codec *codec)
13468 alc269_speaker_automute(codec);
13469 alc_mic_automute(codec);
13473 * generic initialization of ADC, input mixers and output mixers
13475 static struct hda_verb alc269_init_verbs[] = {
13477 * Unmute ADC0 and set the default input to mic-in
13479 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13481 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13482 * analog-loopback mixer widget
13483 * Note: PASD motherboards uses the Line In 2 as the input for
13484 * front panel mic (mic 2)
13486 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13494 * Set up output mixers (0x0c - 0x0e)
13496 /* set vol=0 to output mixers */
13497 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13498 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13500 /* set up input amps for analog loopback */
13501 /* Amp Indices: DAC = 0, mixer = 1 */
13502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13504 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13506 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13509 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13510 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13511 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13512 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13513 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13514 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13515 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13517 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13518 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13519 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13522 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13523 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13525 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13526 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13528 /* FIXME: use matrix-type input source selection */
13529 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13530 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13537 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13538 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13542 #define alc269_auto_create_multi_out_ctls \
13543 alc268_auto_create_multi_out_ctls
13544 #define alc269_auto_create_input_ctls \
13545 alc268_auto_create_input_ctls
13547 #ifdef CONFIG_SND_HDA_POWER_SAVE
13548 #define alc269_loopbacks alc880_loopbacks
13551 /* pcm configuration: identical with ALC880 */
13552 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13553 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13554 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13555 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13557 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13561 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13562 /* NID is set in alc_build_pcms */
13564 .open = alc880_playback_pcm_open,
13565 .prepare = alc880_playback_pcm_prepare,
13566 .cleanup = alc880_playback_pcm_cleanup
13570 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13574 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13575 /* NID is set in alc_build_pcms */
13579 * BIOS auto configuration
13581 static int alc269_parse_auto_config(struct hda_codec *codec)
13583 struct alc_spec *spec = codec->spec;
13585 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13587 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13592 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13595 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13599 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13601 if (spec->autocfg.dig_outs)
13602 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13604 if (spec->kctls.list)
13605 add_mixer(spec, spec->kctls.list);
13607 add_verb(spec, alc269_init_verbs);
13608 spec->num_mux_defs = 1;
13609 spec->input_mux = &spec->private_imux[0];
13610 /* set default input source */
13611 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13612 0, AC_VERB_SET_CONNECT_SEL,
13613 spec->input_mux->items[0].index);
13615 err = alc_auto_add_mic_boost(codec);
13619 if (!spec->cap_mixer && !spec->no_analog)
13620 set_capture_mixer(codec);
13622 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13627 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13628 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13629 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13632 /* init callback for auto-configuration model -- overriding the default init */
13633 static void alc269_auto_init(struct hda_codec *codec)
13635 struct alc_spec *spec = codec->spec;
13636 alc269_auto_init_multi_out(codec);
13637 alc269_auto_init_hp_out(codec);
13638 alc269_auto_init_analog_input(codec);
13639 if (spec->unsol_event)
13640 alc_inithook(codec);
13644 * configuration and preset
13646 static const char *alc269_models[ALC269_MODEL_LAST] = {
13647 [ALC269_BASIC] = "basic",
13648 [ALC269_QUANTA_FL1] = "quanta",
13649 [ALC269_ASUS_AMIC] = "asus-amic",
13650 [ALC269_ASUS_DMIC] = "asus-dmic",
13651 [ALC269_FUJITSU] = "fujitsu",
13652 [ALC269_LIFEBOOK] = "lifebook",
13653 [ALC269_AUTO] = "auto",
13656 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13657 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13658 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13660 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13661 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13662 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13663 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13664 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13665 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13666 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13667 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13668 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13669 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13670 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13671 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13672 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13673 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13674 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13675 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13676 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13677 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13678 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13679 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13680 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13681 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13682 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13683 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13684 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13685 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13687 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13688 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13690 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13692 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13693 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13694 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13695 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13699 static struct alc_config_preset alc269_presets[] = {
13701 .mixers = { alc269_base_mixer },
13702 .init_verbs = { alc269_init_verbs },
13703 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13704 .dac_nids = alc269_dac_nids,
13706 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13707 .channel_mode = alc269_modes,
13708 .input_mux = &alc269_capture_source,
13710 [ALC269_QUANTA_FL1] = {
13711 .mixers = { alc269_quanta_fl1_mixer },
13712 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13713 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13714 .dac_nids = alc269_dac_nids,
13716 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13717 .channel_mode = alc269_modes,
13718 .input_mux = &alc269_capture_source,
13719 .unsol_event = alc269_quanta_fl1_unsol_event,
13720 .setup = alc269_quanta_fl1_setup,
13721 .init_hook = alc269_quanta_fl1_init_hook,
13723 [ALC269_ASUS_AMIC] = {
13724 .mixers = { alc269_eeepc_mixer },
13725 .cap_mixer = alc269_epc_capture_mixer,
13726 .init_verbs = { alc269_init_verbs,
13727 alc269_eeepc_amic_init_verbs },
13728 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13729 .dac_nids = alc269_dac_nids,
13731 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13732 .channel_mode = alc269_modes,
13733 .unsol_event = alc269_eeepc_unsol_event,
13734 .setup = alc269_eeepc_amic_setup,
13735 .init_hook = alc269_eeepc_inithook,
13737 [ALC269_ASUS_DMIC] = {
13738 .mixers = { alc269_eeepc_mixer },
13739 .cap_mixer = alc269_epc_capture_mixer,
13740 .init_verbs = { alc269_init_verbs,
13741 alc269_eeepc_dmic_init_verbs },
13742 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13743 .dac_nids = alc269_dac_nids,
13745 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13746 .channel_mode = alc269_modes,
13747 .unsol_event = alc269_eeepc_unsol_event,
13748 .setup = alc269_eeepc_dmic_setup,
13749 .init_hook = alc269_eeepc_inithook,
13751 [ALC269_FUJITSU] = {
13752 .mixers = { alc269_fujitsu_mixer },
13753 .cap_mixer = alc269_epc_capture_mixer,
13754 .init_verbs = { alc269_init_verbs,
13755 alc269_eeepc_dmic_init_verbs },
13756 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13757 .dac_nids = alc269_dac_nids,
13759 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13760 .channel_mode = alc269_modes,
13761 .unsol_event = alc269_eeepc_unsol_event,
13762 .setup = alc269_eeepc_dmic_setup,
13763 .init_hook = alc269_eeepc_inithook,
13765 [ALC269_LIFEBOOK] = {
13766 .mixers = { alc269_lifebook_mixer },
13767 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13768 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13769 .dac_nids = alc269_dac_nids,
13771 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13772 .channel_mode = alc269_modes,
13773 .input_mux = &alc269_capture_source,
13774 .unsol_event = alc269_lifebook_unsol_event,
13775 .init_hook = alc269_lifebook_init_hook,
13779 static int patch_alc269(struct hda_codec *codec)
13781 struct alc_spec *spec;
13785 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13789 codec->spec = spec;
13791 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13793 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13794 kfree(codec->chip_name);
13795 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13796 if (!codec->chip_name) {
13802 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13806 if (board_config < 0) {
13807 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13809 board_config = ALC269_AUTO;
13812 if (board_config == ALC269_AUTO) {
13813 /* automatic parse from the BIOS config */
13814 err = alc269_parse_auto_config(codec);
13820 "hda_codec: Cannot set up configuration "
13821 "from BIOS. Using base mode...\n");
13822 board_config = ALC269_BASIC;
13826 err = snd_hda_attach_beep_device(codec, 0x1);
13832 if (board_config != ALC269_AUTO)
13833 setup_preset(codec, &alc269_presets[board_config]);
13835 if (codec->subsystem_id == 0x17aa3bf8) {
13836 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13837 * fix the sample rate of analog I/O to 44.1kHz
13839 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13840 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13842 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13843 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13845 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13846 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13848 spec->adc_nids = alc269_adc_nids;
13849 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13850 spec->capsrc_nids = alc269_capsrc_nids;
13851 if (!spec->cap_mixer)
13852 set_capture_mixer(codec);
13853 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13855 spec->vmaster_nid = 0x02;
13857 codec->patch_ops = alc_patch_ops;
13858 if (board_config == ALC269_AUTO)
13859 spec->init_hook = alc269_auto_init;
13860 #ifdef CONFIG_SND_HDA_POWER_SAVE
13861 if (!spec->loopback.amplist)
13862 spec->loopback.amplist = alc269_loopbacks;
13864 codec->proc_widget_hook = print_realtek_coef;
13870 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13874 * set the path ways for 2 channel output
13875 * need to set the codec line out and mic 1 pin widgets to inputs
13877 static struct hda_verb alc861_threestack_ch2_init[] = {
13878 /* set pin widget 1Ah (line in) for input */
13879 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13880 /* set pin widget 18h (mic1/2) for input, for mic also enable
13883 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13885 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13887 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13888 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13894 * need to set the codec line out and mic 1 pin widgets to outputs
13896 static struct hda_verb alc861_threestack_ch6_init[] = {
13897 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13898 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13899 /* set pin widget 18h (mic1) for output (CLFE)*/
13900 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13902 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13903 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13905 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13907 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13908 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13913 static struct hda_channel_mode alc861_threestack_modes[2] = {
13914 { 2, alc861_threestack_ch2_init },
13915 { 6, alc861_threestack_ch6_init },
13917 /* Set mic1 as input and unmute the mixer */
13918 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13919 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13920 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13923 /* Set mic1 as output and mute mixer */
13924 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13925 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13926 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13930 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13931 { 2, alc861_uniwill_m31_ch2_init },
13932 { 4, alc861_uniwill_m31_ch4_init },
13935 /* Set mic1 and line-in as input and unmute the mixer */
13936 static struct hda_verb alc861_asus_ch2_init[] = {
13937 /* set pin widget 1Ah (line in) for input */
13938 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13939 /* set pin widget 18h (mic1/2) for input, for mic also enable
13942 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13944 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13946 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13947 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13951 /* Set mic1 nad line-in as output and mute mixer */
13952 static struct hda_verb alc861_asus_ch6_init[] = {
13953 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13954 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13955 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13956 /* set pin widget 18h (mic1) for output (CLFE)*/
13957 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13958 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13959 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13960 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13962 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13964 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13970 static struct hda_channel_mode alc861_asus_modes[2] = {
13971 { 2, alc861_asus_ch2_init },
13972 { 6, alc861_asus_ch6_init },
13977 static struct snd_kcontrol_new alc861_base_mixer[] = {
13978 /* output mixer control */
13979 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13980 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13983 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13985 /*Input mixer control */
13986 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13987 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13988 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13989 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13990 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13991 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13993 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13994 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13995 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14000 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14001 /* output mixer control */
14002 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14003 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14004 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14005 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14006 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14008 /* Input mixer control */
14009 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14010 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14011 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14012 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14013 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14014 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14015 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14016 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14017 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14018 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14021 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14022 .name = "Channel Mode",
14023 .info = alc_ch_mode_info,
14024 .get = alc_ch_mode_get,
14025 .put = alc_ch_mode_put,
14026 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14031 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14032 /* output mixer control */
14033 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14035 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14040 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14041 /* output mixer control */
14042 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14043 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14044 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14045 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14046 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14048 /* Input mixer control */
14049 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14050 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14051 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14052 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14053 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14054 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14055 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14056 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14058 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14061 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14062 .name = "Channel Mode",
14063 .info = alc_ch_mode_info,
14064 .get = alc_ch_mode_get,
14065 .put = alc_ch_mode_put,
14066 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14071 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14072 /* output mixer control */
14073 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14074 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14075 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14076 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14077 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14079 /* Input mixer control */
14080 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14081 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14082 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14083 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14084 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14085 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14086 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14087 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14089 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14092 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14093 .name = "Channel Mode",
14094 .info = alc_ch_mode_info,
14095 .get = alc_ch_mode_get,
14096 .put = alc_ch_mode_put,
14097 .private_value = ARRAY_SIZE(alc861_asus_modes),
14102 /* additional mixer */
14103 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14104 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14105 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14110 * generic initialization of ADC, input mixers and output mixers
14112 static struct hda_verb alc861_base_init_verbs[] = {
14114 * Unmute ADC0 and set the default input to mic-in
14116 /* port-A for surround (rear panel) */
14117 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14118 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14119 /* port-B for mic-in (rear panel) with vref */
14120 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14121 /* port-C for line-in (rear panel) */
14122 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14123 /* port-D for Front */
14124 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14125 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14126 /* port-E for HP out (front panel) */
14127 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14128 /* route front PCM to HP */
14129 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14130 /* port-F for mic-in (front panel) with vref */
14131 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14132 /* port-G for CLFE (rear panel) */
14133 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14134 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14135 /* port-H for side (rear panel) */
14136 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14137 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14139 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14140 /* route front mic to ADC1*/
14141 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14144 /* Unmute DAC0~3 & spdif out*/
14145 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14146 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14147 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14148 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14151 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14152 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14153 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14154 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14155 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14157 /* Unmute Stereo Mixer 15 */
14158 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14163 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14164 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14165 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14166 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14167 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14168 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14169 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14170 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14171 /* hp used DAC 3 (Front) */
14172 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14173 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14178 static struct hda_verb alc861_threestack_init_verbs[] = {
14180 * Unmute ADC0 and set the default input to mic-in
14182 /* port-A for surround (rear panel) */
14183 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14184 /* port-B for mic-in (rear panel) with vref */
14185 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14186 /* port-C for line-in (rear panel) */
14187 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14188 /* port-D for Front */
14189 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14190 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14191 /* port-E for HP out (front panel) */
14192 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14193 /* route front PCM to HP */
14194 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14195 /* port-F for mic-in (front panel) with vref */
14196 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14197 /* port-G for CLFE (rear panel) */
14198 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14199 /* port-H for side (rear panel) */
14200 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14202 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14203 /* route front mic to ADC1*/
14204 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14205 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14206 /* Unmute DAC0~3 & spdif out*/
14207 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14208 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14209 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14210 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14211 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14213 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14214 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14215 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14216 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14217 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14219 /* Unmute Stereo Mixer 15 */
14220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14225 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14226 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14227 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14228 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14230 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14233 /* hp used DAC 3 (Front) */
14234 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14235 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14239 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14241 * Unmute ADC0 and set the default input to mic-in
14243 /* port-A for surround (rear panel) */
14244 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14245 /* port-B for mic-in (rear panel) with vref */
14246 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14247 /* port-C for line-in (rear panel) */
14248 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14249 /* port-D for Front */
14250 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14251 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14252 /* port-E for HP out (front panel) */
14253 /* this has to be set to VREF80 */
14254 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14255 /* route front PCM to HP */
14256 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14257 /* port-F for mic-in (front panel) with vref */
14258 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14259 /* port-G for CLFE (rear panel) */
14260 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14261 /* port-H for side (rear panel) */
14262 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14264 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14265 /* route front mic to ADC1*/
14266 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14267 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14268 /* Unmute DAC0~3 & spdif out*/
14269 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14270 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14271 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14272 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14275 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14276 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14277 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14278 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14279 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14281 /* Unmute Stereo Mixer 15 */
14282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14287 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14289 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14290 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14291 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14293 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14295 /* hp used DAC 3 (Front) */
14296 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14301 static struct hda_verb alc861_asus_init_verbs[] = {
14303 * Unmute ADC0 and set the default input to mic-in
14305 /* port-A for surround (rear panel)
14306 * according to codec#0 this is the HP jack
14308 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14309 /* route front PCM to HP */
14310 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14311 /* port-B for mic-in (rear panel) with vref */
14312 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14313 /* port-C for line-in (rear panel) */
14314 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14315 /* port-D for Front */
14316 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14317 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14318 /* port-E for HP out (front panel) */
14319 /* this has to be set to VREF80 */
14320 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14321 /* route front PCM to HP */
14322 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14323 /* port-F for mic-in (front panel) with vref */
14324 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14325 /* port-G for CLFE (rear panel) */
14326 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14327 /* port-H for side (rear panel) */
14328 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14330 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14331 /* route front mic to ADC1*/
14332 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14333 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14334 /* Unmute DAC0~3 & spdif out*/
14335 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14336 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14337 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14338 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14340 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14341 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14342 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14343 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14344 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14346 /* Unmute Stereo Mixer 15 */
14347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14348 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14352 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14353 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14354 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14355 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14356 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14358 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14359 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14360 /* hp used DAC 3 (Front) */
14361 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14366 /* additional init verbs for ASUS laptops */
14367 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14368 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14369 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14374 * generic initialization of ADC, input mixers and output mixers
14376 static struct hda_verb alc861_auto_init_verbs[] = {
14378 * Unmute ADC0 and set the default input to mic-in
14380 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14381 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14383 /* Unmute DAC0~3 & spdif out*/
14384 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14385 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14386 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14387 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14388 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14390 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14391 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14392 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14393 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14394 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14396 /* Unmute Stereo Mixer 15 */
14397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14402 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14403 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14404 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14405 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14406 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14407 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14408 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14411 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14415 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14417 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14418 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14420 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14425 static struct hda_verb alc861_toshiba_init_verbs[] = {
14426 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14431 /* toggle speaker-output according to the hp-jack state */
14432 static void alc861_toshiba_automute(struct hda_codec *codec)
14434 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14436 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14437 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14438 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14439 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14442 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14445 if ((res >> 26) == ALC880_HP_EVENT)
14446 alc861_toshiba_automute(codec);
14449 /* pcm configuration: identical with ALC880 */
14450 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14451 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14452 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14453 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14456 #define ALC861_DIGOUT_NID 0x07
14458 static struct hda_channel_mode alc861_8ch_modes[1] = {
14462 static hda_nid_t alc861_dac_nids[4] = {
14463 /* front, surround, clfe, side */
14464 0x03, 0x06, 0x05, 0x04
14467 static hda_nid_t alc660_dac_nids[3] = {
14468 /* front, clfe, surround */
14472 static hda_nid_t alc861_adc_nids[1] = {
14477 static struct hda_input_mux alc861_capture_source = {
14481 { "Front Mic", 0x3 },
14488 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14490 struct alc_spec *spec = codec->spec;
14491 hda_nid_t mix, srcs[5];
14494 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14496 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14499 for (i = 0; i < num; i++) {
14501 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14502 if (type != AC_WID_AUD_OUT)
14504 for (j = 0; j < spec->multiout.num_dacs; j++)
14505 if (spec->multiout.dac_nids[j] == srcs[i])
14507 if (j >= spec->multiout.num_dacs)
14513 /* fill in the dac_nids table from the parsed pin configuration */
14514 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14515 const struct auto_pin_cfg *cfg)
14517 struct alc_spec *spec = codec->spec;
14519 hda_nid_t nid, dac;
14521 spec->multiout.dac_nids = spec->private_dac_nids;
14522 for (i = 0; i < cfg->line_outs; i++) {
14523 nid = cfg->line_out_pins[i];
14524 dac = alc861_look_for_dac(codec, nid);
14527 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14532 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14533 hda_nid_t nid, unsigned int chs)
14535 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14536 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14539 /* add playback controls from the parsed DAC table */
14540 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14541 const struct auto_pin_cfg *cfg)
14543 struct alc_spec *spec = codec->spec;
14544 static const char *chname[4] = {
14545 "Front", "Surround", NULL /*CLFE*/, "Side"
14550 if (cfg->line_outs == 1) {
14551 const char *pfx = NULL;
14554 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14557 nid = spec->multiout.dac_nids[0];
14558 return alc861_create_out_sw(codec, pfx, nid, 3);
14562 for (i = 0; i < cfg->line_outs; i++) {
14563 nid = spec->multiout.dac_nids[i];
14568 err = alc861_create_out_sw(codec, "Center", nid, 1);
14571 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14575 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14583 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14585 struct alc_spec *spec = codec->spec;
14592 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14593 nid = alc861_look_for_dac(codec, pin);
14595 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14598 spec->multiout.hp_nid = nid;
14604 /* create playback/capture controls for input pins */
14605 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14606 const struct auto_pin_cfg *cfg)
14608 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14611 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14613 int pin_type, hda_nid_t dac)
14615 hda_nid_t mix, srcs[5];
14618 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14620 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14622 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14624 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14627 for (i = 0; i < num; i++) {
14629 if (srcs[i] == dac || srcs[i] == 0x15)
14630 mute = AMP_IN_UNMUTE(i);
14632 mute = AMP_IN_MUTE(i);
14633 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14638 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14640 struct alc_spec *spec = codec->spec;
14643 for (i = 0; i < spec->autocfg.line_outs; i++) {
14644 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14645 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14647 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14648 spec->multiout.dac_nids[i]);
14652 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14654 struct alc_spec *spec = codec->spec;
14656 if (spec->autocfg.hp_outs)
14657 alc861_auto_set_output_and_unmute(codec,
14658 spec->autocfg.hp_pins[0],
14660 spec->multiout.hp_nid);
14661 if (spec->autocfg.speaker_outs)
14662 alc861_auto_set_output_and_unmute(codec,
14663 spec->autocfg.speaker_pins[0],
14665 spec->multiout.dac_nids[0]);
14668 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14670 struct alc_spec *spec = codec->spec;
14673 for (i = 0; i < AUTO_PIN_LAST; i++) {
14674 hda_nid_t nid = spec->autocfg.input_pins[i];
14675 if (nid >= 0x0c && nid <= 0x11)
14676 alc_set_input_pin(codec, nid, i);
14680 /* parse the BIOS configuration and set up the alc_spec */
14681 /* return 1 if successful, 0 if the proper config is not found,
14682 * or a negative error code
14684 static int alc861_parse_auto_config(struct hda_codec *codec)
14686 struct alc_spec *spec = codec->spec;
14688 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14690 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14694 if (!spec->autocfg.line_outs)
14695 return 0; /* can't find valid BIOS pin config */
14697 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14700 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14703 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14706 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14710 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14712 if (spec->autocfg.dig_outs)
14713 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14715 if (spec->kctls.list)
14716 add_mixer(spec, spec->kctls.list);
14718 add_verb(spec, alc861_auto_init_verbs);
14720 spec->num_mux_defs = 1;
14721 spec->input_mux = &spec->private_imux[0];
14723 spec->adc_nids = alc861_adc_nids;
14724 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14725 set_capture_mixer(codec);
14727 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14732 /* additional initialization for auto-configuration model */
14733 static void alc861_auto_init(struct hda_codec *codec)
14735 struct alc_spec *spec = codec->spec;
14736 alc861_auto_init_multi_out(codec);
14737 alc861_auto_init_hp_out(codec);
14738 alc861_auto_init_analog_input(codec);
14739 if (spec->unsol_event)
14740 alc_inithook(codec);
14743 #ifdef CONFIG_SND_HDA_POWER_SAVE
14744 static struct hda_amp_list alc861_loopbacks[] = {
14745 { 0x15, HDA_INPUT, 0 },
14746 { 0x15, HDA_INPUT, 1 },
14747 { 0x15, HDA_INPUT, 2 },
14748 { 0x15, HDA_INPUT, 3 },
14755 * configuration and preset
14757 static const char *alc861_models[ALC861_MODEL_LAST] = {
14758 [ALC861_3ST] = "3stack",
14759 [ALC660_3ST] = "3stack-660",
14760 [ALC861_3ST_DIG] = "3stack-dig",
14761 [ALC861_6ST_DIG] = "6stack-dig",
14762 [ALC861_UNIWILL_M31] = "uniwill-m31",
14763 [ALC861_TOSHIBA] = "toshiba",
14764 [ALC861_ASUS] = "asus",
14765 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14766 [ALC861_AUTO] = "auto",
14769 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14770 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14771 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14772 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14773 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14774 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14775 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14776 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14777 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14778 * Any other models that need this preset?
14780 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14781 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14782 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14783 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14784 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14785 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14786 /* FIXME: the below seems conflict */
14787 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14788 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14789 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14793 static struct alc_config_preset alc861_presets[] = {
14795 .mixers = { alc861_3ST_mixer },
14796 .init_verbs = { alc861_threestack_init_verbs },
14797 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14798 .dac_nids = alc861_dac_nids,
14799 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14800 .channel_mode = alc861_threestack_modes,
14802 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14803 .adc_nids = alc861_adc_nids,
14804 .input_mux = &alc861_capture_source,
14806 [ALC861_3ST_DIG] = {
14807 .mixers = { alc861_base_mixer },
14808 .init_verbs = { alc861_threestack_init_verbs },
14809 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14810 .dac_nids = alc861_dac_nids,
14811 .dig_out_nid = ALC861_DIGOUT_NID,
14812 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14813 .channel_mode = alc861_threestack_modes,
14815 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14816 .adc_nids = alc861_adc_nids,
14817 .input_mux = &alc861_capture_source,
14819 [ALC861_6ST_DIG] = {
14820 .mixers = { alc861_base_mixer },
14821 .init_verbs = { alc861_base_init_verbs },
14822 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14823 .dac_nids = alc861_dac_nids,
14824 .dig_out_nid = ALC861_DIGOUT_NID,
14825 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14826 .channel_mode = alc861_8ch_modes,
14827 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14828 .adc_nids = alc861_adc_nids,
14829 .input_mux = &alc861_capture_source,
14832 .mixers = { alc861_3ST_mixer },
14833 .init_verbs = { alc861_threestack_init_verbs },
14834 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14835 .dac_nids = alc660_dac_nids,
14836 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14837 .channel_mode = alc861_threestack_modes,
14839 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14840 .adc_nids = alc861_adc_nids,
14841 .input_mux = &alc861_capture_source,
14843 [ALC861_UNIWILL_M31] = {
14844 .mixers = { alc861_uniwill_m31_mixer },
14845 .init_verbs = { alc861_uniwill_m31_init_verbs },
14846 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14847 .dac_nids = alc861_dac_nids,
14848 .dig_out_nid = ALC861_DIGOUT_NID,
14849 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14850 .channel_mode = alc861_uniwill_m31_modes,
14852 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14853 .adc_nids = alc861_adc_nids,
14854 .input_mux = &alc861_capture_source,
14856 [ALC861_TOSHIBA] = {
14857 .mixers = { alc861_toshiba_mixer },
14858 .init_verbs = { alc861_base_init_verbs,
14859 alc861_toshiba_init_verbs },
14860 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14861 .dac_nids = alc861_dac_nids,
14862 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14863 .channel_mode = alc883_3ST_2ch_modes,
14864 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14865 .adc_nids = alc861_adc_nids,
14866 .input_mux = &alc861_capture_source,
14867 .unsol_event = alc861_toshiba_unsol_event,
14868 .init_hook = alc861_toshiba_automute,
14871 .mixers = { alc861_asus_mixer },
14872 .init_verbs = { alc861_asus_init_verbs },
14873 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14874 .dac_nids = alc861_dac_nids,
14875 .dig_out_nid = ALC861_DIGOUT_NID,
14876 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14877 .channel_mode = alc861_asus_modes,
14880 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14881 .adc_nids = alc861_adc_nids,
14882 .input_mux = &alc861_capture_source,
14884 [ALC861_ASUS_LAPTOP] = {
14885 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14886 .init_verbs = { alc861_asus_init_verbs,
14887 alc861_asus_laptop_init_verbs },
14888 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14889 .dac_nids = alc861_dac_nids,
14890 .dig_out_nid = ALC861_DIGOUT_NID,
14891 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14892 .channel_mode = alc883_3ST_2ch_modes,
14894 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14895 .adc_nids = alc861_adc_nids,
14896 .input_mux = &alc861_capture_source,
14900 /* Pin config fixes */
14902 PINFIX_FSC_AMILO_PI1505,
14905 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14906 { 0x0b, 0x0221101f }, /* HP */
14907 { 0x0f, 0x90170310 }, /* speaker */
14911 static const struct alc_fixup alc861_fixups[] = {
14912 [PINFIX_FSC_AMILO_PI1505] = {
14913 .pins = alc861_fsc_amilo_pi1505_pinfix
14917 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14918 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14922 static int patch_alc861(struct hda_codec *codec)
14924 struct alc_spec *spec;
14928 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14932 codec->spec = spec;
14934 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14938 if (board_config < 0) {
14939 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14941 board_config = ALC861_AUTO;
14944 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14946 if (board_config == ALC861_AUTO) {
14947 /* automatic parse from the BIOS config */
14948 err = alc861_parse_auto_config(codec);
14954 "hda_codec: Cannot set up configuration "
14955 "from BIOS. Using base mode...\n");
14956 board_config = ALC861_3ST_DIG;
14960 err = snd_hda_attach_beep_device(codec, 0x23);
14966 if (board_config != ALC861_AUTO)
14967 setup_preset(codec, &alc861_presets[board_config]);
14969 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14970 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14972 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14973 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14975 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14977 spec->vmaster_nid = 0x03;
14979 codec->patch_ops = alc_patch_ops;
14980 if (board_config == ALC861_AUTO)
14981 spec->init_hook = alc861_auto_init;
14982 #ifdef CONFIG_SND_HDA_POWER_SAVE
14983 if (!spec->loopback.amplist)
14984 spec->loopback.amplist = alc861_loopbacks;
14986 codec->proc_widget_hook = print_realtek_coef;
14992 * ALC861-VD support
14996 * In addition, an independent DAC
14998 #define ALC861VD_DIGOUT_NID 0x06
15000 static hda_nid_t alc861vd_dac_nids[4] = {
15001 /* front, surr, clfe, side surr */
15002 0x02, 0x03, 0x04, 0x05
15005 /* dac_nids for ALC660vd are in a different order - according to
15006 * Realtek's driver.
15007 * This should probably result in a different mixer for 6stack models
15008 * of ALC660vd codecs, but for now there is only 3stack mixer
15009 * - and it is the same as in 861vd.
15010 * adc_nids in ALC660vd are (is) the same as in 861vd
15012 static hda_nid_t alc660vd_dac_nids[3] = {
15013 /* front, rear, clfe, rear_surr */
15017 static hda_nid_t alc861vd_adc_nids[1] = {
15022 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15025 /* FIXME: should be a matrix-type input source selection */
15026 static struct hda_input_mux alc861vd_capture_source = {
15030 { "Front Mic", 0x1 },
15036 static struct hda_input_mux alc861vd_dallas_capture_source = {
15039 { "Ext Mic", 0x0 },
15040 { "Int Mic", 0x1 },
15044 static struct hda_input_mux alc861vd_hp_capture_source = {
15047 { "Front Mic", 0x0 },
15048 { "ATAPI Mic", 0x1 },
15055 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15062 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15063 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15064 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15065 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15066 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15073 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15074 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15075 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15076 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15077 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15081 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15082 { 6, alc861vd_6stack_ch6_init },
15083 { 8, alc861vd_6stack_ch8_init },
15086 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15088 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15089 .name = "Channel Mode",
15090 .info = alc_ch_mode_info,
15091 .get = alc_ch_mode_get,
15092 .put = alc_ch_mode_put,
15097 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15098 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15100 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15101 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15102 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15104 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15105 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15107 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15109 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15111 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15112 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15114 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15115 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15117 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15119 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15121 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15123 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15124 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15127 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15128 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15130 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15131 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15136 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15137 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 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_lenovo_mixer[] = {
15160 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15161 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15162 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15164 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15167 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15168 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15170 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15172 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15174 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15175 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15180 /* Pin assignment: Speaker=0x14, HP = 0x15,
15181 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15183 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15184 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15185 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15186 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15187 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15188 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15189 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15190 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15191 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15192 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15193 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15197 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15198 * Front Mic=0x18, ATAPI Mic = 0x19,
15200 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15201 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15203 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15204 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15206 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15207 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15208 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15214 * generic initialization of ADC, input mixers and output mixers
15216 static struct hda_verb alc861vd_volume_init_verbs[] = {
15218 * Unmute ADC0 and set the default input to mic-in
15220 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15221 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15223 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15224 * the analog-loopback mixer widget
15226 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15233 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15240 * Set up output mixers (0x02 - 0x05)
15242 /* set vol=0 to output mixers */
15243 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15244 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15245 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15246 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15248 /* set up input amps for analog loopback */
15249 /* Amp Indices: DAC = 0, mixer = 1 */
15250 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15252 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15254 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15256 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15263 * 3-stack pin configuration:
15264 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15266 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15268 * Set pin mode and muting
15270 /* set front pin widgets 0x14 for output */
15271 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15272 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15273 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15275 /* Mic (rear) pin: input vref at 80% */
15276 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15277 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15278 /* Front Mic pin: input vref at 80% */
15279 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15280 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15281 /* Line In pin: input */
15282 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15283 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15284 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15285 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15286 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15287 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15288 /* CD pin widget for input */
15289 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15295 * 6-stack pin configuration:
15297 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15299 * Set pin mode and muting
15301 /* set front pin widgets 0x14 for output */
15302 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15303 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15304 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15306 /* Rear Pin: output 1 (0x0d) */
15307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15310 /* CLFE Pin: output 2 (0x0e) */
15311 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15312 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15313 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15314 /* Side Pin: output 3 (0x0f) */
15315 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15316 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15317 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15319 /* Mic (rear) pin: input vref at 80% */
15320 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15321 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15322 /* Front Mic pin: input vref at 80% */
15323 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15324 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15325 /* Line In pin: input */
15326 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15327 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15328 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15329 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15330 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15331 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15332 /* CD pin widget for input */
15333 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15338 static struct hda_verb alc861vd_eapd_verbs[] = {
15339 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15343 static struct hda_verb alc660vd_eapd_verbs[] = {
15344 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15345 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15349 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15350 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15352 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15353 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15354 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15358 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15360 unsigned int present;
15361 unsigned char bits;
15363 present = snd_hda_jack_detect(codec, 0x18);
15364 bits = present ? HDA_AMP_MUTE : 0;
15366 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15367 HDA_AMP_MUTE, bits);
15370 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15372 struct alc_spec *spec = codec->spec;
15373 spec->autocfg.hp_pins[0] = 0x1b;
15374 spec->autocfg.speaker_pins[0] = 0x14;
15377 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15379 alc_automute_amp(codec);
15380 alc861vd_lenovo_mic_automute(codec);
15383 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15386 switch (res >> 26) {
15387 case ALC880_MIC_EVENT:
15388 alc861vd_lenovo_mic_automute(codec);
15391 alc_automute_amp_unsol_event(codec, res);
15396 static struct hda_verb alc861vd_dallas_verbs[] = {
15397 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15398 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15399 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15400 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15411 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15413 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15415 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15416 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15417 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15418 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15420 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15422 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15423 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15424 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15425 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15426 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15427 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15434 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15435 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15441 /* toggle speaker-output according to the hp-jack state */
15442 static void alc861vd_dallas_setup(struct hda_codec *codec)
15444 struct alc_spec *spec = codec->spec;
15446 spec->autocfg.hp_pins[0] = 0x15;
15447 spec->autocfg.speaker_pins[0] = 0x14;
15450 #ifdef CONFIG_SND_HDA_POWER_SAVE
15451 #define alc861vd_loopbacks alc880_loopbacks
15454 /* pcm configuration: identical with ALC880 */
15455 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15456 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15457 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15458 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15461 * configuration and preset
15463 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15464 [ALC660VD_3ST] = "3stack-660",
15465 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15466 [ALC660VD_ASUS_V1S] = "asus-v1s",
15467 [ALC861VD_3ST] = "3stack",
15468 [ALC861VD_3ST_DIG] = "3stack-digout",
15469 [ALC861VD_6ST_DIG] = "6stack-digout",
15470 [ALC861VD_LENOVO] = "lenovo",
15471 [ALC861VD_DALLAS] = "dallas",
15472 [ALC861VD_HP] = "hp",
15473 [ALC861VD_AUTO] = "auto",
15476 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15477 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15478 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15479 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15480 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15481 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15482 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15483 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15484 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15485 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15486 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15487 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15488 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15489 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15490 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15491 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15495 static struct alc_config_preset alc861vd_presets[] = {
15497 .mixers = { alc861vd_3st_mixer },
15498 .init_verbs = { alc861vd_volume_init_verbs,
15499 alc861vd_3stack_init_verbs },
15500 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15501 .dac_nids = alc660vd_dac_nids,
15502 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15503 .channel_mode = alc861vd_3stack_2ch_modes,
15504 .input_mux = &alc861vd_capture_source,
15506 [ALC660VD_3ST_DIG] = {
15507 .mixers = { alc861vd_3st_mixer },
15508 .init_verbs = { alc861vd_volume_init_verbs,
15509 alc861vd_3stack_init_verbs },
15510 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15511 .dac_nids = alc660vd_dac_nids,
15512 .dig_out_nid = ALC861VD_DIGOUT_NID,
15513 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15514 .channel_mode = alc861vd_3stack_2ch_modes,
15515 .input_mux = &alc861vd_capture_source,
15518 .mixers = { alc861vd_3st_mixer },
15519 .init_verbs = { alc861vd_volume_init_verbs,
15520 alc861vd_3stack_init_verbs },
15521 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15522 .dac_nids = alc861vd_dac_nids,
15523 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15524 .channel_mode = alc861vd_3stack_2ch_modes,
15525 .input_mux = &alc861vd_capture_source,
15527 [ALC861VD_3ST_DIG] = {
15528 .mixers = { alc861vd_3st_mixer },
15529 .init_verbs = { alc861vd_volume_init_verbs,
15530 alc861vd_3stack_init_verbs },
15531 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15532 .dac_nids = alc861vd_dac_nids,
15533 .dig_out_nid = ALC861VD_DIGOUT_NID,
15534 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15535 .channel_mode = alc861vd_3stack_2ch_modes,
15536 .input_mux = &alc861vd_capture_source,
15538 [ALC861VD_6ST_DIG] = {
15539 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15540 .init_verbs = { alc861vd_volume_init_verbs,
15541 alc861vd_6stack_init_verbs },
15542 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15543 .dac_nids = alc861vd_dac_nids,
15544 .dig_out_nid = ALC861VD_DIGOUT_NID,
15545 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15546 .channel_mode = alc861vd_6stack_modes,
15547 .input_mux = &alc861vd_capture_source,
15549 [ALC861VD_LENOVO] = {
15550 .mixers = { alc861vd_lenovo_mixer },
15551 .init_verbs = { alc861vd_volume_init_verbs,
15552 alc861vd_3stack_init_verbs,
15553 alc861vd_eapd_verbs,
15554 alc861vd_lenovo_unsol_verbs },
15555 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15556 .dac_nids = alc660vd_dac_nids,
15557 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15558 .channel_mode = alc861vd_3stack_2ch_modes,
15559 .input_mux = &alc861vd_capture_source,
15560 .unsol_event = alc861vd_lenovo_unsol_event,
15561 .setup = alc861vd_lenovo_setup,
15562 .init_hook = alc861vd_lenovo_init_hook,
15564 [ALC861VD_DALLAS] = {
15565 .mixers = { alc861vd_dallas_mixer },
15566 .init_verbs = { alc861vd_dallas_verbs },
15567 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15568 .dac_nids = alc861vd_dac_nids,
15569 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15570 .channel_mode = alc861vd_3stack_2ch_modes,
15571 .input_mux = &alc861vd_dallas_capture_source,
15572 .unsol_event = alc_automute_amp_unsol_event,
15573 .setup = alc861vd_dallas_setup,
15574 .init_hook = alc_automute_amp,
15577 .mixers = { alc861vd_hp_mixer },
15578 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15579 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15580 .dac_nids = alc861vd_dac_nids,
15581 .dig_out_nid = ALC861VD_DIGOUT_NID,
15582 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15583 .channel_mode = alc861vd_3stack_2ch_modes,
15584 .input_mux = &alc861vd_hp_capture_source,
15585 .unsol_event = alc_automute_amp_unsol_event,
15586 .setup = alc861vd_dallas_setup,
15587 .init_hook = alc_automute_amp,
15589 [ALC660VD_ASUS_V1S] = {
15590 .mixers = { alc861vd_lenovo_mixer },
15591 .init_verbs = { alc861vd_volume_init_verbs,
15592 alc861vd_3stack_init_verbs,
15593 alc861vd_eapd_verbs,
15594 alc861vd_lenovo_unsol_verbs },
15595 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15596 .dac_nids = alc660vd_dac_nids,
15597 .dig_out_nid = ALC861VD_DIGOUT_NID,
15598 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15599 .channel_mode = alc861vd_3stack_2ch_modes,
15600 .input_mux = &alc861vd_capture_source,
15601 .unsol_event = alc861vd_lenovo_unsol_event,
15602 .setup = alc861vd_lenovo_setup,
15603 .init_hook = alc861vd_lenovo_init_hook,
15608 * BIOS auto configuration
15610 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15611 const struct auto_pin_cfg *cfg)
15613 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15617 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15618 hda_nid_t nid, int pin_type, int dac_idx)
15620 alc_set_pin_output(codec, nid, pin_type);
15623 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15625 struct alc_spec *spec = codec->spec;
15628 for (i = 0; i <= HDA_SIDE; i++) {
15629 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15630 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15632 alc861vd_auto_set_output_and_unmute(codec, nid,
15638 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15640 struct alc_spec *spec = codec->spec;
15643 pin = spec->autocfg.hp_pins[0];
15644 if (pin) /* connect to front and use dac 0 */
15645 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15646 pin = spec->autocfg.speaker_pins[0];
15648 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15651 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15653 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15655 struct alc_spec *spec = codec->spec;
15658 for (i = 0; i < AUTO_PIN_LAST; i++) {
15659 hda_nid_t nid = spec->autocfg.input_pins[i];
15660 if (alc_is_input_pin(codec, nid)) {
15661 alc_set_input_pin(codec, nid, i);
15662 if (nid != ALC861VD_PIN_CD_NID &&
15663 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15664 snd_hda_codec_write(codec, nid, 0,
15665 AC_VERB_SET_AMP_GAIN_MUTE,
15671 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15673 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15674 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15676 /* add playback controls from the parsed DAC table */
15677 /* Based on ALC880 version. But ALC861VD has separate,
15678 * different NIDs for mute/unmute switch and volume control */
15679 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15680 const struct auto_pin_cfg *cfg)
15682 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15683 hda_nid_t nid_v, nid_s;
15686 for (i = 0; i < cfg->line_outs; i++) {
15687 if (!spec->multiout.dac_nids[i])
15689 nid_v = alc861vd_idx_to_mixer_vol(
15691 spec->multiout.dac_nids[i]));
15692 nid_s = alc861vd_idx_to_mixer_switch(
15694 spec->multiout.dac_nids[i]));
15698 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15700 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15704 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15706 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15710 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15712 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15716 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15718 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15724 if (cfg->line_outs == 1 &&
15725 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15732 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15733 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15737 if (cfg->line_outs == 1 &&
15738 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15740 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15741 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15750 /* add playback controls for speaker and HP outputs */
15751 /* Based on ALC880 version. But ALC861VD has separate,
15752 * different NIDs for mute/unmute switch and volume control */
15753 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15754 hda_nid_t pin, const char *pfx)
15756 hda_nid_t nid_v, nid_s;
15762 if (alc880_is_fixed_pin(pin)) {
15763 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15764 /* specify the DAC as the extra output */
15765 if (!spec->multiout.hp_nid)
15766 spec->multiout.hp_nid = nid_v;
15768 spec->multiout.extra_out_nid[0] = nid_v;
15769 /* control HP volume/switch on the output mixer amp */
15770 nid_v = alc861vd_idx_to_mixer_vol(
15771 alc880_fixed_pin_idx(pin));
15772 nid_s = alc861vd_idx_to_mixer_switch(
15773 alc880_fixed_pin_idx(pin));
15775 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15776 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15779 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15780 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15783 } else if (alc880_is_multi_pin(pin)) {
15784 /* set manual connection */
15785 /* we have only a switch on HP-out PIN */
15786 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15787 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15794 /* parse the BIOS configuration and set up the alc_spec
15795 * return 1 if successful, 0 if the proper config is not found,
15796 * or a negative error code
15797 * Based on ALC880 version - had to change it to override
15798 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15799 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15801 struct alc_spec *spec = codec->spec;
15803 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15805 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15809 if (!spec->autocfg.line_outs)
15810 return 0; /* can't find valid BIOS pin config */
15812 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15815 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15818 err = alc861vd_auto_create_extra_out(spec,
15819 spec->autocfg.speaker_pins[0],
15823 err = alc861vd_auto_create_extra_out(spec,
15824 spec->autocfg.hp_pins[0],
15828 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15832 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15834 if (spec->autocfg.dig_outs)
15835 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15837 if (spec->kctls.list)
15838 add_mixer(spec, spec->kctls.list);
15840 add_verb(spec, alc861vd_volume_init_verbs);
15842 spec->num_mux_defs = 1;
15843 spec->input_mux = &spec->private_imux[0];
15845 err = alc_auto_add_mic_boost(codec);
15849 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15854 /* additional initialization for auto-configuration model */
15855 static void alc861vd_auto_init(struct hda_codec *codec)
15857 struct alc_spec *spec = codec->spec;
15858 alc861vd_auto_init_multi_out(codec);
15859 alc861vd_auto_init_hp_out(codec);
15860 alc861vd_auto_init_analog_input(codec);
15861 alc861vd_auto_init_input_src(codec);
15862 if (spec->unsol_event)
15863 alc_inithook(codec);
15867 ALC660VD_FIX_ASUS_GPIO1
15871 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15872 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15873 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15874 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15878 static const struct alc_fixup alc861vd_fixups[] = {
15879 [ALC660VD_FIX_ASUS_GPIO1] = {
15880 .verbs = alc660vd_fix_asus_gpio1_verbs,
15884 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15885 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15889 static int patch_alc861vd(struct hda_codec *codec)
15891 struct alc_spec *spec;
15892 int err, board_config;
15894 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15898 codec->spec = spec;
15900 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15904 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15905 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15907 board_config = ALC861VD_AUTO;
15910 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15912 if (board_config == ALC861VD_AUTO) {
15913 /* automatic parse from the BIOS config */
15914 err = alc861vd_parse_auto_config(codec);
15920 "hda_codec: Cannot set up configuration "
15921 "from BIOS. Using base mode...\n");
15922 board_config = ALC861VD_3ST;
15926 err = snd_hda_attach_beep_device(codec, 0x23);
15932 if (board_config != ALC861VD_AUTO)
15933 setup_preset(codec, &alc861vd_presets[board_config]);
15935 if (codec->vendor_id == 0x10ec0660) {
15936 /* always turn on EAPD */
15937 add_verb(spec, alc660vd_eapd_verbs);
15940 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15941 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15943 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15944 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15946 if (!spec->adc_nids) {
15947 spec->adc_nids = alc861vd_adc_nids;
15948 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15950 if (!spec->capsrc_nids)
15951 spec->capsrc_nids = alc861vd_capsrc_nids;
15953 set_capture_mixer(codec);
15954 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15956 spec->vmaster_nid = 0x02;
15958 codec->patch_ops = alc_patch_ops;
15960 if (board_config == ALC861VD_AUTO)
15961 spec->init_hook = alc861vd_auto_init;
15962 #ifdef CONFIG_SND_HDA_POWER_SAVE
15963 if (!spec->loopback.amplist)
15964 spec->loopback.amplist = alc861vd_loopbacks;
15966 codec->proc_widget_hook = print_realtek_coef;
15974 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15975 * configuration. Each pin widget can choose any input DACs and a mixer.
15976 * Each ADC is connected from a mixer of all inputs. This makes possible
15977 * 6-channel independent captures.
15979 * In addition, an independent DAC for the multi-playback (not used in this
15982 #define ALC662_DIGOUT_NID 0x06
15983 #define ALC662_DIGIN_NID 0x0a
15985 static hda_nid_t alc662_dac_nids[4] = {
15986 /* front, rear, clfe, rear_surr */
15990 static hda_nid_t alc272_dac_nids[2] = {
15994 static hda_nid_t alc662_adc_nids[2] = {
15999 static hda_nid_t alc272_adc_nids[1] = {
16004 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16005 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16009 /* FIXME: should be a matrix-type input source selection */
16010 static struct hda_input_mux alc662_capture_source = {
16014 { "Front Mic", 0x1 },
16020 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16028 static struct hda_input_mux alc663_capture_source = {
16032 { "Front Mic", 0x1 },
16037 #if 0 /* set to 1 for testing other input sources below */
16038 static struct hda_input_mux alc272_nc10_capture_source = {
16041 { "Autoselect Mic", 0x0 },
16042 { "Internal Mic", 0x1 },
16043 { "In-0x02", 0x2 },
16044 { "In-0x03", 0x3 },
16045 { "In-0x04", 0x4 },
16046 { "In-0x05", 0x5 },
16047 { "In-0x06", 0x6 },
16048 { "In-0x07", 0x7 },
16049 { "In-0x08", 0x8 },
16050 { "In-0x09", 0x9 },
16051 { "In-0x0a", 0x0a },
16052 { "In-0x0b", 0x0b },
16053 { "In-0x0c", 0x0c },
16054 { "In-0x0d", 0x0d },
16055 { "In-0x0e", 0x0e },
16056 { "In-0x0f", 0x0f },
16064 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16071 static struct hda_verb alc662_3ST_ch2_init[] = {
16072 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16073 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16074 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16075 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16082 static struct hda_verb alc662_3ST_ch6_init[] = {
16083 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16084 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16085 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16086 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16087 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16088 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16092 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16093 { 2, alc662_3ST_ch2_init },
16094 { 6, alc662_3ST_ch6_init },
16100 static struct hda_verb alc662_sixstack_ch6_init[] = {
16101 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16102 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16103 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16110 static struct hda_verb alc662_sixstack_ch8_init[] = {
16111 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16112 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16113 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16117 static struct hda_channel_mode alc662_5stack_modes[2] = {
16118 { 2, alc662_sixstack_ch6_init },
16119 { 6, alc662_sixstack_ch8_init },
16122 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16123 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16126 static struct snd_kcontrol_new alc662_base_mixer[] = {
16127 /* output mixer control */
16128 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16129 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16131 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16132 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16133 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16134 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16135 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16136 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16138 /*Input mixer control */
16139 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16140 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16141 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16142 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16143 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16144 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16150 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16151 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16152 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16153 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16159 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16160 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16161 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16165 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16166 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16167 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16168 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16169 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16170 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16171 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16172 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16173 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16181 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16182 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16186 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16187 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16188 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16189 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16190 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16192 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16193 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16195 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16199 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16200 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16201 ALC262_HIPPO_MASTER_SWITCH,
16203 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16204 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16205 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16207 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16208 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16209 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16213 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16214 ALC262_HIPPO_MASTER_SWITCH,
16215 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16216 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16217 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16218 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16219 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16220 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16221 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16222 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16223 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16227 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16228 .ops = &snd_hda_bind_vol,
16230 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16231 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16236 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16237 .ops = &snd_hda_bind_sw,
16239 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16240 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16245 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16246 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16247 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16248 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16249 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16253 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16254 .ops = &snd_hda_bind_sw,
16256 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16257 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16258 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16263 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16264 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16265 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16268 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16269 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16274 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16275 .ops = &snd_hda_bind_sw,
16277 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16278 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16279 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16284 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16285 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16286 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16289 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16290 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16294 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16295 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16298 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16299 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16300 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16301 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16305 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16306 .ops = &snd_hda_bind_vol,
16308 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16309 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16314 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16315 .ops = &snd_hda_bind_sw,
16317 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16318 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16323 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16324 HDA_BIND_VOL("Master Playback Volume",
16325 &alc663_asus_two_bind_master_vol),
16326 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16327 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16329 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16330 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16334 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16335 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16336 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16337 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16338 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16339 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16340 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16344 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16345 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16346 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16347 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16348 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16353 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16354 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16358 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16359 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16360 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16361 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16363 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16364 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16365 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16366 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16367 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16368 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16372 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16373 .ops = &snd_hda_bind_sw,
16375 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16376 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16377 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16378 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16379 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16384 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16385 .ops = &snd_hda_bind_sw,
16387 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16388 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16393 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16394 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16395 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16396 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16397 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16398 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16399 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16400 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16401 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16402 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16406 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16407 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16408 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16409 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16410 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16411 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16412 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16413 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16418 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16420 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16421 .name = "Channel Mode",
16422 .info = alc_ch_mode_info,
16423 .get = alc_ch_mode_get,
16424 .put = alc_ch_mode_put,
16429 static struct hda_verb alc662_init_verbs[] = {
16430 /* ADC: mute amp left and right */
16431 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16432 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16433 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16445 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16446 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16448 /* Front Pin: output 0 (0x0c) */
16449 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16450 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16452 /* Rear Pin: output 1 (0x0d) */
16453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16454 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16456 /* CLFE Pin: output 2 (0x0e) */
16457 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16460 /* Mic (rear) pin: input vref at 80% */
16461 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16462 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16463 /* Front Mic pin: input vref at 80% */
16464 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16465 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16466 /* Line In pin: input */
16467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16469 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16470 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16471 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16472 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16473 /* CD pin widget for input */
16474 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16476 /* FIXME: use matrix-type input source selection */
16477 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16479 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16480 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16482 /* always trun on EAPD */
16483 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16484 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16489 static struct hda_verb alc662_sue_init_verbs[] = {
16490 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16491 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16495 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16496 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16497 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16501 /* Set Unsolicited Event*/
16502 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16503 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16504 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16509 * generic initialization of ADC, input mixers and output mixers
16511 static struct hda_verb alc662_auto_init_verbs[] = {
16513 * Unmute ADC and set the default input to mic-in
16515 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16516 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16518 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16520 * Note: PASD motherboards uses the Line In 2 as the input for front
16521 * panel mic (mic 2)
16523 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16531 * Set up output mixers (0x0c - 0x0f)
16533 /* set vol=0 to output mixers */
16534 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16535 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16536 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16538 /* set up input amps for analog loopback */
16539 /* Amp Indices: DAC = 0, mixer = 1 */
16540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16542 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16544 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16548 /* FIXME: use matrix-type input source selection */
16549 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16556 /* additional verbs for ALC663 */
16557 static struct hda_verb alc663_auto_init_verbs[] = {
16558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16559 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16563 static struct hda_verb alc663_m51va_init_verbs[] = {
16564 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16565 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16566 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16567 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16568 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16571 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16572 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16576 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16577 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16578 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16579 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16580 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16582 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16583 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16587 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16588 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16589 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16590 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16591 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16592 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16594 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16595 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16599 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16601 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16602 {0x15, 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 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16610 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16611 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16612 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16613 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16614 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16617 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16620 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16621 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16622 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16626 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16628 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16629 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16630 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16633 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16634 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16636 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16637 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16638 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16642 static struct hda_verb alc663_g71v_init_verbs[] = {
16643 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16644 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16645 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16647 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16648 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16649 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16651 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16652 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16653 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16657 static struct hda_verb alc663_g50v_init_verbs[] = {
16658 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16659 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16660 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16662 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16663 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16667 static struct hda_verb alc662_ecs_init_verbs[] = {
16668 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16670 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16671 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16675 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16676 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16677 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16678 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16679 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16680 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16681 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16682 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16683 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
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 alc272_dell_init_verbs[] = {
16691 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16692 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16693 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16694 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16695 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16696 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16697 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16698 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16699 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16700 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16701 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16705 static struct hda_verb alc663_mode7_init_verbs[] = {
16706 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16707 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16708 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16709 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16710 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16711 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16712 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16713 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16714 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16715 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16718 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16719 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16720 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16724 static struct hda_verb alc663_mode8_init_verbs[] = {
16725 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16726 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16727 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16728 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16729 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16730 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16731 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16732 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16733 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16734 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16735 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16738 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16739 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16740 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16744 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16745 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16746 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16750 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16751 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16752 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16756 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16758 unsigned int present;
16759 unsigned char bits;
16761 present = snd_hda_jack_detect(codec, 0x14);
16762 bits = present ? HDA_AMP_MUTE : 0;
16764 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16765 HDA_AMP_MUTE, bits);
16768 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16770 unsigned int present;
16771 unsigned char bits;
16773 present = snd_hda_jack_detect(codec, 0x1b);
16774 bits = present ? HDA_AMP_MUTE : 0;
16776 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16777 HDA_AMP_MUTE, bits);
16778 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16779 HDA_AMP_MUTE, bits);
16782 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16785 if ((res >> 26) == ALC880_HP_EVENT)
16786 alc662_lenovo_101e_all_automute(codec);
16787 if ((res >> 26) == ALC880_FRONT_EVENT)
16788 alc662_lenovo_101e_ispeaker_automute(codec);
16791 /* unsolicited event for HP jack sensing */
16792 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16795 if ((res >> 26) == ALC880_MIC_EVENT)
16796 alc_mic_automute(codec);
16798 alc262_hippo_unsol_event(codec, res);
16801 static void alc662_eeepc_setup(struct hda_codec *codec)
16803 struct alc_spec *spec = codec->spec;
16805 alc262_hippo1_setup(codec);
16806 spec->ext_mic.pin = 0x18;
16807 spec->ext_mic.mux_idx = 0;
16808 spec->int_mic.pin = 0x19;
16809 spec->int_mic.mux_idx = 1;
16810 spec->auto_mic = 1;
16813 static void alc662_eeepc_inithook(struct hda_codec *codec)
16815 alc262_hippo_automute(codec);
16816 alc_mic_automute(codec);
16819 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16821 struct alc_spec *spec = codec->spec;
16823 spec->autocfg.hp_pins[0] = 0x14;
16824 spec->autocfg.speaker_pins[0] = 0x1b;
16827 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16829 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16831 unsigned int present;
16832 unsigned char bits;
16834 present = snd_hda_jack_detect(codec, 0x21);
16835 bits = present ? HDA_AMP_MUTE : 0;
16836 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16837 AMP_IN_MUTE(0), bits);
16838 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16839 AMP_IN_MUTE(0), bits);
16842 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16844 unsigned int present;
16845 unsigned char bits;
16847 present = snd_hda_jack_detect(codec, 0x21);
16848 bits = present ? HDA_AMP_MUTE : 0;
16849 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16850 AMP_IN_MUTE(0), bits);
16851 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16852 AMP_IN_MUTE(0), bits);
16853 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16854 AMP_IN_MUTE(0), bits);
16855 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16856 AMP_IN_MUTE(0), bits);
16859 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16861 unsigned int present;
16862 unsigned char bits;
16864 present = snd_hda_jack_detect(codec, 0x15);
16865 bits = present ? HDA_AMP_MUTE : 0;
16866 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16867 AMP_IN_MUTE(0), bits);
16868 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16869 AMP_IN_MUTE(0), bits);
16870 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16871 AMP_IN_MUTE(0), bits);
16872 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16873 AMP_IN_MUTE(0), bits);
16876 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16878 unsigned int present;
16879 unsigned char bits;
16881 present = snd_hda_jack_detect(codec, 0x1b);
16882 bits = present ? 0 : PIN_OUT;
16883 snd_hda_codec_write(codec, 0x14, 0,
16884 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16887 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16889 unsigned int present1, present2;
16891 present1 = snd_hda_jack_detect(codec, 0x21);
16892 present2 = snd_hda_jack_detect(codec, 0x15);
16894 if (present1 || present2) {
16895 snd_hda_codec_write_cache(codec, 0x14, 0,
16896 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16898 snd_hda_codec_write_cache(codec, 0x14, 0,
16899 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16903 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16905 unsigned int present1, present2;
16907 present1 = snd_hda_jack_detect(codec, 0x1b);
16908 present2 = snd_hda_jack_detect(codec, 0x15);
16910 if (present1 || present2) {
16911 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16912 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16913 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16914 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16916 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16917 AMP_IN_MUTE(0), 0);
16918 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16919 AMP_IN_MUTE(0), 0);
16923 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16925 unsigned int present1, present2;
16927 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16928 AC_VERB_GET_PIN_SENSE, 0)
16929 & AC_PINSENSE_PRESENCE;
16930 present2 = snd_hda_codec_read(codec, 0x21, 0,
16931 AC_VERB_GET_PIN_SENSE, 0)
16932 & AC_PINSENSE_PRESENCE;
16934 if (present1 || present2) {
16935 snd_hda_codec_write_cache(codec, 0x14, 0,
16936 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16937 snd_hda_codec_write_cache(codec, 0x17, 0,
16938 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16940 snd_hda_codec_write_cache(codec, 0x14, 0,
16941 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16942 snd_hda_codec_write_cache(codec, 0x17, 0,
16943 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16947 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16949 unsigned int present1, present2;
16951 present1 = snd_hda_codec_read(codec, 0x21, 0,
16952 AC_VERB_GET_PIN_SENSE, 0)
16953 & AC_PINSENSE_PRESENCE;
16954 present2 = snd_hda_codec_read(codec, 0x15, 0,
16955 AC_VERB_GET_PIN_SENSE, 0)
16956 & AC_PINSENSE_PRESENCE;
16958 if (present1 || present2) {
16959 snd_hda_codec_write_cache(codec, 0x14, 0,
16960 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16961 snd_hda_codec_write_cache(codec, 0x17, 0,
16962 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16964 snd_hda_codec_write_cache(codec, 0x14, 0,
16965 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16966 snd_hda_codec_write_cache(codec, 0x17, 0,
16967 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16971 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16974 switch (res >> 26) {
16975 case ALC880_HP_EVENT:
16976 alc663_m51va_speaker_automute(codec);
16978 case ALC880_MIC_EVENT:
16979 alc_mic_automute(codec);
16984 static void alc663_m51va_setup(struct hda_codec *codec)
16986 struct alc_spec *spec = codec->spec;
16987 spec->ext_mic.pin = 0x18;
16988 spec->ext_mic.mux_idx = 0;
16989 spec->int_mic.pin = 0x12;
16990 spec->int_mic.mux_idx = 9;
16991 spec->auto_mic = 1;
16994 static void alc663_m51va_inithook(struct hda_codec *codec)
16996 alc663_m51va_speaker_automute(codec);
16997 alc_mic_automute(codec);
17000 /* ***************** Mode1 ******************************/
17001 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17003 static void alc663_mode1_setup(struct hda_codec *codec)
17005 struct alc_spec *spec = codec->spec;
17006 spec->ext_mic.pin = 0x18;
17007 spec->ext_mic.mux_idx = 0;
17008 spec->int_mic.pin = 0x19;
17009 spec->int_mic.mux_idx = 1;
17010 spec->auto_mic = 1;
17013 #define alc663_mode1_inithook alc663_m51va_inithook
17015 /* ***************** Mode2 ******************************/
17016 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17019 switch (res >> 26) {
17020 case ALC880_HP_EVENT:
17021 alc662_f5z_speaker_automute(codec);
17023 case ALC880_MIC_EVENT:
17024 alc_mic_automute(codec);
17029 #define alc662_mode2_setup alc663_mode1_setup
17031 static void alc662_mode2_inithook(struct hda_codec *codec)
17033 alc662_f5z_speaker_automute(codec);
17034 alc_mic_automute(codec);
17036 /* ***************** Mode3 ******************************/
17037 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17040 switch (res >> 26) {
17041 case ALC880_HP_EVENT:
17042 alc663_two_hp_m1_speaker_automute(codec);
17044 case ALC880_MIC_EVENT:
17045 alc_mic_automute(codec);
17050 #define alc663_mode3_setup alc663_mode1_setup
17052 static void alc663_mode3_inithook(struct hda_codec *codec)
17054 alc663_two_hp_m1_speaker_automute(codec);
17055 alc_mic_automute(codec);
17057 /* ***************** Mode4 ******************************/
17058 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17061 switch (res >> 26) {
17062 case ALC880_HP_EVENT:
17063 alc663_21jd_two_speaker_automute(codec);
17065 case ALC880_MIC_EVENT:
17066 alc_mic_automute(codec);
17071 #define alc663_mode4_setup alc663_mode1_setup
17073 static void alc663_mode4_inithook(struct hda_codec *codec)
17075 alc663_21jd_two_speaker_automute(codec);
17076 alc_mic_automute(codec);
17078 /* ***************** Mode5 ******************************/
17079 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17082 switch (res >> 26) {
17083 case ALC880_HP_EVENT:
17084 alc663_15jd_two_speaker_automute(codec);
17086 case ALC880_MIC_EVENT:
17087 alc_mic_automute(codec);
17092 #define alc663_mode5_setup alc663_mode1_setup
17094 static void alc663_mode5_inithook(struct hda_codec *codec)
17096 alc663_15jd_two_speaker_automute(codec);
17097 alc_mic_automute(codec);
17099 /* ***************** Mode6 ******************************/
17100 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17103 switch (res >> 26) {
17104 case ALC880_HP_EVENT:
17105 alc663_two_hp_m2_speaker_automute(codec);
17107 case ALC880_MIC_EVENT:
17108 alc_mic_automute(codec);
17113 #define alc663_mode6_setup alc663_mode1_setup
17115 static void alc663_mode6_inithook(struct hda_codec *codec)
17117 alc663_two_hp_m2_speaker_automute(codec);
17118 alc_mic_automute(codec);
17121 /* ***************** Mode7 ******************************/
17122 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17125 switch (res >> 26) {
17126 case ALC880_HP_EVENT:
17127 alc663_two_hp_m7_speaker_automute(codec);
17129 case ALC880_MIC_EVENT:
17130 alc_mic_automute(codec);
17135 #define alc663_mode7_setup alc663_mode1_setup
17137 static void alc663_mode7_inithook(struct hda_codec *codec)
17139 alc663_two_hp_m7_speaker_automute(codec);
17140 alc_mic_automute(codec);
17143 /* ***************** Mode8 ******************************/
17144 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17147 switch (res >> 26) {
17148 case ALC880_HP_EVENT:
17149 alc663_two_hp_m8_speaker_automute(codec);
17151 case ALC880_MIC_EVENT:
17152 alc_mic_automute(codec);
17157 #define alc663_mode8_setup alc663_m51va_setup
17159 static void alc663_mode8_inithook(struct hda_codec *codec)
17161 alc663_two_hp_m8_speaker_automute(codec);
17162 alc_mic_automute(codec);
17165 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17167 unsigned int present;
17168 unsigned char bits;
17170 present = snd_hda_jack_detect(codec, 0x21);
17171 bits = present ? HDA_AMP_MUTE : 0;
17172 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17173 HDA_AMP_MUTE, bits);
17174 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17175 HDA_AMP_MUTE, bits);
17178 static void alc663_g71v_front_automute(struct hda_codec *codec)
17180 unsigned int present;
17181 unsigned char bits;
17183 present = snd_hda_jack_detect(codec, 0x15);
17184 bits = present ? HDA_AMP_MUTE : 0;
17185 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17186 HDA_AMP_MUTE, bits);
17189 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17192 switch (res >> 26) {
17193 case ALC880_HP_EVENT:
17194 alc663_g71v_hp_automute(codec);
17196 case ALC880_FRONT_EVENT:
17197 alc663_g71v_front_automute(codec);
17199 case ALC880_MIC_EVENT:
17200 alc_mic_automute(codec);
17205 #define alc663_g71v_setup alc663_m51va_setup
17207 static void alc663_g71v_inithook(struct hda_codec *codec)
17209 alc663_g71v_front_automute(codec);
17210 alc663_g71v_hp_automute(codec);
17211 alc_mic_automute(codec);
17214 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17217 switch (res >> 26) {
17218 case ALC880_HP_EVENT:
17219 alc663_m51va_speaker_automute(codec);
17221 case ALC880_MIC_EVENT:
17222 alc_mic_automute(codec);
17227 #define alc663_g50v_setup alc663_m51va_setup
17229 static void alc663_g50v_inithook(struct hda_codec *codec)
17231 alc663_m51va_speaker_automute(codec);
17232 alc_mic_automute(codec);
17235 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17236 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17237 ALC262_HIPPO_MASTER_SWITCH,
17239 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17240 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17241 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17243 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17244 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17245 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17249 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17250 /* Master Playback automatically created from Speaker and Headphone */
17251 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17252 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17254 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17256 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17257 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17258 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17260 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17261 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17262 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17266 #ifdef CONFIG_SND_HDA_POWER_SAVE
17267 #define alc662_loopbacks alc880_loopbacks
17271 /* pcm configuration: identical with ALC880 */
17272 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17273 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17274 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17275 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17278 * configuration and preset
17280 static const char *alc662_models[ALC662_MODEL_LAST] = {
17281 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17282 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17283 [ALC662_3ST_6ch] = "3stack-6ch",
17284 [ALC662_5ST_DIG] = "6stack-dig",
17285 [ALC662_LENOVO_101E] = "lenovo-101e",
17286 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17287 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17288 [ALC662_ECS] = "ecs",
17289 [ALC663_ASUS_M51VA] = "m51va",
17290 [ALC663_ASUS_G71V] = "g71v",
17291 [ALC663_ASUS_H13] = "h13",
17292 [ALC663_ASUS_G50V] = "g50v",
17293 [ALC663_ASUS_MODE1] = "asus-mode1",
17294 [ALC662_ASUS_MODE2] = "asus-mode2",
17295 [ALC663_ASUS_MODE3] = "asus-mode3",
17296 [ALC663_ASUS_MODE4] = "asus-mode4",
17297 [ALC663_ASUS_MODE5] = "asus-mode5",
17298 [ALC663_ASUS_MODE6] = "asus-mode6",
17299 [ALC663_ASUS_MODE7] = "asus-mode7",
17300 [ALC663_ASUS_MODE8] = "asus-mode8",
17301 [ALC272_DELL] = "dell",
17302 [ALC272_DELL_ZM1] = "dell-zm1",
17303 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17304 [ALC662_AUTO] = "auto",
17307 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17308 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17309 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17310 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17311 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17312 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17313 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17314 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17315 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17316 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17317 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17318 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17319 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17320 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17321 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17322 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17323 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17324 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17325 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17326 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17327 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17328 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17329 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17330 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17331 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17332 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17333 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17334 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17335 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17336 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17337 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17338 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17339 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17340 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17341 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17342 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17343 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17344 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17345 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17346 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17347 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17348 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17349 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17350 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17351 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17352 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17353 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17354 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17355 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17356 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17357 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17358 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17359 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17360 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17361 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17362 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17363 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17364 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17365 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17366 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17367 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17368 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17369 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17370 ALC662_3ST_6ch_DIG),
17371 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17372 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17373 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17374 ALC662_3ST_6ch_DIG),
17375 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17376 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17377 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17378 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17379 ALC662_3ST_6ch_DIG),
17380 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17382 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17386 static struct alc_config_preset alc662_presets[] = {
17387 [ALC662_3ST_2ch_DIG] = {
17388 .mixers = { alc662_3ST_2ch_mixer },
17389 .init_verbs = { alc662_init_verbs },
17390 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17391 .dac_nids = alc662_dac_nids,
17392 .dig_out_nid = ALC662_DIGOUT_NID,
17393 .dig_in_nid = ALC662_DIGIN_NID,
17394 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17395 .channel_mode = alc662_3ST_2ch_modes,
17396 .input_mux = &alc662_capture_source,
17398 [ALC662_3ST_6ch_DIG] = {
17399 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17400 .init_verbs = { alc662_init_verbs },
17401 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17402 .dac_nids = alc662_dac_nids,
17403 .dig_out_nid = ALC662_DIGOUT_NID,
17404 .dig_in_nid = ALC662_DIGIN_NID,
17405 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17406 .channel_mode = alc662_3ST_6ch_modes,
17408 .input_mux = &alc662_capture_source,
17410 [ALC662_3ST_6ch] = {
17411 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17412 .init_verbs = { alc662_init_verbs },
17413 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17414 .dac_nids = alc662_dac_nids,
17415 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17416 .channel_mode = alc662_3ST_6ch_modes,
17418 .input_mux = &alc662_capture_source,
17420 [ALC662_5ST_DIG] = {
17421 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17422 .init_verbs = { alc662_init_verbs },
17423 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17424 .dac_nids = alc662_dac_nids,
17425 .dig_out_nid = ALC662_DIGOUT_NID,
17426 .dig_in_nid = ALC662_DIGIN_NID,
17427 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17428 .channel_mode = alc662_5stack_modes,
17429 .input_mux = &alc662_capture_source,
17431 [ALC662_LENOVO_101E] = {
17432 .mixers = { alc662_lenovo_101e_mixer },
17433 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17434 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17435 .dac_nids = alc662_dac_nids,
17436 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17437 .channel_mode = alc662_3ST_2ch_modes,
17438 .input_mux = &alc662_lenovo_101e_capture_source,
17439 .unsol_event = alc662_lenovo_101e_unsol_event,
17440 .init_hook = alc662_lenovo_101e_all_automute,
17442 [ALC662_ASUS_EEEPC_P701] = {
17443 .mixers = { alc662_eeepc_p701_mixer },
17444 .init_verbs = { alc662_init_verbs,
17445 alc662_eeepc_sue_init_verbs },
17446 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17447 .dac_nids = alc662_dac_nids,
17448 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17449 .channel_mode = alc662_3ST_2ch_modes,
17450 .unsol_event = alc662_eeepc_unsol_event,
17451 .setup = alc662_eeepc_setup,
17452 .init_hook = alc662_eeepc_inithook,
17454 [ALC662_ASUS_EEEPC_EP20] = {
17455 .mixers = { alc662_eeepc_ep20_mixer,
17456 alc662_chmode_mixer },
17457 .init_verbs = { alc662_init_verbs,
17458 alc662_eeepc_ep20_sue_init_verbs },
17459 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17460 .dac_nids = alc662_dac_nids,
17461 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17462 .channel_mode = alc662_3ST_6ch_modes,
17463 .input_mux = &alc662_lenovo_101e_capture_source,
17464 .unsol_event = alc662_eeepc_unsol_event,
17465 .setup = alc662_eeepc_ep20_setup,
17466 .init_hook = alc662_eeepc_ep20_inithook,
17469 .mixers = { alc662_ecs_mixer },
17470 .init_verbs = { alc662_init_verbs,
17471 alc662_ecs_init_verbs },
17472 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17473 .dac_nids = alc662_dac_nids,
17474 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17475 .channel_mode = alc662_3ST_2ch_modes,
17476 .unsol_event = alc662_eeepc_unsol_event,
17477 .setup = alc662_eeepc_setup,
17478 .init_hook = alc662_eeepc_inithook,
17480 [ALC663_ASUS_M51VA] = {
17481 .mixers = { alc663_m51va_mixer },
17482 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17483 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17484 .dac_nids = alc662_dac_nids,
17485 .dig_out_nid = ALC662_DIGOUT_NID,
17486 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17487 .channel_mode = alc662_3ST_2ch_modes,
17488 .unsol_event = alc663_m51va_unsol_event,
17489 .setup = alc663_m51va_setup,
17490 .init_hook = alc663_m51va_inithook,
17492 [ALC663_ASUS_G71V] = {
17493 .mixers = { alc663_g71v_mixer },
17494 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17495 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17496 .dac_nids = alc662_dac_nids,
17497 .dig_out_nid = ALC662_DIGOUT_NID,
17498 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17499 .channel_mode = alc662_3ST_2ch_modes,
17500 .unsol_event = alc663_g71v_unsol_event,
17501 .setup = alc663_g71v_setup,
17502 .init_hook = alc663_g71v_inithook,
17504 [ALC663_ASUS_H13] = {
17505 .mixers = { alc663_m51va_mixer },
17506 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17507 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17508 .dac_nids = alc662_dac_nids,
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 .init_hook = alc663_m51va_inithook,
17514 [ALC663_ASUS_G50V] = {
17515 .mixers = { alc663_g50v_mixer },
17516 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17517 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17518 .dac_nids = alc662_dac_nids,
17519 .dig_out_nid = ALC662_DIGOUT_NID,
17520 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17521 .channel_mode = alc662_3ST_6ch_modes,
17522 .input_mux = &alc663_capture_source,
17523 .unsol_event = alc663_g50v_unsol_event,
17524 .setup = alc663_g50v_setup,
17525 .init_hook = alc663_g50v_inithook,
17527 [ALC663_ASUS_MODE1] = {
17528 .mixers = { alc663_m51va_mixer },
17529 .cap_mixer = alc662_auto_capture_mixer,
17530 .init_verbs = { alc662_init_verbs,
17531 alc663_21jd_amic_init_verbs },
17532 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17534 .dac_nids = alc662_dac_nids,
17535 .dig_out_nid = ALC662_DIGOUT_NID,
17536 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17537 .channel_mode = alc662_3ST_2ch_modes,
17538 .unsol_event = alc663_mode1_unsol_event,
17539 .setup = alc663_mode1_setup,
17540 .init_hook = alc663_mode1_inithook,
17542 [ALC662_ASUS_MODE2] = {
17543 .mixers = { alc662_1bjd_mixer },
17544 .cap_mixer = alc662_auto_capture_mixer,
17545 .init_verbs = { alc662_init_verbs,
17546 alc662_1bjd_amic_init_verbs },
17547 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17548 .dac_nids = alc662_dac_nids,
17549 .dig_out_nid = ALC662_DIGOUT_NID,
17550 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17551 .channel_mode = alc662_3ST_2ch_modes,
17552 .unsol_event = alc662_mode2_unsol_event,
17553 .setup = alc662_mode2_setup,
17554 .init_hook = alc662_mode2_inithook,
17556 [ALC663_ASUS_MODE3] = {
17557 .mixers = { alc663_two_hp_m1_mixer },
17558 .cap_mixer = alc662_auto_capture_mixer,
17559 .init_verbs = { alc662_init_verbs,
17560 alc663_two_hp_amic_m1_init_verbs },
17561 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17563 .dac_nids = alc662_dac_nids,
17564 .dig_out_nid = ALC662_DIGOUT_NID,
17565 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17566 .channel_mode = alc662_3ST_2ch_modes,
17567 .unsol_event = alc663_mode3_unsol_event,
17568 .setup = alc663_mode3_setup,
17569 .init_hook = alc663_mode3_inithook,
17571 [ALC663_ASUS_MODE4] = {
17572 .mixers = { alc663_asus_21jd_clfe_mixer },
17573 .cap_mixer = alc662_auto_capture_mixer,
17574 .init_verbs = { alc662_init_verbs,
17575 alc663_21jd_amic_init_verbs},
17576 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17578 .dac_nids = alc662_dac_nids,
17579 .dig_out_nid = ALC662_DIGOUT_NID,
17580 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17581 .channel_mode = alc662_3ST_2ch_modes,
17582 .unsol_event = alc663_mode4_unsol_event,
17583 .setup = alc663_mode4_setup,
17584 .init_hook = alc663_mode4_inithook,
17586 [ALC663_ASUS_MODE5] = {
17587 .mixers = { alc663_asus_15jd_clfe_mixer },
17588 .cap_mixer = alc662_auto_capture_mixer,
17589 .init_verbs = { alc662_init_verbs,
17590 alc663_15jd_amic_init_verbs },
17591 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17593 .dac_nids = alc662_dac_nids,
17594 .dig_out_nid = ALC662_DIGOUT_NID,
17595 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17596 .channel_mode = alc662_3ST_2ch_modes,
17597 .unsol_event = alc663_mode5_unsol_event,
17598 .setup = alc663_mode5_setup,
17599 .init_hook = alc663_mode5_inithook,
17601 [ALC663_ASUS_MODE6] = {
17602 .mixers = { alc663_two_hp_m2_mixer },
17603 .cap_mixer = alc662_auto_capture_mixer,
17604 .init_verbs = { alc662_init_verbs,
17605 alc663_two_hp_amic_m2_init_verbs },
17606 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17608 .dac_nids = alc662_dac_nids,
17609 .dig_out_nid = ALC662_DIGOUT_NID,
17610 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17611 .channel_mode = alc662_3ST_2ch_modes,
17612 .unsol_event = alc663_mode6_unsol_event,
17613 .setup = alc663_mode6_setup,
17614 .init_hook = alc663_mode6_inithook,
17616 [ALC663_ASUS_MODE7] = {
17617 .mixers = { alc663_mode7_mixer },
17618 .cap_mixer = alc662_auto_capture_mixer,
17619 .init_verbs = { alc662_init_verbs,
17620 alc663_mode7_init_verbs },
17621 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17623 .dac_nids = alc662_dac_nids,
17624 .dig_out_nid = ALC662_DIGOUT_NID,
17625 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17626 .channel_mode = alc662_3ST_2ch_modes,
17627 .unsol_event = alc663_mode7_unsol_event,
17628 .setup = alc663_mode7_setup,
17629 .init_hook = alc663_mode7_inithook,
17631 [ALC663_ASUS_MODE8] = {
17632 .mixers = { alc663_mode8_mixer },
17633 .cap_mixer = alc662_auto_capture_mixer,
17634 .init_verbs = { alc662_init_verbs,
17635 alc663_mode8_init_verbs },
17636 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17638 .dac_nids = alc662_dac_nids,
17639 .dig_out_nid = ALC662_DIGOUT_NID,
17640 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17641 .channel_mode = alc662_3ST_2ch_modes,
17642 .unsol_event = alc663_mode8_unsol_event,
17643 .setup = alc663_mode8_setup,
17644 .init_hook = alc663_mode8_inithook,
17647 .mixers = { alc663_m51va_mixer },
17648 .cap_mixer = alc272_auto_capture_mixer,
17649 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17650 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17651 .dac_nids = alc662_dac_nids,
17652 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17653 .adc_nids = alc272_adc_nids,
17654 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17655 .capsrc_nids = alc272_capsrc_nids,
17656 .channel_mode = alc662_3ST_2ch_modes,
17657 .unsol_event = alc663_m51va_unsol_event,
17658 .setup = alc663_m51va_setup,
17659 .init_hook = alc663_m51va_inithook,
17661 [ALC272_DELL_ZM1] = {
17662 .mixers = { alc663_m51va_mixer },
17663 .cap_mixer = alc662_auto_capture_mixer,
17664 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17665 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17666 .dac_nids = alc662_dac_nids,
17667 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17668 .adc_nids = alc662_adc_nids,
17670 .capsrc_nids = alc662_capsrc_nids,
17671 .channel_mode = alc662_3ST_2ch_modes,
17672 .unsol_event = alc663_m51va_unsol_event,
17673 .setup = alc663_m51va_setup,
17674 .init_hook = alc663_m51va_inithook,
17676 [ALC272_SAMSUNG_NC10] = {
17677 .mixers = { alc272_nc10_mixer },
17678 .init_verbs = { alc662_init_verbs,
17679 alc663_21jd_amic_init_verbs },
17680 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17681 .dac_nids = alc272_dac_nids,
17682 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17683 .channel_mode = alc662_3ST_2ch_modes,
17684 /*.input_mux = &alc272_nc10_capture_source,*/
17685 .unsol_event = alc663_mode4_unsol_event,
17686 .setup = alc663_mode4_setup,
17687 .init_hook = alc663_mode4_inithook,
17693 * BIOS auto configuration
17696 /* convert from MIX nid to DAC */
17697 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17701 else if (nid >= 0x0c && nid <= 0x0e)
17702 return nid - 0x0c + 0x02;
17707 /* get MIX nid connected to the given pin targeted to DAC */
17708 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17714 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17715 for (i = 0; i < num; i++) {
17716 if (alc662_mix_to_dac(mix[i]) == dac)
17722 /* look for an empty DAC slot */
17723 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17725 struct alc_spec *spec = codec->spec;
17729 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17732 for (i = 0; i < num; i++) {
17733 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17736 for (j = 0; j < spec->multiout.num_dacs; j++)
17737 if (spec->multiout.dac_nids[j] == nid)
17739 if (j >= spec->multiout.num_dacs)
17745 /* fill in the dac_nids table from the parsed pin configuration */
17746 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17747 const struct auto_pin_cfg *cfg)
17749 struct alc_spec *spec = codec->spec;
17753 spec->multiout.dac_nids = spec->private_dac_nids;
17754 for (i = 0; i < cfg->line_outs; i++) {
17755 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17758 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17763 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17764 hda_nid_t nid, unsigned int chs)
17766 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17767 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17770 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17771 hda_nid_t nid, unsigned int chs)
17773 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17774 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17777 #define alc662_add_stereo_vol(spec, pfx, nid) \
17778 alc662_add_vol_ctl(spec, pfx, nid, 3)
17779 #define alc662_add_stereo_sw(spec, pfx, nid) \
17780 alc662_add_sw_ctl(spec, pfx, nid, 3)
17782 /* add playback controls from the parsed DAC table */
17783 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17784 const struct auto_pin_cfg *cfg)
17786 struct alc_spec *spec = codec->spec;
17787 static const char *chname[4] = {
17788 "Front", "Surround", NULL /*CLFE*/, "Side"
17790 hda_nid_t nid, mix;
17793 for (i = 0; i < cfg->line_outs; i++) {
17794 nid = spec->multiout.dac_nids[i];
17797 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17802 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17805 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17808 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17811 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17816 if (cfg->line_outs == 1 &&
17817 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17824 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17827 if (cfg->line_outs == 1 &&
17828 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17830 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17838 /* add playback controls for speaker and HP outputs */
17839 /* return DAC nid if any new DAC is assigned */
17840 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17843 struct alc_spec *spec = codec->spec;
17844 hda_nid_t nid, mix;
17849 nid = alc662_look_for_dac(codec, pin);
17851 /* the corresponding DAC is already occupied */
17852 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17853 return 0; /* no way */
17854 /* create a switch only */
17855 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17856 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17859 mix = alc662_dac_to_mix(codec, pin, nid);
17862 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17865 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17871 /* create playback/capture controls for input pins */
17872 #define alc662_auto_create_input_ctls \
17873 alc882_auto_create_input_ctls
17875 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17876 hda_nid_t nid, int pin_type,
17882 alc_set_pin_output(codec, nid, pin_type);
17883 /* need the manual connection? */
17884 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17887 for (i = 0; i < num; i++) {
17888 if (alc662_mix_to_dac(srcs[i]) != dac)
17890 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17895 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17897 struct alc_spec *spec = codec->spec;
17898 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17901 for (i = 0; i <= HDA_SIDE; i++) {
17902 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17904 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17905 spec->multiout.dac_nids[i]);
17909 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17911 struct alc_spec *spec = codec->spec;
17914 pin = spec->autocfg.hp_pins[0];
17916 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17917 spec->multiout.hp_nid);
17918 pin = spec->autocfg.speaker_pins[0];
17920 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17921 spec->multiout.extra_out_nid[0]);
17924 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17926 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17928 struct alc_spec *spec = codec->spec;
17931 for (i = 0; i < AUTO_PIN_LAST; i++) {
17932 hda_nid_t nid = spec->autocfg.input_pins[i];
17933 if (alc_is_input_pin(codec, nid)) {
17934 alc_set_input_pin(codec, nid, i);
17935 if (nid != ALC662_PIN_CD_NID &&
17936 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17937 snd_hda_codec_write(codec, nid, 0,
17938 AC_VERB_SET_AMP_GAIN_MUTE,
17944 #define alc662_auto_init_input_src alc882_auto_init_input_src
17946 static int alc662_parse_auto_config(struct hda_codec *codec)
17948 struct alc_spec *spec = codec->spec;
17950 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17952 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17956 if (!spec->autocfg.line_outs)
17957 return 0; /* can't find valid BIOS pin config */
17959 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17962 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17965 err = alc662_auto_create_extra_out(codec,
17966 spec->autocfg.speaker_pins[0],
17971 spec->multiout.extra_out_nid[0] = err;
17972 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17977 spec->multiout.hp_nid = err;
17978 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17982 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17984 if (spec->autocfg.dig_outs)
17985 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17987 if (spec->kctls.list)
17988 add_mixer(spec, spec->kctls.list);
17990 spec->num_mux_defs = 1;
17991 spec->input_mux = &spec->private_imux[0];
17993 add_verb(spec, alc662_auto_init_verbs);
17994 if (codec->vendor_id == 0x10ec0663)
17995 add_verb(spec, alc663_auto_init_verbs);
17997 err = alc_auto_add_mic_boost(codec);
18001 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18006 /* additional initialization for auto-configuration model */
18007 static void alc662_auto_init(struct hda_codec *codec)
18009 struct alc_spec *spec = codec->spec;
18010 alc662_auto_init_multi_out(codec);
18011 alc662_auto_init_hp_out(codec);
18012 alc662_auto_init_analog_input(codec);
18013 alc662_auto_init_input_src(codec);
18014 if (spec->unsol_event)
18015 alc_inithook(codec);
18018 static int patch_alc662(struct hda_codec *codec)
18020 struct alc_spec *spec;
18021 int err, board_config;
18023 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18027 codec->spec = spec;
18029 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18031 if (alc_read_coef_idx(codec, 0)==0x8020){
18032 kfree(codec->chip_name);
18033 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18034 if (!codec->chip_name) {
18040 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18043 if (board_config < 0) {
18044 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18046 board_config = ALC662_AUTO;
18049 if (board_config == ALC662_AUTO) {
18050 /* automatic parse from the BIOS config */
18051 err = alc662_parse_auto_config(codec);
18057 "hda_codec: Cannot set up configuration "
18058 "from BIOS. Using base mode...\n");
18059 board_config = ALC662_3ST_2ch_DIG;
18063 err = snd_hda_attach_beep_device(codec, 0x1);
18069 if (board_config != ALC662_AUTO)
18070 setup_preset(codec, &alc662_presets[board_config]);
18072 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18073 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18075 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18076 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18078 if (!spec->adc_nids) {
18079 spec->adc_nids = alc662_adc_nids;
18080 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18082 if (!spec->capsrc_nids)
18083 spec->capsrc_nids = alc662_capsrc_nids;
18085 if (!spec->cap_mixer)
18086 set_capture_mixer(codec);
18087 if (codec->vendor_id == 0x10ec0662)
18088 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18090 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18092 spec->vmaster_nid = 0x02;
18094 codec->patch_ops = alc_patch_ops;
18095 if (board_config == ALC662_AUTO)
18096 spec->init_hook = alc662_auto_init;
18097 #ifdef CONFIG_SND_HDA_POWER_SAVE
18098 if (!spec->loopback.amplist)
18099 spec->loopback.amplist = alc662_loopbacks;
18101 codec->proc_widget_hook = print_realtek_coef;
18106 static int patch_alc888(struct hda_codec *codec)
18108 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18109 kfree(codec->chip_name);
18110 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18111 if (!codec->chip_name) {
18115 return patch_alc662(codec);
18117 return patch_alc882(codec);
18123 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18124 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18125 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18126 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18127 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18128 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18129 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18130 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18131 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18132 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18133 .patch = patch_alc861 },
18134 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18135 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18136 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18137 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18138 .patch = patch_alc882 },
18139 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18140 .patch = patch_alc662 },
18141 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18142 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18143 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18144 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18145 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18146 .patch = patch_alc882 },
18147 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18148 .patch = patch_alc882 },
18149 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18150 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18151 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18152 .patch = patch_alc882 },
18153 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18154 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18155 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18156 {} /* terminator */
18159 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18161 MODULE_LICENSE("GPL");
18162 MODULE_DESCRIPTION("Realtek HD-audio codec");
18164 static struct hda_codec_preset_list realtek_list = {
18165 .preset = snd_hda_preset_realtek,
18166 .owner = THIS_MODULE,
18169 static int __init patch_realtek_init(void)
18171 return snd_hda_add_codec_preset(&realtek_list);
18174 static void __exit patch_realtek_exit(void)
18176 snd_hda_delete_codec_preset(&realtek_list);
18179 module_init(patch_realtek_init)
18180 module_exit(patch_realtek_exit)