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 err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids,
2552 spec->input_mux->num_items);
2556 if (spec->cap_mixer) {
2557 const char *kname = kctl ? kctl->id.name : NULL;
2558 for (knew = spec->cap_mixer; knew->name; knew++) {
2559 if (kname && strcmp(knew->name, kname) == 0)
2561 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2562 for (i = 0; kctl && i < kctl->count; i++) {
2563 err = snd_hda_add_nid(codec, kctl, i,
2571 /* other nid->control mapping */
2572 for (i = 0; i < spec->num_mixers; i++) {
2573 for (knew = spec->mixers[i]; knew->name; knew++) {
2574 if (knew->iface != NID_MAPPING)
2576 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2579 u = knew->subdevice;
2580 for (j = 0; j < 4; j++, u >>= 8) {
2585 case SUBDEV_SPEAKER_:
2586 nid = spec->autocfg.speaker_pins[nid];
2589 nid = spec->autocfg.line_out_pins[nid];
2592 nid = spec->autocfg.hp_pins[nid];
2597 err = snd_hda_add_nid(codec, kctl, 0, nid);
2601 u = knew->private_value;
2602 for (j = 0; j < 4; j++, u >>= 8) {
2606 err = snd_hda_add_nid(codec, kctl, 0, nid);
2617 * initialize the codec volumes, etc
2621 * generic initialization of ADC, input mixers and output mixers
2623 static struct hda_verb alc880_volume_init_verbs[] = {
2625 * Unmute ADC0-2 and set the default input to mic-in
2627 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2628 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2629 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2630 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2631 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2632 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2634 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2636 * Note: PASD motherboards uses the Line In 2 as the input for front
2639 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2640 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2641 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2642 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2649 * Set up output mixers (0x0c - 0x0f)
2651 /* set vol=0 to output mixers */
2652 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2653 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2655 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2656 /* set up input amps for analog loopback */
2657 /* Amp Indices: DAC = 0, mixer = 1 */
2658 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2659 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2660 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2661 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2662 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2663 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2664 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2665 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2671 * 3-stack pin configuration:
2672 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2674 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2676 * preset connection lists of input pins
2677 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2679 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2680 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2681 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2684 * Set pin mode and muting
2686 /* set front pin widgets 0x14 for output */
2687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2688 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2689 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2692 /* Mic2 (as headphone out) for HP output */
2693 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2694 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2695 /* Line In pin widget for input */
2696 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2697 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2698 /* Line2 (as front mic) pin widget for input and vref at 80% */
2699 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2700 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2701 /* CD pin widget for input */
2702 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2708 * 5-stack pin configuration:
2709 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2710 * line-in/side = 0x1a, f-mic = 0x1b
2712 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2714 * preset connection lists of input pins
2715 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2717 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2718 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2721 * Set pin mode and muting
2723 /* set pin widgets 0x14-0x17 for output */
2724 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2725 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2726 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2727 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 /* unmute pins for output (no gain on this amp) */
2729 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2730 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2731 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2732 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2735 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2736 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2737 /* Mic2 (as headphone out) for HP output */
2738 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2739 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2740 /* Line In pin widget for input */
2741 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2743 /* Line2 (as front mic) pin widget for input and vref at 80% */
2744 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2745 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 /* CD pin widget for input */
2747 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2753 * W810 pin configuration:
2754 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2756 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2757 /* hphone/speaker input selector: front DAC */
2758 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2764 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2765 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2768 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2774 * Z71V pin configuration:
2775 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2777 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2778 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2779 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2780 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2781 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2784 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2785 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2786 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2792 * 6-stack pin configuration:
2793 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2794 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2796 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2797 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2799 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2800 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2802 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2803 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2804 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2805 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2806 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2808 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2809 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2810 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2811 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2812 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2813 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2814 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2815 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2816 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2822 * Uniwill pin configuration:
2823 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2826 static struct hda_verb alc880_uniwill_init_verbs[] = {
2827 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2830 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2831 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2832 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2833 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2834 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2835 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2836 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2837 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2838 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2839 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2840 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2841 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2842 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2844 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2845 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2846 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2847 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2848 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2849 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2850 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2851 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2852 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2854 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2862 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2864 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2865 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2867 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2868 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2869 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2870 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2871 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2872 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2873 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2874 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2875 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2876 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2877 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2878 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2880 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2881 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2882 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2883 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2884 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2885 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2887 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2888 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2893 static struct hda_verb alc880_beep_init_verbs[] = {
2894 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2898 /* auto-toggle front mic */
2899 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2901 unsigned int present;
2904 present = snd_hda_jack_detect(codec, 0x18);
2905 bits = present ? HDA_AMP_MUTE : 0;
2906 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2909 static void alc880_uniwill_setup(struct hda_codec *codec)
2911 struct alc_spec *spec = codec->spec;
2913 spec->autocfg.hp_pins[0] = 0x14;
2914 spec->autocfg.speaker_pins[0] = 0x15;
2915 spec->autocfg.speaker_pins[0] = 0x16;
2918 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2920 alc_automute_amp(codec);
2921 alc880_uniwill_mic_automute(codec);
2924 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2927 /* Looks like the unsol event is incompatible with the standard
2928 * definition. 4bit tag is placed at 28 bit!
2930 switch (res >> 28) {
2931 case ALC880_MIC_EVENT:
2932 alc880_uniwill_mic_automute(codec);
2935 alc_automute_amp_unsol_event(codec, res);
2940 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2942 struct alc_spec *spec = codec->spec;
2944 spec->autocfg.hp_pins[0] = 0x14;
2945 spec->autocfg.speaker_pins[0] = 0x15;
2948 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2950 unsigned int present;
2952 present = snd_hda_codec_read(codec, 0x21, 0,
2953 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2954 present &= HDA_AMP_VOLMASK;
2955 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2956 HDA_AMP_VOLMASK, present);
2957 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2958 HDA_AMP_VOLMASK, present);
2961 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2964 /* Looks like the unsol event is incompatible with the standard
2965 * definition. 4bit tag is placed at 28 bit!
2967 if ((res >> 28) == ALC880_DCVOL_EVENT)
2968 alc880_uniwill_p53_dcvol_automute(codec);
2970 alc_automute_amp_unsol_event(codec, res);
2974 * F1734 pin configuration:
2975 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2977 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2978 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2979 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2980 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2981 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2982 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2984 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2985 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2986 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2987 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2990 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2991 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2992 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2993 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2995 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2996 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2997 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2999 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3000 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3006 * ASUS pin configuration:
3007 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3009 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3010 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3011 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3012 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3013 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3017 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3018 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3019 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3020 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3021 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3022 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3024 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3026 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3027 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3028 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3030 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3031 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3032 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3037 /* Enable GPIO mask and set output */
3038 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3039 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3040 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3042 /* Clevo m520g init */
3043 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3044 /* headphone output */
3045 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3047 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3048 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3050 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3051 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3054 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3055 /* Mic1 (rear panel) */
3056 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3057 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 /* Mic2 (front panel) */
3059 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3060 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3062 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3063 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3064 /* change to EAPD mode */
3065 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3066 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3071 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3072 /* change to EAPD mode */
3073 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3074 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3076 /* Headphone output */
3077 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3079 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3080 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3082 /* Line In pin widget for input */
3083 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3084 /* CD pin widget for input */
3085 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3086 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3087 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3089 /* change to EAPD mode */
3090 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3091 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3097 * LG m1 express dual
3100 * Rear Line-In/Out (blue): 0x14
3101 * Build-in Mic-In: 0x15
3103 * HP-Out (green): 0x1b
3104 * Mic-In/Out (red): 0x19
3108 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3109 static hda_nid_t alc880_lg_dac_nids[3] = {
3113 /* seems analog CD is not working */
3114 static struct hda_input_mux alc880_lg_capture_source = {
3119 { "Internal Mic", 0x6 },
3123 /* 2,4,6 channel modes */
3124 static struct hda_verb alc880_lg_ch2_init[] = {
3125 /* set line-in and mic-in to input */
3126 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3127 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3131 static struct hda_verb alc880_lg_ch4_init[] = {
3132 /* set line-in to out and mic-in to input */
3133 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3134 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3138 static struct hda_verb alc880_lg_ch6_init[] = {
3139 /* set line-in and mic-in to output */
3140 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3141 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3145 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3146 { 2, alc880_lg_ch2_init },
3147 { 4, alc880_lg_ch4_init },
3148 { 6, alc880_lg_ch6_init },
3151 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3152 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3153 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3154 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3155 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3156 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3157 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3158 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3159 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3160 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3161 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3164 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3165 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3167 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3168 .name = "Channel Mode",
3169 .info = alc_ch_mode_info,
3170 .get = alc_ch_mode_get,
3171 .put = alc_ch_mode_put,
3176 static struct hda_verb alc880_lg_init_verbs[] = {
3177 /* set capture source to mic-in */
3178 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3179 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3180 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3181 /* mute all amp mixer inputs */
3182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3185 /* line-in to input */
3186 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3187 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3189 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3190 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3192 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3193 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3194 /* mic-in to input */
3195 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3196 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3197 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3199 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3200 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3201 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3207 /* toggle speaker-output according to the hp-jack state */
3208 static void alc880_lg_setup(struct hda_codec *codec)
3210 struct alc_spec *spec = codec->spec;
3212 spec->autocfg.hp_pins[0] = 0x1b;
3213 spec->autocfg.speaker_pins[0] = 0x17;
3222 * Built-in Mic-In: 0x19
3228 static struct hda_input_mux alc880_lg_lw_capture_source = {
3232 { "Internal Mic", 0x1 },
3237 #define alc880_lg_lw_modes alc880_threestack_modes
3239 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3240 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3241 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3242 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3243 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3244 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3245 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3246 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3247 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3252 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3253 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3256 .name = "Channel Mode",
3257 .info = alc_ch_mode_info,
3258 .get = alc_ch_mode_get,
3259 .put = alc_ch_mode_put,
3264 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3265 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3266 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3267 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3269 /* set capture source to mic-in */
3270 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3271 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3273 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3280 /* mic-in to input */
3281 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3282 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3284 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3285 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3287 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3291 /* toggle speaker-output according to the hp-jack state */
3292 static void alc880_lg_lw_setup(struct hda_codec *codec)
3294 struct alc_spec *spec = codec->spec;
3296 spec->autocfg.hp_pins[0] = 0x1b;
3297 spec->autocfg.speaker_pins[0] = 0x14;
3300 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3301 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3302 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3303 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3304 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3305 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3306 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3310 static struct hda_input_mux alc880_medion_rim_capture_source = {
3314 { "Internal Mic", 0x1 },
3318 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3319 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3321 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3322 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3324 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3327 /* Mic2 (as headphone out) for HP output */
3328 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3329 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3330 /* Internal Speaker */
3331 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3332 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3334 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3335 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3337 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3341 /* toggle speaker-output according to the hp-jack state */
3342 static void alc880_medion_rim_automute(struct hda_codec *codec)
3344 struct alc_spec *spec = codec->spec;
3345 alc_automute_amp(codec);
3347 if (spec->jack_present)
3348 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3350 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3353 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3356 /* Looks like the unsol event is incompatible with the standard
3357 * definition. 4bit tag is placed at 28 bit!
3359 if ((res >> 28) == ALC880_HP_EVENT)
3360 alc880_medion_rim_automute(codec);
3363 static void alc880_medion_rim_setup(struct hda_codec *codec)
3365 struct alc_spec *spec = codec->spec;
3367 spec->autocfg.hp_pins[0] = 0x14;
3368 spec->autocfg.speaker_pins[0] = 0x1b;
3371 #ifdef CONFIG_SND_HDA_POWER_SAVE
3372 static struct hda_amp_list alc880_loopbacks[] = {
3373 { 0x0b, HDA_INPUT, 0 },
3374 { 0x0b, HDA_INPUT, 1 },
3375 { 0x0b, HDA_INPUT, 2 },
3376 { 0x0b, HDA_INPUT, 3 },
3377 { 0x0b, HDA_INPUT, 4 },
3381 static struct hda_amp_list alc880_lg_loopbacks[] = {
3382 { 0x0b, HDA_INPUT, 1 },
3383 { 0x0b, HDA_INPUT, 6 },
3384 { 0x0b, HDA_INPUT, 7 },
3393 static int alc_init(struct hda_codec *codec)
3395 struct alc_spec *spec = codec->spec;
3399 alc_auto_init_amp(codec, spec->init_amp);
3401 for (i = 0; i < spec->num_init_verbs; i++)
3402 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3404 if (spec->init_hook)
3405 spec->init_hook(codec);
3410 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3412 struct alc_spec *spec = codec->spec;
3414 if (spec->unsol_event)
3415 spec->unsol_event(codec, res);
3418 #ifdef CONFIG_SND_HDA_POWER_SAVE
3419 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3421 struct alc_spec *spec = codec->spec;
3422 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3427 * Analog playback callbacks
3429 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3430 struct hda_codec *codec,
3431 struct snd_pcm_substream *substream)
3433 struct alc_spec *spec = codec->spec;
3434 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3438 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3439 struct hda_codec *codec,
3440 unsigned int stream_tag,
3441 unsigned int format,
3442 struct snd_pcm_substream *substream)
3444 struct alc_spec *spec = codec->spec;
3445 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3446 stream_tag, format, substream);
3449 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3450 struct hda_codec *codec,
3451 struct snd_pcm_substream *substream)
3453 struct alc_spec *spec = codec->spec;
3454 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3460 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3461 struct hda_codec *codec,
3462 struct snd_pcm_substream *substream)
3464 struct alc_spec *spec = codec->spec;
3465 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3468 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3469 struct hda_codec *codec,
3470 unsigned int stream_tag,
3471 unsigned int format,
3472 struct snd_pcm_substream *substream)
3474 struct alc_spec *spec = codec->spec;
3475 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3476 stream_tag, format, substream);
3479 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3480 struct hda_codec *codec,
3481 struct snd_pcm_substream *substream)
3483 struct alc_spec *spec = codec->spec;
3484 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3487 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3488 struct hda_codec *codec,
3489 struct snd_pcm_substream *substream)
3491 struct alc_spec *spec = codec->spec;
3492 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3498 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3499 struct hda_codec *codec,
3500 unsigned int stream_tag,
3501 unsigned int format,
3502 struct snd_pcm_substream *substream)
3504 struct alc_spec *spec = codec->spec;
3506 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3507 stream_tag, 0, format);
3511 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3512 struct hda_codec *codec,
3513 struct snd_pcm_substream *substream)
3515 struct alc_spec *spec = codec->spec;
3517 snd_hda_codec_cleanup_stream(codec,
3518 spec->adc_nids[substream->number + 1]);
3525 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3529 /* NID is set in alc_build_pcms */
3531 .open = alc880_playback_pcm_open,
3532 .prepare = alc880_playback_pcm_prepare,
3533 .cleanup = alc880_playback_pcm_cleanup
3537 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3541 /* NID is set in alc_build_pcms */
3544 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3548 /* NID is set in alc_build_pcms */
3551 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3552 .substreams = 2, /* can be overridden */
3555 /* NID is set in alc_build_pcms */
3557 .prepare = alc880_alt_capture_pcm_prepare,
3558 .cleanup = alc880_alt_capture_pcm_cleanup
3562 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3566 /* NID is set in alc_build_pcms */
3568 .open = alc880_dig_playback_pcm_open,
3569 .close = alc880_dig_playback_pcm_close,
3570 .prepare = alc880_dig_playback_pcm_prepare,
3571 .cleanup = alc880_dig_playback_pcm_cleanup
3575 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3579 /* NID is set in alc_build_pcms */
3582 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3583 static struct hda_pcm_stream alc_pcm_null_stream = {
3589 static int alc_build_pcms(struct hda_codec *codec)
3591 struct alc_spec *spec = codec->spec;
3592 struct hda_pcm *info = spec->pcm_rec;
3595 codec->num_pcms = 1;
3596 codec->pcm_info = info;
3598 if (spec->no_analog)
3601 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3602 "%s Analog", codec->chip_name);
3603 info->name = spec->stream_name_analog;
3605 if (spec->stream_analog_playback) {
3606 if (snd_BUG_ON(!spec->multiout.dac_nids))
3608 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3609 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3611 if (spec->stream_analog_capture) {
3612 if (snd_BUG_ON(!spec->adc_nids))
3614 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3615 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3618 if (spec->channel_mode) {
3619 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3620 for (i = 0; i < spec->num_channel_mode; i++) {
3621 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3622 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3628 /* SPDIF for stream index #1 */
3629 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3630 snprintf(spec->stream_name_digital,
3631 sizeof(spec->stream_name_digital),
3632 "%s Digital", codec->chip_name);
3633 codec->num_pcms = 2;
3634 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3635 info = spec->pcm_rec + 1;
3636 info->name = spec->stream_name_digital;
3637 if (spec->dig_out_type)
3638 info->pcm_type = spec->dig_out_type;
3640 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3641 if (spec->multiout.dig_out_nid &&
3642 spec->stream_digital_playback) {
3643 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3644 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3646 if (spec->dig_in_nid &&
3647 spec->stream_digital_capture) {
3648 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3649 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3651 /* FIXME: do we need this for all Realtek codec models? */
3652 codec->spdif_status_reset = 1;
3655 if (spec->no_analog)
3658 /* If the use of more than one ADC is requested for the current
3659 * model, configure a second analog capture-only PCM.
3661 /* Additional Analaog capture for index #2 */
3662 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3663 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3664 codec->num_pcms = 3;
3665 info = spec->pcm_rec + 2;
3666 info->name = spec->stream_name_analog;
3667 if (spec->alt_dac_nid) {
3668 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3669 *spec->stream_analog_alt_playback;
3670 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3673 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3674 alc_pcm_null_stream;
3675 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3677 if (spec->num_adc_nids > 1) {
3678 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3679 *spec->stream_analog_alt_capture;
3680 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3682 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3683 spec->num_adc_nids - 1;
3685 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3686 alc_pcm_null_stream;
3687 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3694 static void alc_free_kctls(struct hda_codec *codec)
3696 struct alc_spec *spec = codec->spec;
3698 if (spec->kctls.list) {
3699 struct snd_kcontrol_new *kctl = spec->kctls.list;
3701 for (i = 0; i < spec->kctls.used; i++)
3702 kfree(kctl[i].name);
3704 snd_array_free(&spec->kctls);
3707 static void alc_free(struct hda_codec *codec)
3709 struct alc_spec *spec = codec->spec;
3714 alc_free_kctls(codec);
3716 snd_hda_detach_beep_device(codec);
3719 #ifdef CONFIG_SND_HDA_POWER_SAVE
3720 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3722 struct alc_spec *spec = codec->spec;
3723 if (spec && spec->power_hook)
3724 spec->power_hook(codec, 0);
3729 #ifdef SND_HDA_NEEDS_RESUME
3730 static int alc_resume(struct hda_codec *codec)
3732 #ifdef CONFIG_SND_HDA_POWER_SAVE
3733 struct alc_spec *spec = codec->spec;
3735 codec->patch_ops.init(codec);
3736 snd_hda_codec_resume_amp(codec);
3737 snd_hda_codec_resume_cache(codec);
3738 #ifdef CONFIG_SND_HDA_POWER_SAVE
3739 if (spec && spec->power_hook)
3740 spec->power_hook(codec, 1);
3748 static struct hda_codec_ops alc_patch_ops = {
3749 .build_controls = alc_build_controls,
3750 .build_pcms = alc_build_pcms,
3753 .unsol_event = alc_unsol_event,
3754 #ifdef SND_HDA_NEEDS_RESUME
3755 .resume = alc_resume,
3757 #ifdef CONFIG_SND_HDA_POWER_SAVE
3758 .suspend = alc_suspend,
3759 .check_power_status = alc_check_power_status,
3765 * Test configuration for debugging
3767 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3770 #ifdef CONFIG_SND_DEBUG
3771 static hda_nid_t alc880_test_dac_nids[4] = {
3772 0x02, 0x03, 0x04, 0x05
3775 static struct hda_input_mux alc880_test_capture_source = {
3784 { "Surround", 0x6 },
3788 static struct hda_channel_mode alc880_test_modes[4] = {
3795 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3796 struct snd_ctl_elem_info *uinfo)
3798 static char *texts[] = {
3799 "N/A", "Line Out", "HP Out",
3800 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3802 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3804 uinfo->value.enumerated.items = 8;
3805 if (uinfo->value.enumerated.item >= 8)
3806 uinfo->value.enumerated.item = 7;
3807 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3811 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3812 struct snd_ctl_elem_value *ucontrol)
3814 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3815 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3816 unsigned int pin_ctl, item = 0;
3818 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3819 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3820 if (pin_ctl & AC_PINCTL_OUT_EN) {
3821 if (pin_ctl & AC_PINCTL_HP_EN)
3825 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3826 switch (pin_ctl & AC_PINCTL_VREFEN) {
3827 case AC_PINCTL_VREF_HIZ: item = 3; break;
3828 case AC_PINCTL_VREF_50: item = 4; break;
3829 case AC_PINCTL_VREF_GRD: item = 5; break;
3830 case AC_PINCTL_VREF_80: item = 6; break;
3831 case AC_PINCTL_VREF_100: item = 7; break;
3834 ucontrol->value.enumerated.item[0] = item;
3838 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3839 struct snd_ctl_elem_value *ucontrol)
3841 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3842 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3843 static unsigned int ctls[] = {
3844 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3845 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3846 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3847 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3848 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3849 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3851 unsigned int old_ctl, new_ctl;
3853 old_ctl = snd_hda_codec_read(codec, nid, 0,
3854 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3855 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3856 if (old_ctl != new_ctl) {
3858 snd_hda_codec_write_cache(codec, nid, 0,
3859 AC_VERB_SET_PIN_WIDGET_CONTROL,
3861 val = ucontrol->value.enumerated.item[0] >= 3 ?
3863 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3870 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3871 struct snd_ctl_elem_info *uinfo)
3873 static char *texts[] = {
3874 "Front", "Surround", "CLFE", "Side"
3876 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3878 uinfo->value.enumerated.items = 4;
3879 if (uinfo->value.enumerated.item >= 4)
3880 uinfo->value.enumerated.item = 3;
3881 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3885 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3886 struct snd_ctl_elem_value *ucontrol)
3888 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3889 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3892 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3893 ucontrol->value.enumerated.item[0] = sel & 3;
3897 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3898 struct snd_ctl_elem_value *ucontrol)
3900 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3901 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3904 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3905 if (ucontrol->value.enumerated.item[0] != sel) {
3906 sel = ucontrol->value.enumerated.item[0] & 3;
3907 snd_hda_codec_write_cache(codec, nid, 0,
3908 AC_VERB_SET_CONNECT_SEL, sel);
3914 #define PIN_CTL_TEST(xname,nid) { \
3915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3917 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3918 .info = alc_test_pin_ctl_info, \
3919 .get = alc_test_pin_ctl_get, \
3920 .put = alc_test_pin_ctl_put, \
3921 .private_value = nid \
3924 #define PIN_SRC_TEST(xname,nid) { \
3925 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3927 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3928 .info = alc_test_pin_src_info, \
3929 .get = alc_test_pin_src_get, \
3930 .put = alc_test_pin_src_put, \
3931 .private_value = nid \
3934 static struct snd_kcontrol_new alc880_test_mixer[] = {
3935 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3936 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3937 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3938 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3939 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3940 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3941 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3942 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3943 PIN_CTL_TEST("Front Pin Mode", 0x14),
3944 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3945 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3946 PIN_CTL_TEST("Side Pin Mode", 0x17),
3947 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3948 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3949 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3950 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3951 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3952 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3953 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3954 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3955 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3956 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3957 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3958 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3959 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3960 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3961 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3962 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3963 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3964 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3966 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3967 .name = "Channel Mode",
3968 .info = alc_ch_mode_info,
3969 .get = alc_ch_mode_get,
3970 .put = alc_ch_mode_put,
3975 static struct hda_verb alc880_test_init_verbs[] = {
3976 /* Unmute inputs of 0x0c - 0x0f */
3977 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3978 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3979 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3980 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3981 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3982 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3983 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3984 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3985 /* Vol output for 0x0c-0x0f */
3986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3988 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3989 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3990 /* Set output pins 0x14-0x17 */
3991 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3992 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3993 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3994 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3995 /* Unmute output pins 0x14-0x17 */
3996 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3997 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3998 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3999 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4000 /* Set input pins 0x18-0x1c */
4001 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4002 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4003 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4004 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4005 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4006 /* Mute input pins 0x18-0x1b */
4007 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4008 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4009 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4010 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4012 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4013 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4014 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4015 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4017 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4018 /* Analog input/passthru */
4019 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4020 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4021 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4031 static const char *alc880_models[ALC880_MODEL_LAST] = {
4032 [ALC880_3ST] = "3stack",
4033 [ALC880_TCL_S700] = "tcl",
4034 [ALC880_3ST_DIG] = "3stack-digout",
4035 [ALC880_CLEVO] = "clevo",
4036 [ALC880_5ST] = "5stack",
4037 [ALC880_5ST_DIG] = "5stack-digout",
4038 [ALC880_W810] = "w810",
4039 [ALC880_Z71V] = "z71v",
4040 [ALC880_6ST] = "6stack",
4041 [ALC880_6ST_DIG] = "6stack-digout",
4042 [ALC880_ASUS] = "asus",
4043 [ALC880_ASUS_W1V] = "asus-w1v",
4044 [ALC880_ASUS_DIG] = "asus-dig",
4045 [ALC880_ASUS_DIG2] = "asus-dig2",
4046 [ALC880_UNIWILL_DIG] = "uniwill",
4047 [ALC880_UNIWILL_P53] = "uniwill-p53",
4048 [ALC880_FUJITSU] = "fujitsu",
4049 [ALC880_F1734] = "F1734",
4051 [ALC880_LG_LW] = "lg-lw",
4052 [ALC880_MEDION_RIM] = "medion",
4053 #ifdef CONFIG_SND_DEBUG
4054 [ALC880_TEST] = "test",
4056 [ALC880_AUTO] = "auto",
4059 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4060 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4061 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4062 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4063 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4064 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4065 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4066 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4067 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4068 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4069 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4070 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4071 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4072 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4073 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4074 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4075 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4076 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4077 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4078 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4079 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4080 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4081 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4082 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4084 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4085 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4086 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4087 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4088 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4089 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4090 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4091 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4092 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4093 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4094 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4095 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4096 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4097 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4098 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4099 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4100 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4101 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4102 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4103 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4104 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4105 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4106 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4107 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4108 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4109 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4110 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4111 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4112 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4113 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4114 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4115 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4116 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4117 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4118 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4119 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4120 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4121 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4122 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4123 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4124 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4125 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4126 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4130 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4136 * ALC880 codec presets
4138 static struct alc_config_preset alc880_presets[] = {
4140 .mixers = { alc880_three_stack_mixer },
4141 .init_verbs = { alc880_volume_init_verbs,
4142 alc880_pin_3stack_init_verbs },
4143 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4144 .dac_nids = alc880_dac_nids,
4145 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4146 .channel_mode = alc880_threestack_modes,
4148 .input_mux = &alc880_capture_source,
4150 [ALC880_3ST_DIG] = {
4151 .mixers = { alc880_three_stack_mixer },
4152 .init_verbs = { alc880_volume_init_verbs,
4153 alc880_pin_3stack_init_verbs },
4154 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4155 .dac_nids = alc880_dac_nids,
4156 .dig_out_nid = ALC880_DIGOUT_NID,
4157 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4158 .channel_mode = alc880_threestack_modes,
4160 .input_mux = &alc880_capture_source,
4162 [ALC880_TCL_S700] = {
4163 .mixers = { alc880_tcl_s700_mixer },
4164 .init_verbs = { alc880_volume_init_verbs,
4165 alc880_pin_tcl_S700_init_verbs,
4166 alc880_gpio2_init_verbs },
4167 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4168 .dac_nids = alc880_dac_nids,
4169 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4170 .num_adc_nids = 1, /* single ADC */
4172 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4173 .channel_mode = alc880_2_jack_modes,
4174 .input_mux = &alc880_capture_source,
4177 .mixers = { alc880_three_stack_mixer,
4178 alc880_five_stack_mixer},
4179 .init_verbs = { alc880_volume_init_verbs,
4180 alc880_pin_5stack_init_verbs },
4181 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4182 .dac_nids = alc880_dac_nids,
4183 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4184 .channel_mode = alc880_fivestack_modes,
4185 .input_mux = &alc880_capture_source,
4187 [ALC880_5ST_DIG] = {
4188 .mixers = { alc880_three_stack_mixer,
4189 alc880_five_stack_mixer },
4190 .init_verbs = { alc880_volume_init_verbs,
4191 alc880_pin_5stack_init_verbs },
4192 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4193 .dac_nids = alc880_dac_nids,
4194 .dig_out_nid = ALC880_DIGOUT_NID,
4195 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4196 .channel_mode = alc880_fivestack_modes,
4197 .input_mux = &alc880_capture_source,
4200 .mixers = { alc880_six_stack_mixer },
4201 .init_verbs = { alc880_volume_init_verbs,
4202 alc880_pin_6stack_init_verbs },
4203 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4204 .dac_nids = alc880_6st_dac_nids,
4205 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4206 .channel_mode = alc880_sixstack_modes,
4207 .input_mux = &alc880_6stack_capture_source,
4209 [ALC880_6ST_DIG] = {
4210 .mixers = { alc880_six_stack_mixer },
4211 .init_verbs = { alc880_volume_init_verbs,
4212 alc880_pin_6stack_init_verbs },
4213 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4214 .dac_nids = alc880_6st_dac_nids,
4215 .dig_out_nid = ALC880_DIGOUT_NID,
4216 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4217 .channel_mode = alc880_sixstack_modes,
4218 .input_mux = &alc880_6stack_capture_source,
4221 .mixers = { alc880_w810_base_mixer },
4222 .init_verbs = { alc880_volume_init_verbs,
4223 alc880_pin_w810_init_verbs,
4224 alc880_gpio2_init_verbs },
4225 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4226 .dac_nids = alc880_w810_dac_nids,
4227 .dig_out_nid = ALC880_DIGOUT_NID,
4228 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4229 .channel_mode = alc880_w810_modes,
4230 .input_mux = &alc880_capture_source,
4233 .mixers = { alc880_z71v_mixer },
4234 .init_verbs = { alc880_volume_init_verbs,
4235 alc880_pin_z71v_init_verbs },
4236 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4237 .dac_nids = alc880_z71v_dac_nids,
4238 .dig_out_nid = ALC880_DIGOUT_NID,
4240 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4241 .channel_mode = alc880_2_jack_modes,
4242 .input_mux = &alc880_capture_source,
4245 .mixers = { alc880_f1734_mixer },
4246 .init_verbs = { alc880_volume_init_verbs,
4247 alc880_pin_f1734_init_verbs },
4248 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4249 .dac_nids = alc880_f1734_dac_nids,
4251 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4252 .channel_mode = alc880_2_jack_modes,
4253 .input_mux = &alc880_f1734_capture_source,
4254 .unsol_event = alc880_uniwill_p53_unsol_event,
4255 .setup = alc880_uniwill_p53_setup,
4256 .init_hook = alc_automute_amp,
4259 .mixers = { alc880_asus_mixer },
4260 .init_verbs = { alc880_volume_init_verbs,
4261 alc880_pin_asus_init_verbs,
4262 alc880_gpio1_init_verbs },
4263 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4264 .dac_nids = alc880_asus_dac_nids,
4265 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4266 .channel_mode = alc880_asus_modes,
4268 .input_mux = &alc880_capture_source,
4270 [ALC880_ASUS_DIG] = {
4271 .mixers = { alc880_asus_mixer },
4272 .init_verbs = { alc880_volume_init_verbs,
4273 alc880_pin_asus_init_verbs,
4274 alc880_gpio1_init_verbs },
4275 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4276 .dac_nids = alc880_asus_dac_nids,
4277 .dig_out_nid = ALC880_DIGOUT_NID,
4278 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4279 .channel_mode = alc880_asus_modes,
4281 .input_mux = &alc880_capture_source,
4283 [ALC880_ASUS_DIG2] = {
4284 .mixers = { alc880_asus_mixer },
4285 .init_verbs = { alc880_volume_init_verbs,
4286 alc880_pin_asus_init_verbs,
4287 alc880_gpio2_init_verbs }, /* use GPIO2 */
4288 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4289 .dac_nids = alc880_asus_dac_nids,
4290 .dig_out_nid = ALC880_DIGOUT_NID,
4291 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4292 .channel_mode = alc880_asus_modes,
4294 .input_mux = &alc880_capture_source,
4296 [ALC880_ASUS_W1V] = {
4297 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4298 .init_verbs = { alc880_volume_init_verbs,
4299 alc880_pin_asus_init_verbs,
4300 alc880_gpio1_init_verbs },
4301 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4302 .dac_nids = alc880_asus_dac_nids,
4303 .dig_out_nid = ALC880_DIGOUT_NID,
4304 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4305 .channel_mode = alc880_asus_modes,
4307 .input_mux = &alc880_capture_source,
4309 [ALC880_UNIWILL_DIG] = {
4310 .mixers = { alc880_asus_mixer },
4311 .init_verbs = { alc880_volume_init_verbs,
4312 alc880_pin_asus_init_verbs },
4313 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4314 .dac_nids = alc880_asus_dac_nids,
4315 .dig_out_nid = ALC880_DIGOUT_NID,
4316 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4317 .channel_mode = alc880_asus_modes,
4319 .input_mux = &alc880_capture_source,
4321 [ALC880_UNIWILL] = {
4322 .mixers = { alc880_uniwill_mixer },
4323 .init_verbs = { alc880_volume_init_verbs,
4324 alc880_uniwill_init_verbs },
4325 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4326 .dac_nids = alc880_asus_dac_nids,
4327 .dig_out_nid = ALC880_DIGOUT_NID,
4328 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4329 .channel_mode = alc880_threestack_modes,
4331 .input_mux = &alc880_capture_source,
4332 .unsol_event = alc880_uniwill_unsol_event,
4333 .setup = alc880_uniwill_setup,
4334 .init_hook = alc880_uniwill_init_hook,
4336 [ALC880_UNIWILL_P53] = {
4337 .mixers = { alc880_uniwill_p53_mixer },
4338 .init_verbs = { alc880_volume_init_verbs,
4339 alc880_uniwill_p53_init_verbs },
4340 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4341 .dac_nids = alc880_asus_dac_nids,
4342 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4343 .channel_mode = alc880_threestack_modes,
4344 .input_mux = &alc880_capture_source,
4345 .unsol_event = alc880_uniwill_p53_unsol_event,
4346 .setup = alc880_uniwill_p53_setup,
4347 .init_hook = alc_automute_amp,
4349 [ALC880_FUJITSU] = {
4350 .mixers = { alc880_fujitsu_mixer },
4351 .init_verbs = { alc880_volume_init_verbs,
4352 alc880_uniwill_p53_init_verbs,
4353 alc880_beep_init_verbs },
4354 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4355 .dac_nids = alc880_dac_nids,
4356 .dig_out_nid = ALC880_DIGOUT_NID,
4357 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4358 .channel_mode = alc880_2_jack_modes,
4359 .input_mux = &alc880_capture_source,
4360 .unsol_event = alc880_uniwill_p53_unsol_event,
4361 .setup = alc880_uniwill_p53_setup,
4362 .init_hook = alc_automute_amp,
4365 .mixers = { alc880_three_stack_mixer },
4366 .init_verbs = { alc880_volume_init_verbs,
4367 alc880_pin_clevo_init_verbs },
4368 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4369 .dac_nids = alc880_dac_nids,
4371 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4372 .channel_mode = alc880_threestack_modes,
4374 .input_mux = &alc880_capture_source,
4377 .mixers = { alc880_lg_mixer },
4378 .init_verbs = { alc880_volume_init_verbs,
4379 alc880_lg_init_verbs },
4380 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4381 .dac_nids = alc880_lg_dac_nids,
4382 .dig_out_nid = ALC880_DIGOUT_NID,
4383 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4384 .channel_mode = alc880_lg_ch_modes,
4386 .input_mux = &alc880_lg_capture_source,
4387 .unsol_event = alc_automute_amp_unsol_event,
4388 .setup = alc880_lg_setup,
4389 .init_hook = alc_automute_amp,
4390 #ifdef CONFIG_SND_HDA_POWER_SAVE
4391 .loopbacks = alc880_lg_loopbacks,
4395 .mixers = { alc880_lg_lw_mixer },
4396 .init_verbs = { alc880_volume_init_verbs,
4397 alc880_lg_lw_init_verbs },
4398 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4399 .dac_nids = alc880_dac_nids,
4400 .dig_out_nid = ALC880_DIGOUT_NID,
4401 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4402 .channel_mode = alc880_lg_lw_modes,
4403 .input_mux = &alc880_lg_lw_capture_source,
4404 .unsol_event = alc_automute_amp_unsol_event,
4405 .setup = alc880_lg_lw_setup,
4406 .init_hook = alc_automute_amp,
4408 [ALC880_MEDION_RIM] = {
4409 .mixers = { alc880_medion_rim_mixer },
4410 .init_verbs = { alc880_volume_init_verbs,
4411 alc880_medion_rim_init_verbs,
4412 alc_gpio2_init_verbs },
4413 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4414 .dac_nids = alc880_dac_nids,
4415 .dig_out_nid = ALC880_DIGOUT_NID,
4416 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4417 .channel_mode = alc880_2_jack_modes,
4418 .input_mux = &alc880_medion_rim_capture_source,
4419 .unsol_event = alc880_medion_rim_unsol_event,
4420 .setup = alc880_medion_rim_setup,
4421 .init_hook = alc880_medion_rim_automute,
4423 #ifdef CONFIG_SND_DEBUG
4425 .mixers = { alc880_test_mixer },
4426 .init_verbs = { alc880_test_init_verbs },
4427 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4428 .dac_nids = alc880_test_dac_nids,
4429 .dig_out_nid = ALC880_DIGOUT_NID,
4430 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4431 .channel_mode = alc880_test_modes,
4432 .input_mux = &alc880_test_capture_source,
4438 * Automatic parse of I/O pins from the BIOS configuration
4443 ALC_CTL_WIDGET_MUTE,
4446 static struct snd_kcontrol_new alc880_control_templates[] = {
4447 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4448 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4449 HDA_BIND_MUTE(NULL, 0, 0, 0),
4452 /* add dynamic controls */
4453 static int add_control(struct alc_spec *spec, int type, const char *name,
4456 struct snd_kcontrol_new *knew;
4458 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4459 knew = snd_array_new(&spec->kctls);
4462 *knew = alc880_control_templates[type];
4463 knew->name = kstrdup(name, GFP_KERNEL);
4466 if (get_amp_nid_(val))
4467 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4468 knew->private_value = val;
4472 static int add_control_with_pfx(struct alc_spec *spec, int type,
4473 const char *pfx, const char *dir,
4474 const char *sfx, unsigned long val)
4477 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4478 return add_control(spec, type, name, val);
4481 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4482 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4483 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4484 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4486 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4487 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4488 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4489 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4490 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4491 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4492 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4493 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4494 #define ALC880_PIN_CD_NID 0x1c
4496 /* fill in the dac_nids table from the parsed pin configuration */
4497 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4498 const struct auto_pin_cfg *cfg)
4504 memset(assigned, 0, sizeof(assigned));
4505 spec->multiout.dac_nids = spec->private_dac_nids;
4507 /* check the pins hardwired to audio widget */
4508 for (i = 0; i < cfg->line_outs; i++) {
4509 nid = cfg->line_out_pins[i];
4510 if (alc880_is_fixed_pin(nid)) {
4511 int idx = alc880_fixed_pin_idx(nid);
4512 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4516 /* left pins can be connect to any audio widget */
4517 for (i = 0; i < cfg->line_outs; i++) {
4518 nid = cfg->line_out_pins[i];
4519 if (alc880_is_fixed_pin(nid))
4521 /* search for an empty channel */
4522 for (j = 0; j < cfg->line_outs; j++) {
4524 spec->multiout.dac_nids[i] =
4525 alc880_idx_to_dac(j);
4531 spec->multiout.num_dacs = cfg->line_outs;
4535 /* add playback controls from the parsed DAC table */
4536 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4537 const struct auto_pin_cfg *cfg)
4539 static const char *chname[4] = {
4540 "Front", "Surround", NULL /*CLFE*/, "Side"
4545 for (i = 0; i < cfg->line_outs; i++) {
4546 if (!spec->multiout.dac_nids[i])
4548 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4551 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4553 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4557 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4559 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4563 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4565 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4569 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4571 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4577 if (cfg->line_outs == 1 &&
4578 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4582 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4583 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4587 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4588 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4597 /* add playback controls for speaker and HP outputs */
4598 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4607 if (alc880_is_fixed_pin(pin)) {
4608 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4609 /* specify the DAC as the extra output */
4610 if (!spec->multiout.hp_nid)
4611 spec->multiout.hp_nid = nid;
4613 spec->multiout.extra_out_nid[0] = nid;
4614 /* control HP volume/switch on the output mixer amp */
4615 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4616 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4617 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4620 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4621 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4624 } else if (alc880_is_multi_pin(pin)) {
4625 /* set manual connection */
4626 /* we have only a switch on HP-out PIN */
4627 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4628 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4635 /* create input playback/capture controls for the given pin */
4636 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4637 const char *ctlname,
4638 int idx, hda_nid_t mix_nid)
4642 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4643 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4646 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4647 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4653 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4655 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4656 return (pincap & AC_PINCAP_IN) != 0;
4659 /* create playback/capture controls for input pins */
4660 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4661 const struct auto_pin_cfg *cfg,
4663 hda_nid_t cap1, hda_nid_t cap2)
4665 struct alc_spec *spec = codec->spec;
4666 struct hda_input_mux *imux = &spec->private_imux[0];
4669 for (i = 0; i < AUTO_PIN_LAST; i++) {
4672 pin = cfg->input_pins[i];
4673 if (!alc_is_input_pin(codec, pin))
4677 idx = get_connection_index(codec, mixer, pin);
4679 err = new_analog_input(spec, pin,
4680 auto_pin_cfg_labels[i],
4689 idx = get_connection_index(codec, cap1, pin);
4690 if (idx < 0 && cap2)
4691 idx = get_connection_index(codec, cap2, pin);
4693 imux->items[imux->num_items].label =
4694 auto_pin_cfg_labels[i];
4695 imux->items[imux->num_items].index = idx;
4702 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4703 const struct auto_pin_cfg *cfg)
4705 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4708 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4709 unsigned int pin_type)
4711 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4714 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4718 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4719 hda_nid_t nid, int pin_type,
4722 alc_set_pin_output(codec, nid, pin_type);
4723 /* need the manual connection? */
4724 if (alc880_is_multi_pin(nid)) {
4725 struct alc_spec *spec = codec->spec;
4726 int idx = alc880_multi_pin_idx(nid);
4727 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4728 AC_VERB_SET_CONNECT_SEL,
4729 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4733 static int get_pin_type(int line_out_type)
4735 if (line_out_type == AUTO_PIN_HP_OUT)
4741 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4743 struct alc_spec *spec = codec->spec;
4746 for (i = 0; i < spec->autocfg.line_outs; i++) {
4747 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4748 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4749 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4753 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4755 struct alc_spec *spec = codec->spec;
4758 pin = spec->autocfg.speaker_pins[0];
4759 if (pin) /* connect to front */
4760 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4761 pin = spec->autocfg.hp_pins[0];
4762 if (pin) /* connect to front */
4763 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4766 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4768 struct alc_spec *spec = codec->spec;
4771 for (i = 0; i < AUTO_PIN_LAST; i++) {
4772 hda_nid_t nid = spec->autocfg.input_pins[i];
4773 if (alc_is_input_pin(codec, nid)) {
4774 alc_set_input_pin(codec, nid, i);
4775 if (nid != ALC880_PIN_CD_NID &&
4776 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4777 snd_hda_codec_write(codec, nid, 0,
4778 AC_VERB_SET_AMP_GAIN_MUTE,
4784 /* parse the BIOS configuration and set up the alc_spec */
4785 /* return 1 if successful, 0 if the proper config is not found,
4786 * or a negative error code
4788 static int alc880_parse_auto_config(struct hda_codec *codec)
4790 struct alc_spec *spec = codec->spec;
4792 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4794 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4798 if (!spec->autocfg.line_outs)
4799 return 0; /* can't find valid BIOS pin config */
4801 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4804 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4807 err = alc880_auto_create_extra_out(spec,
4808 spec->autocfg.speaker_pins[0],
4812 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4816 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4820 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4822 /* check multiple SPDIF-out (for recent codecs) */
4823 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4825 err = snd_hda_get_connections(codec,
4826 spec->autocfg.dig_out_pins[i],
4831 spec->multiout.dig_out_nid = dig_nid;
4833 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4834 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4836 spec->slave_dig_outs[i - 1] = dig_nid;
4839 if (spec->autocfg.dig_in_pin)
4840 spec->dig_in_nid = ALC880_DIGIN_NID;
4842 if (spec->kctls.list)
4843 add_mixer(spec, spec->kctls.list);
4845 add_verb(spec, alc880_volume_init_verbs);
4847 spec->num_mux_defs = 1;
4848 spec->input_mux = &spec->private_imux[0];
4850 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4855 /* additional initialization for auto-configuration model */
4856 static void alc880_auto_init(struct hda_codec *codec)
4858 struct alc_spec *spec = codec->spec;
4859 alc880_auto_init_multi_out(codec);
4860 alc880_auto_init_extra_out(codec);
4861 alc880_auto_init_analog_input(codec);
4862 if (spec->unsol_event)
4863 alc_inithook(codec);
4866 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4867 * one of two digital mic pins, e.g. on ALC272
4869 static void fixup_automic_adc(struct hda_codec *codec)
4871 struct alc_spec *spec = codec->spec;
4874 for (i = 0; i < spec->num_adc_nids; i++) {
4875 hda_nid_t cap = spec->capsrc_nids ?
4876 spec->capsrc_nids[i] : spec->adc_nids[i];
4879 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4882 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4885 spec->int_mic.mux_idx = iidx;
4886 spec->ext_mic.mux_idx = eidx;
4887 if (spec->capsrc_nids)
4888 spec->capsrc_nids += i;
4889 spec->adc_nids += i;
4890 spec->num_adc_nids = 1;
4893 snd_printd(KERN_INFO "hda_codec: %s: "
4894 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4895 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4896 spec->auto_mic = 0; /* disable auto-mic to be sure */
4899 static void set_capture_mixer(struct hda_codec *codec)
4901 struct alc_spec *spec = codec->spec;
4902 static struct snd_kcontrol_new *caps[2][3] = {
4903 { alc_capture_mixer_nosrc1,
4904 alc_capture_mixer_nosrc2,
4905 alc_capture_mixer_nosrc3 },
4906 { alc_capture_mixer1,
4908 alc_capture_mixer3 },
4910 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4912 if (spec->auto_mic) {
4914 fixup_automic_adc(codec);
4915 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4919 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4923 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4924 #define set_beep_amp(spec, nid, idx, dir) \
4925 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4927 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4931 * OK, here we have finally the patch for ALC880
4934 static int patch_alc880(struct hda_codec *codec)
4936 struct alc_spec *spec;
4940 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4946 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4949 if (board_config < 0) {
4950 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4952 board_config = ALC880_AUTO;
4955 if (board_config == ALC880_AUTO) {
4956 /* automatic parse from the BIOS config */
4957 err = alc880_parse_auto_config(codec);
4963 "hda_codec: Cannot set up configuration "
4964 "from BIOS. Using 3-stack mode...\n");
4965 board_config = ALC880_3ST;
4969 err = snd_hda_attach_beep_device(codec, 0x1);
4975 if (board_config != ALC880_AUTO)
4976 setup_preset(codec, &alc880_presets[board_config]);
4978 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4979 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4980 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4982 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4983 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4985 if (!spec->adc_nids && spec->input_mux) {
4986 /* check whether NID 0x07 is valid */
4987 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4989 wcap = get_wcaps_type(wcap);
4990 if (wcap != AC_WID_AUD_IN) {
4991 spec->adc_nids = alc880_adc_nids_alt;
4992 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4994 spec->adc_nids = alc880_adc_nids;
4995 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
4998 set_capture_mixer(codec);
4999 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5001 spec->vmaster_nid = 0x0c;
5003 codec->patch_ops = alc_patch_ops;
5004 if (board_config == ALC880_AUTO)
5005 spec->init_hook = alc880_auto_init;
5006 #ifdef CONFIG_SND_HDA_POWER_SAVE
5007 if (!spec->loopback.amplist)
5008 spec->loopback.amplist = alc880_loopbacks;
5010 codec->proc_widget_hook = print_realtek_coef;
5020 static hda_nid_t alc260_dac_nids[1] = {
5025 static hda_nid_t alc260_adc_nids[1] = {
5030 static hda_nid_t alc260_adc_nids_alt[1] = {
5035 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5036 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5038 static hda_nid_t alc260_dual_adc_nids[2] = {
5043 #define ALC260_DIGOUT_NID 0x03
5044 #define ALC260_DIGIN_NID 0x06
5046 static struct hda_input_mux alc260_capture_source = {
5050 { "Front Mic", 0x1 },
5056 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5057 * headphone jack and the internal CD lines since these are the only pins at
5058 * which audio can appear. For flexibility, also allow the option of
5059 * recording the mixer output on the second ADC (ADC0 doesn't have a
5060 * connection to the mixer output).
5062 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5066 { "Mic/Line", 0x0 },
5068 { "Headphone", 0x2 },
5074 { "Mic/Line", 0x0 },
5076 { "Headphone", 0x2 },
5083 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5084 * the Fujitsu S702x, but jacks are marked differently.
5086 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5093 { "Headphone", 0x5 },
5102 { "Headphone", 0x6 },
5108 /* Maxdata Favorit 100XS */
5109 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5113 { "Line/Mic", 0x0 },
5120 { "Line/Mic", 0x0 },
5128 * This is just place-holder, so there's something for alc_build_pcms to look
5129 * at when it calculates the maximum number of channels. ALC260 has no mixer
5130 * element which allows changing the channel mode, so the verb list is
5133 static struct hda_channel_mode alc260_modes[1] = {
5138 /* Mixer combinations
5140 * basic: base_output + input + pc_beep + capture
5141 * HP: base_output + input + capture_alt
5142 * HP_3013: hp_3013 + input + capture
5143 * fujitsu: fujitsu + capture
5144 * acer: acer + capture
5147 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5148 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5149 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5150 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5151 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5152 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5153 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5157 static struct snd_kcontrol_new alc260_input_mixer[] = {
5158 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5159 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5160 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5161 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5163 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5164 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5165 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5169 /* update HP, line and mono out pins according to the master switch */
5170 static void alc260_hp_master_update(struct hda_codec *codec,
5171 hda_nid_t hp, hda_nid_t line,
5174 struct alc_spec *spec = codec->spec;
5175 unsigned int val = spec->master_sw ? PIN_HP : 0;
5176 /* change HP and line-out pins */
5177 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5179 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5181 /* mono (speaker) depending on the HP jack sense */
5182 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5183 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5187 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5188 struct snd_ctl_elem_value *ucontrol)
5190 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5191 struct alc_spec *spec = codec->spec;
5192 *ucontrol->value.integer.value = spec->master_sw;
5196 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5197 struct snd_ctl_elem_value *ucontrol)
5199 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5200 struct alc_spec *spec = codec->spec;
5201 int val = !!*ucontrol->value.integer.value;
5202 hda_nid_t hp, line, mono;
5204 if (val == spec->master_sw)
5206 spec->master_sw = val;
5207 hp = (kcontrol->private_value >> 16) & 0xff;
5208 line = (kcontrol->private_value >> 8) & 0xff;
5209 mono = kcontrol->private_value & 0xff;
5210 alc260_hp_master_update(codec, hp, line, mono);
5214 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5217 .name = "Master Playback Switch",
5218 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5219 .info = snd_ctl_boolean_mono_info,
5220 .get = alc260_hp_master_sw_get,
5221 .put = alc260_hp_master_sw_put,
5222 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5224 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5225 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5227 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5228 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5230 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5234 static struct hda_verb alc260_hp_unsol_verbs[] = {
5235 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5239 static void alc260_hp_automute(struct hda_codec *codec)
5241 struct alc_spec *spec = codec->spec;
5243 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5244 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5247 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5249 if ((res >> 26) == ALC880_HP_EVENT)
5250 alc260_hp_automute(codec);
5253 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5255 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5256 .name = "Master Playback Switch",
5257 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5258 .info = snd_ctl_boolean_mono_info,
5259 .get = alc260_hp_master_sw_get,
5260 .put = alc260_hp_master_sw_put,
5261 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5263 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5264 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5265 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5266 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5267 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5269 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5270 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5274 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5275 .ops = &snd_hda_bind_vol,
5277 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5278 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5279 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5284 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5285 .ops = &snd_hda_bind_sw,
5287 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5288 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5293 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5294 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5295 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5296 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5297 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5301 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5306 static void alc260_hp_3013_automute(struct hda_codec *codec)
5308 struct alc_spec *spec = codec->spec;
5310 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5311 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5314 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5317 if ((res >> 26) == ALC880_HP_EVENT)
5318 alc260_hp_3013_automute(codec);
5321 static void alc260_hp_3012_automute(struct hda_codec *codec)
5323 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5325 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5327 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5329 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5333 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5336 if ((res >> 26) == ALC880_HP_EVENT)
5337 alc260_hp_3012_automute(codec);
5340 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5341 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5343 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5344 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5345 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5346 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5347 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5348 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5349 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5350 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5351 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5352 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5353 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5357 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5358 * versions of the ALC260 don't act on requests to enable mic bias from NID
5359 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5360 * datasheet doesn't mention this restriction. At this stage it's not clear
5361 * whether this behaviour is intentional or is a hardware bug in chip
5362 * revisions available in early 2006. Therefore for now allow the
5363 * "Headphone Jack Mode" control to span all choices, but if it turns out
5364 * that the lack of mic bias for this NID is intentional we could change the
5365 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5367 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5368 * don't appear to make the mic bias available from the "line" jack, even
5369 * though the NID used for this jack (0x14) can supply it. The theory is
5370 * that perhaps Acer have included blocking capacitors between the ALC260
5371 * and the output jack. If this turns out to be the case for all such
5372 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5373 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5375 * The C20x Tablet series have a mono internal speaker which is controlled
5376 * via the chip's Mono sum widget and pin complex, so include the necessary
5377 * controls for such models. On models without a "mono speaker" the control
5378 * won't do anything.
5380 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5381 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5382 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5383 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5384 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5386 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5388 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5389 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5390 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5391 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5392 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5393 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5394 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5395 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5399 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5401 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5402 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5403 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5404 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5405 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5406 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5407 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5411 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5412 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5414 static struct snd_kcontrol_new alc260_will_mixer[] = {
5415 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5416 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5417 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5418 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5419 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5420 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5421 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5422 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5423 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5424 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5428 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5429 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5431 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5432 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5433 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5434 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5435 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5436 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5437 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5438 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5439 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5440 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5441 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5446 * initialization verbs
5448 static struct hda_verb alc260_init_verbs[] = {
5449 /* Line In pin widget for input */
5450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5451 /* CD pin widget for input */
5452 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5453 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5454 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5455 /* Mic2 (front panel) pin widget for input and vref at 80% */
5456 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5457 /* LINE-2 is used for line-out in rear */
5458 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5459 /* select line-out */
5460 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5462 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5464 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5466 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5467 /* mute capture amp left and right */
5468 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5469 /* set connection select to line in (default select for this ADC) */
5470 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5471 /* mute capture amp left and right */
5472 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5473 /* set connection select to line in (default select for this ADC) */
5474 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5475 /* set vol=0 Line-Out mixer amp left and right */
5476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5477 /* unmute pin widget amp left and right (no gain on this amp) */
5478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5479 /* set vol=0 HP mixer amp left and right */
5480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5481 /* unmute pin widget amp left and right (no gain on this amp) */
5482 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5483 /* set vol=0 Mono mixer amp left and right */
5484 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5485 /* unmute pin widget amp left and right (no gain on this amp) */
5486 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5487 /* unmute LINE-2 out pin */
5488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5489 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5492 /* mute analog inputs */
5493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5494 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5495 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5498 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5499 /* mute Front out path */
5500 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5501 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5502 /* mute Headphone out path */
5503 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5504 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5505 /* mute Mono out path */
5506 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5507 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5511 #if 0 /* should be identical with alc260_init_verbs? */
5512 static struct hda_verb alc260_hp_init_verbs[] = {
5513 /* Headphone and output */
5514 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5516 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5517 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5518 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5519 /* Mic2 (front panel) pin widget for input and vref at 80% */
5520 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5521 /* Line In pin widget for input */
5522 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5523 /* Line-2 pin widget for output */
5524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5525 /* CD pin widget for input */
5526 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5527 /* unmute amp left and right */
5528 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5529 /* set connection select to line in (default select for this ADC) */
5530 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5531 /* unmute Line-Out mixer amp left and right (volume = 0) */
5532 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5533 /* mute pin widget amp left and right (no gain on this amp) */
5534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5535 /* unmute HP mixer amp left and right (volume = 0) */
5536 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5537 /* mute pin widget amp left and right (no gain on this amp) */
5538 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5539 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5542 /* mute analog inputs */
5543 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5548 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5549 /* Unmute Front out path */
5550 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5552 /* Unmute Headphone out path */
5553 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5555 /* Unmute Mono out path */
5556 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5562 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5563 /* Line out and output */
5564 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5566 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5567 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5568 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5569 /* Mic2 (front panel) pin widget for input and vref at 80% */
5570 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5571 /* Line In pin widget for input */
5572 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5573 /* Headphone pin widget for output */
5574 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5575 /* CD pin widget for input */
5576 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5577 /* unmute amp left and right */
5578 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5579 /* set connection select to line in (default select for this ADC) */
5580 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5581 /* unmute Line-Out mixer amp left and right (volume = 0) */
5582 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5583 /* mute pin widget amp left and right (no gain on this amp) */
5584 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5585 /* unmute HP mixer amp left and right (volume = 0) */
5586 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5587 /* mute pin widget amp left and right (no gain on this amp) */
5588 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5589 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5592 /* mute analog inputs */
5593 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5598 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5599 /* Unmute Front out path */
5600 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5602 /* Unmute Headphone out path */
5603 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5605 /* Unmute Mono out path */
5606 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5607 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5611 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5612 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5613 * audio = 0x16, internal speaker = 0x10.
5615 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5616 /* Disable all GPIOs */
5617 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5618 /* Internal speaker is connected to headphone pin */
5619 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5620 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5622 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5623 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5624 /* Ensure all other unused pins are disabled and muted. */
5625 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5626 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5627 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5628 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5629 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5630 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5632 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 /* Disable digital (SPDIF) pins */
5635 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5636 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5638 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5639 * when acting as an output.
5641 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5643 /* Start with output sum widgets muted and their output gains at min */
5644 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5646 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5647 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5649 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5650 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5651 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5652 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5654 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5655 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5656 /* Unmute Line1 pin widget output buffer since it starts as an output.
5657 * If the pin mode is changed by the user the pin mode control will
5658 * take care of enabling the pin's input/output buffers as needed.
5659 * Therefore there's no need to enable the input buffer at this
5662 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5663 /* Unmute input buffer of pin widget used for Line-in (no equiv
5666 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5668 /* Mute capture amp left and right */
5669 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5670 /* Set ADC connection select to match default mixer setting - line
5673 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5675 /* Do the same for the second ADC: mute capture input amp and
5676 * set ADC connection to line in (on mic1 pin)
5678 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5679 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5681 /* Mute all inputs to mixer widget (even unconnected ones) */
5682 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5683 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5684 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5694 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5695 * similar laptops (adapted from Fujitsu init verbs).
5697 static struct hda_verb alc260_acer_init_verbs[] = {
5698 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5699 * the headphone jack. Turn this on and rely on the standard mute
5700 * methods whenever the user wants to turn these outputs off.
5702 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5703 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5704 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5705 /* Internal speaker/Headphone jack is connected to Line-out pin */
5706 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5707 /* Internal microphone/Mic jack is connected to Mic1 pin */
5708 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5709 /* Line In jack is connected to Line1 pin */
5710 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5711 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5712 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5713 /* Ensure all other unused pins are disabled and muted. */
5714 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5715 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5716 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5717 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5718 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5719 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5720 /* Disable digital (SPDIF) pins */
5721 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5722 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5724 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5725 * bus when acting as outputs.
5727 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5728 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5730 /* Start with output sum widgets muted and their output gains at min */
5731 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5732 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5734 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5735 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5738 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5739 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5741 /* Unmute Line-out pin widget amp left and right
5742 * (no equiv mixer ctrl)
5744 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5745 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5746 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5747 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5748 * inputs. If the pin mode is changed by the user the pin mode control
5749 * will take care of enabling the pin's input/output buffers as needed.
5750 * Therefore there's no need to enable the input buffer at this
5753 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5756 /* Mute capture amp left and right */
5757 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5758 /* Set ADC connection select to match default mixer setting - mic
5761 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5763 /* Do similar with the second ADC: mute capture input amp and
5764 * set ADC connection to mic to match ALSA's default state.
5766 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5769 /* Mute all inputs to mixer widget (even unconnected ones) */
5770 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5771 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5772 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5782 /* Initialisation sequence for Maxdata Favorit 100XS
5783 * (adapted from Acer init verbs).
5785 static struct hda_verb alc260_favorit100_init_verbs[] = {
5786 /* GPIO 0 enables the output jack.
5787 * Turn this on and rely on the standard mute
5788 * methods whenever the user wants to turn these outputs off.
5790 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5791 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5792 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5793 /* Line/Mic input jack is connected to Mic1 pin */
5794 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5795 /* Ensure all other unused pins are disabled and muted. */
5796 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5797 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5798 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5799 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5800 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5801 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5803 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5806 /* Disable digital (SPDIF) pins */
5807 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5808 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5810 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5811 * bus when acting as outputs.
5813 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5814 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5816 /* Start with output sum widgets muted and their output gains at min */
5817 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5818 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5819 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5820 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5822 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5823 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5824 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5825 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5827 /* Unmute Line-out pin widget amp left and right
5828 * (no equiv mixer ctrl)
5830 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5831 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5832 * inputs. If the pin mode is changed by the user the pin mode control
5833 * will take care of enabling the pin's input/output buffers as needed.
5834 * Therefore there's no need to enable the input buffer at this
5837 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5839 /* Mute capture amp left and right */
5840 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5841 /* Set ADC connection select to match default mixer setting - mic
5844 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5846 /* Do similar with the second ADC: mute capture input amp and
5847 * set ADC connection to mic to match ALSA's default state.
5849 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5850 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5852 /* Mute all inputs to mixer widget (even unconnected ones) */
5853 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5854 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5855 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5865 static struct hda_verb alc260_will_verbs[] = {
5866 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5867 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5868 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5869 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5870 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5871 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5875 static struct hda_verb alc260_replacer_672v_verbs[] = {
5876 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5877 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5878 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5880 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5881 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5882 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5884 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5888 /* toggle speaker-output according to the hp-jack state */
5889 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5891 unsigned int present;
5893 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5894 present = snd_hda_jack_detect(codec, 0x0f);
5896 snd_hda_codec_write_cache(codec, 0x01, 0,
5897 AC_VERB_SET_GPIO_DATA, 1);
5898 snd_hda_codec_write_cache(codec, 0x0f, 0,
5899 AC_VERB_SET_PIN_WIDGET_CONTROL,
5902 snd_hda_codec_write_cache(codec, 0x01, 0,
5903 AC_VERB_SET_GPIO_DATA, 0);
5904 snd_hda_codec_write_cache(codec, 0x0f, 0,
5905 AC_VERB_SET_PIN_WIDGET_CONTROL,
5910 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5913 if ((res >> 26) == ALC880_HP_EVENT)
5914 alc260_replacer_672v_automute(codec);
5917 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5918 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5919 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5920 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5921 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5922 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5923 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5924 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5925 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5926 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5927 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5931 /* Test configuration for debugging, modelled after the ALC880 test
5934 #ifdef CONFIG_SND_DEBUG
5935 static hda_nid_t alc260_test_dac_nids[1] = {
5938 static hda_nid_t alc260_test_adc_nids[2] = {
5941 /* For testing the ALC260, each input MUX needs its own definition since
5942 * the signal assignments are different. This assumes that the first ADC
5945 static struct hda_input_mux alc260_test_capture_sources[2] = {
5949 { "MIC1 pin", 0x0 },
5950 { "MIC2 pin", 0x1 },
5951 { "LINE1 pin", 0x2 },
5952 { "LINE2 pin", 0x3 },
5954 { "LINE-OUT pin", 0x5 },
5955 { "HP-OUT pin", 0x6 },
5961 { "MIC1 pin", 0x0 },
5962 { "MIC2 pin", 0x1 },
5963 { "LINE1 pin", 0x2 },
5964 { "LINE2 pin", 0x3 },
5967 { "LINE-OUT pin", 0x6 },
5968 { "HP-OUT pin", 0x7 },
5972 static struct snd_kcontrol_new alc260_test_mixer[] = {
5973 /* Output driver widgets */
5974 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5975 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5976 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5977 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5978 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5979 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5981 /* Modes for retasking pin widgets
5982 * Note: the ALC260 doesn't seem to act on requests to enable mic
5983 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5984 * mention this restriction. At this stage it's not clear whether
5985 * this behaviour is intentional or is a hardware bug in chip
5986 * revisions available at least up until early 2006. Therefore for
5987 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5988 * choices, but if it turns out that the lack of mic bias for these
5989 * NIDs is intentional we could change their modes from
5990 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5992 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5993 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5994 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5995 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5996 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
5997 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
5999 /* Loopback mixer controls */
6000 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6001 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6002 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6003 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6004 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6005 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6006 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6007 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6008 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6009 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6010 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6011 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6012 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6013 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6015 /* Controls for GPIO pins, assuming they are configured as outputs */
6016 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6017 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6018 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6019 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6021 /* Switches to allow the digital IO pins to be enabled. The datasheet
6022 * is ambigious as to which NID is which; testing on laptops which
6023 * make this output available should provide clarification.
6025 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6026 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6028 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6029 * this output to turn on an external amplifier.
6031 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6032 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6036 static struct hda_verb alc260_test_init_verbs[] = {
6037 /* Enable all GPIOs as outputs with an initial value of 0 */
6038 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6039 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6040 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6042 /* Enable retasking pins as output, initially without power amp */
6043 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6044 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6045 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6046 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6047 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6048 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6050 /* Disable digital (SPDIF) pins initially, but users can enable
6051 * them via a mixer switch. In the case of SPDIF-out, this initverb
6052 * payload also sets the generation to 0, output to be in "consumer"
6053 * PCM format, copyright asserted, no pre-emphasis and no validity
6056 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6057 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6059 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6060 * OUT1 sum bus when acting as an output.
6062 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6063 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6064 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6065 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6067 /* Start with output sum widgets muted and their output gains at min */
6068 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6069 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6070 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6071 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6072 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6073 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6074 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6075 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6076 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6078 /* Unmute retasking pin widget output buffers since the default
6079 * state appears to be output. As the pin mode is changed by the
6080 * user the pin mode control will take care of enabling the pin's
6081 * input/output buffers as needed.
6083 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6085 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6086 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6087 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6088 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6089 /* Also unmute the mono-out pin widget */
6090 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6092 /* Mute capture amp left and right */
6093 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6094 /* Set ADC connection select to match default mixer setting (mic1
6097 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6099 /* Do the same for the second ADC: mute capture input amp and
6100 * set ADC connection to mic1 pin
6102 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6103 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6105 /* Mute all inputs to mixer widget (even unconnected ones) */
6106 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6119 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6120 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6122 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6123 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6126 * for BIOS auto-configuration
6129 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6130 const char *pfx, int *vol_bits)
6133 unsigned long vol_val, sw_val;
6136 if (nid >= 0x0f && nid < 0x11) {
6137 nid_vol = nid - 0x7;
6138 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6139 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6140 } else if (nid == 0x11) {
6141 nid_vol = nid - 0x7;
6142 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6143 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6144 } else if (nid >= 0x12 && nid <= 0x15) {
6146 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6147 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6151 if (!(*vol_bits & (1 << nid_vol))) {
6152 /* first control for the volume widget */
6153 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6156 *vol_bits |= (1 << nid_vol);
6158 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6164 /* add playback controls from the parsed DAC table */
6165 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6166 const struct auto_pin_cfg *cfg)
6172 spec->multiout.num_dacs = 1;
6173 spec->multiout.dac_nids = spec->private_dac_nids;
6174 spec->multiout.dac_nids[0] = 0x02;
6176 nid = cfg->line_out_pins[0];
6179 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6181 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6185 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6190 nid = cfg->speaker_pins[0];
6192 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6197 nid = cfg->hp_pins[0];
6199 err = alc260_add_playback_controls(spec, nid, "Headphone",
6207 /* create playback/capture controls for input pins */
6208 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6209 const struct auto_pin_cfg *cfg)
6211 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6214 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6215 hda_nid_t nid, int pin_type,
6218 alc_set_pin_output(codec, nid, pin_type);
6219 /* need the manual connection? */
6221 int idx = nid - 0x12;
6222 snd_hda_codec_write(codec, idx + 0x0b, 0,
6223 AC_VERB_SET_CONNECT_SEL, sel_idx);
6227 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6229 struct alc_spec *spec = codec->spec;
6232 nid = spec->autocfg.line_out_pins[0];
6234 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6235 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6238 nid = spec->autocfg.speaker_pins[0];
6240 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6242 nid = spec->autocfg.hp_pins[0];
6244 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6247 #define ALC260_PIN_CD_NID 0x16
6248 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6250 struct alc_spec *spec = codec->spec;
6253 for (i = 0; i < AUTO_PIN_LAST; i++) {
6254 hda_nid_t nid = spec->autocfg.input_pins[i];
6256 alc_set_input_pin(codec, nid, i);
6257 if (nid != ALC260_PIN_CD_NID &&
6258 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6259 snd_hda_codec_write(codec, nid, 0,
6260 AC_VERB_SET_AMP_GAIN_MUTE,
6267 * generic initialization of ADC, input mixers and output mixers
6269 static struct hda_verb alc260_volume_init_verbs[] = {
6271 * Unmute ADC0-1 and set the default input to mic-in
6273 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6274 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6275 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6276 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6278 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6280 * Note: PASD motherboards uses the Line In 2 as the input for
6281 * front panel mic (mic 2)
6283 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6284 /* mute analog inputs */
6285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6292 * Set up output mixers (0x08 - 0x0a)
6294 /* set vol=0 to output mixers */
6295 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6296 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6297 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6298 /* set up input amps for analog loopback */
6299 /* Amp Indices: DAC = 0, mixer = 1 */
6300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6303 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6304 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6305 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6310 static int alc260_parse_auto_config(struct hda_codec *codec)
6312 struct alc_spec *spec = codec->spec;
6314 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6316 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6320 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6323 if (!spec->kctls.list)
6324 return 0; /* can't find valid BIOS pin config */
6325 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6329 spec->multiout.max_channels = 2;
6331 if (spec->autocfg.dig_outs)
6332 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6333 if (spec->kctls.list)
6334 add_mixer(spec, spec->kctls.list);
6336 add_verb(spec, alc260_volume_init_verbs);
6338 spec->num_mux_defs = 1;
6339 spec->input_mux = &spec->private_imux[0];
6341 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6346 /* additional initialization for auto-configuration model */
6347 static void alc260_auto_init(struct hda_codec *codec)
6349 struct alc_spec *spec = codec->spec;
6350 alc260_auto_init_multi_out(codec);
6351 alc260_auto_init_analog_input(codec);
6352 if (spec->unsol_event)
6353 alc_inithook(codec);
6356 #ifdef CONFIG_SND_HDA_POWER_SAVE
6357 static struct hda_amp_list alc260_loopbacks[] = {
6358 { 0x07, HDA_INPUT, 0 },
6359 { 0x07, HDA_INPUT, 1 },
6360 { 0x07, HDA_INPUT, 2 },
6361 { 0x07, HDA_INPUT, 3 },
6362 { 0x07, HDA_INPUT, 4 },
6368 * ALC260 configurations
6370 static const char *alc260_models[ALC260_MODEL_LAST] = {
6371 [ALC260_BASIC] = "basic",
6373 [ALC260_HP_3013] = "hp-3013",
6374 [ALC260_HP_DC7600] = "hp-dc7600",
6375 [ALC260_FUJITSU_S702X] = "fujitsu",
6376 [ALC260_ACER] = "acer",
6377 [ALC260_WILL] = "will",
6378 [ALC260_REPLACER_672V] = "replacer",
6379 [ALC260_FAVORIT100] = "favorit100",
6380 #ifdef CONFIG_SND_DEBUG
6381 [ALC260_TEST] = "test",
6383 [ALC260_AUTO] = "auto",
6386 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6387 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6388 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6389 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6390 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6391 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6392 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6393 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6394 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6395 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6396 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6397 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6398 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6399 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6400 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6401 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6402 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6403 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6404 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6405 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6406 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6410 static struct alc_config_preset alc260_presets[] = {
6412 .mixers = { alc260_base_output_mixer,
6413 alc260_input_mixer },
6414 .init_verbs = { alc260_init_verbs },
6415 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6416 .dac_nids = alc260_dac_nids,
6417 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6418 .adc_nids = alc260_adc_nids,
6419 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6420 .channel_mode = alc260_modes,
6421 .input_mux = &alc260_capture_source,
6424 .mixers = { alc260_hp_output_mixer,
6425 alc260_input_mixer },
6426 .init_verbs = { alc260_init_verbs,
6427 alc260_hp_unsol_verbs },
6428 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6429 .dac_nids = alc260_dac_nids,
6430 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6431 .adc_nids = alc260_adc_nids_alt,
6432 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6433 .channel_mode = alc260_modes,
6434 .input_mux = &alc260_capture_source,
6435 .unsol_event = alc260_hp_unsol_event,
6436 .init_hook = alc260_hp_automute,
6438 [ALC260_HP_DC7600] = {
6439 .mixers = { alc260_hp_dc7600_mixer,
6440 alc260_input_mixer },
6441 .init_verbs = { alc260_init_verbs,
6442 alc260_hp_dc7600_verbs },
6443 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6444 .dac_nids = alc260_dac_nids,
6445 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6446 .adc_nids = alc260_adc_nids_alt,
6447 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6448 .channel_mode = alc260_modes,
6449 .input_mux = &alc260_capture_source,
6450 .unsol_event = alc260_hp_3012_unsol_event,
6451 .init_hook = alc260_hp_3012_automute,
6453 [ALC260_HP_3013] = {
6454 .mixers = { alc260_hp_3013_mixer,
6455 alc260_input_mixer },
6456 .init_verbs = { alc260_hp_3013_init_verbs,
6457 alc260_hp_3013_unsol_verbs },
6458 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6459 .dac_nids = alc260_dac_nids,
6460 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6461 .adc_nids = alc260_adc_nids_alt,
6462 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6463 .channel_mode = alc260_modes,
6464 .input_mux = &alc260_capture_source,
6465 .unsol_event = alc260_hp_3013_unsol_event,
6466 .init_hook = alc260_hp_3013_automute,
6468 [ALC260_FUJITSU_S702X] = {
6469 .mixers = { alc260_fujitsu_mixer },
6470 .init_verbs = { alc260_fujitsu_init_verbs },
6471 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6472 .dac_nids = alc260_dac_nids,
6473 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6474 .adc_nids = alc260_dual_adc_nids,
6475 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6476 .channel_mode = alc260_modes,
6477 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6478 .input_mux = alc260_fujitsu_capture_sources,
6481 .mixers = { alc260_acer_mixer },
6482 .init_verbs = { alc260_acer_init_verbs },
6483 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6484 .dac_nids = alc260_dac_nids,
6485 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6486 .adc_nids = alc260_dual_adc_nids,
6487 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6488 .channel_mode = alc260_modes,
6489 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6490 .input_mux = alc260_acer_capture_sources,
6492 [ALC260_FAVORIT100] = {
6493 .mixers = { alc260_favorit100_mixer },
6494 .init_verbs = { alc260_favorit100_init_verbs },
6495 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6496 .dac_nids = alc260_dac_nids,
6497 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6498 .adc_nids = alc260_dual_adc_nids,
6499 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6500 .channel_mode = alc260_modes,
6501 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6502 .input_mux = alc260_favorit100_capture_sources,
6505 .mixers = { alc260_will_mixer },
6506 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6507 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6508 .dac_nids = alc260_dac_nids,
6509 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6510 .adc_nids = alc260_adc_nids,
6511 .dig_out_nid = ALC260_DIGOUT_NID,
6512 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6513 .channel_mode = alc260_modes,
6514 .input_mux = &alc260_capture_source,
6516 [ALC260_REPLACER_672V] = {
6517 .mixers = { alc260_replacer_672v_mixer },
6518 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6519 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6520 .dac_nids = alc260_dac_nids,
6521 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6522 .adc_nids = alc260_adc_nids,
6523 .dig_out_nid = ALC260_DIGOUT_NID,
6524 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6525 .channel_mode = alc260_modes,
6526 .input_mux = &alc260_capture_source,
6527 .unsol_event = alc260_replacer_672v_unsol_event,
6528 .init_hook = alc260_replacer_672v_automute,
6530 #ifdef CONFIG_SND_DEBUG
6532 .mixers = { alc260_test_mixer },
6533 .init_verbs = { alc260_test_init_verbs },
6534 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6535 .dac_nids = alc260_test_dac_nids,
6536 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6537 .adc_nids = alc260_test_adc_nids,
6538 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6539 .channel_mode = alc260_modes,
6540 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6541 .input_mux = alc260_test_capture_sources,
6546 static int patch_alc260(struct hda_codec *codec)
6548 struct alc_spec *spec;
6549 int err, board_config;
6551 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6557 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6560 if (board_config < 0) {
6561 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6563 board_config = ALC260_AUTO;
6566 if (board_config == ALC260_AUTO) {
6567 /* automatic parse from the BIOS config */
6568 err = alc260_parse_auto_config(codec);
6574 "hda_codec: Cannot set up configuration "
6575 "from BIOS. Using base mode...\n");
6576 board_config = ALC260_BASIC;
6580 err = snd_hda_attach_beep_device(codec, 0x1);
6586 if (board_config != ALC260_AUTO)
6587 setup_preset(codec, &alc260_presets[board_config]);
6589 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6590 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6592 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6593 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6595 if (!spec->adc_nids && spec->input_mux) {
6596 /* check whether NID 0x04 is valid */
6597 unsigned int wcap = get_wcaps(codec, 0x04);
6598 wcap = get_wcaps_type(wcap);
6600 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6601 spec->adc_nids = alc260_adc_nids_alt;
6602 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6604 spec->adc_nids = alc260_adc_nids;
6605 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6608 set_capture_mixer(codec);
6609 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6611 spec->vmaster_nid = 0x08;
6613 codec->patch_ops = alc_patch_ops;
6614 if (board_config == ALC260_AUTO)
6615 spec->init_hook = alc260_auto_init;
6616 #ifdef CONFIG_SND_HDA_POWER_SAVE
6617 if (!spec->loopback.amplist)
6618 spec->loopback.amplist = alc260_loopbacks;
6620 codec->proc_widget_hook = print_realtek_coef;
6627 * ALC882/883/885/888/889 support
6629 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6630 * configuration. Each pin widget can choose any input DACs and a mixer.
6631 * Each ADC is connected from a mixer of all inputs. This makes possible
6632 * 6-channel independent captures.
6634 * In addition, an independent DAC for the multi-playback (not used in this
6637 #define ALC882_DIGOUT_NID 0x06
6638 #define ALC882_DIGIN_NID 0x0a
6639 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6640 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6641 #define ALC1200_DIGOUT_NID 0x10
6644 static struct hda_channel_mode alc882_ch_modes[1] = {
6649 static hda_nid_t alc882_dac_nids[4] = {
6650 /* front, rear, clfe, rear_surr */
6651 0x02, 0x03, 0x04, 0x05
6653 #define alc883_dac_nids alc882_dac_nids
6656 #define alc882_adc_nids alc880_adc_nids
6657 #define alc882_adc_nids_alt alc880_adc_nids_alt
6658 #define alc883_adc_nids alc882_adc_nids_alt
6659 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6660 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6661 #define alc889_adc_nids alc880_adc_nids
6663 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6664 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6665 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6666 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6667 #define alc889_capsrc_nids alc882_capsrc_nids
6670 /* FIXME: should be a matrix-type input source selection */
6672 static struct hda_input_mux alc882_capture_source = {
6676 { "Front Mic", 0x1 },
6682 #define alc883_capture_source alc882_capture_source
6684 static struct hda_input_mux alc889_capture_source = {
6687 { "Front Mic", 0x0 },
6693 static struct hda_input_mux mb5_capture_source = {
6702 static struct hda_input_mux alc883_3stack_6ch_intel = {
6706 { "Front Mic", 0x0 },
6712 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6720 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6730 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6738 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6742 { "Front Mic", 0x1 },
6747 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6755 static struct hda_input_mux alc889A_mb31_capture_source = {
6759 /* Front Mic (0x01) unused */
6761 /* Line 2 (0x03) unused */
6762 /* CD (0x04) unused? */
6769 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6776 static struct hda_verb alc882_3ST_ch2_init[] = {
6777 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6778 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6779 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6780 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6787 static struct hda_verb alc882_3ST_ch4_init[] = {
6788 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6789 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6790 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6791 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6792 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6799 static struct hda_verb alc882_3ST_ch6_init[] = {
6800 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6801 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6802 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6803 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6804 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6805 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6809 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6810 { 2, alc882_3ST_ch2_init },
6811 { 4, alc882_3ST_ch4_init },
6812 { 6, alc882_3ST_ch6_init },
6815 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6820 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6821 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6822 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6823 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6824 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6825 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6832 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6833 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6834 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6835 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6837 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6838 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6845 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6846 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6847 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6848 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6849 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6850 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6851 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6852 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6856 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6857 { 2, alc883_3ST_ch2_clevo_init },
6858 { 4, alc883_3ST_ch4_clevo_init },
6859 { 6, alc883_3ST_ch6_clevo_init },
6866 static struct hda_verb alc882_sixstack_ch6_init[] = {
6867 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6868 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6869 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6870 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6877 static struct hda_verb alc882_sixstack_ch8_init[] = {
6878 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6879 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6880 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6881 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6885 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6886 { 6, alc882_sixstack_ch6_init },
6887 { 8, alc882_sixstack_ch8_init },
6891 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6897 static struct hda_verb alc885_mbp_ch2_init[] = {
6898 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6899 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6900 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6907 static struct hda_verb alc885_mbp_ch4_init[] = {
6908 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6909 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6910 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6911 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6912 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6916 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6917 { 2, alc885_mbp_ch2_init },
6918 { 4, alc885_mbp_ch4_init },
6923 * Speakers/Woofer/HP = Front
6926 static struct hda_verb alc885_mb5_ch2_init[] = {
6927 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6928 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6934 * Speakers/HP = Front
6938 static struct hda_verb alc885_mb5_ch6_init[] = {
6939 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6945 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6946 { 2, alc885_mb5_ch2_init },
6947 { 6, alc885_mb5_ch6_init },
6954 static struct hda_verb alc883_4ST_ch2_init[] = {
6955 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6956 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6957 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6958 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6959 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6960 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6967 static struct hda_verb alc883_4ST_ch4_init[] = {
6968 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6969 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6970 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6971 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6972 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6973 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6974 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6981 static struct hda_verb alc883_4ST_ch6_init[] = {
6982 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6983 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6984 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6985 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6986 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6987 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6989 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6996 static struct hda_verb alc883_4ST_ch8_init[] = {
6997 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6998 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6999 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7000 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7001 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7002 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7003 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7005 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7009 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7010 { 2, alc883_4ST_ch2_init },
7011 { 4, alc883_4ST_ch4_init },
7012 { 6, alc883_4ST_ch6_init },
7013 { 8, alc883_4ST_ch8_init },
7020 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7021 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7022 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7023 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7024 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7031 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7032 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7033 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7034 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7036 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7043 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7044 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7045 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7046 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7047 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7048 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7049 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7053 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7054 { 2, alc883_3ST_ch2_intel_init },
7055 { 4, alc883_3ST_ch4_intel_init },
7056 { 6, alc883_3ST_ch6_intel_init },
7062 static struct hda_verb alc889_ch2_intel_init[] = {
7063 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7064 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7065 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7066 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7067 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7068 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7075 static struct hda_verb alc889_ch6_intel_init[] = {
7076 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7077 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7078 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7079 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7080 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7081 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7088 static struct hda_verb alc889_ch8_intel_init[] = {
7089 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7090 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7091 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7092 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7093 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7094 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7095 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7099 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7100 { 2, alc889_ch2_intel_init },
7101 { 6, alc889_ch6_intel_init },
7102 { 8, alc889_ch8_intel_init },
7108 static struct hda_verb alc883_sixstack_ch6_init[] = {
7109 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7110 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7111 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7112 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7119 static struct hda_verb alc883_sixstack_ch8_init[] = {
7120 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7121 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7122 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7123 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7127 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7128 { 6, alc883_sixstack_ch6_init },
7129 { 8, alc883_sixstack_ch8_init },
7133 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7134 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7136 static struct snd_kcontrol_new alc882_base_mixer[] = {
7137 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7138 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7139 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7140 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7141 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7143 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7144 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7145 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7146 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7148 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7149 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7150 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7151 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7152 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7153 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7154 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7156 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7157 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7161 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7162 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7163 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7164 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7165 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7166 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7167 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7168 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7169 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7170 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7171 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7172 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7176 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7177 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7178 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7179 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7180 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7181 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7182 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7183 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7184 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7186 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7188 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7194 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7195 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7196 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7197 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7198 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7199 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7200 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7202 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7208 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7209 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7210 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7221 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7225 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7226 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7227 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7228 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7231 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7232 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7233 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7238 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7239 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7241 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7242 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7243 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7244 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7245 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7250 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7251 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7258 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7262 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7263 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7264 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7265 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7267 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7272 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7275 .name = "Channel Mode",
7276 .info = alc_ch_mode_info,
7277 .get = alc_ch_mode_get,
7278 .put = alc_ch_mode_put,
7283 static struct hda_verb alc882_base_init_verbs[] = {
7284 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7285 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7286 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7289 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7290 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7291 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7293 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7294 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7295 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7298 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7299 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7301 /* mute analog input loopbacks */
7302 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7303 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7304 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7308 /* Front Pin: output 0 (0x0c) */
7309 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7310 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7311 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7312 /* Rear Pin: output 1 (0x0d) */
7313 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7314 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7315 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7316 /* CLFE Pin: output 2 (0x0e) */
7317 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7318 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7319 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7320 /* Side Pin: output 3 (0x0f) */
7321 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7322 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7323 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7324 /* Mic (rear) pin: input vref at 80% */
7325 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7327 /* Front Mic pin: input vref at 80% */
7328 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7329 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7330 /* Line In pin: input */
7331 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7332 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7333 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7334 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7335 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7336 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7337 /* CD pin widget for input */
7338 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7340 /* FIXME: use matrix-type input source selection */
7341 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7352 /* ADC2: mute amp left and right */
7353 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7354 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7355 /* ADC3: mute amp left and right */
7356 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7357 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7362 static struct hda_verb alc882_adc1_init_verbs[] = {
7363 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7366 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7368 /* ADC1: mute amp left and right */
7369 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7370 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7374 static struct hda_verb alc882_eapd_verbs[] = {
7375 /* change to EAPD mode */
7376 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7377 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7381 static struct hda_verb alc889_eapd_verbs[] = {
7382 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7383 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7387 static struct hda_verb alc_hp15_unsol_verbs[] = {
7388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7393 static struct hda_verb alc885_init_verbs[] = {
7394 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7395 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7401 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7403 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7408 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7411 /* mute analog input loopbacks */
7412 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7413 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7414 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7416 /* Front HP Pin: output 0 (0x0c) */
7417 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7418 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7419 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7420 /* Front Pin: output 0 (0x0c) */
7421 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7422 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7423 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7424 /* Rear Pin: output 1 (0x0d) */
7425 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7427 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7428 /* CLFE Pin: output 2 (0x0e) */
7429 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7430 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7431 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7432 /* Side Pin: output 3 (0x0f) */
7433 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7434 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7435 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7436 /* Mic (rear) pin: input vref at 80% */
7437 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7438 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7439 /* Front Mic pin: input vref at 80% */
7440 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7441 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7442 /* Line In pin: input */
7443 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7444 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7446 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7448 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7452 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7453 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7454 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7459 /* ADC2: mute amp left and right */
7460 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7461 /* ADC3: mute amp left and right */
7462 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7467 static struct hda_verb alc885_init_input_verbs[] = {
7468 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7469 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7470 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7475 /* Unmute Selector 24h and set the default input to front mic */
7476 static struct hda_verb alc889_init_input_verbs[] = {
7477 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7483 #define alc883_init_verbs alc882_base_init_verbs
7486 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7487 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7488 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7489 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7490 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7491 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7492 /* FIXME: this looks suspicious...
7493 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7494 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7499 static struct hda_verb alc882_macpro_init_verbs[] = {
7500 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7504 /* Front Pin: output 0 (0x0c) */
7505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7506 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7507 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7508 /* Front Mic pin: input vref at 80% */
7509 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7510 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7511 /* Speaker: output */
7512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7513 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7514 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7515 /* Headphone output (output 0 - 0x0c) */
7516 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7517 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7518 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7520 /* FIXME: use matrix-type input source selection */
7521 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7522 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7523 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7524 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7525 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7528 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7529 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7530 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7533 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7534 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7535 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7537 /* ADC1: mute amp left and right */
7538 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7539 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7540 /* ADC2: mute amp left and right */
7541 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7542 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7543 /* ADC3: mute amp left and right */
7544 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7545 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7551 static struct hda_verb alc885_mb5_init_verbs[] = {
7553 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7554 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7555 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7556 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7560 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7561 /* Surround mixer */
7562 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7567 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7568 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7570 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7571 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7572 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7573 /* Front Pin (0x0c) */
7574 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7575 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7576 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7577 /* LFE Pin (0x0e) */
7578 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7579 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7580 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7585 /* Front Mic pin: input vref at 80% */
7586 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7587 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7589 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7590 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7592 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7593 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7594 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7599 /* Macbook Pro rev3 */
7600 static struct hda_verb alc885_mbp3_init_verbs[] = {
7601 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7602 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7603 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7604 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7606 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7607 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7608 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7610 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7611 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7612 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7613 /* Front Pin: output 0 (0x0c) */
7614 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7615 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7616 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7617 /* HP Pin: output 0 (0x0e) */
7618 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7619 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7620 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7621 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7622 /* Mic (rear) pin: input vref at 80% */
7623 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7625 /* Front Mic pin: input vref at 80% */
7626 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7628 /* Line In pin: use output 1 when in LineOut mode */
7629 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7630 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7631 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7633 /* FIXME: use matrix-type input source selection */
7634 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7635 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7636 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7637 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7638 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7641 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7642 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7643 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7646 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7647 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7648 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7650 /* ADC1: mute amp left and right */
7651 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7652 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7653 /* ADC2: mute amp left and right */
7654 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7655 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7656 /* ADC3: mute amp left and right */
7657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7658 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7664 static struct hda_verb alc885_imac91_init_verbs[] = {
7665 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7666 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7667 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7668 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7670 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7671 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7672 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7673 /* HP Pin: output 0 (0x0c) */
7674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7675 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7676 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7677 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7678 /* Internal Speakers: output 0 (0x0d) */
7679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7680 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7681 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7682 /* Mic (rear) pin: input vref at 80% */
7683 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7684 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7685 /* Front Mic pin: input vref at 80% */
7686 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7687 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7688 /* Line In pin: use output 1 when in LineOut mode */
7689 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7690 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7691 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7693 /* FIXME: use matrix-type input source selection */
7694 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7695 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7696 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7697 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7698 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7701 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7702 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7703 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7708 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7710 /* ADC1: mute amp left and right */
7711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7712 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7713 /* ADC2: mute amp left and right */
7714 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7715 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7716 /* ADC3: mute amp left and right */
7717 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7718 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7723 /* iMac 24 mixer. */
7724 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7725 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7726 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7730 /* iMac 24 init verbs. */
7731 static struct hda_verb alc885_imac24_init_verbs[] = {
7732 /* Internal speakers: output 0 (0x0c) */
7733 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7734 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7735 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7736 /* Internal speakers: output 0 (0x0c) */
7737 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7738 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7739 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7740 /* Headphone: output 0 (0x0c) */
7741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7743 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7744 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7745 /* Front Mic: input vref at 80% */
7746 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7747 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7751 /* Toggle speaker-output according to the hp-jack state */
7752 static void alc885_imac24_setup(struct hda_codec *codec)
7754 struct alc_spec *spec = codec->spec;
7756 spec->autocfg.hp_pins[0] = 0x14;
7757 spec->autocfg.speaker_pins[0] = 0x18;
7758 spec->autocfg.speaker_pins[1] = 0x1a;
7761 static void alc885_mbp3_setup(struct hda_codec *codec)
7763 struct alc_spec *spec = codec->spec;
7765 spec->autocfg.hp_pins[0] = 0x15;
7766 spec->autocfg.speaker_pins[0] = 0x14;
7769 static void alc885_imac91_automute(struct hda_codec *codec)
7771 unsigned int present;
7773 present = snd_hda_codec_read(codec, 0x14, 0,
7774 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7775 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7776 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7777 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7778 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7782 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7785 /* Headphone insertion or removal. */
7786 if ((res >> 26) == ALC880_HP_EVENT)
7787 alc885_imac91_automute(codec);
7790 static struct hda_verb alc882_targa_verbs[] = {
7791 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7792 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7794 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7795 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7797 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7798 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7799 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7801 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7805 /* toggle speaker-output according to the hp-jack state */
7806 static void alc882_targa_automute(struct hda_codec *codec)
7808 struct alc_spec *spec = codec->spec;
7809 alc_automute_amp(codec);
7810 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7811 spec->jack_present ? 1 : 3);
7814 static void alc882_targa_setup(struct hda_codec *codec)
7816 struct alc_spec *spec = codec->spec;
7818 spec->autocfg.hp_pins[0] = 0x14;
7819 spec->autocfg.speaker_pins[0] = 0x1b;
7822 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7824 if ((res >> 26) == ALC880_HP_EVENT)
7825 alc882_targa_automute(codec);
7828 static struct hda_verb alc882_asus_a7j_verbs[] = {
7829 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7830 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7832 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7833 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7834 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7836 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7837 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7838 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7840 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7841 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7842 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7846 static struct hda_verb alc882_asus_a7m_verbs[] = {
7847 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7848 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7850 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7851 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7852 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7854 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7855 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7856 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7858 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7859 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7860 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7864 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7866 unsigned int gpiostate, gpiomask, gpiodir;
7868 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7869 AC_VERB_GET_GPIO_DATA, 0);
7872 gpiostate |= (1 << pin);
7874 gpiostate &= ~(1 << pin);
7876 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7877 AC_VERB_GET_GPIO_MASK, 0);
7878 gpiomask |= (1 << pin);
7880 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7881 AC_VERB_GET_GPIO_DIRECTION, 0);
7882 gpiodir |= (1 << pin);
7885 snd_hda_codec_write(codec, codec->afg, 0,
7886 AC_VERB_SET_GPIO_MASK, gpiomask);
7887 snd_hda_codec_write(codec, codec->afg, 0,
7888 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7892 snd_hda_codec_write(codec, codec->afg, 0,
7893 AC_VERB_SET_GPIO_DATA, gpiostate);
7896 /* set up GPIO at initialization */
7897 static void alc885_macpro_init_hook(struct hda_codec *codec)
7899 alc882_gpio_mute(codec, 0, 0);
7900 alc882_gpio_mute(codec, 1, 0);
7903 /* set up GPIO and update auto-muting at initialization */
7904 static void alc885_imac24_init_hook(struct hda_codec *codec)
7906 alc885_macpro_init_hook(codec);
7907 alc_automute_amp(codec);
7911 * generic initialization of ADC, input mixers and output mixers
7913 static struct hda_verb alc883_auto_init_verbs[] = {
7915 * Unmute ADC0-2 and set the default input to mic-in
7917 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7918 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7919 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7920 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7924 * Note: PASD motherboards uses the Line In 2 as the input for
7925 * front panel mic (mic 2)
7927 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7928 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7929 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7930 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7935 * Set up output mixers (0x0c - 0x0f)
7937 /* set vol=0 to output mixers */
7938 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7939 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7941 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7942 /* set up input amps for analog loopback */
7943 /* Amp Indices: DAC = 0, mixer = 1 */
7944 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7947 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7948 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7949 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7950 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7951 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7952 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7953 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7955 /* FIXME: use matrix-type input source selection */
7956 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7958 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7959 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7960 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7963 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7964 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7965 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7971 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7972 static struct hda_verb alc889A_mb31_ch2_init[] = {
7973 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7974 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7980 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7981 static struct hda_verb alc889A_mb31_ch4_init[] = {
7982 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7983 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7984 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7985 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7989 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7990 static struct hda_verb alc889A_mb31_ch5_init[] = {
7991 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7992 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7993 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7994 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7998 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
7999 static struct hda_verb alc889A_mb31_ch6_init[] = {
8000 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8002 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8003 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8007 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8008 { 2, alc889A_mb31_ch2_init },
8009 { 4, alc889A_mb31_ch4_init },
8010 { 5, alc889A_mb31_ch5_init },
8011 { 6, alc889A_mb31_ch6_init },
8014 static struct hda_verb alc883_medion_eapd_verbs[] = {
8015 /* eanable EAPD on medion laptop */
8016 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8017 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8021 #define alc883_base_mixer alc882_base_mixer
8023 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8024 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8025 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8026 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8027 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8029 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8030 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8032 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8033 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8036 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8040 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8041 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8042 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8043 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8044 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8045 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8046 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8047 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8050 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8054 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8055 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8056 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8057 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8058 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8059 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8064 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8068 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8069 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8070 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8071 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8072 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8073 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8074 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8075 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8076 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8078 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8081 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8085 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8087 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8088 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8089 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8090 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8091 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8092 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8093 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8094 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8095 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8096 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8098 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8099 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8104 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8108 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8109 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8111 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8112 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8113 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8115 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8116 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8117 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8119 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8120 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8122 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8125 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8128 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8132 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8133 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8134 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8135 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8136 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8137 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8143 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8144 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8146 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8149 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8152 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8156 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8157 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8158 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8159 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8160 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8161 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8162 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8164 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8166 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8167 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8169 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8170 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8172 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8175 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8179 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8181 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8182 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8183 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8185 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8186 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8187 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8188 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8189 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8190 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8191 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8193 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8200 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8204 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8205 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8206 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8207 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8208 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8209 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8210 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8211 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8212 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8216 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8217 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8218 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8219 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8220 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8221 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8225 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8226 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8227 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8229 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8230 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8231 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8237 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8239 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8240 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8245 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8246 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8250 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8251 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8253 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8254 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8255 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8256 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8257 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8258 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8259 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8263 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8265 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8266 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8268 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8275 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8276 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8277 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8278 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8279 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8280 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8281 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8282 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8283 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8284 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8285 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8290 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8291 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8292 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8293 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8294 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8295 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8296 0x0d, 1, 0x0, HDA_OUTPUT),
8297 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8299 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8300 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8301 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8302 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8303 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8304 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8305 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8308 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8309 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8310 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8311 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8315 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8317 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8318 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8319 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8320 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8321 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8323 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8324 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8325 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8326 /* Output switches */
8327 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8328 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8329 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8331 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8332 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8336 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8337 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8341 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8342 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8343 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8344 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8345 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8346 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8347 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8351 static struct hda_bind_ctls alc883_bind_cap_vol = {
8352 .ops = &snd_hda_bind_vol,
8354 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8355 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8360 static struct hda_bind_ctls alc883_bind_cap_switch = {
8361 .ops = &snd_hda_bind_sw,
8363 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8364 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8369 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8370 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8371 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8372 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8373 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8374 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8375 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8376 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8381 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8382 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8383 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8386 /* .name = "Capture Source", */
8387 .name = "Input Source",
8389 .info = alc_mux_enum_info,
8390 .get = alc_mux_enum_get,
8391 .put = alc_mux_enum_put,
8396 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8398 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8399 .name = "Channel Mode",
8400 .info = alc_ch_mode_info,
8401 .get = alc_ch_mode_get,
8402 .put = alc_ch_mode_put,
8407 /* toggle speaker-output according to the hp-jack state */
8408 static void alc883_mitac_setup(struct hda_codec *codec)
8410 struct alc_spec *spec = codec->spec;
8412 spec->autocfg.hp_pins[0] = 0x15;
8413 spec->autocfg.speaker_pins[0] = 0x14;
8414 spec->autocfg.speaker_pins[1] = 0x17;
8417 /* auto-toggle front mic */
8419 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8421 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8423 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8427 static struct hda_verb alc883_mitac_verbs[] = {
8429 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8430 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8432 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8433 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8435 /* enable unsolicited event */
8436 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8437 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8442 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8444 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8445 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8447 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8449 /* enable unsolicited event */
8451 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8452 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8458 static struct hda_verb alc883_clevo_m720_verbs[] = {
8460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8463 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8464 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8466 /* enable unsolicited event */
8467 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8468 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8473 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8475 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8476 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8478 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8479 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8481 /* enable unsolicited event */
8482 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8487 static struct hda_verb alc883_targa_verbs[] = {
8488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8491 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8492 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8494 /* Connect Line-Out side jack (SPDIF) to Side */
8495 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8496 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8497 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8498 /* Connect Mic jack to CLFE */
8499 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8500 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8501 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8502 /* Connect Line-in jack to Surround */
8503 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8504 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8505 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8506 /* Connect HP out jack to Front */
8507 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8508 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8509 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8511 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8516 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8518 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8519 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8523 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8525 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8526 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8531 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8532 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8533 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8534 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8535 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8536 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8540 static struct hda_verb alc883_haier_w66_verbs[] = {
8541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8546 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8547 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8548 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8549 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8553 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8555 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8556 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8557 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8558 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8559 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8560 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8561 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8565 static struct hda_verb alc888_6st_dell_verbs[] = {
8566 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8570 static struct hda_verb alc883_vaiott_verbs[] = {
8572 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8573 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8575 /* enable unsolicited event */
8576 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8581 static void alc888_3st_hp_setup(struct hda_codec *codec)
8583 struct alc_spec *spec = codec->spec;
8585 spec->autocfg.hp_pins[0] = 0x1b;
8586 spec->autocfg.speaker_pins[0] = 0x14;
8587 spec->autocfg.speaker_pins[1] = 0x16;
8588 spec->autocfg.speaker_pins[2] = 0x18;
8591 static struct hda_verb alc888_3st_hp_verbs[] = {
8592 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8593 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8594 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8595 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8602 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8603 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8604 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8605 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8606 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8613 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8614 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8615 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8616 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8617 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8618 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8625 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8626 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8627 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8628 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8629 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8630 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8631 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8635 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8636 { 2, alc888_3st_hp_2ch_init },
8637 { 4, alc888_3st_hp_4ch_init },
8638 { 6, alc888_3st_hp_6ch_init },
8641 /* toggle front-jack and RCA according to the hp-jack state */
8642 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8644 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8646 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8647 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8648 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8649 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8652 /* toggle RCA according to the front-jack state */
8653 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8655 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8657 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8658 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8661 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8664 if ((res >> 26) == ALC880_HP_EVENT)
8665 alc888_lenovo_ms7195_front_automute(codec);
8666 if ((res >> 26) == ALC880_FRONT_EVENT)
8667 alc888_lenovo_ms7195_rca_automute(codec);
8670 static struct hda_verb alc883_medion_md2_verbs[] = {
8671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8674 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8676 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8680 /* toggle speaker-output according to the hp-jack state */
8681 static void alc883_medion_md2_setup(struct hda_codec *codec)
8683 struct alc_spec *spec = codec->spec;
8685 spec->autocfg.hp_pins[0] = 0x14;
8686 spec->autocfg.speaker_pins[0] = 0x15;
8689 /* toggle speaker-output according to the hp-jack state */
8690 #define alc883_targa_init_hook alc882_targa_init_hook
8691 #define alc883_targa_unsol_event alc882_targa_unsol_event
8693 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8695 unsigned int present;
8697 present = snd_hda_jack_detect(codec, 0x18);
8698 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8699 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8702 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8704 struct alc_spec *spec = codec->spec;
8706 spec->autocfg.hp_pins[0] = 0x15;
8707 spec->autocfg.speaker_pins[0] = 0x14;
8710 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8712 alc_automute_amp(codec);
8713 alc883_clevo_m720_mic_automute(codec);
8716 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8719 switch (res >> 26) {
8720 case ALC880_MIC_EVENT:
8721 alc883_clevo_m720_mic_automute(codec);
8724 alc_automute_amp_unsol_event(codec, res);
8729 /* toggle speaker-output according to the hp-jack state */
8730 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8732 struct alc_spec *spec = codec->spec;
8734 spec->autocfg.hp_pins[0] = 0x14;
8735 spec->autocfg.speaker_pins[0] = 0x15;
8738 static void alc883_haier_w66_setup(struct hda_codec *codec)
8740 struct alc_spec *spec = codec->spec;
8742 spec->autocfg.hp_pins[0] = 0x1b;
8743 spec->autocfg.speaker_pins[0] = 0x14;
8746 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8748 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8750 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8751 HDA_AMP_MUTE, bits);
8754 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8756 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8758 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8759 HDA_AMP_MUTE, bits);
8760 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8761 HDA_AMP_MUTE, bits);
8764 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8767 if ((res >> 26) == ALC880_HP_EVENT)
8768 alc883_lenovo_101e_all_automute(codec);
8769 if ((res >> 26) == ALC880_FRONT_EVENT)
8770 alc883_lenovo_101e_ispeaker_automute(codec);
8773 /* toggle speaker-output according to the hp-jack state */
8774 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8776 struct alc_spec *spec = codec->spec;
8778 spec->autocfg.hp_pins[0] = 0x14;
8779 spec->autocfg.speaker_pins[0] = 0x15;
8780 spec->autocfg.speaker_pins[1] = 0x16;
8783 static struct hda_verb alc883_acer_eapd_verbs[] = {
8784 /* HP Pin: output 0 (0x0c) */
8785 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8786 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8787 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8788 /* Front Pin: output 0 (0x0c) */
8789 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8790 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8791 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8792 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8793 /* eanable EAPD on medion laptop */
8794 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8795 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8796 /* enable unsolicited event */
8797 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8801 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8802 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8803 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8804 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8808 static void alc888_6st_dell_setup(struct hda_codec *codec)
8810 struct alc_spec *spec = codec->spec;
8812 spec->autocfg.hp_pins[0] = 0x1b;
8813 spec->autocfg.speaker_pins[0] = 0x14;
8814 spec->autocfg.speaker_pins[1] = 0x15;
8815 spec->autocfg.speaker_pins[2] = 0x16;
8816 spec->autocfg.speaker_pins[3] = 0x17;
8819 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8821 struct alc_spec *spec = codec->spec;
8823 spec->autocfg.hp_pins[0] = 0x1b;
8824 spec->autocfg.speaker_pins[0] = 0x14;
8825 spec->autocfg.speaker_pins[1] = 0x15;
8826 spec->autocfg.speaker_pins[2] = 0x16;
8827 spec->autocfg.speaker_pins[3] = 0x17;
8828 spec->autocfg.speaker_pins[4] = 0x1a;
8831 static void alc883_vaiott_setup(struct hda_codec *codec)
8833 struct alc_spec *spec = codec->spec;
8835 spec->autocfg.hp_pins[0] = 0x15;
8836 spec->autocfg.speaker_pins[0] = 0x14;
8837 spec->autocfg.speaker_pins[1] = 0x17;
8840 static struct hda_verb alc888_asus_m90v_verbs[] = {
8841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8842 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8843 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8844 /* enable unsolicited event */
8845 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8846 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8850 static void alc883_mode2_setup(struct hda_codec *codec)
8852 struct alc_spec *spec = codec->spec;
8854 spec->autocfg.hp_pins[0] = 0x1b;
8855 spec->autocfg.speaker_pins[0] = 0x14;
8856 spec->autocfg.speaker_pins[1] = 0x15;
8857 spec->autocfg.speaker_pins[2] = 0x16;
8858 spec->ext_mic.pin = 0x18;
8859 spec->int_mic.pin = 0x19;
8860 spec->ext_mic.mux_idx = 0;
8861 spec->int_mic.mux_idx = 1;
8865 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8866 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8867 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8868 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8869 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8870 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8871 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8872 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8873 /* enable unsolicited event */
8874 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8878 static void alc883_eee1601_inithook(struct hda_codec *codec)
8880 struct alc_spec *spec = codec->spec;
8882 spec->autocfg.hp_pins[0] = 0x14;
8883 spec->autocfg.speaker_pins[0] = 0x1b;
8884 alc_automute_pin(codec);
8887 static struct hda_verb alc889A_mb31_verbs[] = {
8888 /* Init rear pin (used as headphone output) */
8889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8890 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8891 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8892 /* Init line pin (used as output in 4ch and 6ch mode) */
8893 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8894 /* Init line 2 pin (used as headphone out by default) */
8895 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8896 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8900 /* Mute speakers according to the headphone jack state */
8901 static void alc889A_mb31_automute(struct hda_codec *codec)
8903 unsigned int present;
8905 /* Mute only in 2ch or 4ch mode */
8906 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8908 present = snd_hda_jack_detect(codec, 0x15);
8909 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8910 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8911 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8912 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8916 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8918 if ((res >> 26) == ALC880_HP_EVENT)
8919 alc889A_mb31_automute(codec);
8923 #ifdef CONFIG_SND_HDA_POWER_SAVE
8924 #define alc882_loopbacks alc880_loopbacks
8927 /* pcm configuration: identical with ALC880 */
8928 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8929 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8930 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8931 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8933 static hda_nid_t alc883_slave_dig_outs[] = {
8934 ALC1200_DIGOUT_NID, 0,
8937 static hda_nid_t alc1200_slave_dig_outs[] = {
8938 ALC883_DIGOUT_NID, 0,
8942 * configuration and preset
8944 static const char *alc882_models[ALC882_MODEL_LAST] = {
8945 [ALC882_3ST_DIG] = "3stack-dig",
8946 [ALC882_6ST_DIG] = "6stack-dig",
8947 [ALC882_ARIMA] = "arima",
8948 [ALC882_W2JC] = "w2jc",
8949 [ALC882_TARGA] = "targa",
8950 [ALC882_ASUS_A7J] = "asus-a7j",
8951 [ALC882_ASUS_A7M] = "asus-a7m",
8952 [ALC885_MACPRO] = "macpro",
8953 [ALC885_MB5] = "mb5",
8954 [ALC885_MBP3] = "mbp3",
8955 [ALC885_IMAC24] = "imac24",
8956 [ALC885_IMAC91] = "imac91",
8957 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8958 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8959 [ALC883_3ST_6ch] = "3stack-6ch",
8960 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8961 [ALC883_TARGA_DIG] = "targa-dig",
8962 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8963 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8964 [ALC883_ACER] = "acer",
8965 [ALC883_ACER_ASPIRE] = "acer-aspire",
8966 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8967 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8968 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8969 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8970 [ALC883_MEDION] = "medion",
8971 [ALC883_MEDION_MD2] = "medion-md2",
8972 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8973 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8974 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8975 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8976 [ALC888_LENOVO_SKY] = "lenovo-sky",
8977 [ALC883_HAIER_W66] = "haier-w66",
8978 [ALC888_3ST_HP] = "3stack-hp",
8979 [ALC888_6ST_DELL] = "6stack-dell",
8980 [ALC883_MITAC] = "mitac",
8981 [ALC883_CLEVO_M540R] = "clevo-m540r",
8982 [ALC883_CLEVO_M720] = "clevo-m720",
8983 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8984 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8985 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8986 [ALC889A_INTEL] = "intel-alc889a",
8987 [ALC889_INTEL] = "intel-x58",
8988 [ALC1200_ASUS_P5Q] = "asus-p5q",
8989 [ALC889A_MB31] = "mb31",
8990 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8991 [ALC882_AUTO] = "auto",
8994 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8995 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
8997 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
8998 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
8999 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9000 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9001 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9002 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9003 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9004 ALC888_ACER_ASPIRE_4930G),
9005 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9006 ALC888_ACER_ASPIRE_4930G),
9007 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9008 ALC888_ACER_ASPIRE_8930G),
9009 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9010 ALC888_ACER_ASPIRE_8930G),
9011 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9012 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9013 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9014 ALC888_ACER_ASPIRE_6530G),
9015 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9016 ALC888_ACER_ASPIRE_6530G),
9017 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9018 ALC888_ACER_ASPIRE_7730G),
9019 /* default Acer -- disabled as it causes more problems.
9020 * model=auto should work fine now
9022 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9024 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9026 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9027 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9028 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9029 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9030 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9031 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9033 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9034 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9035 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9036 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9037 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9038 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9039 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9040 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9041 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9042 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9043 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9045 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9046 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9047 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9048 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9049 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9050 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9051 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9052 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9053 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9055 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9056 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9057 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9058 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9059 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9060 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9061 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9062 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9063 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9064 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9065 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9066 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9067 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9068 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9069 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9070 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9071 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9072 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9073 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9074 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9075 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9076 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9077 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9080 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9081 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9082 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9083 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9085 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9086 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9087 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9088 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9089 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9090 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9091 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9092 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9093 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9094 ALC883_FUJITSU_PI2515),
9095 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9096 ALC888_FUJITSU_XA3530),
9097 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9098 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9099 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9100 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9101 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9102 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9103 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9104 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9105 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9107 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9108 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9109 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9110 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9111 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9112 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9113 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9118 /* codec SSID table for Intel Mac */
9119 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9120 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9121 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9122 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9123 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9124 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9125 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9126 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9127 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9128 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9129 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9130 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9131 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9132 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9133 * so apparently no perfect solution yet
9135 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9136 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9140 static struct alc_config_preset alc882_presets[] = {
9141 [ALC882_3ST_DIG] = {
9142 .mixers = { alc882_base_mixer },
9143 .init_verbs = { alc882_base_init_verbs,
9144 alc882_adc1_init_verbs },
9145 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9146 .dac_nids = alc882_dac_nids,
9147 .dig_out_nid = ALC882_DIGOUT_NID,
9148 .dig_in_nid = ALC882_DIGIN_NID,
9149 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9150 .channel_mode = alc882_ch_modes,
9152 .input_mux = &alc882_capture_source,
9154 [ALC882_6ST_DIG] = {
9155 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9156 .init_verbs = { alc882_base_init_verbs,
9157 alc882_adc1_init_verbs },
9158 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9159 .dac_nids = alc882_dac_nids,
9160 .dig_out_nid = ALC882_DIGOUT_NID,
9161 .dig_in_nid = ALC882_DIGIN_NID,
9162 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9163 .channel_mode = alc882_sixstack_modes,
9164 .input_mux = &alc882_capture_source,
9167 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9168 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9169 alc882_eapd_verbs },
9170 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9171 .dac_nids = alc882_dac_nids,
9172 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9173 .channel_mode = alc882_sixstack_modes,
9174 .input_mux = &alc882_capture_source,
9177 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9178 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9179 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9180 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9181 .dac_nids = alc882_dac_nids,
9182 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9183 .channel_mode = alc880_threestack_modes,
9185 .input_mux = &alc882_capture_source,
9186 .dig_out_nid = ALC882_DIGOUT_NID,
9189 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9190 .init_verbs = { alc885_mbp3_init_verbs,
9191 alc880_gpio1_init_verbs },
9193 .dac_nids = alc882_dac_nids,
9195 .channel_mode = alc885_mbp_4ch_modes,
9196 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9197 .input_mux = &alc882_capture_source,
9198 .dig_out_nid = ALC882_DIGOUT_NID,
9199 .dig_in_nid = ALC882_DIGIN_NID,
9200 .unsol_event = alc_automute_amp_unsol_event,
9201 .setup = alc885_mbp3_setup,
9202 .init_hook = alc_automute_amp,
9205 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9206 .init_verbs = { alc885_mb5_init_verbs,
9207 alc880_gpio1_init_verbs },
9208 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9209 .dac_nids = alc882_dac_nids,
9210 .channel_mode = alc885_mb5_6ch_modes,
9211 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9212 .input_mux = &mb5_capture_source,
9213 .dig_out_nid = ALC882_DIGOUT_NID,
9214 .dig_in_nid = ALC882_DIGIN_NID,
9217 .mixers = { alc882_macpro_mixer },
9218 .init_verbs = { alc882_macpro_init_verbs },
9219 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9220 .dac_nids = alc882_dac_nids,
9221 .dig_out_nid = ALC882_DIGOUT_NID,
9222 .dig_in_nid = ALC882_DIGIN_NID,
9223 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9224 .channel_mode = alc882_ch_modes,
9225 .input_mux = &alc882_capture_source,
9226 .init_hook = alc885_macpro_init_hook,
9229 .mixers = { alc885_imac24_mixer },
9230 .init_verbs = { alc885_imac24_init_verbs },
9231 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9232 .dac_nids = alc882_dac_nids,
9233 .dig_out_nid = ALC882_DIGOUT_NID,
9234 .dig_in_nid = ALC882_DIGIN_NID,
9235 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9236 .channel_mode = alc882_ch_modes,
9237 .input_mux = &alc882_capture_source,
9238 .unsol_event = alc_automute_amp_unsol_event,
9239 .setup = alc885_imac24_setup,
9240 .init_hook = alc885_imac24_init_hook,
9243 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9244 .init_verbs = { alc885_imac91_init_verbs,
9245 alc880_gpio1_init_verbs },
9246 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9247 .dac_nids = alc882_dac_nids,
9248 .channel_mode = alc885_mbp_4ch_modes,
9249 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9250 .input_mux = &alc882_capture_source,
9251 .dig_out_nid = ALC882_DIGOUT_NID,
9252 .dig_in_nid = ALC882_DIGIN_NID,
9253 .unsol_event = alc885_imac91_unsol_event,
9254 .init_hook = alc885_imac91_automute,
9257 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9258 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9259 alc880_gpio3_init_verbs, alc882_targa_verbs},
9260 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9261 .dac_nids = alc882_dac_nids,
9262 .dig_out_nid = ALC882_DIGOUT_NID,
9263 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9264 .adc_nids = alc882_adc_nids,
9265 .capsrc_nids = alc882_capsrc_nids,
9266 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9267 .channel_mode = alc882_3ST_6ch_modes,
9269 .input_mux = &alc882_capture_source,
9270 .unsol_event = alc882_targa_unsol_event,
9271 .setup = alc882_targa_setup,
9272 .init_hook = alc882_targa_automute,
9274 [ALC882_ASUS_A7J] = {
9275 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9276 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9277 alc882_asus_a7j_verbs},
9278 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9279 .dac_nids = alc882_dac_nids,
9280 .dig_out_nid = ALC882_DIGOUT_NID,
9281 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9282 .adc_nids = alc882_adc_nids,
9283 .capsrc_nids = alc882_capsrc_nids,
9284 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9285 .channel_mode = alc882_3ST_6ch_modes,
9287 .input_mux = &alc882_capture_source,
9289 [ALC882_ASUS_A7M] = {
9290 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9291 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9292 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9293 alc882_asus_a7m_verbs },
9294 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9295 .dac_nids = alc882_dac_nids,
9296 .dig_out_nid = ALC882_DIGOUT_NID,
9297 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9298 .channel_mode = alc880_threestack_modes,
9300 .input_mux = &alc882_capture_source,
9302 [ALC883_3ST_2ch_DIG] = {
9303 .mixers = { alc883_3ST_2ch_mixer },
9304 .init_verbs = { alc883_init_verbs },
9305 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9306 .dac_nids = alc883_dac_nids,
9307 .dig_out_nid = ALC883_DIGOUT_NID,
9308 .dig_in_nid = ALC883_DIGIN_NID,
9309 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9310 .channel_mode = alc883_3ST_2ch_modes,
9311 .input_mux = &alc883_capture_source,
9313 [ALC883_3ST_6ch_DIG] = {
9314 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9315 .init_verbs = { alc883_init_verbs },
9316 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9317 .dac_nids = alc883_dac_nids,
9318 .dig_out_nid = ALC883_DIGOUT_NID,
9319 .dig_in_nid = ALC883_DIGIN_NID,
9320 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9321 .channel_mode = alc883_3ST_6ch_modes,
9323 .input_mux = &alc883_capture_source,
9325 [ALC883_3ST_6ch] = {
9326 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9327 .init_verbs = { alc883_init_verbs },
9328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9329 .dac_nids = alc883_dac_nids,
9330 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9331 .channel_mode = alc883_3ST_6ch_modes,
9333 .input_mux = &alc883_capture_source,
9335 [ALC883_3ST_6ch_INTEL] = {
9336 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9337 .init_verbs = { alc883_init_verbs },
9338 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9339 .dac_nids = alc883_dac_nids,
9340 .dig_out_nid = ALC883_DIGOUT_NID,
9341 .dig_in_nid = ALC883_DIGIN_NID,
9342 .slave_dig_outs = alc883_slave_dig_outs,
9343 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9344 .channel_mode = alc883_3ST_6ch_intel_modes,
9346 .input_mux = &alc883_3stack_6ch_intel,
9349 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9351 alc_hp15_unsol_verbs },
9352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9353 .dac_nids = alc883_dac_nids,
9354 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9355 .adc_nids = alc889_adc_nids,
9356 .dig_out_nid = ALC883_DIGOUT_NID,
9357 .dig_in_nid = ALC883_DIGIN_NID,
9358 .slave_dig_outs = alc883_slave_dig_outs,
9359 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9360 .channel_mode = alc889_8ch_intel_modes,
9361 .capsrc_nids = alc889_capsrc_nids,
9362 .input_mux = &alc889_capture_source,
9363 .setup = alc889_automute_setup,
9364 .init_hook = alc_automute_amp,
9365 .unsol_event = alc_automute_amp_unsol_event,
9369 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9370 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9371 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9372 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9373 .dac_nids = alc883_dac_nids,
9374 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9375 .adc_nids = alc889_adc_nids,
9376 .dig_out_nid = ALC883_DIGOUT_NID,
9377 .dig_in_nid = ALC883_DIGIN_NID,
9378 .slave_dig_outs = alc883_slave_dig_outs,
9379 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9380 .channel_mode = alc889_8ch_intel_modes,
9381 .capsrc_nids = alc889_capsrc_nids,
9382 .input_mux = &alc889_capture_source,
9383 .setup = alc889_automute_setup,
9384 .init_hook = alc889_intel_init_hook,
9385 .unsol_event = alc_automute_amp_unsol_event,
9388 [ALC883_6ST_DIG] = {
9389 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9390 .init_verbs = { alc883_init_verbs },
9391 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9392 .dac_nids = alc883_dac_nids,
9393 .dig_out_nid = ALC883_DIGOUT_NID,
9394 .dig_in_nid = ALC883_DIGIN_NID,
9395 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9396 .channel_mode = alc883_sixstack_modes,
9397 .input_mux = &alc883_capture_source,
9399 [ALC883_TARGA_DIG] = {
9400 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9401 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9402 alc883_targa_verbs},
9403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9404 .dac_nids = alc883_dac_nids,
9405 .dig_out_nid = ALC883_DIGOUT_NID,
9406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9407 .channel_mode = alc883_3ST_6ch_modes,
9409 .input_mux = &alc883_capture_source,
9410 .unsol_event = alc883_targa_unsol_event,
9411 .setup = alc882_targa_setup,
9412 .init_hook = alc882_targa_automute,
9414 [ALC883_TARGA_2ch_DIG] = {
9415 .mixers = { alc883_targa_2ch_mixer},
9416 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9417 alc883_targa_verbs},
9418 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9419 .dac_nids = alc883_dac_nids,
9420 .adc_nids = alc883_adc_nids_alt,
9421 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9422 .capsrc_nids = alc883_capsrc_nids,
9423 .dig_out_nid = ALC883_DIGOUT_NID,
9424 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9425 .channel_mode = alc883_3ST_2ch_modes,
9426 .input_mux = &alc883_capture_source,
9427 .unsol_event = alc883_targa_unsol_event,
9428 .setup = alc882_targa_setup,
9429 .init_hook = alc882_targa_automute,
9431 [ALC883_TARGA_8ch_DIG] = {
9432 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9433 alc883_chmode_mixer },
9434 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9435 alc883_targa_verbs },
9436 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9437 .dac_nids = alc883_dac_nids,
9438 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9439 .adc_nids = alc883_adc_nids_rev,
9440 .capsrc_nids = alc883_capsrc_nids_rev,
9441 .dig_out_nid = ALC883_DIGOUT_NID,
9442 .dig_in_nid = ALC883_DIGIN_NID,
9443 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9444 .channel_mode = alc883_4ST_8ch_modes,
9446 .input_mux = &alc883_capture_source,
9447 .unsol_event = alc883_targa_unsol_event,
9448 .setup = alc882_targa_setup,
9449 .init_hook = alc882_targa_automute,
9452 .mixers = { alc883_base_mixer },
9453 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9454 * and the headphone jack. Turn this on and rely on the
9455 * standard mute methods whenever the user wants to turn
9456 * these outputs off.
9458 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9459 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9460 .dac_nids = alc883_dac_nids,
9461 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9462 .channel_mode = alc883_3ST_2ch_modes,
9463 .input_mux = &alc883_capture_source,
9465 [ALC883_ACER_ASPIRE] = {
9466 .mixers = { alc883_acer_aspire_mixer },
9467 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9468 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9469 .dac_nids = alc883_dac_nids,
9470 .dig_out_nid = ALC883_DIGOUT_NID,
9471 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9472 .channel_mode = alc883_3ST_2ch_modes,
9473 .input_mux = &alc883_capture_source,
9474 .unsol_event = alc_automute_amp_unsol_event,
9475 .setup = alc883_acer_aspire_setup,
9476 .init_hook = alc_automute_amp,
9478 [ALC888_ACER_ASPIRE_4930G] = {
9479 .mixers = { alc888_base_mixer,
9480 alc883_chmode_mixer },
9481 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9482 alc888_acer_aspire_4930g_verbs },
9483 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9484 .dac_nids = alc883_dac_nids,
9485 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9486 .adc_nids = alc883_adc_nids_rev,
9487 .capsrc_nids = alc883_capsrc_nids_rev,
9488 .dig_out_nid = ALC883_DIGOUT_NID,
9489 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9490 .channel_mode = alc883_3ST_6ch_modes,
9493 ARRAY_SIZE(alc888_2_capture_sources),
9494 .input_mux = alc888_2_capture_sources,
9495 .unsol_event = alc_automute_amp_unsol_event,
9496 .setup = alc888_acer_aspire_4930g_setup,
9497 .init_hook = alc_automute_amp,
9499 [ALC888_ACER_ASPIRE_6530G] = {
9500 .mixers = { alc888_acer_aspire_6530_mixer },
9501 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9502 alc888_acer_aspire_6530g_verbs },
9503 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9504 .dac_nids = alc883_dac_nids,
9505 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9506 .adc_nids = alc883_adc_nids_rev,
9507 .capsrc_nids = alc883_capsrc_nids_rev,
9508 .dig_out_nid = ALC883_DIGOUT_NID,
9509 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9510 .channel_mode = alc883_3ST_2ch_modes,
9512 ARRAY_SIZE(alc888_2_capture_sources),
9513 .input_mux = alc888_acer_aspire_6530_sources,
9514 .unsol_event = alc_automute_amp_unsol_event,
9515 .setup = alc888_acer_aspire_6530g_setup,
9516 .init_hook = alc_automute_amp,
9518 [ALC888_ACER_ASPIRE_8930G] = {
9519 .mixers = { alc889_acer_aspire_8930g_mixer,
9520 alc883_chmode_mixer },
9521 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9522 alc889_acer_aspire_8930g_verbs,
9524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9525 .dac_nids = alc883_dac_nids,
9526 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9527 .adc_nids = alc889_adc_nids,
9528 .capsrc_nids = alc889_capsrc_nids,
9529 .dig_out_nid = ALC883_DIGOUT_NID,
9530 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9531 .channel_mode = alc883_3ST_6ch_modes,
9533 .const_channel_count = 6,
9535 ARRAY_SIZE(alc889_capture_sources),
9536 .input_mux = alc889_capture_sources,
9537 .unsol_event = alc_automute_amp_unsol_event,
9538 .setup = alc889_acer_aspire_8930g_setup,
9539 .init_hook = alc_automute_amp,
9540 #ifdef CONFIG_SND_HDA_POWER_SAVE
9541 .power_hook = alc889_power_eapd,
9544 [ALC888_ACER_ASPIRE_7730G] = {
9545 .mixers = { alc883_3ST_6ch_mixer,
9546 alc883_chmode_mixer },
9547 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9548 alc888_acer_aspire_7730G_verbs },
9549 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9550 .dac_nids = alc883_dac_nids,
9551 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9552 .adc_nids = alc883_adc_nids_rev,
9553 .capsrc_nids = alc883_capsrc_nids_rev,
9554 .dig_out_nid = ALC883_DIGOUT_NID,
9555 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9556 .channel_mode = alc883_3ST_6ch_modes,
9558 .const_channel_count = 6,
9559 .input_mux = &alc883_capture_source,
9560 .unsol_event = alc_automute_amp_unsol_event,
9561 .setup = alc888_acer_aspire_6530g_setup,
9562 .init_hook = alc_automute_amp,
9565 .mixers = { alc883_fivestack_mixer,
9566 alc883_chmode_mixer },
9567 .init_verbs = { alc883_init_verbs,
9568 alc883_medion_eapd_verbs },
9569 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9570 .dac_nids = alc883_dac_nids,
9571 .adc_nids = alc883_adc_nids_alt,
9572 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9573 .capsrc_nids = alc883_capsrc_nids,
9574 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9575 .channel_mode = alc883_sixstack_modes,
9576 .input_mux = &alc883_capture_source,
9578 [ALC883_MEDION_MD2] = {
9579 .mixers = { alc883_medion_md2_mixer},
9580 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9581 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9582 .dac_nids = alc883_dac_nids,
9583 .dig_out_nid = ALC883_DIGOUT_NID,
9584 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9585 .channel_mode = alc883_3ST_2ch_modes,
9586 .input_mux = &alc883_capture_source,
9587 .unsol_event = alc_automute_amp_unsol_event,
9588 .setup = alc883_medion_md2_setup,
9589 .init_hook = alc_automute_amp,
9591 [ALC883_LAPTOP_EAPD] = {
9592 .mixers = { alc883_base_mixer },
9593 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9594 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9595 .dac_nids = alc883_dac_nids,
9596 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9597 .channel_mode = alc883_3ST_2ch_modes,
9598 .input_mux = &alc883_capture_source,
9600 [ALC883_CLEVO_M540R] = {
9601 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9602 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9603 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9604 .dac_nids = alc883_dac_nids,
9605 .dig_out_nid = ALC883_DIGOUT_NID,
9606 .dig_in_nid = ALC883_DIGIN_NID,
9607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9608 .channel_mode = alc883_3ST_6ch_clevo_modes,
9610 .input_mux = &alc883_capture_source,
9611 /* This machine has the hardware HP auto-muting, thus
9612 * we need no software mute via unsol event
9615 [ALC883_CLEVO_M720] = {
9616 .mixers = { alc883_clevo_m720_mixer },
9617 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9618 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9619 .dac_nids = alc883_dac_nids,
9620 .dig_out_nid = ALC883_DIGOUT_NID,
9621 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9622 .channel_mode = alc883_3ST_2ch_modes,
9623 .input_mux = &alc883_capture_source,
9624 .unsol_event = alc883_clevo_m720_unsol_event,
9625 .setup = alc883_clevo_m720_setup,
9626 .init_hook = alc883_clevo_m720_init_hook,
9628 [ALC883_LENOVO_101E_2ch] = {
9629 .mixers = { alc883_lenovo_101e_2ch_mixer},
9630 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9631 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9632 .dac_nids = alc883_dac_nids,
9633 .adc_nids = alc883_adc_nids_alt,
9634 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9635 .capsrc_nids = alc883_capsrc_nids,
9636 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9637 .channel_mode = alc883_3ST_2ch_modes,
9638 .input_mux = &alc883_lenovo_101e_capture_source,
9639 .unsol_event = alc883_lenovo_101e_unsol_event,
9640 .init_hook = alc883_lenovo_101e_all_automute,
9642 [ALC883_LENOVO_NB0763] = {
9643 .mixers = { alc883_lenovo_nb0763_mixer },
9644 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9645 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9646 .dac_nids = alc883_dac_nids,
9647 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9648 .channel_mode = alc883_3ST_2ch_modes,
9650 .input_mux = &alc883_lenovo_nb0763_capture_source,
9651 .unsol_event = alc_automute_amp_unsol_event,
9652 .setup = alc883_medion_md2_setup,
9653 .init_hook = alc_automute_amp,
9655 [ALC888_LENOVO_MS7195_DIG] = {
9656 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9657 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9658 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9659 .dac_nids = alc883_dac_nids,
9660 .dig_out_nid = ALC883_DIGOUT_NID,
9661 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9662 .channel_mode = alc883_3ST_6ch_modes,
9664 .input_mux = &alc883_capture_source,
9665 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9666 .init_hook = alc888_lenovo_ms7195_front_automute,
9668 [ALC883_HAIER_W66] = {
9669 .mixers = { alc883_targa_2ch_mixer},
9670 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9671 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9672 .dac_nids = alc883_dac_nids,
9673 .dig_out_nid = ALC883_DIGOUT_NID,
9674 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9675 .channel_mode = alc883_3ST_2ch_modes,
9676 .input_mux = &alc883_capture_source,
9677 .unsol_event = alc_automute_amp_unsol_event,
9678 .setup = alc883_haier_w66_setup,
9679 .init_hook = alc_automute_amp,
9682 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9683 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9684 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9685 .dac_nids = alc883_dac_nids,
9686 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9687 .channel_mode = alc888_3st_hp_modes,
9689 .input_mux = &alc883_capture_source,
9690 .unsol_event = alc_automute_amp_unsol_event,
9691 .setup = alc888_3st_hp_setup,
9692 .init_hook = alc_automute_amp,
9694 [ALC888_6ST_DELL] = {
9695 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9696 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9697 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9698 .dac_nids = alc883_dac_nids,
9699 .dig_out_nid = ALC883_DIGOUT_NID,
9700 .dig_in_nid = ALC883_DIGIN_NID,
9701 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9702 .channel_mode = alc883_sixstack_modes,
9703 .input_mux = &alc883_capture_source,
9704 .unsol_event = alc_automute_amp_unsol_event,
9705 .setup = alc888_6st_dell_setup,
9706 .init_hook = alc_automute_amp,
9709 .mixers = { alc883_mitac_mixer },
9710 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9711 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9712 .dac_nids = alc883_dac_nids,
9713 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9714 .channel_mode = alc883_3ST_2ch_modes,
9715 .input_mux = &alc883_capture_source,
9716 .unsol_event = alc_automute_amp_unsol_event,
9717 .setup = alc883_mitac_setup,
9718 .init_hook = alc_automute_amp,
9720 [ALC883_FUJITSU_PI2515] = {
9721 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9722 .init_verbs = { alc883_init_verbs,
9723 alc883_2ch_fujitsu_pi2515_verbs},
9724 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9725 .dac_nids = alc883_dac_nids,
9726 .dig_out_nid = ALC883_DIGOUT_NID,
9727 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9728 .channel_mode = alc883_3ST_2ch_modes,
9729 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9730 .unsol_event = alc_automute_amp_unsol_event,
9731 .setup = alc883_2ch_fujitsu_pi2515_setup,
9732 .init_hook = alc_automute_amp,
9734 [ALC888_FUJITSU_XA3530] = {
9735 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9736 .init_verbs = { alc883_init_verbs,
9737 alc888_fujitsu_xa3530_verbs },
9738 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9739 .dac_nids = alc883_dac_nids,
9740 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9741 .adc_nids = alc883_adc_nids_rev,
9742 .capsrc_nids = alc883_capsrc_nids_rev,
9743 .dig_out_nid = ALC883_DIGOUT_NID,
9744 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9745 .channel_mode = alc888_4ST_8ch_intel_modes,
9747 ARRAY_SIZE(alc888_2_capture_sources),
9748 .input_mux = alc888_2_capture_sources,
9749 .unsol_event = alc_automute_amp_unsol_event,
9750 .setup = alc888_fujitsu_xa3530_setup,
9751 .init_hook = alc_automute_amp,
9753 [ALC888_LENOVO_SKY] = {
9754 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9755 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9756 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9757 .dac_nids = alc883_dac_nids,
9758 .dig_out_nid = ALC883_DIGOUT_NID,
9759 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9760 .channel_mode = alc883_sixstack_modes,
9762 .input_mux = &alc883_lenovo_sky_capture_source,
9763 .unsol_event = alc_automute_amp_unsol_event,
9764 .setup = alc888_lenovo_sky_setup,
9765 .init_hook = alc_automute_amp,
9767 [ALC888_ASUS_M90V] = {
9768 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9769 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9770 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9771 .dac_nids = alc883_dac_nids,
9772 .dig_out_nid = ALC883_DIGOUT_NID,
9773 .dig_in_nid = ALC883_DIGIN_NID,
9774 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9775 .channel_mode = alc883_3ST_6ch_modes,
9777 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9778 .unsol_event = alc_sku_unsol_event,
9779 .setup = alc883_mode2_setup,
9780 .init_hook = alc_inithook,
9782 [ALC888_ASUS_EEE1601] = {
9783 .mixers = { alc883_asus_eee1601_mixer },
9784 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9785 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9786 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9787 .dac_nids = alc883_dac_nids,
9788 .dig_out_nid = ALC883_DIGOUT_NID,
9789 .dig_in_nid = ALC883_DIGIN_NID,
9790 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9791 .channel_mode = alc883_3ST_2ch_modes,
9793 .input_mux = &alc883_asus_eee1601_capture_source,
9794 .unsol_event = alc_sku_unsol_event,
9795 .init_hook = alc883_eee1601_inithook,
9797 [ALC1200_ASUS_P5Q] = {
9798 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9799 .init_verbs = { alc883_init_verbs },
9800 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9801 .dac_nids = alc883_dac_nids,
9802 .dig_out_nid = ALC1200_DIGOUT_NID,
9803 .dig_in_nid = ALC883_DIGIN_NID,
9804 .slave_dig_outs = alc1200_slave_dig_outs,
9805 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9806 .channel_mode = alc883_sixstack_modes,
9807 .input_mux = &alc883_capture_source,
9810 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9811 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9812 alc880_gpio1_init_verbs },
9813 .adc_nids = alc883_adc_nids,
9814 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9815 .capsrc_nids = alc883_capsrc_nids,
9816 .dac_nids = alc883_dac_nids,
9817 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9818 .channel_mode = alc889A_mb31_6ch_modes,
9819 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9820 .input_mux = &alc889A_mb31_capture_source,
9821 .dig_out_nid = ALC883_DIGOUT_NID,
9822 .unsol_event = alc889A_mb31_unsol_event,
9823 .init_hook = alc889A_mb31_automute,
9825 [ALC883_SONY_VAIO_TT] = {
9826 .mixers = { alc883_vaiott_mixer },
9827 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9828 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9829 .dac_nids = alc883_dac_nids,
9830 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9831 .channel_mode = alc883_3ST_2ch_modes,
9832 .input_mux = &alc883_capture_source,
9833 .unsol_event = alc_automute_amp_unsol_event,
9834 .setup = alc883_vaiott_setup,
9835 .init_hook = alc_automute_amp,
9844 PINFIX_ABIT_AW9D_MAX
9847 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9848 { 0x15, 0x01080104 }, /* side */
9849 { 0x16, 0x01011012 }, /* rear */
9850 { 0x17, 0x01016011 }, /* clfe */
9854 static const struct alc_fixup alc882_fixups[] = {
9855 [PINFIX_ABIT_AW9D_MAX] = {
9856 .pins = alc882_abit_aw9d_pinfix
9860 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9861 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9866 * BIOS auto configuration
9868 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9869 const struct auto_pin_cfg *cfg)
9871 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9874 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9875 hda_nid_t nid, int pin_type,
9879 struct alc_spec *spec = codec->spec;
9882 alc_set_pin_output(codec, nid, pin_type);
9883 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9886 idx = spec->multiout.dac_nids[dac_idx] - 2;
9887 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9891 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9893 struct alc_spec *spec = codec->spec;
9896 for (i = 0; i <= HDA_SIDE; i++) {
9897 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9898 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9900 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9905 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9907 struct alc_spec *spec = codec->spec;
9910 pin = spec->autocfg.hp_pins[0];
9911 if (pin) /* connect to front */
9913 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9914 pin = spec->autocfg.speaker_pins[0];
9916 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9919 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9921 struct alc_spec *spec = codec->spec;
9924 for (i = 0; i < AUTO_PIN_LAST; i++) {
9925 hda_nid_t nid = spec->autocfg.input_pins[i];
9928 alc_set_input_pin(codec, nid, i);
9929 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9930 snd_hda_codec_write(codec, nid, 0,
9931 AC_VERB_SET_AMP_GAIN_MUTE,
9936 static void alc882_auto_init_input_src(struct hda_codec *codec)
9938 struct alc_spec *spec = codec->spec;
9941 for (c = 0; c < spec->num_adc_nids; c++) {
9942 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9943 hda_nid_t nid = spec->capsrc_nids[c];
9944 unsigned int mux_idx;
9945 const struct hda_input_mux *imux;
9946 int conns, mute, idx, item;
9948 conns = snd_hda_get_connections(codec, nid, conn_list,
9949 ARRAY_SIZE(conn_list));
9952 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9953 imux = &spec->input_mux[mux_idx];
9954 for (idx = 0; idx < conns; idx++) {
9955 /* if the current connection is the selected one,
9956 * unmute it as default - otherwise mute it
9958 mute = AMP_IN_MUTE(idx);
9959 for (item = 0; item < imux->num_items; item++) {
9960 if (imux->items[item].index == idx) {
9961 if (spec->cur_mux[c] == item)
9962 mute = AMP_IN_UNMUTE(idx);
9966 /* check if we have a selector or mixer
9967 * we could check for the widget type instead, but
9968 * just check for Amp-In presence (in case of mixer
9969 * without amp-in there is something wrong, this
9970 * function shouldn't be used or capsrc nid is wrong)
9972 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9973 snd_hda_codec_write(codec, nid, 0,
9974 AC_VERB_SET_AMP_GAIN_MUTE,
9976 else if (mute != AMP_IN_MUTE(idx))
9977 snd_hda_codec_write(codec, nid, 0,
9978 AC_VERB_SET_CONNECT_SEL,
9984 /* add mic boosts if needed */
9985 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9987 struct alc_spec *spec = codec->spec;
9991 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9992 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9993 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9995 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
9999 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10000 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10001 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10003 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10010 /* almost identical with ALC880 parser... */
10011 static int alc882_parse_auto_config(struct hda_codec *codec)
10013 struct alc_spec *spec = codec->spec;
10014 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10017 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10021 if (!spec->autocfg.line_outs)
10022 return 0; /* can't find valid BIOS pin config */
10024 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10027 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10030 err = alc880_auto_create_extra_out(spec,
10031 spec->autocfg.speaker_pins[0],
10035 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10039 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10043 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10045 /* check multiple SPDIF-out (for recent codecs) */
10046 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10048 err = snd_hda_get_connections(codec,
10049 spec->autocfg.dig_out_pins[i],
10054 spec->multiout.dig_out_nid = dig_nid;
10056 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10057 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10059 spec->slave_dig_outs[i - 1] = dig_nid;
10062 if (spec->autocfg.dig_in_pin)
10063 spec->dig_in_nid = ALC880_DIGIN_NID;
10065 if (spec->kctls.list)
10066 add_mixer(spec, spec->kctls.list);
10068 add_verb(spec, alc883_auto_init_verbs);
10069 /* if ADC 0x07 is available, initialize it, too */
10070 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10071 add_verb(spec, alc882_adc1_init_verbs);
10073 spec->num_mux_defs = 1;
10074 spec->input_mux = &spec->private_imux[0];
10076 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10078 err = alc_auto_add_mic_boost(codec);
10082 return 1; /* config found */
10085 /* additional initialization for auto-configuration model */
10086 static void alc882_auto_init(struct hda_codec *codec)
10088 struct alc_spec *spec = codec->spec;
10089 alc882_auto_init_multi_out(codec);
10090 alc882_auto_init_hp_out(codec);
10091 alc882_auto_init_analog_input(codec);
10092 alc882_auto_init_input_src(codec);
10093 if (spec->unsol_event)
10094 alc_inithook(codec);
10097 static int patch_alc882(struct hda_codec *codec)
10099 struct alc_spec *spec;
10100 int err, board_config;
10102 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10106 codec->spec = spec;
10108 switch (codec->vendor_id) {
10113 /* ALC883 and variants */
10114 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10118 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10122 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10123 board_config = snd_hda_check_board_codec_sid_config(codec,
10124 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10126 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10127 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10129 board_config = ALC882_AUTO;
10132 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10134 if (board_config == ALC882_AUTO) {
10135 /* automatic parse from the BIOS config */
10136 err = alc882_parse_auto_config(codec);
10142 "hda_codec: Cannot set up configuration "
10143 "from BIOS. Using base mode...\n");
10144 board_config = ALC882_3ST_DIG;
10148 err = snd_hda_attach_beep_device(codec, 0x1);
10154 if (board_config != ALC882_AUTO)
10155 setup_preset(codec, &alc882_presets[board_config]);
10157 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10158 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10159 /* FIXME: setup DAC5 */
10160 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10161 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10163 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10164 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10166 if (codec->vendor_id == 0x10ec0888)
10167 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10169 if (!spec->adc_nids && spec->input_mux) {
10171 spec->num_adc_nids = 0;
10172 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10173 const struct hda_input_mux *imux = spec->input_mux;
10175 hda_nid_t items[16];
10176 hda_nid_t nid = alc882_adc_nids[i];
10177 unsigned int wcap = get_wcaps(codec, nid);
10179 wcap = get_wcaps_type(wcap);
10180 if (wcap != AC_WID_AUD_IN)
10182 spec->private_adc_nids[spec->num_adc_nids] = nid;
10183 err = snd_hda_get_connections(codec, nid, &cap, 1);
10186 err = snd_hda_get_connections(codec, cap, items,
10187 ARRAY_SIZE(items));
10190 for (j = 0; j < imux->num_items; j++)
10191 if (imux->items[j].index >= err)
10193 if (j < imux->num_items)
10195 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10196 spec->num_adc_nids++;
10198 spec->adc_nids = spec->private_adc_nids;
10199 spec->capsrc_nids = spec->private_capsrc_nids;
10202 set_capture_mixer(codec);
10203 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10205 spec->vmaster_nid = 0x0c;
10207 codec->patch_ops = alc_patch_ops;
10208 if (board_config == ALC882_AUTO)
10209 spec->init_hook = alc882_auto_init;
10210 #ifdef CONFIG_SND_HDA_POWER_SAVE
10211 if (!spec->loopback.amplist)
10212 spec->loopback.amplist = alc882_loopbacks;
10214 codec->proc_widget_hook = print_realtek_coef;
10224 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10225 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10227 #define alc262_dac_nids alc260_dac_nids
10228 #define alc262_adc_nids alc882_adc_nids
10229 #define alc262_adc_nids_alt alc882_adc_nids_alt
10230 #define alc262_capsrc_nids alc882_capsrc_nids
10231 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10233 #define alc262_modes alc260_modes
10234 #define alc262_capture_source alc882_capture_source
10236 static hda_nid_t alc262_dmic_adc_nids[1] = {
10241 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10243 static struct snd_kcontrol_new alc262_base_mixer[] = {
10244 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10245 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10246 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10247 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10248 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10249 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10250 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10251 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10252 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10253 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10254 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10257 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10258 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10259 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10263 /* update HP, line and mono-out pins according to the master switch */
10264 static void alc262_hp_master_update(struct hda_codec *codec)
10266 struct alc_spec *spec = codec->spec;
10267 int val = spec->master_sw;
10269 /* HP & line-out */
10270 snd_hda_codec_write_cache(codec, 0x1b, 0,
10271 AC_VERB_SET_PIN_WIDGET_CONTROL,
10273 snd_hda_codec_write_cache(codec, 0x15, 0,
10274 AC_VERB_SET_PIN_WIDGET_CONTROL,
10276 /* mono (speaker) depending on the HP jack sense */
10277 val = val && !spec->jack_present;
10278 snd_hda_codec_write_cache(codec, 0x16, 0,
10279 AC_VERB_SET_PIN_WIDGET_CONTROL,
10280 val ? PIN_OUT : 0);
10283 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10285 struct alc_spec *spec = codec->spec;
10287 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10288 alc262_hp_master_update(codec);
10291 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10293 if ((res >> 26) != ALC880_HP_EVENT)
10295 alc262_hp_bpc_automute(codec);
10298 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10300 struct alc_spec *spec = codec->spec;
10302 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10303 alc262_hp_master_update(codec);
10306 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10309 if ((res >> 26) != ALC880_HP_EVENT)
10311 alc262_hp_wildwest_automute(codec);
10314 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10316 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10317 struct snd_ctl_elem_value *ucontrol)
10319 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10320 struct alc_spec *spec = codec->spec;
10321 int val = !!*ucontrol->value.integer.value;
10323 if (val == spec->master_sw)
10325 spec->master_sw = val;
10326 alc262_hp_master_update(codec);
10330 #define ALC262_HP_MASTER_SWITCH \
10332 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10333 .name = "Master Playback Switch", \
10334 .info = snd_ctl_boolean_mono_info, \
10335 .get = alc262_hp_master_sw_get, \
10336 .put = alc262_hp_master_sw_put, \
10339 .iface = NID_MAPPING, \
10340 .name = "Master Playback Switch", \
10341 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10345 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10346 ALC262_HP_MASTER_SWITCH,
10347 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10348 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10350 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10352 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10354 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10355 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10356 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10357 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10358 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10359 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10360 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10361 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10362 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10363 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10364 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10365 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10369 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10370 ALC262_HP_MASTER_SWITCH,
10371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10373 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10375 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10377 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10381 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10389 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10390 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10391 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10392 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10396 /* mute/unmute internal speaker according to the hp jack and mute state */
10397 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10399 struct alc_spec *spec = codec->spec;
10401 spec->autocfg.hp_pins[0] = 0x15;
10402 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10405 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10406 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10407 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10408 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10409 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10412 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10416 static struct hda_verb alc262_hp_t5735_verbs[] = {
10417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10418 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10420 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10424 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10425 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10426 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10427 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10428 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10429 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10430 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10434 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10436 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10438 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10439 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10440 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10442 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10444 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10448 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10455 /* bind hp and internal speaker mute (with plug check) as master switch */
10456 static void alc262_hippo_master_update(struct hda_codec *codec)
10458 struct alc_spec *spec = codec->spec;
10459 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10460 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10461 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10465 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10466 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10467 HDA_AMP_MUTE, mute);
10468 /* mute internal speaker per jack sense */
10469 if (spec->jack_present)
10470 mute = HDA_AMP_MUTE;
10472 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10473 HDA_AMP_MUTE, mute);
10474 if (speaker_nid && speaker_nid != line_nid)
10475 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10476 HDA_AMP_MUTE, mute);
10479 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10481 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10482 struct snd_ctl_elem_value *ucontrol)
10484 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10485 struct alc_spec *spec = codec->spec;
10486 int val = !!*ucontrol->value.integer.value;
10488 if (val == spec->master_sw)
10490 spec->master_sw = val;
10491 alc262_hippo_master_update(codec);
10495 #define ALC262_HIPPO_MASTER_SWITCH \
10497 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10498 .name = "Master Playback Switch", \
10499 .info = snd_ctl_boolean_mono_info, \
10500 .get = alc262_hippo_master_sw_get, \
10501 .put = alc262_hippo_master_sw_put, \
10504 .iface = NID_MAPPING, \
10505 .name = "Master Playback Switch", \
10506 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10507 (SUBDEV_SPEAKER(0) << 16), \
10510 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10511 ALC262_HIPPO_MASTER_SWITCH,
10512 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10513 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10514 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10515 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10516 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10517 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10518 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10519 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10520 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10521 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10522 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10523 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10527 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10528 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10529 ALC262_HIPPO_MASTER_SWITCH,
10530 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10531 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10532 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10533 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10534 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10535 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10536 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10537 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10538 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10543 /* mute/unmute internal speaker according to the hp jack and mute state */
10544 static void alc262_hippo_automute(struct hda_codec *codec)
10546 struct alc_spec *spec = codec->spec;
10547 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10549 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10550 alc262_hippo_master_update(codec);
10553 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10555 if ((res >> 26) != ALC880_HP_EVENT)
10557 alc262_hippo_automute(codec);
10560 static void alc262_hippo_setup(struct hda_codec *codec)
10562 struct alc_spec *spec = codec->spec;
10564 spec->autocfg.hp_pins[0] = 0x15;
10565 spec->autocfg.speaker_pins[0] = 0x14;
10568 static void alc262_hippo1_setup(struct hda_codec *codec)
10570 struct alc_spec *spec = codec->spec;
10572 spec->autocfg.hp_pins[0] = 0x1b;
10573 spec->autocfg.speaker_pins[0] = 0x14;
10577 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10578 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10579 ALC262_HIPPO_MASTER_SWITCH,
10580 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10582 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10583 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10587 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10588 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10589 ALC262_HIPPO_MASTER_SWITCH,
10590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10591 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10592 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10593 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10594 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10598 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10599 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10600 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10601 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10602 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10603 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10604 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10605 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10606 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10607 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10608 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10609 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10614 static struct hda_verb alc262_tyan_verbs[] = {
10615 /* Headphone automute */
10616 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10617 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10618 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10620 /* P11 AUX_IN, white 4-pin connector */
10621 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10622 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10623 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10624 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10629 /* unsolicited event for HP jack sensing */
10630 static void alc262_tyan_setup(struct hda_codec *codec)
10632 struct alc_spec *spec = codec->spec;
10634 spec->autocfg.hp_pins[0] = 0x1b;
10635 spec->autocfg.speaker_pins[0] = 0x15;
10639 #define alc262_capture_mixer alc882_capture_mixer
10640 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10643 * generic initialization of ADC, input mixers and output mixers
10645 static struct hda_verb alc262_init_verbs[] = {
10647 * Unmute ADC0-2 and set the default input to mic-in
10649 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10650 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10651 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10653 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10656 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10658 * Note: PASD motherboards uses the Line In 2 as the input for
10659 * front panel mic (mic 2)
10661 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10662 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10663 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10664 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10669 * Set up output mixers (0x0c - 0x0e)
10671 /* set vol=0 to output mixers */
10672 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10674 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10675 /* set up input amps for analog loopback */
10676 /* Amp Indices: DAC = 0, mixer = 1 */
10677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10684 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10685 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10686 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10687 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10688 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10689 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10692 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10694 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10697 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10698 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10700 /* FIXME: use matrix-type input source selection */
10701 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10702 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10703 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10704 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10705 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10708 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10709 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10710 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10713 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10721 static struct hda_verb alc262_eapd_verbs[] = {
10722 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10723 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10727 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10728 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10729 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10732 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10737 static struct hda_verb alc262_sony_unsol_verbs[] = {
10738 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10739 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10740 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10742 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10747 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10748 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10749 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10750 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10752 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10756 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10757 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10758 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10759 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10760 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10761 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10763 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10764 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10768 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10770 struct alc_spec *spec = codec->spec;
10772 spec->autocfg.hp_pins[0] = 0x15;
10773 spec->autocfg.speaker_pins[0] = 0x14;
10774 spec->ext_mic.pin = 0x18;
10775 spec->ext_mic.mux_idx = 0;
10776 spec->int_mic.pin = 0x12;
10777 spec->int_mic.mux_idx = 9;
10778 spec->auto_mic = 1;
10784 * 0x16 = internal speaker
10785 * 0x18 = external mic
10788 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10789 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10790 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10796 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10797 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10801 static struct hda_verb alc262_nec_verbs[] = {
10802 /* Unmute Speaker */
10803 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10806 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10809 /* External mic to headphone */
10810 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10811 /* External mic to speaker */
10812 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10818 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10819 * 0x1b = port replicator headphone out
10822 #define ALC_HP_EVENT 0x37
10824 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10825 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10826 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10827 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10828 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10832 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10833 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10834 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10838 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10839 /* Front Mic pin: input vref at 50% */
10840 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10841 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10845 static struct hda_input_mux alc262_fujitsu_capture_source = {
10849 { "Int Mic", 0x1 },
10854 static struct hda_input_mux alc262_HP_capture_source = {
10858 { "Front Mic", 0x1 },
10865 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10869 { "Front Mic", 0x2 },
10875 /* mute/unmute internal speaker according to the hp jacks and mute state */
10876 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10878 struct alc_spec *spec = codec->spec;
10881 if (force || !spec->sense_updated) {
10882 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10883 snd_hda_jack_detect(codec, 0x1b);
10884 spec->sense_updated = 1;
10886 /* unmute internal speaker only if both HPs are unplugged and
10887 * master switch is on
10889 if (spec->jack_present)
10890 mute = HDA_AMP_MUTE;
10892 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10893 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10894 HDA_AMP_MUTE, mute);
10897 /* unsolicited event for HP jack sensing */
10898 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10901 if ((res >> 26) != ALC_HP_EVENT)
10903 alc262_fujitsu_automute(codec, 1);
10906 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10908 alc262_fujitsu_automute(codec, 1);
10911 /* bind volumes of both NID 0x0c and 0x0d */
10912 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10913 .ops = &snd_hda_bind_vol,
10915 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10916 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10921 /* mute/unmute internal speaker according to the hp jack and mute state */
10922 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10924 struct alc_spec *spec = codec->spec;
10927 if (force || !spec->sense_updated) {
10928 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10929 spec->sense_updated = 1;
10931 if (spec->jack_present) {
10932 /* mute internal speaker */
10933 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10934 HDA_AMP_MUTE, HDA_AMP_MUTE);
10935 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10936 HDA_AMP_MUTE, HDA_AMP_MUTE);
10938 /* unmute internal speaker if necessary */
10939 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10940 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10941 HDA_AMP_MUTE, mute);
10942 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10943 HDA_AMP_MUTE, mute);
10947 /* unsolicited event for HP jack sensing */
10948 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10951 if ((res >> 26) != ALC_HP_EVENT)
10953 alc262_lenovo_3000_automute(codec, 1);
10956 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10957 int dir, int idx, long *valp)
10961 for (i = 0; i < 2; i++, valp++)
10962 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10964 *valp ? 0 : HDA_AMP_MUTE);
10968 /* bind hp and internal speaker mute (with plug check) */
10969 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10970 struct snd_ctl_elem_value *ucontrol)
10972 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10973 long *valp = ucontrol->value.integer.value;
10976 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10977 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10979 alc262_fujitsu_automute(codec, 0);
10983 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10984 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10986 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10987 .name = "Master Playback Switch",
10988 .subdevice = HDA_SUBDEV_AMP_FLAG,
10989 .info = snd_hda_mixer_amp_switch_info,
10990 .get = snd_hda_mixer_amp_switch_get,
10991 .put = alc262_fujitsu_master_sw_put,
10992 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10995 .iface = NID_MAPPING,
10996 .name = "Master Playback Switch",
10997 .private_value = 0x1b,
10999 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11000 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11001 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11002 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11003 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11004 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11005 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11006 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11010 /* bind hp and internal speaker mute (with plug check) */
11011 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11012 struct snd_ctl_elem_value *ucontrol)
11014 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11015 long *valp = ucontrol->value.integer.value;
11018 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11020 alc262_lenovo_3000_automute(codec, 0);
11024 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11025 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11027 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11028 .name = "Master Playback Switch",
11029 .subdevice = HDA_SUBDEV_AMP_FLAG,
11030 .info = snd_hda_mixer_amp_switch_info,
11031 .get = snd_hda_mixer_amp_switch_get,
11032 .put = alc262_lenovo_3000_master_sw_put,
11033 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11035 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11036 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11037 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11038 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11039 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11040 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11041 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11042 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11046 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11047 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11048 ALC262_HIPPO_MASTER_SWITCH,
11049 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11051 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11052 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11053 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11054 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11058 /* additional init verbs for Benq laptops */
11059 static struct hda_verb alc262_EAPD_verbs[] = {
11060 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11061 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11065 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11066 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11067 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11069 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11070 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11074 /* Samsung Q1 Ultra Vista model setup */
11075 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11076 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11077 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11078 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11079 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11080 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11081 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11085 static struct hda_verb alc262_ultra_verbs[] = {
11087 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11088 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11089 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11091 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11092 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11093 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11094 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11097 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11098 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11099 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11100 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11102 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11103 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11104 /* ADC, choose mic */
11105 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11106 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11107 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11108 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11118 /* mute/unmute internal speaker according to the hp jack and mute state */
11119 static void alc262_ultra_automute(struct hda_codec *codec)
11121 struct alc_spec *spec = codec->spec;
11125 /* auto-mute only when HP is used as HP */
11126 if (!spec->cur_mux[0]) {
11127 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11128 if (spec->jack_present)
11129 mute = HDA_AMP_MUTE;
11131 /* mute/unmute internal speaker */
11132 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11133 HDA_AMP_MUTE, mute);
11134 /* mute/unmute HP */
11135 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11136 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11139 /* unsolicited event for HP jack sensing */
11140 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11143 if ((res >> 26) != ALC880_HP_EVENT)
11145 alc262_ultra_automute(codec);
11148 static struct hda_input_mux alc262_ultra_capture_source = {
11152 { "Headphone", 0x7 },
11156 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11157 struct snd_ctl_elem_value *ucontrol)
11159 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11160 struct alc_spec *spec = codec->spec;
11163 ret = alc_mux_enum_put(kcontrol, ucontrol);
11166 /* reprogram the HP pin as mic or HP according to the input source */
11167 snd_hda_codec_write_cache(codec, 0x15, 0,
11168 AC_VERB_SET_PIN_WIDGET_CONTROL,
11169 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11170 alc262_ultra_automute(codec); /* mute/unmute HP */
11174 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11175 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11176 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11178 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11179 .name = "Capture Source",
11180 .info = alc_mux_enum_info,
11181 .get = alc_mux_enum_get,
11182 .put = alc262_ultra_mux_enum_put,
11185 .iface = NID_MAPPING,
11186 .name = "Capture Source",
11187 .private_value = 0x15,
11192 /* We use two mixers depending on the output pin; 0x16 is a mono output
11193 * and thus it's bound with a different mixer.
11194 * This function returns which mixer amp should be used.
11196 static int alc262_check_volbit(hda_nid_t nid)
11200 else if (nid == 0x16)
11206 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11207 const char *pfx, int *vbits)
11212 vbit = alc262_check_volbit(nid);
11215 if (*vbits & vbit) /* a volume control for this mixer already there */
11219 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11221 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11222 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11225 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11233 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11235 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11236 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11239 /* add playback controls from the parsed DAC table */
11240 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11241 const struct auto_pin_cfg *cfg)
11247 spec->multiout.num_dacs = 1; /* only use one dac */
11248 spec->multiout.dac_nids = spec->private_dac_nids;
11249 spec->multiout.dac_nids[0] = 2;
11251 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11253 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11257 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11260 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11263 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11267 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11268 alc262_check_volbit(cfg->speaker_pins[0]) |
11269 alc262_check_volbit(cfg->hp_pins[0]);
11270 if (vbits == 1 || vbits == 2)
11271 pfx = "Master"; /* only one mixer is used */
11272 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11277 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11280 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11284 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11291 #define alc262_auto_create_input_ctls \
11292 alc880_auto_create_input_ctls
11295 * generic initialization of ADC, input mixers and output mixers
11297 static struct hda_verb alc262_volume_init_verbs[] = {
11299 * Unmute ADC0-2 and set the default input to mic-in
11301 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11302 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11303 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11305 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11308 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11310 * Note: PASD motherboards uses the Line In 2 as the input for
11311 * front panel mic (mic 2)
11313 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11315 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11316 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11321 * Set up output mixers (0x0c - 0x0f)
11323 /* set vol=0 to output mixers */
11324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11328 /* set up input amps for analog loopback */
11329 /* Amp Indices: DAC = 0, mixer = 1 */
11330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11333 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11334 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11335 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11337 /* FIXME: use matrix-type input source selection */
11338 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11339 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11340 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11342 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11350 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11358 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11360 * Unmute ADC0-2 and set the default input to mic-in
11362 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11363 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11364 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11365 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11366 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11367 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11369 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11371 * Note: PASD motherboards uses the Line In 2 as the input for
11372 * front panel mic (mic 2)
11374 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11384 * Set up output mixers (0x0c - 0x0e)
11386 /* set vol=0 to output mixers */
11387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11388 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11389 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11391 /* set up input amps for analog loopback */
11392 /* Amp Indices: DAC = 0, mixer = 1 */
11393 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11394 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11395 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11396 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11397 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11398 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11401 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11402 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11404 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11405 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11407 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11410 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11411 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11412 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11414 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11417 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11418 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11419 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11420 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11421 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11424 /* FIXME: use matrix-type input source selection */
11425 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11426 /* Input mixer1: only unmute Mic */
11427 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11428 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11429 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11437 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11438 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11439 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11447 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11448 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11449 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11457 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11462 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11464 * Unmute ADC0-2 and set the default input to mic-in
11466 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11467 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11468 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11469 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11470 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11471 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11473 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11475 * Note: PASD motherboards uses the Line In 2 as the input for front
11476 * panel mic (mic 2)
11478 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11479 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11480 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11481 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11488 * Set up output mixers (0x0c - 0x0e)
11490 /* set vol=0 to output mixers */
11491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11492 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11493 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11495 /* set up input amps for analog loopback */
11496 /* Amp Indices: DAC = 0, mixer = 1 */
11497 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11498 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11499 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11500 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11501 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11502 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11505 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11506 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11507 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11508 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11509 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11511 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11513 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11514 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11516 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11517 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11519 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11521 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11522 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11523 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11524 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11526 /* FIXME: use matrix-type input source selection */
11527 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11528 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11534 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11537 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11538 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11539 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11542 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11545 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11546 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11547 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11550 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11553 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11558 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11560 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11561 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11562 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11564 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11565 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11566 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11567 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11569 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11570 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11571 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11576 #ifdef CONFIG_SND_HDA_POWER_SAVE
11577 #define alc262_loopbacks alc880_loopbacks
11580 /* pcm configuration: identical with ALC880 */
11581 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11582 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11583 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11584 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11587 * BIOS auto configuration
11589 static int alc262_parse_auto_config(struct hda_codec *codec)
11591 struct alc_spec *spec = codec->spec;
11593 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11595 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11599 if (!spec->autocfg.line_outs) {
11600 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11601 spec->multiout.max_channels = 2;
11602 spec->no_analog = 1;
11605 return 0; /* can't find valid BIOS pin config */
11607 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11610 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11614 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11617 if (spec->autocfg.dig_outs) {
11618 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11619 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11621 if (spec->autocfg.dig_in_pin)
11622 spec->dig_in_nid = ALC262_DIGIN_NID;
11624 if (spec->kctls.list)
11625 add_mixer(spec, spec->kctls.list);
11627 add_verb(spec, alc262_volume_init_verbs);
11628 spec->num_mux_defs = 1;
11629 spec->input_mux = &spec->private_imux[0];
11631 err = alc_auto_add_mic_boost(codec);
11635 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11640 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11641 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11642 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11643 #define alc262_auto_init_input_src alc882_auto_init_input_src
11646 /* init callback for auto-configuration model -- overriding the default init */
11647 static void alc262_auto_init(struct hda_codec *codec)
11649 struct alc_spec *spec = codec->spec;
11650 alc262_auto_init_multi_out(codec);
11651 alc262_auto_init_hp_out(codec);
11652 alc262_auto_init_analog_input(codec);
11653 alc262_auto_init_input_src(codec);
11654 if (spec->unsol_event)
11655 alc_inithook(codec);
11659 * configuration and preset
11661 static const char *alc262_models[ALC262_MODEL_LAST] = {
11662 [ALC262_BASIC] = "basic",
11663 [ALC262_HIPPO] = "hippo",
11664 [ALC262_HIPPO_1] = "hippo_1",
11665 [ALC262_FUJITSU] = "fujitsu",
11666 [ALC262_HP_BPC] = "hp-bpc",
11667 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11668 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11669 [ALC262_HP_RP5700] = "hp-rp5700",
11670 [ALC262_BENQ_ED8] = "benq",
11671 [ALC262_BENQ_T31] = "benq-t31",
11672 [ALC262_SONY_ASSAMD] = "sony-assamd",
11673 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11674 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11675 [ALC262_ULTRA] = "ultra",
11676 [ALC262_LENOVO_3000] = "lenovo-3000",
11677 [ALC262_NEC] = "nec",
11678 [ALC262_TYAN] = "tyan",
11679 [ALC262_AUTO] = "auto",
11682 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11683 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11684 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11685 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11687 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11689 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11691 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11692 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11693 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11694 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11695 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11696 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11697 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11698 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11699 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11700 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11701 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11702 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11703 ALC262_HP_TC_T5735),
11704 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11705 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11706 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11707 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11708 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11709 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11710 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11711 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11712 #if 0 /* disable the quirk since model=auto works better in recent versions */
11713 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11714 ALC262_SONY_ASSAMD),
11716 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11717 ALC262_TOSHIBA_RX1),
11718 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11719 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11720 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11721 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11722 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11724 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11725 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11726 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11727 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11728 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11732 static struct alc_config_preset alc262_presets[] = {
11734 .mixers = { alc262_base_mixer },
11735 .init_verbs = { alc262_init_verbs },
11736 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11737 .dac_nids = alc262_dac_nids,
11739 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11740 .channel_mode = alc262_modes,
11741 .input_mux = &alc262_capture_source,
11744 .mixers = { alc262_hippo_mixer },
11745 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11746 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11747 .dac_nids = alc262_dac_nids,
11749 .dig_out_nid = ALC262_DIGOUT_NID,
11750 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11751 .channel_mode = alc262_modes,
11752 .input_mux = &alc262_capture_source,
11753 .unsol_event = alc262_hippo_unsol_event,
11754 .setup = alc262_hippo_setup,
11755 .init_hook = alc262_hippo_automute,
11757 [ALC262_HIPPO_1] = {
11758 .mixers = { alc262_hippo1_mixer },
11759 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11760 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11761 .dac_nids = alc262_dac_nids,
11763 .dig_out_nid = ALC262_DIGOUT_NID,
11764 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11765 .channel_mode = alc262_modes,
11766 .input_mux = &alc262_capture_source,
11767 .unsol_event = alc262_hippo_unsol_event,
11768 .setup = alc262_hippo1_setup,
11769 .init_hook = alc262_hippo_automute,
11771 [ALC262_FUJITSU] = {
11772 .mixers = { alc262_fujitsu_mixer },
11773 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11774 alc262_fujitsu_unsol_verbs },
11775 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11776 .dac_nids = alc262_dac_nids,
11778 .dig_out_nid = ALC262_DIGOUT_NID,
11779 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11780 .channel_mode = alc262_modes,
11781 .input_mux = &alc262_fujitsu_capture_source,
11782 .unsol_event = alc262_fujitsu_unsol_event,
11783 .init_hook = alc262_fujitsu_init_hook,
11785 [ALC262_HP_BPC] = {
11786 .mixers = { alc262_HP_BPC_mixer },
11787 .init_verbs = { alc262_HP_BPC_init_verbs },
11788 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11789 .dac_nids = alc262_dac_nids,
11791 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11792 .channel_mode = alc262_modes,
11793 .input_mux = &alc262_HP_capture_source,
11794 .unsol_event = alc262_hp_bpc_unsol_event,
11795 .init_hook = alc262_hp_bpc_automute,
11797 [ALC262_HP_BPC_D7000_WF] = {
11798 .mixers = { alc262_HP_BPC_WildWest_mixer },
11799 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11800 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11801 .dac_nids = alc262_dac_nids,
11803 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11804 .channel_mode = alc262_modes,
11805 .input_mux = &alc262_HP_D7000_capture_source,
11806 .unsol_event = alc262_hp_wildwest_unsol_event,
11807 .init_hook = alc262_hp_wildwest_automute,
11809 [ALC262_HP_BPC_D7000_WL] = {
11810 .mixers = { alc262_HP_BPC_WildWest_mixer,
11811 alc262_HP_BPC_WildWest_option_mixer },
11812 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11813 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11814 .dac_nids = alc262_dac_nids,
11816 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11817 .channel_mode = alc262_modes,
11818 .input_mux = &alc262_HP_D7000_capture_source,
11819 .unsol_event = alc262_hp_wildwest_unsol_event,
11820 .init_hook = alc262_hp_wildwest_automute,
11822 [ALC262_HP_TC_T5735] = {
11823 .mixers = { alc262_hp_t5735_mixer },
11824 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11825 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11826 .dac_nids = alc262_dac_nids,
11828 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11829 .channel_mode = alc262_modes,
11830 .input_mux = &alc262_capture_source,
11831 .unsol_event = alc_automute_amp_unsol_event,
11832 .setup = alc262_hp_t5735_setup,
11833 .init_hook = alc_automute_amp,
11835 [ALC262_HP_RP5700] = {
11836 .mixers = { alc262_hp_rp5700_mixer },
11837 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11838 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11839 .dac_nids = alc262_dac_nids,
11840 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11841 .channel_mode = alc262_modes,
11842 .input_mux = &alc262_hp_rp5700_capture_source,
11844 [ALC262_BENQ_ED8] = {
11845 .mixers = { alc262_base_mixer },
11846 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11848 .dac_nids = alc262_dac_nids,
11850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11851 .channel_mode = alc262_modes,
11852 .input_mux = &alc262_capture_source,
11854 [ALC262_SONY_ASSAMD] = {
11855 .mixers = { alc262_sony_mixer },
11856 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11857 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11858 .dac_nids = alc262_dac_nids,
11860 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11861 .channel_mode = alc262_modes,
11862 .input_mux = &alc262_capture_source,
11863 .unsol_event = alc262_hippo_unsol_event,
11864 .setup = alc262_hippo_setup,
11865 .init_hook = alc262_hippo_automute,
11867 [ALC262_BENQ_T31] = {
11868 .mixers = { alc262_benq_t31_mixer },
11869 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11870 alc_hp15_unsol_verbs },
11871 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11872 .dac_nids = alc262_dac_nids,
11874 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11875 .channel_mode = alc262_modes,
11876 .input_mux = &alc262_capture_source,
11877 .unsol_event = alc262_hippo_unsol_event,
11878 .setup = alc262_hippo_setup,
11879 .init_hook = alc262_hippo_automute,
11882 .mixers = { alc262_ultra_mixer },
11883 .cap_mixer = alc262_ultra_capture_mixer,
11884 .init_verbs = { alc262_ultra_verbs },
11885 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11886 .dac_nids = alc262_dac_nids,
11887 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11888 .channel_mode = alc262_modes,
11889 .input_mux = &alc262_ultra_capture_source,
11890 .adc_nids = alc262_adc_nids, /* ADC0 */
11891 .capsrc_nids = alc262_capsrc_nids,
11892 .num_adc_nids = 1, /* single ADC */
11893 .unsol_event = alc262_ultra_unsol_event,
11894 .init_hook = alc262_ultra_automute,
11896 [ALC262_LENOVO_3000] = {
11897 .mixers = { alc262_lenovo_3000_mixer },
11898 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11899 alc262_lenovo_3000_unsol_verbs,
11900 alc262_lenovo_3000_init_verbs },
11901 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11902 .dac_nids = alc262_dac_nids,
11904 .dig_out_nid = ALC262_DIGOUT_NID,
11905 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11906 .channel_mode = alc262_modes,
11907 .input_mux = &alc262_fujitsu_capture_source,
11908 .unsol_event = alc262_lenovo_3000_unsol_event,
11911 .mixers = { alc262_nec_mixer },
11912 .init_verbs = { alc262_nec_verbs },
11913 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11914 .dac_nids = alc262_dac_nids,
11916 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11917 .channel_mode = alc262_modes,
11918 .input_mux = &alc262_capture_source,
11920 [ALC262_TOSHIBA_S06] = {
11921 .mixers = { alc262_toshiba_s06_mixer },
11922 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11923 alc262_eapd_verbs },
11924 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11925 .capsrc_nids = alc262_dmic_capsrc_nids,
11926 .dac_nids = alc262_dac_nids,
11927 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11928 .num_adc_nids = 1, /* single ADC */
11929 .dig_out_nid = ALC262_DIGOUT_NID,
11930 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11931 .channel_mode = alc262_modes,
11932 .unsol_event = alc_sku_unsol_event,
11933 .setup = alc262_toshiba_s06_setup,
11934 .init_hook = alc_inithook,
11936 [ALC262_TOSHIBA_RX1] = {
11937 .mixers = { alc262_toshiba_rx1_mixer },
11938 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11939 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11940 .dac_nids = alc262_dac_nids,
11942 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11943 .channel_mode = alc262_modes,
11944 .input_mux = &alc262_capture_source,
11945 .unsol_event = alc262_hippo_unsol_event,
11946 .setup = alc262_hippo_setup,
11947 .init_hook = alc262_hippo_automute,
11950 .mixers = { alc262_tyan_mixer },
11951 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11952 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11953 .dac_nids = alc262_dac_nids,
11955 .dig_out_nid = ALC262_DIGOUT_NID,
11956 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11957 .channel_mode = alc262_modes,
11958 .input_mux = &alc262_capture_source,
11959 .unsol_event = alc_automute_amp_unsol_event,
11960 .setup = alc262_tyan_setup,
11961 .init_hook = alc_automute_amp,
11965 static int patch_alc262(struct hda_codec *codec)
11967 struct alc_spec *spec;
11971 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11975 codec->spec = spec;
11977 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11982 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11983 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11984 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11985 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11989 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11991 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11995 if (board_config < 0) {
11996 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
11998 board_config = ALC262_AUTO;
12001 if (board_config == ALC262_AUTO) {
12002 /* automatic parse from the BIOS config */
12003 err = alc262_parse_auto_config(codec);
12009 "hda_codec: Cannot set up configuration "
12010 "from BIOS. Using base mode...\n");
12011 board_config = ALC262_BASIC;
12015 if (!spec->no_analog) {
12016 err = snd_hda_attach_beep_device(codec, 0x1);
12023 if (board_config != ALC262_AUTO)
12024 setup_preset(codec, &alc262_presets[board_config]);
12026 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12027 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12029 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12030 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12032 if (!spec->adc_nids && spec->input_mux) {
12034 /* check whether the digital-mic has to be supported */
12035 for (i = 0; i < spec->input_mux->num_items; i++) {
12036 if (spec->input_mux->items[i].index >= 9)
12039 if (i < spec->input_mux->num_items) {
12040 /* use only ADC0 */
12041 spec->adc_nids = alc262_dmic_adc_nids;
12042 spec->num_adc_nids = 1;
12043 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12045 /* all analog inputs */
12046 /* check whether NID 0x07 is valid */
12047 unsigned int wcap = get_wcaps(codec, 0x07);
12050 wcap = get_wcaps_type(wcap);
12051 if (wcap != AC_WID_AUD_IN) {
12052 spec->adc_nids = alc262_adc_nids_alt;
12053 spec->num_adc_nids =
12054 ARRAY_SIZE(alc262_adc_nids_alt);
12055 spec->capsrc_nids = alc262_capsrc_nids_alt;
12057 spec->adc_nids = alc262_adc_nids;
12058 spec->num_adc_nids =
12059 ARRAY_SIZE(alc262_adc_nids);
12060 spec->capsrc_nids = alc262_capsrc_nids;
12064 if (!spec->cap_mixer && !spec->no_analog)
12065 set_capture_mixer(codec);
12066 if (!spec->no_analog)
12067 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12069 spec->vmaster_nid = 0x0c;
12071 codec->patch_ops = alc_patch_ops;
12072 if (board_config == ALC262_AUTO)
12073 spec->init_hook = alc262_auto_init;
12074 #ifdef CONFIG_SND_HDA_POWER_SAVE
12075 if (!spec->loopback.amplist)
12076 spec->loopback.amplist = alc262_loopbacks;
12078 codec->proc_widget_hook = print_realtek_coef;
12084 * ALC268 channel source setting (2 channel)
12086 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12087 #define alc268_modes alc260_modes
12089 static hda_nid_t alc268_dac_nids[2] = {
12094 static hda_nid_t alc268_adc_nids[2] = {
12099 static hda_nid_t alc268_adc_nids_alt[1] = {
12104 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12106 static struct snd_kcontrol_new alc268_base_mixer[] = {
12107 /* output mixer control */
12108 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12109 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12110 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12111 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12112 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12113 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12114 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12118 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12119 /* output mixer control */
12120 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12121 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12122 ALC262_HIPPO_MASTER_SWITCH,
12123 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12125 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12129 /* bind Beep switches of both NID 0x0f and 0x10 */
12130 static struct hda_bind_ctls alc268_bind_beep_sw = {
12131 .ops = &snd_hda_bind_sw,
12133 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12134 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12139 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12140 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12141 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12145 static struct hda_verb alc268_eapd_verbs[] = {
12146 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12147 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12151 /* Toshiba specific */
12152 static struct hda_verb alc268_toshiba_verbs[] = {
12153 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12157 /* Acer specific */
12158 /* bind volumes of both NID 0x02 and 0x03 */
12159 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12160 .ops = &snd_hda_bind_vol,
12162 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12163 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12168 /* mute/unmute internal speaker according to the hp jack and mute state */
12169 static void alc268_acer_automute(struct hda_codec *codec, int force)
12171 struct alc_spec *spec = codec->spec;
12174 if (force || !spec->sense_updated) {
12175 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12176 spec->sense_updated = 1;
12178 if (spec->jack_present)
12179 mute = HDA_AMP_MUTE; /* mute internal speaker */
12180 else /* unmute internal speaker if necessary */
12181 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12182 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12183 HDA_AMP_MUTE, mute);
12187 /* bind hp and internal speaker mute (with plug check) */
12188 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12189 struct snd_ctl_elem_value *ucontrol)
12191 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12192 long *valp = ucontrol->value.integer.value;
12195 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12197 alc268_acer_automute(codec, 0);
12201 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12202 /* output mixer control */
12203 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12206 .name = "Master Playback Switch",
12207 .subdevice = HDA_SUBDEV_AMP_FLAG,
12208 .info = snd_hda_mixer_amp_switch_info,
12209 .get = snd_hda_mixer_amp_switch_get,
12210 .put = alc268_acer_master_sw_put,
12211 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12213 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12217 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12218 /* output mixer control */
12219 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12221 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12222 .name = "Master Playback Switch",
12223 .subdevice = HDA_SUBDEV_AMP_FLAG,
12224 .info = snd_hda_mixer_amp_switch_info,
12225 .get = snd_hda_mixer_amp_switch_get,
12226 .put = alc268_acer_master_sw_put,
12227 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12230 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12231 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12235 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12236 /* output mixer control */
12237 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12240 .name = "Master Playback Switch",
12241 .subdevice = HDA_SUBDEV_AMP_FLAG,
12242 .info = snd_hda_mixer_amp_switch_info,
12243 .get = snd_hda_mixer_amp_switch_get,
12244 .put = alc268_acer_master_sw_put,
12245 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12247 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12248 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12252 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12253 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12254 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12255 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12256 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12257 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12258 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12262 static struct hda_verb alc268_acer_verbs[] = {
12263 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12264 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12269 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12273 /* unsolicited event for HP jack sensing */
12274 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12275 #define alc268_toshiba_setup alc262_hippo_setup
12276 #define alc268_toshiba_automute alc262_hippo_automute
12278 static void alc268_acer_unsol_event(struct hda_codec *codec,
12281 if ((res >> 26) != ALC880_HP_EVENT)
12283 alc268_acer_automute(codec, 1);
12286 static void alc268_acer_init_hook(struct hda_codec *codec)
12288 alc268_acer_automute(codec, 1);
12291 /* toggle speaker-output according to the hp-jack state */
12292 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12294 unsigned int present;
12295 unsigned char bits;
12297 present = snd_hda_jack_detect(codec, 0x15);
12298 bits = present ? AMP_IN_MUTE(0) : 0;
12299 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12300 AMP_IN_MUTE(0), bits);
12301 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12302 AMP_IN_MUTE(0), bits);
12305 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12308 switch (res >> 26) {
12309 case ALC880_HP_EVENT:
12310 alc268_aspire_one_speaker_automute(codec);
12312 case ALC880_MIC_EVENT:
12313 alc_mic_automute(codec);
12318 static void alc268_acer_lc_setup(struct hda_codec *codec)
12320 struct alc_spec *spec = codec->spec;
12321 spec->ext_mic.pin = 0x18;
12322 spec->ext_mic.mux_idx = 0;
12323 spec->int_mic.pin = 0x12;
12324 spec->int_mic.mux_idx = 6;
12325 spec->auto_mic = 1;
12328 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12330 alc268_aspire_one_speaker_automute(codec);
12331 alc_mic_automute(codec);
12334 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12335 /* output mixer control */
12336 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12337 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12340 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12341 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12345 static struct hda_verb alc268_dell_verbs[] = {
12346 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12347 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12348 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12349 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12353 /* mute/unmute internal speaker according to the hp jack and mute state */
12354 static void alc268_dell_setup(struct hda_codec *codec)
12356 struct alc_spec *spec = codec->spec;
12358 spec->autocfg.hp_pins[0] = 0x15;
12359 spec->autocfg.speaker_pins[0] = 0x14;
12360 spec->ext_mic.pin = 0x18;
12361 spec->ext_mic.mux_idx = 0;
12362 spec->int_mic.pin = 0x19;
12363 spec->int_mic.mux_idx = 1;
12364 spec->auto_mic = 1;
12367 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12368 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12369 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12370 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12372 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12373 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12374 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12375 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12379 static struct hda_verb alc267_quanta_il1_verbs[] = {
12380 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12381 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12385 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12387 struct alc_spec *spec = codec->spec;
12388 spec->autocfg.hp_pins[0] = 0x15;
12389 spec->autocfg.speaker_pins[0] = 0x14;
12390 spec->ext_mic.pin = 0x18;
12391 spec->ext_mic.mux_idx = 0;
12392 spec->int_mic.pin = 0x19;
12393 spec->int_mic.mux_idx = 1;
12394 spec->auto_mic = 1;
12398 * generic initialization of ADC, input mixers and output mixers
12400 static struct hda_verb alc268_base_init_verbs[] = {
12401 /* Unmute DAC0-1 and set vol = 0 */
12402 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12403 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12406 * Set up output mixers (0x0c - 0x0e)
12408 /* set vol=0 to output mixers */
12409 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12410 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12413 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12416 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12417 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12418 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12419 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12420 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12421 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12422 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12424 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12426 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12428 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12430 /* set PCBEEP vol = 0, mute connections */
12431 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12432 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12433 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12435 /* Unmute Selector 23h,24h and set the default input to mic-in */
12437 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12438 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12439 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12440 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12446 * generic initialization of ADC, input mixers and output mixers
12448 static struct hda_verb alc268_volume_init_verbs[] = {
12449 /* set output DAC */
12450 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12451 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12453 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12454 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12455 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12456 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12457 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12459 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12460 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12461 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12464 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12466 /* set PCBEEP vol = 0, mute connections */
12467 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12468 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12469 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12474 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12475 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12476 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12480 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12481 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12482 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12487 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12488 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12489 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12490 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12491 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12496 static struct hda_input_mux alc268_capture_source = {
12500 { "Front Mic", 0x1 },
12506 static struct hda_input_mux alc268_acer_capture_source = {
12510 { "Internal Mic", 0x1 },
12515 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12519 { "Internal Mic", 0x6 },
12524 #ifdef CONFIG_SND_DEBUG
12525 static struct snd_kcontrol_new alc268_test_mixer[] = {
12526 /* Volume widgets */
12527 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12528 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12529 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12530 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12531 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12532 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12533 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12534 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12535 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12536 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12537 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12538 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12539 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12540 /* The below appears problematic on some hardwares */
12541 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12542 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12543 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12544 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12545 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12547 /* Modes for retasking pin widgets */
12548 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12549 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12550 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12551 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12553 /* Controls for GPIO pins, assuming they are configured as outputs */
12554 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12555 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12556 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12557 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12559 /* Switches to allow the digital SPDIF output pin to be enabled.
12560 * The ALC268 does not have an SPDIF input.
12562 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12564 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12565 * this output to turn on an external amplifier.
12567 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12568 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12574 /* create input playback/capture controls for the given pin */
12575 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12576 const char *ctlname, int idx)
12592 if (spec->multiout.dac_nids[0] != dac &&
12593 spec->multiout.dac_nids[1] != dac) {
12594 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12595 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12599 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12603 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12604 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12606 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12607 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12613 /* add playback controls from the parsed DAC table */
12614 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12615 const struct auto_pin_cfg *cfg)
12620 spec->multiout.dac_nids = spec->private_dac_nids;
12622 nid = cfg->line_out_pins[0];
12625 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12629 err = alc268_new_analog_output(spec, nid, name, 0);
12634 nid = cfg->speaker_pins[0];
12636 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12637 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12641 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12645 nid = cfg->hp_pins[0];
12647 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12652 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12654 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12655 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12662 /* create playback/capture controls for input pins */
12663 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12664 const struct auto_pin_cfg *cfg)
12666 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12669 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12670 hda_nid_t nid, int pin_type)
12674 alc_set_pin_output(codec, nid, pin_type);
12675 if (nid == 0x14 || nid == 0x16)
12679 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12682 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12684 struct alc_spec *spec = codec->spec;
12685 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12687 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12688 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12692 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12694 struct alc_spec *spec = codec->spec;
12697 pin = spec->autocfg.hp_pins[0];
12699 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12700 pin = spec->autocfg.speaker_pins[0];
12702 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12705 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12707 struct alc_spec *spec = codec->spec;
12708 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12709 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12710 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12711 unsigned int dac_vol1, dac_vol2;
12713 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12714 snd_hda_codec_write(codec, speaker_nid, 0,
12715 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12716 /* mute mixer inputs from 0x1d */
12717 snd_hda_codec_write(codec, 0x0f, 0,
12718 AC_VERB_SET_AMP_GAIN_MUTE,
12720 snd_hda_codec_write(codec, 0x10, 0,
12721 AC_VERB_SET_AMP_GAIN_MUTE,
12724 /* unmute mixer inputs from 0x1d */
12725 snd_hda_codec_write(codec, 0x0f, 0,
12726 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12727 snd_hda_codec_write(codec, 0x10, 0,
12728 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12731 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12732 if (line_nid == 0x14)
12733 dac_vol2 = AMP_OUT_ZERO;
12734 else if (line_nid == 0x15)
12735 dac_vol1 = AMP_OUT_ZERO;
12736 if (hp_nid == 0x14)
12737 dac_vol2 = AMP_OUT_ZERO;
12738 else if (hp_nid == 0x15)
12739 dac_vol1 = AMP_OUT_ZERO;
12740 if (line_nid != 0x16 || hp_nid != 0x16 ||
12741 spec->autocfg.line_out_pins[1] != 0x16 ||
12742 spec->autocfg.line_out_pins[2] != 0x16)
12743 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12745 snd_hda_codec_write(codec, 0x02, 0,
12746 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12747 snd_hda_codec_write(codec, 0x03, 0,
12748 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12751 /* pcm configuration: identical with ALC880 */
12752 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12753 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12754 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12755 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12758 * BIOS auto configuration
12760 static int alc268_parse_auto_config(struct hda_codec *codec)
12762 struct alc_spec *spec = codec->spec;
12764 static hda_nid_t alc268_ignore[] = { 0 };
12766 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12770 if (!spec->autocfg.line_outs) {
12771 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12772 spec->multiout.max_channels = 2;
12773 spec->no_analog = 1;
12776 return 0; /* can't find valid BIOS pin config */
12778 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12781 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12785 spec->multiout.max_channels = 2;
12788 /* digital only support output */
12789 if (spec->autocfg.dig_outs) {
12790 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12791 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12793 if (spec->kctls.list)
12794 add_mixer(spec, spec->kctls.list);
12796 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12797 add_mixer(spec, alc268_beep_mixer);
12799 add_verb(spec, alc268_volume_init_verbs);
12800 spec->num_mux_defs = 2;
12801 spec->input_mux = &spec->private_imux[0];
12803 err = alc_auto_add_mic_boost(codec);
12807 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12812 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12814 /* init callback for auto-configuration model -- overriding the default init */
12815 static void alc268_auto_init(struct hda_codec *codec)
12817 struct alc_spec *spec = codec->spec;
12818 alc268_auto_init_multi_out(codec);
12819 alc268_auto_init_hp_out(codec);
12820 alc268_auto_init_mono_speaker_out(codec);
12821 alc268_auto_init_analog_input(codec);
12822 if (spec->unsol_event)
12823 alc_inithook(codec);
12827 * configuration and preset
12829 static const char *alc268_models[ALC268_MODEL_LAST] = {
12830 [ALC267_QUANTA_IL1] = "quanta-il1",
12831 [ALC268_3ST] = "3stack",
12832 [ALC268_TOSHIBA] = "toshiba",
12833 [ALC268_ACER] = "acer",
12834 [ALC268_ACER_DMIC] = "acer-dmic",
12835 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12836 [ALC268_DELL] = "dell",
12837 [ALC268_ZEPTO] = "zepto",
12838 #ifdef CONFIG_SND_DEBUG
12839 [ALC268_TEST] = "test",
12841 [ALC268_AUTO] = "auto",
12844 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12845 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12846 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12847 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12848 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12849 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12850 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12851 ALC268_ACER_ASPIRE_ONE),
12852 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12853 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12854 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12855 /* almost compatible with toshiba but with optional digital outs;
12856 * auto-probing seems working fine
12858 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12860 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12861 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12862 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12863 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12864 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12865 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12869 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12870 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12871 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12872 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12873 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12878 static struct alc_config_preset alc268_presets[] = {
12879 [ALC267_QUANTA_IL1] = {
12880 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12881 alc268_capture_nosrc_mixer },
12882 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12883 alc267_quanta_il1_verbs },
12884 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12885 .dac_nids = alc268_dac_nids,
12886 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12887 .adc_nids = alc268_adc_nids_alt,
12889 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12890 .channel_mode = alc268_modes,
12891 .unsol_event = alc_sku_unsol_event,
12892 .setup = alc267_quanta_il1_setup,
12893 .init_hook = alc_inithook,
12896 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12897 alc268_beep_mixer },
12898 .init_verbs = { alc268_base_init_verbs },
12899 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12900 .dac_nids = alc268_dac_nids,
12901 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12902 .adc_nids = alc268_adc_nids_alt,
12903 .capsrc_nids = alc268_capsrc_nids,
12905 .dig_out_nid = ALC268_DIGOUT_NID,
12906 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12907 .channel_mode = alc268_modes,
12908 .input_mux = &alc268_capture_source,
12910 [ALC268_TOSHIBA] = {
12911 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12912 alc268_beep_mixer },
12913 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12914 alc268_toshiba_verbs },
12915 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12916 .dac_nids = alc268_dac_nids,
12917 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12918 .adc_nids = alc268_adc_nids_alt,
12919 .capsrc_nids = alc268_capsrc_nids,
12921 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12922 .channel_mode = alc268_modes,
12923 .input_mux = &alc268_capture_source,
12924 .unsol_event = alc268_toshiba_unsol_event,
12925 .setup = alc268_toshiba_setup,
12926 .init_hook = alc268_toshiba_automute,
12929 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12930 alc268_beep_mixer },
12931 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12932 alc268_acer_verbs },
12933 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12934 .dac_nids = alc268_dac_nids,
12935 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12936 .adc_nids = alc268_adc_nids_alt,
12937 .capsrc_nids = alc268_capsrc_nids,
12939 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12940 .channel_mode = alc268_modes,
12941 .input_mux = &alc268_acer_capture_source,
12942 .unsol_event = alc268_acer_unsol_event,
12943 .init_hook = alc268_acer_init_hook,
12945 [ALC268_ACER_DMIC] = {
12946 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12947 alc268_beep_mixer },
12948 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12949 alc268_acer_verbs },
12950 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12951 .dac_nids = alc268_dac_nids,
12952 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12953 .adc_nids = alc268_adc_nids_alt,
12954 .capsrc_nids = alc268_capsrc_nids,
12956 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12957 .channel_mode = alc268_modes,
12958 .input_mux = &alc268_acer_dmic_capture_source,
12959 .unsol_event = alc268_acer_unsol_event,
12960 .init_hook = alc268_acer_init_hook,
12962 [ALC268_ACER_ASPIRE_ONE] = {
12963 .mixers = { alc268_acer_aspire_one_mixer,
12965 alc268_capture_nosrc_mixer },
12966 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12967 alc268_acer_aspire_one_verbs },
12968 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12969 .dac_nids = alc268_dac_nids,
12970 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12971 .adc_nids = alc268_adc_nids_alt,
12972 .capsrc_nids = alc268_capsrc_nids,
12974 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12975 .channel_mode = alc268_modes,
12976 .unsol_event = alc268_acer_lc_unsol_event,
12977 .setup = alc268_acer_lc_setup,
12978 .init_hook = alc268_acer_lc_init_hook,
12981 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12982 alc268_capture_nosrc_mixer },
12983 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12984 alc268_dell_verbs },
12985 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12986 .dac_nids = alc268_dac_nids,
12987 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12988 .adc_nids = alc268_adc_nids_alt,
12989 .capsrc_nids = alc268_capsrc_nids,
12991 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12992 .channel_mode = alc268_modes,
12993 .unsol_event = alc_sku_unsol_event,
12994 .setup = alc268_dell_setup,
12995 .init_hook = alc_inithook,
12998 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12999 alc268_beep_mixer },
13000 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13001 alc268_toshiba_verbs },
13002 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13003 .dac_nids = alc268_dac_nids,
13004 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13005 .adc_nids = alc268_adc_nids_alt,
13006 .capsrc_nids = alc268_capsrc_nids,
13008 .dig_out_nid = ALC268_DIGOUT_NID,
13009 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13010 .channel_mode = alc268_modes,
13011 .input_mux = &alc268_capture_source,
13012 .setup = alc268_toshiba_setup,
13013 .init_hook = alc268_toshiba_automute,
13015 #ifdef CONFIG_SND_DEBUG
13017 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13018 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13019 alc268_volume_init_verbs },
13020 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13021 .dac_nids = alc268_dac_nids,
13022 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13023 .adc_nids = alc268_adc_nids_alt,
13024 .capsrc_nids = alc268_capsrc_nids,
13026 .dig_out_nid = ALC268_DIGOUT_NID,
13027 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13028 .channel_mode = alc268_modes,
13029 .input_mux = &alc268_capture_source,
13034 static int patch_alc268(struct hda_codec *codec)
13036 struct alc_spec *spec;
13038 int i, has_beep, err;
13040 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13044 codec->spec = spec;
13046 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13050 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13051 board_config = snd_hda_check_board_codec_sid_config(codec,
13052 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13054 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13055 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13057 board_config = ALC268_AUTO;
13060 if (board_config == ALC268_AUTO) {
13061 /* automatic parse from the BIOS config */
13062 err = alc268_parse_auto_config(codec);
13068 "hda_codec: Cannot set up configuration "
13069 "from BIOS. Using base mode...\n");
13070 board_config = ALC268_3ST;
13074 if (board_config != ALC268_AUTO)
13075 setup_preset(codec, &alc268_presets[board_config]);
13077 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13078 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13079 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13081 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13084 for (i = 0; i < spec->num_mixers; i++) {
13085 if (spec->mixers[i] == alc268_beep_mixer) {
13092 err = snd_hda_attach_beep_device(codec, 0x1);
13097 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13098 /* override the amp caps for beep generator */
13099 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13100 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13101 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13102 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13103 (0 << AC_AMPCAP_MUTE_SHIFT));
13106 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13107 /* check whether NID 0x07 is valid */
13108 unsigned int wcap = get_wcaps(codec, 0x07);
13111 spec->capsrc_nids = alc268_capsrc_nids;
13113 wcap = get_wcaps_type(wcap);
13114 if (spec->auto_mic ||
13115 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13116 spec->adc_nids = alc268_adc_nids_alt;
13117 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13118 if (spec->auto_mic)
13119 fixup_automic_adc(codec);
13120 if (spec->auto_mic || spec->input_mux->num_items == 1)
13121 add_mixer(spec, alc268_capture_nosrc_mixer);
13123 add_mixer(spec, alc268_capture_alt_mixer);
13125 spec->adc_nids = alc268_adc_nids;
13126 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13127 add_mixer(spec, alc268_capture_mixer);
13129 /* set default input source */
13130 for (i = 0; i < spec->num_adc_nids; i++)
13131 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13132 0, AC_VERB_SET_CONNECT_SEL,
13133 i < spec->num_mux_defs ?
13134 spec->input_mux[i].items[0].index :
13135 spec->input_mux->items[0].index);
13138 spec->vmaster_nid = 0x02;
13140 codec->patch_ops = alc_patch_ops;
13141 if (board_config == ALC268_AUTO)
13142 spec->init_hook = alc268_auto_init;
13144 codec->proc_widget_hook = print_realtek_coef;
13150 * ALC269 channel source setting (2 channel)
13152 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13154 #define alc269_dac_nids alc260_dac_nids
13156 static hda_nid_t alc269_adc_nids[1] = {
13161 static hda_nid_t alc269_capsrc_nids[1] = {
13165 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13169 #define alc269_modes alc260_modes
13170 #define alc269_capture_source alc880_lg_lw_capture_source
13172 static struct snd_kcontrol_new alc269_base_mixer[] = {
13173 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13174 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13179 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13180 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13181 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13182 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13184 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13188 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13189 /* output mixer control */
13190 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13192 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13193 .name = "Master Playback Switch",
13194 .subdevice = HDA_SUBDEV_AMP_FLAG,
13195 .info = snd_hda_mixer_amp_switch_info,
13196 .get = snd_hda_mixer_amp_switch_get,
13197 .put = alc268_acer_master_sw_put,
13198 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13202 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13203 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13204 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13205 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13209 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13210 /* output mixer control */
13211 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13213 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13214 .name = "Master Playback Switch",
13215 .subdevice = HDA_SUBDEV_AMP_FLAG,
13216 .info = snd_hda_mixer_amp_switch_info,
13217 .get = snd_hda_mixer_amp_switch_get,
13218 .put = alc268_acer_master_sw_put,
13219 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13223 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13224 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13225 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13227 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13228 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13229 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13233 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13234 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13235 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13236 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13237 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13241 /* capture mixer elements */
13242 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13243 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13244 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13245 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13250 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13252 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13253 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13254 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13256 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13257 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13258 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13262 static struct hda_verb alc269_lifebook_verbs[] = {
13263 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13264 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13265 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13267 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13268 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13269 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13270 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13271 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13272 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13276 /* toggle speaker-output according to the hp-jack state */
13277 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13279 unsigned int present;
13280 unsigned char bits;
13282 present = snd_hda_jack_detect(codec, 0x15);
13283 bits = present ? AMP_IN_MUTE(0) : 0;
13284 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13285 AMP_IN_MUTE(0), bits);
13286 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13287 AMP_IN_MUTE(0), bits);
13289 snd_hda_codec_write(codec, 0x20, 0,
13290 AC_VERB_SET_COEF_INDEX, 0x0c);
13291 snd_hda_codec_write(codec, 0x20, 0,
13292 AC_VERB_SET_PROC_COEF, 0x680);
13294 snd_hda_codec_write(codec, 0x20, 0,
13295 AC_VERB_SET_COEF_INDEX, 0x0c);
13296 snd_hda_codec_write(codec, 0x20, 0,
13297 AC_VERB_SET_PROC_COEF, 0x480);
13300 /* toggle speaker-output according to the hp-jacks state */
13301 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13303 unsigned int present;
13304 unsigned char bits;
13306 /* Check laptop headphone socket */
13307 present = snd_hda_jack_detect(codec, 0x15);
13309 /* Check port replicator headphone socket */
13310 present |= snd_hda_jack_detect(codec, 0x1a);
13312 bits = present ? AMP_IN_MUTE(0) : 0;
13313 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13314 AMP_IN_MUTE(0), bits);
13315 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13316 AMP_IN_MUTE(0), bits);
13318 snd_hda_codec_write(codec, 0x20, 0,
13319 AC_VERB_SET_COEF_INDEX, 0x0c);
13320 snd_hda_codec_write(codec, 0x20, 0,
13321 AC_VERB_SET_PROC_COEF, 0x680);
13323 snd_hda_codec_write(codec, 0x20, 0,
13324 AC_VERB_SET_COEF_INDEX, 0x0c);
13325 snd_hda_codec_write(codec, 0x20, 0,
13326 AC_VERB_SET_PROC_COEF, 0x480);
13329 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13331 unsigned int present_laptop;
13332 unsigned int present_dock;
13334 present_laptop = snd_hda_jack_detect(codec, 0x18);
13335 present_dock = snd_hda_jack_detect(codec, 0x1b);
13337 /* Laptop mic port overrides dock mic port, design decision */
13339 snd_hda_codec_write(codec, 0x23, 0,
13340 AC_VERB_SET_CONNECT_SEL, 0x3);
13341 if (present_laptop)
13342 snd_hda_codec_write(codec, 0x23, 0,
13343 AC_VERB_SET_CONNECT_SEL, 0x0);
13344 if (!present_dock && !present_laptop)
13345 snd_hda_codec_write(codec, 0x23, 0,
13346 AC_VERB_SET_CONNECT_SEL, 0x1);
13349 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13352 switch (res >> 26) {
13353 case ALC880_HP_EVENT:
13354 alc269_quanta_fl1_speaker_automute(codec);
13356 case ALC880_MIC_EVENT:
13357 alc_mic_automute(codec);
13362 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13365 if ((res >> 26) == ALC880_HP_EVENT)
13366 alc269_lifebook_speaker_automute(codec);
13367 if ((res >> 26) == ALC880_MIC_EVENT)
13368 alc269_lifebook_mic_autoswitch(codec);
13371 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13373 struct alc_spec *spec = codec->spec;
13374 spec->ext_mic.pin = 0x18;
13375 spec->ext_mic.mux_idx = 0;
13376 spec->int_mic.pin = 0x19;
13377 spec->int_mic.mux_idx = 1;
13378 spec->auto_mic = 1;
13381 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13383 alc269_quanta_fl1_speaker_automute(codec);
13384 alc_mic_automute(codec);
13387 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13389 alc269_lifebook_speaker_automute(codec);
13390 alc269_lifebook_mic_autoswitch(codec);
13393 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13394 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13395 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13396 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13398 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13399 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13400 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13404 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13405 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13406 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13407 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13408 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13409 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13410 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13414 /* toggle speaker-output according to the hp-jack state */
13415 static void alc269_speaker_automute(struct hda_codec *codec)
13417 struct alc_spec *spec = codec->spec;
13418 unsigned int nid = spec->autocfg.hp_pins[0];
13419 unsigned int present;
13420 unsigned char bits;
13422 present = snd_hda_jack_detect(codec, nid);
13423 bits = present ? AMP_IN_MUTE(0) : 0;
13424 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13425 AMP_IN_MUTE(0), bits);
13426 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13427 AMP_IN_MUTE(0), bits);
13430 /* unsolicited event for HP jack sensing */
13431 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13434 switch (res >> 26) {
13435 case ALC880_HP_EVENT:
13436 alc269_speaker_automute(codec);
13438 case ALC880_MIC_EVENT:
13439 alc_mic_automute(codec);
13444 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13446 struct alc_spec *spec = codec->spec;
13447 spec->ext_mic.pin = 0x18;
13448 spec->ext_mic.mux_idx = 0;
13449 spec->int_mic.pin = 0x12;
13450 spec->int_mic.mux_idx = 5;
13451 spec->auto_mic = 1;
13454 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13456 struct alc_spec *spec = codec->spec;
13457 spec->ext_mic.pin = 0x18;
13458 spec->ext_mic.mux_idx = 0;
13459 spec->int_mic.pin = 0x19;
13460 spec->int_mic.mux_idx = 1;
13461 spec->auto_mic = 1;
13464 static void alc269_eeepc_inithook(struct hda_codec *codec)
13466 alc269_speaker_automute(codec);
13467 alc_mic_automute(codec);
13471 * generic initialization of ADC, input mixers and output mixers
13473 static struct hda_verb alc269_init_verbs[] = {
13475 * Unmute ADC0 and set the default input to mic-in
13477 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13479 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13480 * analog-loopback mixer widget
13481 * Note: PASD motherboards uses the Line In 2 as the input for
13482 * front panel mic (mic 2)
13484 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13492 * Set up output mixers (0x0c - 0x0e)
13494 /* set vol=0 to output mixers */
13495 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13496 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13498 /* set up input amps for analog loopback */
13499 /* Amp Indices: DAC = 0, mixer = 1 */
13500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13505 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13507 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13509 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13515 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13516 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13517 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13518 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13519 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13520 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13521 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13523 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13524 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13526 /* FIXME: use matrix-type input source selection */
13527 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13528 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13530 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13531 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13535 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13536 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13540 #define alc269_auto_create_multi_out_ctls \
13541 alc268_auto_create_multi_out_ctls
13542 #define alc269_auto_create_input_ctls \
13543 alc268_auto_create_input_ctls
13545 #ifdef CONFIG_SND_HDA_POWER_SAVE
13546 #define alc269_loopbacks alc880_loopbacks
13549 /* pcm configuration: identical with ALC880 */
13550 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13551 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13552 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13553 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13555 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13559 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13560 /* NID is set in alc_build_pcms */
13562 .open = alc880_playback_pcm_open,
13563 .prepare = alc880_playback_pcm_prepare,
13564 .cleanup = alc880_playback_pcm_cleanup
13568 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13572 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13573 /* NID is set in alc_build_pcms */
13577 * BIOS auto configuration
13579 static int alc269_parse_auto_config(struct hda_codec *codec)
13581 struct alc_spec *spec = codec->spec;
13583 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13585 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13590 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13593 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13597 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13599 if (spec->autocfg.dig_outs)
13600 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13602 if (spec->kctls.list)
13603 add_mixer(spec, spec->kctls.list);
13605 add_verb(spec, alc269_init_verbs);
13606 spec->num_mux_defs = 1;
13607 spec->input_mux = &spec->private_imux[0];
13608 /* set default input source */
13609 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13610 0, AC_VERB_SET_CONNECT_SEL,
13611 spec->input_mux->items[0].index);
13613 err = alc_auto_add_mic_boost(codec);
13617 if (!spec->cap_mixer && !spec->no_analog)
13618 set_capture_mixer(codec);
13620 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13625 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13626 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13627 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13630 /* init callback for auto-configuration model -- overriding the default init */
13631 static void alc269_auto_init(struct hda_codec *codec)
13633 struct alc_spec *spec = codec->spec;
13634 alc269_auto_init_multi_out(codec);
13635 alc269_auto_init_hp_out(codec);
13636 alc269_auto_init_analog_input(codec);
13637 if (spec->unsol_event)
13638 alc_inithook(codec);
13642 * configuration and preset
13644 static const char *alc269_models[ALC269_MODEL_LAST] = {
13645 [ALC269_BASIC] = "basic",
13646 [ALC269_QUANTA_FL1] = "quanta",
13647 [ALC269_ASUS_AMIC] = "asus-amic",
13648 [ALC269_ASUS_DMIC] = "asus-dmic",
13649 [ALC269_FUJITSU] = "fujitsu",
13650 [ALC269_LIFEBOOK] = "lifebook",
13651 [ALC269_AUTO] = "auto",
13654 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13655 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13656 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13658 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13659 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13660 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13661 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13662 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13663 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13664 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13665 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13666 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13667 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13668 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13669 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13670 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13671 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13672 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13673 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13674 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13675 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13676 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13677 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13678 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13679 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13680 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13681 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13682 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13683 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13684 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13685 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13688 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13690 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13691 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13692 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13693 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13697 static struct alc_config_preset alc269_presets[] = {
13699 .mixers = { alc269_base_mixer },
13700 .init_verbs = { alc269_init_verbs },
13701 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13702 .dac_nids = alc269_dac_nids,
13704 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13705 .channel_mode = alc269_modes,
13706 .input_mux = &alc269_capture_source,
13708 [ALC269_QUANTA_FL1] = {
13709 .mixers = { alc269_quanta_fl1_mixer },
13710 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13711 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13712 .dac_nids = alc269_dac_nids,
13714 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13715 .channel_mode = alc269_modes,
13716 .input_mux = &alc269_capture_source,
13717 .unsol_event = alc269_quanta_fl1_unsol_event,
13718 .setup = alc269_quanta_fl1_setup,
13719 .init_hook = alc269_quanta_fl1_init_hook,
13721 [ALC269_ASUS_AMIC] = {
13722 .mixers = { alc269_eeepc_mixer },
13723 .cap_mixer = alc269_epc_capture_mixer,
13724 .init_verbs = { alc269_init_verbs,
13725 alc269_eeepc_amic_init_verbs },
13726 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13727 .dac_nids = alc269_dac_nids,
13729 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13730 .channel_mode = alc269_modes,
13731 .unsol_event = alc269_eeepc_unsol_event,
13732 .setup = alc269_eeepc_amic_setup,
13733 .init_hook = alc269_eeepc_inithook,
13735 [ALC269_ASUS_DMIC] = {
13736 .mixers = { alc269_eeepc_mixer },
13737 .cap_mixer = alc269_epc_capture_mixer,
13738 .init_verbs = { alc269_init_verbs,
13739 alc269_eeepc_dmic_init_verbs },
13740 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13741 .dac_nids = alc269_dac_nids,
13743 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13744 .channel_mode = alc269_modes,
13745 .unsol_event = alc269_eeepc_unsol_event,
13746 .setup = alc269_eeepc_dmic_setup,
13747 .init_hook = alc269_eeepc_inithook,
13749 [ALC269_FUJITSU] = {
13750 .mixers = { alc269_fujitsu_mixer },
13751 .cap_mixer = alc269_epc_capture_mixer,
13752 .init_verbs = { alc269_init_verbs,
13753 alc269_eeepc_dmic_init_verbs },
13754 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13755 .dac_nids = alc269_dac_nids,
13757 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13758 .channel_mode = alc269_modes,
13759 .unsol_event = alc269_eeepc_unsol_event,
13760 .setup = alc269_eeepc_dmic_setup,
13761 .init_hook = alc269_eeepc_inithook,
13763 [ALC269_LIFEBOOK] = {
13764 .mixers = { alc269_lifebook_mixer },
13765 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13766 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13767 .dac_nids = alc269_dac_nids,
13769 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13770 .channel_mode = alc269_modes,
13771 .input_mux = &alc269_capture_source,
13772 .unsol_event = alc269_lifebook_unsol_event,
13773 .init_hook = alc269_lifebook_init_hook,
13777 static int patch_alc269(struct hda_codec *codec)
13779 struct alc_spec *spec;
13783 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13787 codec->spec = spec;
13789 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13791 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13792 kfree(codec->chip_name);
13793 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13794 if (!codec->chip_name) {
13800 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13804 if (board_config < 0) {
13805 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13807 board_config = ALC269_AUTO;
13810 if (board_config == ALC269_AUTO) {
13811 /* automatic parse from the BIOS config */
13812 err = alc269_parse_auto_config(codec);
13818 "hda_codec: Cannot set up configuration "
13819 "from BIOS. Using base mode...\n");
13820 board_config = ALC269_BASIC;
13824 err = snd_hda_attach_beep_device(codec, 0x1);
13830 if (board_config != ALC269_AUTO)
13831 setup_preset(codec, &alc269_presets[board_config]);
13833 if (codec->subsystem_id == 0x17aa3bf8) {
13834 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13835 * fix the sample rate of analog I/O to 44.1kHz
13837 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13838 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13840 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13841 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13843 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13844 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13846 spec->adc_nids = alc269_adc_nids;
13847 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13848 spec->capsrc_nids = alc269_capsrc_nids;
13849 if (!spec->cap_mixer)
13850 set_capture_mixer(codec);
13851 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13853 spec->vmaster_nid = 0x02;
13855 codec->patch_ops = alc_patch_ops;
13856 if (board_config == ALC269_AUTO)
13857 spec->init_hook = alc269_auto_init;
13858 #ifdef CONFIG_SND_HDA_POWER_SAVE
13859 if (!spec->loopback.amplist)
13860 spec->loopback.amplist = alc269_loopbacks;
13862 codec->proc_widget_hook = print_realtek_coef;
13868 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13872 * set the path ways for 2 channel output
13873 * need to set the codec line out and mic 1 pin widgets to inputs
13875 static struct hda_verb alc861_threestack_ch2_init[] = {
13876 /* set pin widget 1Ah (line in) for input */
13877 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13878 /* set pin widget 18h (mic1/2) for input, for mic also enable
13881 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13883 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13885 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13886 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13892 * need to set the codec line out and mic 1 pin widgets to outputs
13894 static struct hda_verb alc861_threestack_ch6_init[] = {
13895 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13896 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13897 /* set pin widget 18h (mic1) for output (CLFE)*/
13898 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13900 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13901 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13903 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13905 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13906 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13911 static struct hda_channel_mode alc861_threestack_modes[2] = {
13912 { 2, alc861_threestack_ch2_init },
13913 { 6, alc861_threestack_ch6_init },
13915 /* Set mic1 as input and unmute the mixer */
13916 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13917 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13918 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13921 /* Set mic1 as output and mute mixer */
13922 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13923 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13928 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13929 { 2, alc861_uniwill_m31_ch2_init },
13930 { 4, alc861_uniwill_m31_ch4_init },
13933 /* Set mic1 and line-in as input and unmute the mixer */
13934 static struct hda_verb alc861_asus_ch2_init[] = {
13935 /* set pin widget 1Ah (line in) for input */
13936 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13937 /* set pin widget 18h (mic1/2) for input, for mic also enable
13940 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13942 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13944 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13945 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13949 /* Set mic1 nad line-in as output and mute mixer */
13950 static struct hda_verb alc861_asus_ch6_init[] = {
13951 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13952 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13953 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13954 /* set pin widget 18h (mic1) for output (CLFE)*/
13955 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13956 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13957 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13958 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13960 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13962 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13968 static struct hda_channel_mode alc861_asus_modes[2] = {
13969 { 2, alc861_asus_ch2_init },
13970 { 6, alc861_asus_ch6_init },
13975 static struct snd_kcontrol_new alc861_base_mixer[] = {
13976 /* output mixer control */
13977 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13978 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13979 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13980 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13983 /*Input mixer control */
13984 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13985 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13986 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13987 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13988 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13989 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13990 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13991 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13992 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13993 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
13998 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
13999 /* output mixer control */
14000 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14001 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14002 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14003 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14004 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14006 /* Input mixer control */
14007 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14008 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14009 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14010 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14011 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14012 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14013 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14014 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14015 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14016 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14020 .name = "Channel Mode",
14021 .info = alc_ch_mode_info,
14022 .get = alc_ch_mode_get,
14023 .put = alc_ch_mode_put,
14024 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14029 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14030 /* output mixer control */
14031 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14033 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14038 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14039 /* output mixer control */
14040 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14041 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14042 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14043 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14044 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14046 /* Input mixer control */
14047 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14048 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14049 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14050 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14051 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14052 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14053 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14054 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14055 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14056 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14060 .name = "Channel Mode",
14061 .info = alc_ch_mode_info,
14062 .get = alc_ch_mode_get,
14063 .put = alc_ch_mode_put,
14064 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14069 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14070 /* output mixer control */
14071 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14072 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14073 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14074 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14075 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14077 /* Input mixer control */
14078 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14079 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14080 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14081 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14082 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14083 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14085 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14086 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14087 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14090 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14091 .name = "Channel Mode",
14092 .info = alc_ch_mode_info,
14093 .get = alc_ch_mode_get,
14094 .put = alc_ch_mode_put,
14095 .private_value = ARRAY_SIZE(alc861_asus_modes),
14100 /* additional mixer */
14101 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14102 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14103 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14108 * generic initialization of ADC, input mixers and output mixers
14110 static struct hda_verb alc861_base_init_verbs[] = {
14112 * Unmute ADC0 and set the default input to mic-in
14114 /* port-A for surround (rear panel) */
14115 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14116 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14117 /* port-B for mic-in (rear panel) with vref */
14118 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14119 /* port-C for line-in (rear panel) */
14120 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14121 /* port-D for Front */
14122 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14123 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14124 /* port-E for HP out (front panel) */
14125 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14126 /* route front PCM to HP */
14127 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14128 /* port-F for mic-in (front panel) with vref */
14129 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14130 /* port-G for CLFE (rear panel) */
14131 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14132 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14133 /* port-H for side (rear panel) */
14134 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14135 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14137 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14138 /* route front mic to ADC1*/
14139 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14140 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14142 /* Unmute DAC0~3 & spdif out*/
14143 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14145 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14146 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14149 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14150 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14151 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14152 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14153 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14155 /* Unmute Stereo Mixer 15 */
14156 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14157 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14158 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14161 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14162 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14163 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14164 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14165 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14167 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14168 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14169 /* hp used DAC 3 (Front) */
14170 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14171 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14176 static struct hda_verb alc861_threestack_init_verbs[] = {
14178 * Unmute ADC0 and set the default input to mic-in
14180 /* port-A for surround (rear panel) */
14181 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14182 /* port-B for mic-in (rear panel) with vref */
14183 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14184 /* port-C for line-in (rear panel) */
14185 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14186 /* port-D for Front */
14187 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14188 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14189 /* port-E for HP out (front panel) */
14190 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14191 /* route front PCM to HP */
14192 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14193 /* port-F for mic-in (front panel) with vref */
14194 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14195 /* port-G for CLFE (rear panel) */
14196 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14197 /* port-H for side (rear panel) */
14198 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14200 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14201 /* route front mic to ADC1*/
14202 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14203 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14204 /* Unmute DAC0~3 & spdif out*/
14205 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14206 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14207 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14208 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14209 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14211 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14212 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14213 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14214 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14215 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14217 /* Unmute Stereo Mixer 15 */
14218 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14219 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14220 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14223 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14225 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14226 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14227 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14228 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14229 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14230 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14231 /* hp used DAC 3 (Front) */
14232 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14237 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14239 * Unmute ADC0 and set the default input to mic-in
14241 /* port-A for surround (rear panel) */
14242 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14243 /* port-B for mic-in (rear panel) with vref */
14244 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14245 /* port-C for line-in (rear panel) */
14246 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14247 /* port-D for Front */
14248 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14249 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14250 /* port-E for HP out (front panel) */
14251 /* this has to be set to VREF80 */
14252 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14253 /* route front PCM to HP */
14254 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14255 /* port-F for mic-in (front panel) with vref */
14256 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14257 /* port-G for CLFE (rear panel) */
14258 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14259 /* port-H for side (rear panel) */
14260 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14262 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14263 /* route front mic to ADC1*/
14264 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14265 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14266 /* Unmute DAC0~3 & spdif out*/
14267 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14268 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14269 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14270 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14273 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14274 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14275 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14276 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14277 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14279 /* Unmute Stereo Mixer 15 */
14280 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14282 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14285 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14286 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14287 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14288 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14289 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14290 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14291 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14292 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14293 /* hp used DAC 3 (Front) */
14294 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14295 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14299 static struct hda_verb alc861_asus_init_verbs[] = {
14301 * Unmute ADC0 and set the default input to mic-in
14303 /* port-A for surround (rear panel)
14304 * according to codec#0 this is the HP jack
14306 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14307 /* route front PCM to HP */
14308 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14309 /* port-B for mic-in (rear panel) with vref */
14310 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14311 /* port-C for line-in (rear panel) */
14312 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14313 /* port-D for Front */
14314 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14315 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14316 /* port-E for HP out (front panel) */
14317 /* this has to be set to VREF80 */
14318 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14319 /* route front PCM to HP */
14320 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14321 /* port-F for mic-in (front panel) with vref */
14322 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14323 /* port-G for CLFE (rear panel) */
14324 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14325 /* port-H for side (rear panel) */
14326 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14328 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14329 /* route front mic to ADC1*/
14330 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14331 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14332 /* Unmute DAC0~3 & spdif out*/
14333 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14334 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14335 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14336 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14338 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14339 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14340 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14341 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14342 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14344 /* Unmute Stereo Mixer 15 */
14345 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14346 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14347 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14348 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14350 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14351 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14352 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14353 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14354 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14355 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14356 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14358 /* hp used DAC 3 (Front) */
14359 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14360 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14364 /* additional init verbs for ASUS laptops */
14365 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14366 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14367 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14372 * generic initialization of ADC, input mixers and output mixers
14374 static struct hda_verb alc861_auto_init_verbs[] = {
14376 * Unmute ADC0 and set the default input to mic-in
14378 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14379 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14381 /* Unmute DAC0~3 & spdif out*/
14382 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14383 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14384 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14385 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14386 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14388 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14389 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14390 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14391 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14392 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14394 /* Unmute Stereo Mixer 15 */
14395 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14396 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14397 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14400 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14401 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14402 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14403 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14404 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14405 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14406 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14407 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14409 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14410 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14411 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14413 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14414 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14415 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14418 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14423 static struct hda_verb alc861_toshiba_init_verbs[] = {
14424 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14429 /* toggle speaker-output according to the hp-jack state */
14430 static void alc861_toshiba_automute(struct hda_codec *codec)
14432 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14434 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14435 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14436 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14437 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14440 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14443 if ((res >> 26) == ALC880_HP_EVENT)
14444 alc861_toshiba_automute(codec);
14447 /* pcm configuration: identical with ALC880 */
14448 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14449 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14450 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14451 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14454 #define ALC861_DIGOUT_NID 0x07
14456 static struct hda_channel_mode alc861_8ch_modes[1] = {
14460 static hda_nid_t alc861_dac_nids[4] = {
14461 /* front, surround, clfe, side */
14462 0x03, 0x06, 0x05, 0x04
14465 static hda_nid_t alc660_dac_nids[3] = {
14466 /* front, clfe, surround */
14470 static hda_nid_t alc861_adc_nids[1] = {
14475 static struct hda_input_mux alc861_capture_source = {
14479 { "Front Mic", 0x3 },
14486 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14488 struct alc_spec *spec = codec->spec;
14489 hda_nid_t mix, srcs[5];
14492 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14494 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14497 for (i = 0; i < num; i++) {
14499 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14500 if (type != AC_WID_AUD_OUT)
14502 for (j = 0; j < spec->multiout.num_dacs; j++)
14503 if (spec->multiout.dac_nids[j] == srcs[i])
14505 if (j >= spec->multiout.num_dacs)
14511 /* fill in the dac_nids table from the parsed pin configuration */
14512 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14513 const struct auto_pin_cfg *cfg)
14515 struct alc_spec *spec = codec->spec;
14517 hda_nid_t nid, dac;
14519 spec->multiout.dac_nids = spec->private_dac_nids;
14520 for (i = 0; i < cfg->line_outs; i++) {
14521 nid = cfg->line_out_pins[i];
14522 dac = alc861_look_for_dac(codec, nid);
14525 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14530 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14531 hda_nid_t nid, unsigned int chs)
14533 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14534 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14537 /* add playback controls from the parsed DAC table */
14538 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14539 const struct auto_pin_cfg *cfg)
14541 struct alc_spec *spec = codec->spec;
14542 static const char *chname[4] = {
14543 "Front", "Surround", NULL /*CLFE*/, "Side"
14548 if (cfg->line_outs == 1) {
14549 const char *pfx = NULL;
14552 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14555 nid = spec->multiout.dac_nids[0];
14556 return alc861_create_out_sw(codec, pfx, nid, 3);
14560 for (i = 0; i < cfg->line_outs; i++) {
14561 nid = spec->multiout.dac_nids[i];
14566 err = alc861_create_out_sw(codec, "Center", nid, 1);
14569 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14573 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14581 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14583 struct alc_spec *spec = codec->spec;
14590 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14591 nid = alc861_look_for_dac(codec, pin);
14593 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14596 spec->multiout.hp_nid = nid;
14602 /* create playback/capture controls for input pins */
14603 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14604 const struct auto_pin_cfg *cfg)
14606 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14609 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14611 int pin_type, hda_nid_t dac)
14613 hda_nid_t mix, srcs[5];
14616 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14618 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14620 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14622 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14625 for (i = 0; i < num; i++) {
14627 if (srcs[i] == dac || srcs[i] == 0x15)
14628 mute = AMP_IN_UNMUTE(i);
14630 mute = AMP_IN_MUTE(i);
14631 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14636 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14638 struct alc_spec *spec = codec->spec;
14641 for (i = 0; i < spec->autocfg.line_outs; i++) {
14642 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14643 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14645 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14646 spec->multiout.dac_nids[i]);
14650 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14652 struct alc_spec *spec = codec->spec;
14654 if (spec->autocfg.hp_outs)
14655 alc861_auto_set_output_and_unmute(codec,
14656 spec->autocfg.hp_pins[0],
14658 spec->multiout.hp_nid);
14659 if (spec->autocfg.speaker_outs)
14660 alc861_auto_set_output_and_unmute(codec,
14661 spec->autocfg.speaker_pins[0],
14663 spec->multiout.dac_nids[0]);
14666 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14668 struct alc_spec *spec = codec->spec;
14671 for (i = 0; i < AUTO_PIN_LAST; i++) {
14672 hda_nid_t nid = spec->autocfg.input_pins[i];
14673 if (nid >= 0x0c && nid <= 0x11)
14674 alc_set_input_pin(codec, nid, i);
14678 /* parse the BIOS configuration and set up the alc_spec */
14679 /* return 1 if successful, 0 if the proper config is not found,
14680 * or a negative error code
14682 static int alc861_parse_auto_config(struct hda_codec *codec)
14684 struct alc_spec *spec = codec->spec;
14686 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14688 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14692 if (!spec->autocfg.line_outs)
14693 return 0; /* can't find valid BIOS pin config */
14695 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14698 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14701 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14704 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14708 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14710 if (spec->autocfg.dig_outs)
14711 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14713 if (spec->kctls.list)
14714 add_mixer(spec, spec->kctls.list);
14716 add_verb(spec, alc861_auto_init_verbs);
14718 spec->num_mux_defs = 1;
14719 spec->input_mux = &spec->private_imux[0];
14721 spec->adc_nids = alc861_adc_nids;
14722 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14723 set_capture_mixer(codec);
14725 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14730 /* additional initialization for auto-configuration model */
14731 static void alc861_auto_init(struct hda_codec *codec)
14733 struct alc_spec *spec = codec->spec;
14734 alc861_auto_init_multi_out(codec);
14735 alc861_auto_init_hp_out(codec);
14736 alc861_auto_init_analog_input(codec);
14737 if (spec->unsol_event)
14738 alc_inithook(codec);
14741 #ifdef CONFIG_SND_HDA_POWER_SAVE
14742 static struct hda_amp_list alc861_loopbacks[] = {
14743 { 0x15, HDA_INPUT, 0 },
14744 { 0x15, HDA_INPUT, 1 },
14745 { 0x15, HDA_INPUT, 2 },
14746 { 0x15, HDA_INPUT, 3 },
14753 * configuration and preset
14755 static const char *alc861_models[ALC861_MODEL_LAST] = {
14756 [ALC861_3ST] = "3stack",
14757 [ALC660_3ST] = "3stack-660",
14758 [ALC861_3ST_DIG] = "3stack-dig",
14759 [ALC861_6ST_DIG] = "6stack-dig",
14760 [ALC861_UNIWILL_M31] = "uniwill-m31",
14761 [ALC861_TOSHIBA] = "toshiba",
14762 [ALC861_ASUS] = "asus",
14763 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14764 [ALC861_AUTO] = "auto",
14767 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14768 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14769 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14770 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14771 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14772 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14773 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14774 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14775 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14776 * Any other models that need this preset?
14778 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14779 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14780 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14781 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14782 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14783 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14784 /* FIXME: the below seems conflict */
14785 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14786 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14787 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14791 static struct alc_config_preset alc861_presets[] = {
14793 .mixers = { alc861_3ST_mixer },
14794 .init_verbs = { alc861_threestack_init_verbs },
14795 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14796 .dac_nids = alc861_dac_nids,
14797 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14798 .channel_mode = alc861_threestack_modes,
14800 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14801 .adc_nids = alc861_adc_nids,
14802 .input_mux = &alc861_capture_source,
14804 [ALC861_3ST_DIG] = {
14805 .mixers = { alc861_base_mixer },
14806 .init_verbs = { alc861_threestack_init_verbs },
14807 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14808 .dac_nids = alc861_dac_nids,
14809 .dig_out_nid = ALC861_DIGOUT_NID,
14810 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14811 .channel_mode = alc861_threestack_modes,
14813 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14814 .adc_nids = alc861_adc_nids,
14815 .input_mux = &alc861_capture_source,
14817 [ALC861_6ST_DIG] = {
14818 .mixers = { alc861_base_mixer },
14819 .init_verbs = { alc861_base_init_verbs },
14820 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14821 .dac_nids = alc861_dac_nids,
14822 .dig_out_nid = ALC861_DIGOUT_NID,
14823 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14824 .channel_mode = alc861_8ch_modes,
14825 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14826 .adc_nids = alc861_adc_nids,
14827 .input_mux = &alc861_capture_source,
14830 .mixers = { alc861_3ST_mixer },
14831 .init_verbs = { alc861_threestack_init_verbs },
14832 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14833 .dac_nids = alc660_dac_nids,
14834 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14835 .channel_mode = alc861_threestack_modes,
14837 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14838 .adc_nids = alc861_adc_nids,
14839 .input_mux = &alc861_capture_source,
14841 [ALC861_UNIWILL_M31] = {
14842 .mixers = { alc861_uniwill_m31_mixer },
14843 .init_verbs = { alc861_uniwill_m31_init_verbs },
14844 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14845 .dac_nids = alc861_dac_nids,
14846 .dig_out_nid = ALC861_DIGOUT_NID,
14847 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14848 .channel_mode = alc861_uniwill_m31_modes,
14850 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14851 .adc_nids = alc861_adc_nids,
14852 .input_mux = &alc861_capture_source,
14854 [ALC861_TOSHIBA] = {
14855 .mixers = { alc861_toshiba_mixer },
14856 .init_verbs = { alc861_base_init_verbs,
14857 alc861_toshiba_init_verbs },
14858 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14859 .dac_nids = alc861_dac_nids,
14860 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14861 .channel_mode = alc883_3ST_2ch_modes,
14862 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14863 .adc_nids = alc861_adc_nids,
14864 .input_mux = &alc861_capture_source,
14865 .unsol_event = alc861_toshiba_unsol_event,
14866 .init_hook = alc861_toshiba_automute,
14869 .mixers = { alc861_asus_mixer },
14870 .init_verbs = { alc861_asus_init_verbs },
14871 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14872 .dac_nids = alc861_dac_nids,
14873 .dig_out_nid = ALC861_DIGOUT_NID,
14874 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14875 .channel_mode = alc861_asus_modes,
14878 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14879 .adc_nids = alc861_adc_nids,
14880 .input_mux = &alc861_capture_source,
14882 [ALC861_ASUS_LAPTOP] = {
14883 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14884 .init_verbs = { alc861_asus_init_verbs,
14885 alc861_asus_laptop_init_verbs },
14886 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14887 .dac_nids = alc861_dac_nids,
14888 .dig_out_nid = ALC861_DIGOUT_NID,
14889 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14890 .channel_mode = alc883_3ST_2ch_modes,
14892 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14893 .adc_nids = alc861_adc_nids,
14894 .input_mux = &alc861_capture_source,
14898 /* Pin config fixes */
14900 PINFIX_FSC_AMILO_PI1505,
14903 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14904 { 0x0b, 0x0221101f }, /* HP */
14905 { 0x0f, 0x90170310 }, /* speaker */
14909 static const struct alc_fixup alc861_fixups[] = {
14910 [PINFIX_FSC_AMILO_PI1505] = {
14911 .pins = alc861_fsc_amilo_pi1505_pinfix
14915 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14916 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14920 static int patch_alc861(struct hda_codec *codec)
14922 struct alc_spec *spec;
14926 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14930 codec->spec = spec;
14932 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14936 if (board_config < 0) {
14937 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14939 board_config = ALC861_AUTO;
14942 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14944 if (board_config == ALC861_AUTO) {
14945 /* automatic parse from the BIOS config */
14946 err = alc861_parse_auto_config(codec);
14952 "hda_codec: Cannot set up configuration "
14953 "from BIOS. Using base mode...\n");
14954 board_config = ALC861_3ST_DIG;
14958 err = snd_hda_attach_beep_device(codec, 0x23);
14964 if (board_config != ALC861_AUTO)
14965 setup_preset(codec, &alc861_presets[board_config]);
14967 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14968 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14970 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14971 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14973 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14975 spec->vmaster_nid = 0x03;
14977 codec->patch_ops = alc_patch_ops;
14978 if (board_config == ALC861_AUTO)
14979 spec->init_hook = alc861_auto_init;
14980 #ifdef CONFIG_SND_HDA_POWER_SAVE
14981 if (!spec->loopback.amplist)
14982 spec->loopback.amplist = alc861_loopbacks;
14984 codec->proc_widget_hook = print_realtek_coef;
14990 * ALC861-VD support
14994 * In addition, an independent DAC
14996 #define ALC861VD_DIGOUT_NID 0x06
14998 static hda_nid_t alc861vd_dac_nids[4] = {
14999 /* front, surr, clfe, side surr */
15000 0x02, 0x03, 0x04, 0x05
15003 /* dac_nids for ALC660vd are in a different order - according to
15004 * Realtek's driver.
15005 * This should probably result in a different mixer for 6stack models
15006 * of ALC660vd codecs, but for now there is only 3stack mixer
15007 * - and it is the same as in 861vd.
15008 * adc_nids in ALC660vd are (is) the same as in 861vd
15010 static hda_nid_t alc660vd_dac_nids[3] = {
15011 /* front, rear, clfe, rear_surr */
15015 static hda_nid_t alc861vd_adc_nids[1] = {
15020 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15023 /* FIXME: should be a matrix-type input source selection */
15024 static struct hda_input_mux alc861vd_capture_source = {
15028 { "Front Mic", 0x1 },
15034 static struct hda_input_mux alc861vd_dallas_capture_source = {
15037 { "Ext Mic", 0x0 },
15038 { "Int Mic", 0x1 },
15042 static struct hda_input_mux alc861vd_hp_capture_source = {
15045 { "Front Mic", 0x0 },
15046 { "ATAPI Mic", 0x1 },
15053 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15060 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15061 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15062 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15063 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15064 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15071 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15072 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15073 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15074 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15075 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15079 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15080 { 6, alc861vd_6stack_ch6_init },
15081 { 8, alc861vd_6stack_ch8_init },
15084 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15086 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15087 .name = "Channel Mode",
15088 .info = alc_ch_mode_info,
15089 .get = alc_ch_mode_get,
15090 .put = alc_ch_mode_put,
15095 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15096 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15098 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15099 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15100 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15102 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15103 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15105 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15107 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15109 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15110 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15112 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15113 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15118 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15119 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15121 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15122 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15123 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15125 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15126 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15128 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15129 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15134 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15135 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15136 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15138 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15140 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15141 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15142 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15144 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15145 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15146 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15151 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15152 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15157 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15158 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15159 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15160 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15168 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15169 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15170 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15172 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15173 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15178 /* Pin assignment: Speaker=0x14, HP = 0x15,
15179 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15181 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15182 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15183 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15184 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15185 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15186 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15187 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15188 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15189 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15190 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15191 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15195 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15196 * Front Mic=0x18, ATAPI Mic = 0x19,
15198 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15199 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15200 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15202 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15203 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15204 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15205 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15206 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15212 * generic initialization of ADC, input mixers and output mixers
15214 static struct hda_verb alc861vd_volume_init_verbs[] = {
15216 * Unmute ADC0 and set the default input to mic-in
15218 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15219 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15221 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15222 * the analog-loopback mixer widget
15224 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15225 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15226 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15227 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15231 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15232 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15233 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15238 * Set up output mixers (0x02 - 0x05)
15240 /* set vol=0 to output mixers */
15241 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15242 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15243 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15244 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15246 /* set up input amps for analog loopback */
15247 /* Amp Indices: DAC = 0, mixer = 1 */
15248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15254 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15255 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15261 * 3-stack pin configuration:
15262 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15264 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15266 * Set pin mode and muting
15268 /* set front pin widgets 0x14 for output */
15269 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15270 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15271 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15273 /* Mic (rear) pin: input vref at 80% */
15274 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15275 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15276 /* Front Mic pin: input vref at 80% */
15277 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15278 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15279 /* Line In pin: input */
15280 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15281 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15282 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15284 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15285 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15286 /* CD pin widget for input */
15287 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15293 * 6-stack pin configuration:
15295 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15297 * Set pin mode and muting
15299 /* set front pin widgets 0x14 for output */
15300 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15301 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15302 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15304 /* Rear Pin: output 1 (0x0d) */
15305 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15306 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15307 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15308 /* CLFE Pin: output 2 (0x0e) */
15309 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15310 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15311 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15312 /* Side Pin: output 3 (0x0f) */
15313 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15314 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15315 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15317 /* Mic (rear) pin: input vref at 80% */
15318 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15319 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15320 /* Front Mic pin: input vref at 80% */
15321 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15322 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15323 /* Line In pin: input */
15324 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15325 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15326 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15327 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15328 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15329 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15330 /* CD pin widget for input */
15331 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15336 static struct hda_verb alc861vd_eapd_verbs[] = {
15337 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15341 static struct hda_verb alc660vd_eapd_verbs[] = {
15342 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15343 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15347 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15348 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15349 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15350 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15351 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15352 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15356 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15358 unsigned int present;
15359 unsigned char bits;
15361 present = snd_hda_jack_detect(codec, 0x18);
15362 bits = present ? HDA_AMP_MUTE : 0;
15364 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15365 HDA_AMP_MUTE, bits);
15368 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15370 struct alc_spec *spec = codec->spec;
15371 spec->autocfg.hp_pins[0] = 0x1b;
15372 spec->autocfg.speaker_pins[0] = 0x14;
15375 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15377 alc_automute_amp(codec);
15378 alc861vd_lenovo_mic_automute(codec);
15381 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15384 switch (res >> 26) {
15385 case ALC880_MIC_EVENT:
15386 alc861vd_lenovo_mic_automute(codec);
15389 alc_automute_amp_unsol_event(codec, res);
15394 static struct hda_verb alc861vd_dallas_verbs[] = {
15395 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15396 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15397 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15398 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15401 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15404 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15405 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15406 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15407 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15409 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15410 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15411 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15412 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15413 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15414 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15415 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15416 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15418 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15419 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15422 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15423 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15424 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15425 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15427 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15428 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15429 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15433 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15434 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15439 /* toggle speaker-output according to the hp-jack state */
15440 static void alc861vd_dallas_setup(struct hda_codec *codec)
15442 struct alc_spec *spec = codec->spec;
15444 spec->autocfg.hp_pins[0] = 0x15;
15445 spec->autocfg.speaker_pins[0] = 0x14;
15448 #ifdef CONFIG_SND_HDA_POWER_SAVE
15449 #define alc861vd_loopbacks alc880_loopbacks
15452 /* pcm configuration: identical with ALC880 */
15453 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15454 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15455 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15456 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15459 * configuration and preset
15461 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15462 [ALC660VD_3ST] = "3stack-660",
15463 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15464 [ALC660VD_ASUS_V1S] = "asus-v1s",
15465 [ALC861VD_3ST] = "3stack",
15466 [ALC861VD_3ST_DIG] = "3stack-digout",
15467 [ALC861VD_6ST_DIG] = "6stack-digout",
15468 [ALC861VD_LENOVO] = "lenovo",
15469 [ALC861VD_DALLAS] = "dallas",
15470 [ALC861VD_HP] = "hp",
15471 [ALC861VD_AUTO] = "auto",
15474 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15475 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15476 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15477 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15478 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15479 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15480 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15481 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15482 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15483 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15484 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15485 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15486 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15487 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15488 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15489 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15493 static struct alc_config_preset alc861vd_presets[] = {
15495 .mixers = { alc861vd_3st_mixer },
15496 .init_verbs = { alc861vd_volume_init_verbs,
15497 alc861vd_3stack_init_verbs },
15498 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15499 .dac_nids = alc660vd_dac_nids,
15500 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15501 .channel_mode = alc861vd_3stack_2ch_modes,
15502 .input_mux = &alc861vd_capture_source,
15504 [ALC660VD_3ST_DIG] = {
15505 .mixers = { alc861vd_3st_mixer },
15506 .init_verbs = { alc861vd_volume_init_verbs,
15507 alc861vd_3stack_init_verbs },
15508 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15509 .dac_nids = alc660vd_dac_nids,
15510 .dig_out_nid = ALC861VD_DIGOUT_NID,
15511 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15512 .channel_mode = alc861vd_3stack_2ch_modes,
15513 .input_mux = &alc861vd_capture_source,
15516 .mixers = { alc861vd_3st_mixer },
15517 .init_verbs = { alc861vd_volume_init_verbs,
15518 alc861vd_3stack_init_verbs },
15519 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15520 .dac_nids = alc861vd_dac_nids,
15521 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15522 .channel_mode = alc861vd_3stack_2ch_modes,
15523 .input_mux = &alc861vd_capture_source,
15525 [ALC861VD_3ST_DIG] = {
15526 .mixers = { alc861vd_3st_mixer },
15527 .init_verbs = { alc861vd_volume_init_verbs,
15528 alc861vd_3stack_init_verbs },
15529 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15530 .dac_nids = alc861vd_dac_nids,
15531 .dig_out_nid = ALC861VD_DIGOUT_NID,
15532 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15533 .channel_mode = alc861vd_3stack_2ch_modes,
15534 .input_mux = &alc861vd_capture_source,
15536 [ALC861VD_6ST_DIG] = {
15537 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15538 .init_verbs = { alc861vd_volume_init_verbs,
15539 alc861vd_6stack_init_verbs },
15540 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15541 .dac_nids = alc861vd_dac_nids,
15542 .dig_out_nid = ALC861VD_DIGOUT_NID,
15543 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15544 .channel_mode = alc861vd_6stack_modes,
15545 .input_mux = &alc861vd_capture_source,
15547 [ALC861VD_LENOVO] = {
15548 .mixers = { alc861vd_lenovo_mixer },
15549 .init_verbs = { alc861vd_volume_init_verbs,
15550 alc861vd_3stack_init_verbs,
15551 alc861vd_eapd_verbs,
15552 alc861vd_lenovo_unsol_verbs },
15553 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15554 .dac_nids = alc660vd_dac_nids,
15555 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15556 .channel_mode = alc861vd_3stack_2ch_modes,
15557 .input_mux = &alc861vd_capture_source,
15558 .unsol_event = alc861vd_lenovo_unsol_event,
15559 .setup = alc861vd_lenovo_setup,
15560 .init_hook = alc861vd_lenovo_init_hook,
15562 [ALC861VD_DALLAS] = {
15563 .mixers = { alc861vd_dallas_mixer },
15564 .init_verbs = { alc861vd_dallas_verbs },
15565 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15566 .dac_nids = alc861vd_dac_nids,
15567 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15568 .channel_mode = alc861vd_3stack_2ch_modes,
15569 .input_mux = &alc861vd_dallas_capture_source,
15570 .unsol_event = alc_automute_amp_unsol_event,
15571 .setup = alc861vd_dallas_setup,
15572 .init_hook = alc_automute_amp,
15575 .mixers = { alc861vd_hp_mixer },
15576 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15577 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15578 .dac_nids = alc861vd_dac_nids,
15579 .dig_out_nid = ALC861VD_DIGOUT_NID,
15580 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15581 .channel_mode = alc861vd_3stack_2ch_modes,
15582 .input_mux = &alc861vd_hp_capture_source,
15583 .unsol_event = alc_automute_amp_unsol_event,
15584 .setup = alc861vd_dallas_setup,
15585 .init_hook = alc_automute_amp,
15587 [ALC660VD_ASUS_V1S] = {
15588 .mixers = { alc861vd_lenovo_mixer },
15589 .init_verbs = { alc861vd_volume_init_verbs,
15590 alc861vd_3stack_init_verbs,
15591 alc861vd_eapd_verbs,
15592 alc861vd_lenovo_unsol_verbs },
15593 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15594 .dac_nids = alc660vd_dac_nids,
15595 .dig_out_nid = ALC861VD_DIGOUT_NID,
15596 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15597 .channel_mode = alc861vd_3stack_2ch_modes,
15598 .input_mux = &alc861vd_capture_source,
15599 .unsol_event = alc861vd_lenovo_unsol_event,
15600 .setup = alc861vd_lenovo_setup,
15601 .init_hook = alc861vd_lenovo_init_hook,
15606 * BIOS auto configuration
15608 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15609 const struct auto_pin_cfg *cfg)
15611 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15615 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15616 hda_nid_t nid, int pin_type, int dac_idx)
15618 alc_set_pin_output(codec, nid, pin_type);
15621 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15623 struct alc_spec *spec = codec->spec;
15626 for (i = 0; i <= HDA_SIDE; i++) {
15627 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15628 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15630 alc861vd_auto_set_output_and_unmute(codec, nid,
15636 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15638 struct alc_spec *spec = codec->spec;
15641 pin = spec->autocfg.hp_pins[0];
15642 if (pin) /* connect to front and use dac 0 */
15643 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15644 pin = spec->autocfg.speaker_pins[0];
15646 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15649 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15651 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15653 struct alc_spec *spec = codec->spec;
15656 for (i = 0; i < AUTO_PIN_LAST; i++) {
15657 hda_nid_t nid = spec->autocfg.input_pins[i];
15658 if (alc_is_input_pin(codec, nid)) {
15659 alc_set_input_pin(codec, nid, i);
15660 if (nid != ALC861VD_PIN_CD_NID &&
15661 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15662 snd_hda_codec_write(codec, nid, 0,
15663 AC_VERB_SET_AMP_GAIN_MUTE,
15669 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15671 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15672 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15674 /* add playback controls from the parsed DAC table */
15675 /* Based on ALC880 version. But ALC861VD has separate,
15676 * different NIDs for mute/unmute switch and volume control */
15677 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15678 const struct auto_pin_cfg *cfg)
15680 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15681 hda_nid_t nid_v, nid_s;
15684 for (i = 0; i < cfg->line_outs; i++) {
15685 if (!spec->multiout.dac_nids[i])
15687 nid_v = alc861vd_idx_to_mixer_vol(
15689 spec->multiout.dac_nids[i]));
15690 nid_s = alc861vd_idx_to_mixer_switch(
15692 spec->multiout.dac_nids[i]));
15696 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15698 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15702 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15704 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15708 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15710 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15714 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15716 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15722 if (cfg->line_outs == 1 &&
15723 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15730 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15731 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15735 if (cfg->line_outs == 1 &&
15736 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15738 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15739 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15748 /* add playback controls for speaker and HP outputs */
15749 /* Based on ALC880 version. But ALC861VD has separate,
15750 * different NIDs for mute/unmute switch and volume control */
15751 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15752 hda_nid_t pin, const char *pfx)
15754 hda_nid_t nid_v, nid_s;
15760 if (alc880_is_fixed_pin(pin)) {
15761 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15762 /* specify the DAC as the extra output */
15763 if (!spec->multiout.hp_nid)
15764 spec->multiout.hp_nid = nid_v;
15766 spec->multiout.extra_out_nid[0] = nid_v;
15767 /* control HP volume/switch on the output mixer amp */
15768 nid_v = alc861vd_idx_to_mixer_vol(
15769 alc880_fixed_pin_idx(pin));
15770 nid_s = alc861vd_idx_to_mixer_switch(
15771 alc880_fixed_pin_idx(pin));
15773 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15774 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15777 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15778 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15781 } else if (alc880_is_multi_pin(pin)) {
15782 /* set manual connection */
15783 /* we have only a switch on HP-out PIN */
15784 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15785 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15792 /* parse the BIOS configuration and set up the alc_spec
15793 * return 1 if successful, 0 if the proper config is not found,
15794 * or a negative error code
15795 * Based on ALC880 version - had to change it to override
15796 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15797 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15799 struct alc_spec *spec = codec->spec;
15801 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15803 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15807 if (!spec->autocfg.line_outs)
15808 return 0; /* can't find valid BIOS pin config */
15810 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15813 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15816 err = alc861vd_auto_create_extra_out(spec,
15817 spec->autocfg.speaker_pins[0],
15821 err = alc861vd_auto_create_extra_out(spec,
15822 spec->autocfg.hp_pins[0],
15826 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15830 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15832 if (spec->autocfg.dig_outs)
15833 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15835 if (spec->kctls.list)
15836 add_mixer(spec, spec->kctls.list);
15838 add_verb(spec, alc861vd_volume_init_verbs);
15840 spec->num_mux_defs = 1;
15841 spec->input_mux = &spec->private_imux[0];
15843 err = alc_auto_add_mic_boost(codec);
15847 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15852 /* additional initialization for auto-configuration model */
15853 static void alc861vd_auto_init(struct hda_codec *codec)
15855 struct alc_spec *spec = codec->spec;
15856 alc861vd_auto_init_multi_out(codec);
15857 alc861vd_auto_init_hp_out(codec);
15858 alc861vd_auto_init_analog_input(codec);
15859 alc861vd_auto_init_input_src(codec);
15860 if (spec->unsol_event)
15861 alc_inithook(codec);
15865 ALC660VD_FIX_ASUS_GPIO1
15869 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15870 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15871 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15872 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15876 static const struct alc_fixup alc861vd_fixups[] = {
15877 [ALC660VD_FIX_ASUS_GPIO1] = {
15878 .verbs = alc660vd_fix_asus_gpio1_verbs,
15882 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15883 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15887 static int patch_alc861vd(struct hda_codec *codec)
15889 struct alc_spec *spec;
15890 int err, board_config;
15892 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15896 codec->spec = spec;
15898 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15902 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15903 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15905 board_config = ALC861VD_AUTO;
15908 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15910 if (board_config == ALC861VD_AUTO) {
15911 /* automatic parse from the BIOS config */
15912 err = alc861vd_parse_auto_config(codec);
15918 "hda_codec: Cannot set up configuration "
15919 "from BIOS. Using base mode...\n");
15920 board_config = ALC861VD_3ST;
15924 err = snd_hda_attach_beep_device(codec, 0x23);
15930 if (board_config != ALC861VD_AUTO)
15931 setup_preset(codec, &alc861vd_presets[board_config]);
15933 if (codec->vendor_id == 0x10ec0660) {
15934 /* always turn on EAPD */
15935 add_verb(spec, alc660vd_eapd_verbs);
15938 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15939 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15941 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15942 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15944 if (!spec->adc_nids) {
15945 spec->adc_nids = alc861vd_adc_nids;
15946 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15948 if (!spec->capsrc_nids)
15949 spec->capsrc_nids = alc861vd_capsrc_nids;
15951 set_capture_mixer(codec);
15952 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15954 spec->vmaster_nid = 0x02;
15956 codec->patch_ops = alc_patch_ops;
15958 if (board_config == ALC861VD_AUTO)
15959 spec->init_hook = alc861vd_auto_init;
15960 #ifdef CONFIG_SND_HDA_POWER_SAVE
15961 if (!spec->loopback.amplist)
15962 spec->loopback.amplist = alc861vd_loopbacks;
15964 codec->proc_widget_hook = print_realtek_coef;
15972 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15973 * configuration. Each pin widget can choose any input DACs and a mixer.
15974 * Each ADC is connected from a mixer of all inputs. This makes possible
15975 * 6-channel independent captures.
15977 * In addition, an independent DAC for the multi-playback (not used in this
15980 #define ALC662_DIGOUT_NID 0x06
15981 #define ALC662_DIGIN_NID 0x0a
15983 static hda_nid_t alc662_dac_nids[4] = {
15984 /* front, rear, clfe, rear_surr */
15988 static hda_nid_t alc272_dac_nids[2] = {
15992 static hda_nid_t alc662_adc_nids[2] = {
15997 static hda_nid_t alc272_adc_nids[1] = {
16002 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16003 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16007 /* FIXME: should be a matrix-type input source selection */
16008 static struct hda_input_mux alc662_capture_source = {
16012 { "Front Mic", 0x1 },
16018 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16026 static struct hda_input_mux alc663_capture_source = {
16030 { "Front Mic", 0x1 },
16035 #if 0 /* set to 1 for testing other input sources below */
16036 static struct hda_input_mux alc272_nc10_capture_source = {
16039 { "Autoselect Mic", 0x0 },
16040 { "Internal Mic", 0x1 },
16041 { "In-0x02", 0x2 },
16042 { "In-0x03", 0x3 },
16043 { "In-0x04", 0x4 },
16044 { "In-0x05", 0x5 },
16045 { "In-0x06", 0x6 },
16046 { "In-0x07", 0x7 },
16047 { "In-0x08", 0x8 },
16048 { "In-0x09", 0x9 },
16049 { "In-0x0a", 0x0a },
16050 { "In-0x0b", 0x0b },
16051 { "In-0x0c", 0x0c },
16052 { "In-0x0d", 0x0d },
16053 { "In-0x0e", 0x0e },
16054 { "In-0x0f", 0x0f },
16062 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16069 static struct hda_verb alc662_3ST_ch2_init[] = {
16070 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16071 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16072 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16073 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16080 static struct hda_verb alc662_3ST_ch6_init[] = {
16081 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16082 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16083 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16084 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16085 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16086 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16090 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16091 { 2, alc662_3ST_ch2_init },
16092 { 6, alc662_3ST_ch6_init },
16098 static struct hda_verb alc662_sixstack_ch6_init[] = {
16099 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16100 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16101 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16108 static struct hda_verb alc662_sixstack_ch8_init[] = {
16109 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16110 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16111 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16115 static struct hda_channel_mode alc662_5stack_modes[2] = {
16116 { 2, alc662_sixstack_ch6_init },
16117 { 6, alc662_sixstack_ch8_init },
16120 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16121 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16124 static struct snd_kcontrol_new alc662_base_mixer[] = {
16125 /* output mixer control */
16126 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16127 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16128 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16129 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16130 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16131 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16132 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16133 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16134 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16136 /*Input mixer control */
16137 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16138 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16139 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16140 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16141 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16142 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16143 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16144 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16148 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16149 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16150 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16152 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16153 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16154 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16155 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16156 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16158 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16159 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16163 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16164 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16165 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16166 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16167 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16168 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16169 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16170 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16171 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16173 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16174 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16177 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16179 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16180 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16184 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16185 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16186 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16187 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16188 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16189 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16190 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16191 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16192 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16197 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16198 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16199 ALC262_HIPPO_MASTER_SWITCH,
16201 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16202 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16203 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16205 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16206 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16207 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16211 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16212 ALC262_HIPPO_MASTER_SWITCH,
16213 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16214 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16215 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16216 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16217 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16218 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16219 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16225 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16226 .ops = &snd_hda_bind_vol,
16228 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16229 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16234 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16235 .ops = &snd_hda_bind_sw,
16237 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16238 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16243 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16244 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16245 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16251 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16252 .ops = &snd_hda_bind_sw,
16254 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16255 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16256 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16261 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16262 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16263 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16266 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16267 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16272 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16273 .ops = &snd_hda_bind_sw,
16275 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16276 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16277 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16282 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16283 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16284 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16287 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16288 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16292 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16293 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16294 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16295 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16296 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16297 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16298 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16299 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16303 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16304 .ops = &snd_hda_bind_vol,
16306 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16307 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16312 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16313 .ops = &snd_hda_bind_sw,
16315 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16316 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16321 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16322 HDA_BIND_VOL("Master Playback Volume",
16323 &alc663_asus_two_bind_master_vol),
16324 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16325 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16326 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16332 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16333 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16334 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16335 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16336 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16338 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16342 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16343 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16344 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16345 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16346 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16351 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16352 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16356 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16357 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16358 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16361 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16362 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16363 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16364 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16365 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16366 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16370 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16371 .ops = &snd_hda_bind_sw,
16373 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16374 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16375 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16376 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16377 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16382 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16383 .ops = &snd_hda_bind_sw,
16385 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16386 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16391 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16392 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16393 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16394 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16395 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16396 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16397 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16398 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16399 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16404 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16405 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16406 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16407 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16408 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16409 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16410 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16411 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16416 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16418 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16419 .name = "Channel Mode",
16420 .info = alc_ch_mode_info,
16421 .get = alc_ch_mode_get,
16422 .put = alc_ch_mode_put,
16427 static struct hda_verb alc662_init_verbs[] = {
16428 /* ADC: mute amp left and right */
16429 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16430 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16431 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16439 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16441 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16442 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16443 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16446 /* Front Pin: output 0 (0x0c) */
16447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16448 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16450 /* Rear Pin: output 1 (0x0d) */
16451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16452 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16454 /* CLFE Pin: output 2 (0x0e) */
16455 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16456 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16458 /* Mic (rear) pin: input vref at 80% */
16459 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16460 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16461 /* Front Mic pin: input vref at 80% */
16462 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16463 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16464 /* Line In pin: input */
16465 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16466 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16467 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16468 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16469 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16470 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16471 /* CD pin widget for input */
16472 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16474 /* FIXME: use matrix-type input source selection */
16475 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16478 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16480 /* always trun on EAPD */
16481 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16482 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16487 static struct hda_verb alc662_sue_init_verbs[] = {
16488 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16489 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16493 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16494 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16495 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16499 /* Set Unsolicited Event*/
16500 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16502 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16507 * generic initialization of ADC, input mixers and output mixers
16509 static struct hda_verb alc662_auto_init_verbs[] = {
16511 * Unmute ADC and set the default input to mic-in
16513 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16514 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16516 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16518 * Note: PASD motherboards uses the Line In 2 as the input for front
16519 * panel mic (mic 2)
16521 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16522 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16523 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16524 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16529 * Set up output mixers (0x0c - 0x0f)
16531 /* set vol=0 to output mixers */
16532 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16533 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16534 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16536 /* set up input amps for analog loopback */
16537 /* Amp Indices: DAC = 0, mixer = 1 */
16538 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16539 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16540 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16541 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16542 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16543 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16546 /* FIXME: use matrix-type input source selection */
16547 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16554 /* additional verbs for ALC663 */
16555 static struct hda_verb alc663_auto_init_verbs[] = {
16556 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16557 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16561 static struct hda_verb alc663_m51va_init_verbs[] = {
16562 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16563 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16564 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16565 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16566 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16569 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16570 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16574 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16575 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16576 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16577 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16580 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16581 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16585 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16587 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16588 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16589 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16593 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16597 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16598 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16599 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16600 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16603 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16604 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16608 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16610 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16611 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16612 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16613 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16616 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16617 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16618 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16619 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16620 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16624 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16625 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16626 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16627 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16628 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16629 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16630 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16631 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16632 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16633 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16634 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16635 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16636 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16640 static struct hda_verb alc663_g71v_init_verbs[] = {
16641 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16642 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16643 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16645 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16646 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16647 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16649 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16650 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16651 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16655 static struct hda_verb alc663_g50v_init_verbs[] = {
16656 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16657 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16658 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16660 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16661 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16665 static struct hda_verb alc662_ecs_init_verbs[] = {
16666 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16668 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16673 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16674 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16675 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16676 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16677 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16678 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16679 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16680 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16681 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16682 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16683 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16684 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16688 static struct hda_verb alc272_dell_init_verbs[] = {
16689 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16690 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16691 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16692 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16693 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16694 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16695 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16696 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16697 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16698 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16699 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16703 static struct hda_verb alc663_mode7_init_verbs[] = {
16704 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16705 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16706 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16707 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16708 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16709 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16710 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16711 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16712 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16713 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16714 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16715 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16716 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16717 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16718 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16722 static struct hda_verb alc663_mode8_init_verbs[] = {
16723 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16724 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16725 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16728 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16729 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16730 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16731 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16732 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16734 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16736 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16737 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16738 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16742 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16743 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16744 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16748 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16749 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16750 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16754 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16756 unsigned int present;
16757 unsigned char bits;
16759 present = snd_hda_jack_detect(codec, 0x14);
16760 bits = present ? HDA_AMP_MUTE : 0;
16762 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16763 HDA_AMP_MUTE, bits);
16766 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16768 unsigned int present;
16769 unsigned char bits;
16771 present = snd_hda_jack_detect(codec, 0x1b);
16772 bits = present ? HDA_AMP_MUTE : 0;
16774 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16775 HDA_AMP_MUTE, bits);
16776 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16777 HDA_AMP_MUTE, bits);
16780 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16783 if ((res >> 26) == ALC880_HP_EVENT)
16784 alc662_lenovo_101e_all_automute(codec);
16785 if ((res >> 26) == ALC880_FRONT_EVENT)
16786 alc662_lenovo_101e_ispeaker_automute(codec);
16789 /* unsolicited event for HP jack sensing */
16790 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16793 if ((res >> 26) == ALC880_MIC_EVENT)
16794 alc_mic_automute(codec);
16796 alc262_hippo_unsol_event(codec, res);
16799 static void alc662_eeepc_setup(struct hda_codec *codec)
16801 struct alc_spec *spec = codec->spec;
16803 alc262_hippo1_setup(codec);
16804 spec->ext_mic.pin = 0x18;
16805 spec->ext_mic.mux_idx = 0;
16806 spec->int_mic.pin = 0x19;
16807 spec->int_mic.mux_idx = 1;
16808 spec->auto_mic = 1;
16811 static void alc662_eeepc_inithook(struct hda_codec *codec)
16813 alc262_hippo_automute(codec);
16814 alc_mic_automute(codec);
16817 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16819 struct alc_spec *spec = codec->spec;
16821 spec->autocfg.hp_pins[0] = 0x14;
16822 spec->autocfg.speaker_pins[0] = 0x1b;
16825 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16827 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16829 unsigned int present;
16830 unsigned char bits;
16832 present = snd_hda_jack_detect(codec, 0x21);
16833 bits = present ? HDA_AMP_MUTE : 0;
16834 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16835 AMP_IN_MUTE(0), bits);
16836 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16837 AMP_IN_MUTE(0), bits);
16840 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16842 unsigned int present;
16843 unsigned char bits;
16845 present = snd_hda_jack_detect(codec, 0x21);
16846 bits = present ? HDA_AMP_MUTE : 0;
16847 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16848 AMP_IN_MUTE(0), bits);
16849 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16850 AMP_IN_MUTE(0), bits);
16851 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16852 AMP_IN_MUTE(0), bits);
16853 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16854 AMP_IN_MUTE(0), bits);
16857 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16859 unsigned int present;
16860 unsigned char bits;
16862 present = snd_hda_jack_detect(codec, 0x15);
16863 bits = present ? HDA_AMP_MUTE : 0;
16864 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16865 AMP_IN_MUTE(0), bits);
16866 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16867 AMP_IN_MUTE(0), bits);
16868 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16869 AMP_IN_MUTE(0), bits);
16870 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16871 AMP_IN_MUTE(0), bits);
16874 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16876 unsigned int present;
16877 unsigned char bits;
16879 present = snd_hda_jack_detect(codec, 0x1b);
16880 bits = present ? 0 : PIN_OUT;
16881 snd_hda_codec_write(codec, 0x14, 0,
16882 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16885 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16887 unsigned int present1, present2;
16889 present1 = snd_hda_jack_detect(codec, 0x21);
16890 present2 = snd_hda_jack_detect(codec, 0x15);
16892 if (present1 || present2) {
16893 snd_hda_codec_write_cache(codec, 0x14, 0,
16894 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16896 snd_hda_codec_write_cache(codec, 0x14, 0,
16897 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16901 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16903 unsigned int present1, present2;
16905 present1 = snd_hda_jack_detect(codec, 0x1b);
16906 present2 = snd_hda_jack_detect(codec, 0x15);
16908 if (present1 || present2) {
16909 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16910 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16911 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16912 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16915 AMP_IN_MUTE(0), 0);
16916 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16917 AMP_IN_MUTE(0), 0);
16921 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16923 unsigned int present1, present2;
16925 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16926 AC_VERB_GET_PIN_SENSE, 0)
16927 & AC_PINSENSE_PRESENCE;
16928 present2 = snd_hda_codec_read(codec, 0x21, 0,
16929 AC_VERB_GET_PIN_SENSE, 0)
16930 & AC_PINSENSE_PRESENCE;
16932 if (present1 || present2) {
16933 snd_hda_codec_write_cache(codec, 0x14, 0,
16934 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16935 snd_hda_codec_write_cache(codec, 0x17, 0,
16936 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16938 snd_hda_codec_write_cache(codec, 0x14, 0,
16939 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16940 snd_hda_codec_write_cache(codec, 0x17, 0,
16941 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16945 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16947 unsigned int present1, present2;
16949 present1 = snd_hda_codec_read(codec, 0x21, 0,
16950 AC_VERB_GET_PIN_SENSE, 0)
16951 & AC_PINSENSE_PRESENCE;
16952 present2 = snd_hda_codec_read(codec, 0x15, 0,
16953 AC_VERB_GET_PIN_SENSE, 0)
16954 & AC_PINSENSE_PRESENCE;
16956 if (present1 || present2) {
16957 snd_hda_codec_write_cache(codec, 0x14, 0,
16958 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16959 snd_hda_codec_write_cache(codec, 0x17, 0,
16960 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16962 snd_hda_codec_write_cache(codec, 0x14, 0,
16963 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16964 snd_hda_codec_write_cache(codec, 0x17, 0,
16965 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16969 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16972 switch (res >> 26) {
16973 case ALC880_HP_EVENT:
16974 alc663_m51va_speaker_automute(codec);
16976 case ALC880_MIC_EVENT:
16977 alc_mic_automute(codec);
16982 static void alc663_m51va_setup(struct hda_codec *codec)
16984 struct alc_spec *spec = codec->spec;
16985 spec->ext_mic.pin = 0x18;
16986 spec->ext_mic.mux_idx = 0;
16987 spec->int_mic.pin = 0x12;
16988 spec->int_mic.mux_idx = 9;
16989 spec->auto_mic = 1;
16992 static void alc663_m51va_inithook(struct hda_codec *codec)
16994 alc663_m51va_speaker_automute(codec);
16995 alc_mic_automute(codec);
16998 /* ***************** Mode1 ******************************/
16999 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17001 static void alc663_mode1_setup(struct hda_codec *codec)
17003 struct alc_spec *spec = codec->spec;
17004 spec->ext_mic.pin = 0x18;
17005 spec->ext_mic.mux_idx = 0;
17006 spec->int_mic.pin = 0x19;
17007 spec->int_mic.mux_idx = 1;
17008 spec->auto_mic = 1;
17011 #define alc663_mode1_inithook alc663_m51va_inithook
17013 /* ***************** Mode2 ******************************/
17014 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17017 switch (res >> 26) {
17018 case ALC880_HP_EVENT:
17019 alc662_f5z_speaker_automute(codec);
17021 case ALC880_MIC_EVENT:
17022 alc_mic_automute(codec);
17027 #define alc662_mode2_setup alc663_mode1_setup
17029 static void alc662_mode2_inithook(struct hda_codec *codec)
17031 alc662_f5z_speaker_automute(codec);
17032 alc_mic_automute(codec);
17034 /* ***************** Mode3 ******************************/
17035 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17038 switch (res >> 26) {
17039 case ALC880_HP_EVENT:
17040 alc663_two_hp_m1_speaker_automute(codec);
17042 case ALC880_MIC_EVENT:
17043 alc_mic_automute(codec);
17048 #define alc663_mode3_setup alc663_mode1_setup
17050 static void alc663_mode3_inithook(struct hda_codec *codec)
17052 alc663_two_hp_m1_speaker_automute(codec);
17053 alc_mic_automute(codec);
17055 /* ***************** Mode4 ******************************/
17056 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17059 switch (res >> 26) {
17060 case ALC880_HP_EVENT:
17061 alc663_21jd_two_speaker_automute(codec);
17063 case ALC880_MIC_EVENT:
17064 alc_mic_automute(codec);
17069 #define alc663_mode4_setup alc663_mode1_setup
17071 static void alc663_mode4_inithook(struct hda_codec *codec)
17073 alc663_21jd_two_speaker_automute(codec);
17074 alc_mic_automute(codec);
17076 /* ***************** Mode5 ******************************/
17077 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17080 switch (res >> 26) {
17081 case ALC880_HP_EVENT:
17082 alc663_15jd_two_speaker_automute(codec);
17084 case ALC880_MIC_EVENT:
17085 alc_mic_automute(codec);
17090 #define alc663_mode5_setup alc663_mode1_setup
17092 static void alc663_mode5_inithook(struct hda_codec *codec)
17094 alc663_15jd_two_speaker_automute(codec);
17095 alc_mic_automute(codec);
17097 /* ***************** Mode6 ******************************/
17098 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17101 switch (res >> 26) {
17102 case ALC880_HP_EVENT:
17103 alc663_two_hp_m2_speaker_automute(codec);
17105 case ALC880_MIC_EVENT:
17106 alc_mic_automute(codec);
17111 #define alc663_mode6_setup alc663_mode1_setup
17113 static void alc663_mode6_inithook(struct hda_codec *codec)
17115 alc663_two_hp_m2_speaker_automute(codec);
17116 alc_mic_automute(codec);
17119 /* ***************** Mode7 ******************************/
17120 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17123 switch (res >> 26) {
17124 case ALC880_HP_EVENT:
17125 alc663_two_hp_m7_speaker_automute(codec);
17127 case ALC880_MIC_EVENT:
17128 alc_mic_automute(codec);
17133 #define alc663_mode7_setup alc663_mode1_setup
17135 static void alc663_mode7_inithook(struct hda_codec *codec)
17137 alc663_two_hp_m7_speaker_automute(codec);
17138 alc_mic_automute(codec);
17141 /* ***************** Mode8 ******************************/
17142 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17145 switch (res >> 26) {
17146 case ALC880_HP_EVENT:
17147 alc663_two_hp_m8_speaker_automute(codec);
17149 case ALC880_MIC_EVENT:
17150 alc_mic_automute(codec);
17155 #define alc663_mode8_setup alc663_m51va_setup
17157 static void alc663_mode8_inithook(struct hda_codec *codec)
17159 alc663_two_hp_m8_speaker_automute(codec);
17160 alc_mic_automute(codec);
17163 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17165 unsigned int present;
17166 unsigned char bits;
17168 present = snd_hda_jack_detect(codec, 0x21);
17169 bits = present ? HDA_AMP_MUTE : 0;
17170 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17171 HDA_AMP_MUTE, bits);
17172 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17173 HDA_AMP_MUTE, bits);
17176 static void alc663_g71v_front_automute(struct hda_codec *codec)
17178 unsigned int present;
17179 unsigned char bits;
17181 present = snd_hda_jack_detect(codec, 0x15);
17182 bits = present ? HDA_AMP_MUTE : 0;
17183 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17184 HDA_AMP_MUTE, bits);
17187 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17190 switch (res >> 26) {
17191 case ALC880_HP_EVENT:
17192 alc663_g71v_hp_automute(codec);
17194 case ALC880_FRONT_EVENT:
17195 alc663_g71v_front_automute(codec);
17197 case ALC880_MIC_EVENT:
17198 alc_mic_automute(codec);
17203 #define alc663_g71v_setup alc663_m51va_setup
17205 static void alc663_g71v_inithook(struct hda_codec *codec)
17207 alc663_g71v_front_automute(codec);
17208 alc663_g71v_hp_automute(codec);
17209 alc_mic_automute(codec);
17212 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17215 switch (res >> 26) {
17216 case ALC880_HP_EVENT:
17217 alc663_m51va_speaker_automute(codec);
17219 case ALC880_MIC_EVENT:
17220 alc_mic_automute(codec);
17225 #define alc663_g50v_setup alc663_m51va_setup
17227 static void alc663_g50v_inithook(struct hda_codec *codec)
17229 alc663_m51va_speaker_automute(codec);
17230 alc_mic_automute(codec);
17233 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17234 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17235 ALC262_HIPPO_MASTER_SWITCH,
17237 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17238 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17239 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17241 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17242 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17243 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17247 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17248 /* Master Playback automatically created from Speaker and Headphone */
17249 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17250 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17251 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17252 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17254 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17255 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17256 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17258 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17259 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17260 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17264 #ifdef CONFIG_SND_HDA_POWER_SAVE
17265 #define alc662_loopbacks alc880_loopbacks
17269 /* pcm configuration: identical with ALC880 */
17270 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17271 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17272 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17273 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17276 * configuration and preset
17278 static const char *alc662_models[ALC662_MODEL_LAST] = {
17279 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17280 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17281 [ALC662_3ST_6ch] = "3stack-6ch",
17282 [ALC662_5ST_DIG] = "6stack-dig",
17283 [ALC662_LENOVO_101E] = "lenovo-101e",
17284 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17285 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17286 [ALC662_ECS] = "ecs",
17287 [ALC663_ASUS_M51VA] = "m51va",
17288 [ALC663_ASUS_G71V] = "g71v",
17289 [ALC663_ASUS_H13] = "h13",
17290 [ALC663_ASUS_G50V] = "g50v",
17291 [ALC663_ASUS_MODE1] = "asus-mode1",
17292 [ALC662_ASUS_MODE2] = "asus-mode2",
17293 [ALC663_ASUS_MODE3] = "asus-mode3",
17294 [ALC663_ASUS_MODE4] = "asus-mode4",
17295 [ALC663_ASUS_MODE5] = "asus-mode5",
17296 [ALC663_ASUS_MODE6] = "asus-mode6",
17297 [ALC663_ASUS_MODE7] = "asus-mode7",
17298 [ALC663_ASUS_MODE8] = "asus-mode8",
17299 [ALC272_DELL] = "dell",
17300 [ALC272_DELL_ZM1] = "dell-zm1",
17301 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17302 [ALC662_AUTO] = "auto",
17305 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17306 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17307 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17308 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17309 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17310 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17311 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17312 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17313 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17314 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17315 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17316 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17317 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17318 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17319 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17320 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17321 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17322 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17323 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17324 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17325 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17326 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17327 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17328 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17329 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17330 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17331 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17332 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17333 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17334 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17335 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17336 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17337 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17338 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17339 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17340 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17341 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17342 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17343 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17344 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17345 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17346 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17347 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17348 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17349 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17350 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17351 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17352 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17353 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17354 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17355 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17356 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17357 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17358 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17359 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17360 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17361 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17362 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17363 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17364 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17365 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17366 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17367 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17368 ALC662_3ST_6ch_DIG),
17369 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17370 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17371 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17372 ALC662_3ST_6ch_DIG),
17373 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17374 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17375 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17376 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17377 ALC662_3ST_6ch_DIG),
17378 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17380 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17384 static struct alc_config_preset alc662_presets[] = {
17385 [ALC662_3ST_2ch_DIG] = {
17386 .mixers = { alc662_3ST_2ch_mixer },
17387 .init_verbs = { alc662_init_verbs },
17388 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17389 .dac_nids = alc662_dac_nids,
17390 .dig_out_nid = ALC662_DIGOUT_NID,
17391 .dig_in_nid = ALC662_DIGIN_NID,
17392 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17393 .channel_mode = alc662_3ST_2ch_modes,
17394 .input_mux = &alc662_capture_source,
17396 [ALC662_3ST_6ch_DIG] = {
17397 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17398 .init_verbs = { alc662_init_verbs },
17399 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17400 .dac_nids = alc662_dac_nids,
17401 .dig_out_nid = ALC662_DIGOUT_NID,
17402 .dig_in_nid = ALC662_DIGIN_NID,
17403 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17404 .channel_mode = alc662_3ST_6ch_modes,
17406 .input_mux = &alc662_capture_source,
17408 [ALC662_3ST_6ch] = {
17409 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17410 .init_verbs = { alc662_init_verbs },
17411 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17412 .dac_nids = alc662_dac_nids,
17413 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17414 .channel_mode = alc662_3ST_6ch_modes,
17416 .input_mux = &alc662_capture_source,
17418 [ALC662_5ST_DIG] = {
17419 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17420 .init_verbs = { alc662_init_verbs },
17421 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17422 .dac_nids = alc662_dac_nids,
17423 .dig_out_nid = ALC662_DIGOUT_NID,
17424 .dig_in_nid = ALC662_DIGIN_NID,
17425 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17426 .channel_mode = alc662_5stack_modes,
17427 .input_mux = &alc662_capture_source,
17429 [ALC662_LENOVO_101E] = {
17430 .mixers = { alc662_lenovo_101e_mixer },
17431 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17432 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17433 .dac_nids = alc662_dac_nids,
17434 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17435 .channel_mode = alc662_3ST_2ch_modes,
17436 .input_mux = &alc662_lenovo_101e_capture_source,
17437 .unsol_event = alc662_lenovo_101e_unsol_event,
17438 .init_hook = alc662_lenovo_101e_all_automute,
17440 [ALC662_ASUS_EEEPC_P701] = {
17441 .mixers = { alc662_eeepc_p701_mixer },
17442 .init_verbs = { alc662_init_verbs,
17443 alc662_eeepc_sue_init_verbs },
17444 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17445 .dac_nids = alc662_dac_nids,
17446 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17447 .channel_mode = alc662_3ST_2ch_modes,
17448 .unsol_event = alc662_eeepc_unsol_event,
17449 .setup = alc662_eeepc_setup,
17450 .init_hook = alc662_eeepc_inithook,
17452 [ALC662_ASUS_EEEPC_EP20] = {
17453 .mixers = { alc662_eeepc_ep20_mixer,
17454 alc662_chmode_mixer },
17455 .init_verbs = { alc662_init_verbs,
17456 alc662_eeepc_ep20_sue_init_verbs },
17457 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17458 .dac_nids = alc662_dac_nids,
17459 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17460 .channel_mode = alc662_3ST_6ch_modes,
17461 .input_mux = &alc662_lenovo_101e_capture_source,
17462 .unsol_event = alc662_eeepc_unsol_event,
17463 .setup = alc662_eeepc_ep20_setup,
17464 .init_hook = alc662_eeepc_ep20_inithook,
17467 .mixers = { alc662_ecs_mixer },
17468 .init_verbs = { alc662_init_verbs,
17469 alc662_ecs_init_verbs },
17470 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17471 .dac_nids = alc662_dac_nids,
17472 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17473 .channel_mode = alc662_3ST_2ch_modes,
17474 .unsol_event = alc662_eeepc_unsol_event,
17475 .setup = alc662_eeepc_setup,
17476 .init_hook = alc662_eeepc_inithook,
17478 [ALC663_ASUS_M51VA] = {
17479 .mixers = { alc663_m51va_mixer },
17480 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17481 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17482 .dac_nids = alc662_dac_nids,
17483 .dig_out_nid = ALC662_DIGOUT_NID,
17484 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17485 .channel_mode = alc662_3ST_2ch_modes,
17486 .unsol_event = alc663_m51va_unsol_event,
17487 .setup = alc663_m51va_setup,
17488 .init_hook = alc663_m51va_inithook,
17490 [ALC663_ASUS_G71V] = {
17491 .mixers = { alc663_g71v_mixer },
17492 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17493 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17494 .dac_nids = alc662_dac_nids,
17495 .dig_out_nid = ALC662_DIGOUT_NID,
17496 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17497 .channel_mode = alc662_3ST_2ch_modes,
17498 .unsol_event = alc663_g71v_unsol_event,
17499 .setup = alc663_g71v_setup,
17500 .init_hook = alc663_g71v_inithook,
17502 [ALC663_ASUS_H13] = {
17503 .mixers = { alc663_m51va_mixer },
17504 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17505 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17506 .dac_nids = alc662_dac_nids,
17507 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17508 .channel_mode = alc662_3ST_2ch_modes,
17509 .unsol_event = alc663_m51va_unsol_event,
17510 .init_hook = alc663_m51va_inithook,
17512 [ALC663_ASUS_G50V] = {
17513 .mixers = { alc663_g50v_mixer },
17514 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17515 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17516 .dac_nids = alc662_dac_nids,
17517 .dig_out_nid = ALC662_DIGOUT_NID,
17518 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17519 .channel_mode = alc662_3ST_6ch_modes,
17520 .input_mux = &alc663_capture_source,
17521 .unsol_event = alc663_g50v_unsol_event,
17522 .setup = alc663_g50v_setup,
17523 .init_hook = alc663_g50v_inithook,
17525 [ALC663_ASUS_MODE1] = {
17526 .mixers = { alc663_m51va_mixer },
17527 .cap_mixer = alc662_auto_capture_mixer,
17528 .init_verbs = { alc662_init_verbs,
17529 alc663_21jd_amic_init_verbs },
17530 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17532 .dac_nids = alc662_dac_nids,
17533 .dig_out_nid = ALC662_DIGOUT_NID,
17534 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17535 .channel_mode = alc662_3ST_2ch_modes,
17536 .unsol_event = alc663_mode1_unsol_event,
17537 .setup = alc663_mode1_setup,
17538 .init_hook = alc663_mode1_inithook,
17540 [ALC662_ASUS_MODE2] = {
17541 .mixers = { alc662_1bjd_mixer },
17542 .cap_mixer = alc662_auto_capture_mixer,
17543 .init_verbs = { alc662_init_verbs,
17544 alc662_1bjd_amic_init_verbs },
17545 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17546 .dac_nids = alc662_dac_nids,
17547 .dig_out_nid = ALC662_DIGOUT_NID,
17548 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17549 .channel_mode = alc662_3ST_2ch_modes,
17550 .unsol_event = alc662_mode2_unsol_event,
17551 .setup = alc662_mode2_setup,
17552 .init_hook = alc662_mode2_inithook,
17554 [ALC663_ASUS_MODE3] = {
17555 .mixers = { alc663_two_hp_m1_mixer },
17556 .cap_mixer = alc662_auto_capture_mixer,
17557 .init_verbs = { alc662_init_verbs,
17558 alc663_two_hp_amic_m1_init_verbs },
17559 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17561 .dac_nids = alc662_dac_nids,
17562 .dig_out_nid = ALC662_DIGOUT_NID,
17563 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17564 .channel_mode = alc662_3ST_2ch_modes,
17565 .unsol_event = alc663_mode3_unsol_event,
17566 .setup = alc663_mode3_setup,
17567 .init_hook = alc663_mode3_inithook,
17569 [ALC663_ASUS_MODE4] = {
17570 .mixers = { alc663_asus_21jd_clfe_mixer },
17571 .cap_mixer = alc662_auto_capture_mixer,
17572 .init_verbs = { alc662_init_verbs,
17573 alc663_21jd_amic_init_verbs},
17574 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17576 .dac_nids = alc662_dac_nids,
17577 .dig_out_nid = ALC662_DIGOUT_NID,
17578 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17579 .channel_mode = alc662_3ST_2ch_modes,
17580 .unsol_event = alc663_mode4_unsol_event,
17581 .setup = alc663_mode4_setup,
17582 .init_hook = alc663_mode4_inithook,
17584 [ALC663_ASUS_MODE5] = {
17585 .mixers = { alc663_asus_15jd_clfe_mixer },
17586 .cap_mixer = alc662_auto_capture_mixer,
17587 .init_verbs = { alc662_init_verbs,
17588 alc663_15jd_amic_init_verbs },
17589 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17591 .dac_nids = alc662_dac_nids,
17592 .dig_out_nid = ALC662_DIGOUT_NID,
17593 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17594 .channel_mode = alc662_3ST_2ch_modes,
17595 .unsol_event = alc663_mode5_unsol_event,
17596 .setup = alc663_mode5_setup,
17597 .init_hook = alc663_mode5_inithook,
17599 [ALC663_ASUS_MODE6] = {
17600 .mixers = { alc663_two_hp_m2_mixer },
17601 .cap_mixer = alc662_auto_capture_mixer,
17602 .init_verbs = { alc662_init_verbs,
17603 alc663_two_hp_amic_m2_init_verbs },
17604 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17606 .dac_nids = alc662_dac_nids,
17607 .dig_out_nid = ALC662_DIGOUT_NID,
17608 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17609 .channel_mode = alc662_3ST_2ch_modes,
17610 .unsol_event = alc663_mode6_unsol_event,
17611 .setup = alc663_mode6_setup,
17612 .init_hook = alc663_mode6_inithook,
17614 [ALC663_ASUS_MODE7] = {
17615 .mixers = { alc663_mode7_mixer },
17616 .cap_mixer = alc662_auto_capture_mixer,
17617 .init_verbs = { alc662_init_verbs,
17618 alc663_mode7_init_verbs },
17619 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17621 .dac_nids = alc662_dac_nids,
17622 .dig_out_nid = ALC662_DIGOUT_NID,
17623 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17624 .channel_mode = alc662_3ST_2ch_modes,
17625 .unsol_event = alc663_mode7_unsol_event,
17626 .setup = alc663_mode7_setup,
17627 .init_hook = alc663_mode7_inithook,
17629 [ALC663_ASUS_MODE8] = {
17630 .mixers = { alc663_mode8_mixer },
17631 .cap_mixer = alc662_auto_capture_mixer,
17632 .init_verbs = { alc662_init_verbs,
17633 alc663_mode8_init_verbs },
17634 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17636 .dac_nids = alc662_dac_nids,
17637 .dig_out_nid = ALC662_DIGOUT_NID,
17638 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17639 .channel_mode = alc662_3ST_2ch_modes,
17640 .unsol_event = alc663_mode8_unsol_event,
17641 .setup = alc663_mode8_setup,
17642 .init_hook = alc663_mode8_inithook,
17645 .mixers = { alc663_m51va_mixer },
17646 .cap_mixer = alc272_auto_capture_mixer,
17647 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17648 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17649 .dac_nids = alc662_dac_nids,
17650 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17651 .adc_nids = alc272_adc_nids,
17652 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17653 .capsrc_nids = alc272_capsrc_nids,
17654 .channel_mode = alc662_3ST_2ch_modes,
17655 .unsol_event = alc663_m51va_unsol_event,
17656 .setup = alc663_m51va_setup,
17657 .init_hook = alc663_m51va_inithook,
17659 [ALC272_DELL_ZM1] = {
17660 .mixers = { alc663_m51va_mixer },
17661 .cap_mixer = alc662_auto_capture_mixer,
17662 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17663 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17664 .dac_nids = alc662_dac_nids,
17665 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17666 .adc_nids = alc662_adc_nids,
17668 .capsrc_nids = alc662_capsrc_nids,
17669 .channel_mode = alc662_3ST_2ch_modes,
17670 .unsol_event = alc663_m51va_unsol_event,
17671 .setup = alc663_m51va_setup,
17672 .init_hook = alc663_m51va_inithook,
17674 [ALC272_SAMSUNG_NC10] = {
17675 .mixers = { alc272_nc10_mixer },
17676 .init_verbs = { alc662_init_verbs,
17677 alc663_21jd_amic_init_verbs },
17678 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17679 .dac_nids = alc272_dac_nids,
17680 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17681 .channel_mode = alc662_3ST_2ch_modes,
17682 /*.input_mux = &alc272_nc10_capture_source,*/
17683 .unsol_event = alc663_mode4_unsol_event,
17684 .setup = alc663_mode4_setup,
17685 .init_hook = alc663_mode4_inithook,
17691 * BIOS auto configuration
17694 /* convert from MIX nid to DAC */
17695 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17699 else if (nid >= 0x0c && nid <= 0x0e)
17700 return nid - 0x0c + 0x02;
17705 /* get MIX nid connected to the given pin targeted to DAC */
17706 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17712 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17713 for (i = 0; i < num; i++) {
17714 if (alc662_mix_to_dac(mix[i]) == dac)
17720 /* look for an empty DAC slot */
17721 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17723 struct alc_spec *spec = codec->spec;
17727 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17730 for (i = 0; i < num; i++) {
17731 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17734 for (j = 0; j < spec->multiout.num_dacs; j++)
17735 if (spec->multiout.dac_nids[j] == nid)
17737 if (j >= spec->multiout.num_dacs)
17743 /* fill in the dac_nids table from the parsed pin configuration */
17744 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17745 const struct auto_pin_cfg *cfg)
17747 struct alc_spec *spec = codec->spec;
17751 spec->multiout.dac_nids = spec->private_dac_nids;
17752 for (i = 0; i < cfg->line_outs; i++) {
17753 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17756 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17761 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17762 hda_nid_t nid, unsigned int chs)
17764 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17765 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17768 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17769 hda_nid_t nid, unsigned int chs)
17771 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17772 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17775 #define alc662_add_stereo_vol(spec, pfx, nid) \
17776 alc662_add_vol_ctl(spec, pfx, nid, 3)
17777 #define alc662_add_stereo_sw(spec, pfx, nid) \
17778 alc662_add_sw_ctl(spec, pfx, nid, 3)
17780 /* add playback controls from the parsed DAC table */
17781 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17782 const struct auto_pin_cfg *cfg)
17784 struct alc_spec *spec = codec->spec;
17785 static const char *chname[4] = {
17786 "Front", "Surround", NULL /*CLFE*/, "Side"
17788 hda_nid_t nid, mix;
17791 for (i = 0; i < cfg->line_outs; i++) {
17792 nid = spec->multiout.dac_nids[i];
17795 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17800 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17803 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17806 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17809 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17814 if (cfg->line_outs == 1 &&
17815 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17822 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17825 if (cfg->line_outs == 1 &&
17826 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17828 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17836 /* add playback controls for speaker and HP outputs */
17837 /* return DAC nid if any new DAC is assigned */
17838 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17841 struct alc_spec *spec = codec->spec;
17842 hda_nid_t nid, mix;
17847 nid = alc662_look_for_dac(codec, pin);
17849 /* the corresponding DAC is already occupied */
17850 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17851 return 0; /* no way */
17852 /* create a switch only */
17853 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17854 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17857 mix = alc662_dac_to_mix(codec, pin, nid);
17860 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17863 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17869 /* create playback/capture controls for input pins */
17870 #define alc662_auto_create_input_ctls \
17871 alc882_auto_create_input_ctls
17873 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17874 hda_nid_t nid, int pin_type,
17880 alc_set_pin_output(codec, nid, pin_type);
17881 /* need the manual connection? */
17882 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17885 for (i = 0; i < num; i++) {
17886 if (alc662_mix_to_dac(srcs[i]) != dac)
17888 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17893 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17895 struct alc_spec *spec = codec->spec;
17896 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17899 for (i = 0; i <= HDA_SIDE; i++) {
17900 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17902 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17903 spec->multiout.dac_nids[i]);
17907 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17909 struct alc_spec *spec = codec->spec;
17912 pin = spec->autocfg.hp_pins[0];
17914 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17915 spec->multiout.hp_nid);
17916 pin = spec->autocfg.speaker_pins[0];
17918 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17919 spec->multiout.extra_out_nid[0]);
17922 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17924 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17926 struct alc_spec *spec = codec->spec;
17929 for (i = 0; i < AUTO_PIN_LAST; i++) {
17930 hda_nid_t nid = spec->autocfg.input_pins[i];
17931 if (alc_is_input_pin(codec, nid)) {
17932 alc_set_input_pin(codec, nid, i);
17933 if (nid != ALC662_PIN_CD_NID &&
17934 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17935 snd_hda_codec_write(codec, nid, 0,
17936 AC_VERB_SET_AMP_GAIN_MUTE,
17942 #define alc662_auto_init_input_src alc882_auto_init_input_src
17944 static int alc662_parse_auto_config(struct hda_codec *codec)
17946 struct alc_spec *spec = codec->spec;
17948 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17950 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17954 if (!spec->autocfg.line_outs)
17955 return 0; /* can't find valid BIOS pin config */
17957 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17960 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17963 err = alc662_auto_create_extra_out(codec,
17964 spec->autocfg.speaker_pins[0],
17969 spec->multiout.extra_out_nid[0] = err;
17970 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17975 spec->multiout.hp_nid = err;
17976 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17980 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17982 if (spec->autocfg.dig_outs)
17983 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17985 if (spec->kctls.list)
17986 add_mixer(spec, spec->kctls.list);
17988 spec->num_mux_defs = 1;
17989 spec->input_mux = &spec->private_imux[0];
17991 add_verb(spec, alc662_auto_init_verbs);
17992 if (codec->vendor_id == 0x10ec0663)
17993 add_verb(spec, alc663_auto_init_verbs);
17995 err = alc_auto_add_mic_boost(codec);
17999 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18004 /* additional initialization for auto-configuration model */
18005 static void alc662_auto_init(struct hda_codec *codec)
18007 struct alc_spec *spec = codec->spec;
18008 alc662_auto_init_multi_out(codec);
18009 alc662_auto_init_hp_out(codec);
18010 alc662_auto_init_analog_input(codec);
18011 alc662_auto_init_input_src(codec);
18012 if (spec->unsol_event)
18013 alc_inithook(codec);
18016 static int patch_alc662(struct hda_codec *codec)
18018 struct alc_spec *spec;
18019 int err, board_config;
18021 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18025 codec->spec = spec;
18027 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18029 if (alc_read_coef_idx(codec, 0)==0x8020){
18030 kfree(codec->chip_name);
18031 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18032 if (!codec->chip_name) {
18038 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18041 if (board_config < 0) {
18042 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18044 board_config = ALC662_AUTO;
18047 if (board_config == ALC662_AUTO) {
18048 /* automatic parse from the BIOS config */
18049 err = alc662_parse_auto_config(codec);
18055 "hda_codec: Cannot set up configuration "
18056 "from BIOS. Using base mode...\n");
18057 board_config = ALC662_3ST_2ch_DIG;
18061 err = snd_hda_attach_beep_device(codec, 0x1);
18067 if (board_config != ALC662_AUTO)
18068 setup_preset(codec, &alc662_presets[board_config]);
18070 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18071 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18073 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18074 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18076 if (!spec->adc_nids) {
18077 spec->adc_nids = alc662_adc_nids;
18078 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18080 if (!spec->capsrc_nids)
18081 spec->capsrc_nids = alc662_capsrc_nids;
18083 if (!spec->cap_mixer)
18084 set_capture_mixer(codec);
18085 if (codec->vendor_id == 0x10ec0662)
18086 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18088 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18090 spec->vmaster_nid = 0x02;
18092 codec->patch_ops = alc_patch_ops;
18093 if (board_config == ALC662_AUTO)
18094 spec->init_hook = alc662_auto_init;
18095 #ifdef CONFIG_SND_HDA_POWER_SAVE
18096 if (!spec->loopback.amplist)
18097 spec->loopback.amplist = alc662_loopbacks;
18099 codec->proc_widget_hook = print_realtek_coef;
18104 static int patch_alc888(struct hda_codec *codec)
18106 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18107 kfree(codec->chip_name);
18108 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18109 if (!codec->chip_name) {
18113 return patch_alc662(codec);
18115 return patch_alc882(codec);
18121 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18122 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18123 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18124 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18125 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18126 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18127 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18128 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18129 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18130 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18131 .patch = patch_alc861 },
18132 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18133 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18134 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18135 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18136 .patch = patch_alc882 },
18137 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18138 .patch = patch_alc662 },
18139 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18140 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18141 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18142 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18143 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18144 .patch = patch_alc882 },
18145 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18146 .patch = patch_alc882 },
18147 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18148 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18149 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18150 .patch = patch_alc882 },
18151 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18152 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18153 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18154 {} /* terminator */
18157 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18159 MODULE_LICENSE("GPL");
18160 MODULE_DESCRIPTION("Realtek HD-audio codec");
18162 static struct hda_codec_preset_list realtek_list = {
18163 .preset = snd_hda_preset_realtek,
18164 .owner = THIS_MODULE,
18167 static int __init patch_realtek_init(void)
18169 return snd_hda_add_codec_preset(&realtek_list);
18172 static void __exit patch_realtek_exit(void)
18174 snd_hda_delete_codec_preset(&realtek_list);
18177 module_init(patch_realtek_init)
18178 module_exit(patch_realtek_exit)