2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec, int power);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec, int power);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
637 .info = alc_pin_mode_info, \
638 .get = alc_pin_mode_get, \
639 .put = alc_pin_mode_put, \
640 .private_value = nid | (dir<<16) }
642 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
643 * together using a mask with more than one bit set. This control is
644 * currently used only by the ALC260 test model. At this stage they are not
645 * needed for any "production" models.
647 #ifdef CONFIG_SND_DEBUG
648 #define alc_gpio_data_info snd_ctl_boolean_mono_info
650 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long *valp = ucontrol->value.integer.value;
657 unsigned int val = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_GPIO_DATA, 0x00);
660 *valp = (val & mask) != 0;
663 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 hda_nid_t nid = kcontrol->private_value & 0xffff;
669 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
670 long val = *ucontrol->value.integer.value;
671 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
672 AC_VERB_GET_GPIO_DATA,
675 /* Set/unset the masked GPIO bit(s) as needed */
676 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
681 snd_hda_codec_write_cache(codec, nid, 0,
682 AC_VERB_SET_GPIO_DATA, gpio_data);
686 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
689 .info = alc_gpio_data_info, \
690 .get = alc_gpio_data_get, \
691 .put = alc_gpio_data_put, \
692 .private_value = nid | (mask<<16) }
693 #endif /* CONFIG_SND_DEBUG */
695 /* A switch control to allow the enabling of the digital IO pins on the
696 * ALC260. This is incredibly simplistic; the intention of this control is
697 * to provide something in the test model allowing digital outputs to be
698 * identified if present. If models are found which can utilise these
699 * outputs a more complete mixer control can be devised for those models if
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
705 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_DIGI_CONVERT_1,
730 /* Set/unset the masked control bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
741 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_spdif_ctrl_info, \
745 .get = alc_spdif_ctrl_get, \
746 .put = alc_spdif_ctrl_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
751 * Again, this is only used in the ALC26x test models to help identify when
752 * the EAPD line must be asserted for features to work.
754 #ifdef CONFIG_SND_DEBUG
755 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
757 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
758 struct snd_ctl_elem_value *ucontrol)
760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
761 hda_nid_t nid = kcontrol->private_value & 0xffff;
762 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
763 long *valp = ucontrol->value.integer.value;
764 unsigned int val = snd_hda_codec_read(codec, nid, 0,
765 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
767 *valp = (val & mask) != 0;
771 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
772 struct snd_ctl_elem_value *ucontrol)
775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
776 hda_nid_t nid = kcontrol->private_value & 0xffff;
777 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
778 long val = *ucontrol->value.integer.value;
779 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
780 AC_VERB_GET_EAPD_BTLENABLE,
783 /* Set/unset the masked control bit(s) as needed */
784 change = (!val ? 0 : mask) != (ctrl_data & mask);
789 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
795 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
796 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
797 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
798 .info = alc_eapd_ctrl_info, \
799 .get = alc_eapd_ctrl_get, \
800 .put = alc_eapd_ctrl_put, \
801 .private_value = nid | (mask<<16) }
802 #endif /* CONFIG_SND_DEBUG */
805 * set up the input pin config (depending on the given auto-pin type)
807 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
810 unsigned int val = PIN_IN;
812 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
814 pincap = snd_hda_query_pin_caps(codec, nid);
815 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
816 if (pincap & AC_PINCAP_VREF_80)
818 else if (pincap & AC_PINCAP_VREF_50)
820 else if (pincap & AC_PINCAP_VREF_100)
822 else if (pincap & AC_PINCAP_VREF_GRD)
825 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
830 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
832 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
834 spec->mixers[spec->num_mixers++] = mix;
837 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
839 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
841 spec->init_verbs[spec->num_init_verbs++] = verb;
844 #ifdef CONFIG_PROC_FS
848 static void print_realtek_coef(struct snd_info_buffer *buffer,
849 struct hda_codec *codec, hda_nid_t nid)
855 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
856 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
857 coeff = snd_hda_codec_read(codec, nid, 0,
858 AC_VERB_GET_COEF_INDEX, 0);
859 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
862 #define print_realtek_coef NULL
866 * set up from the preset table
868 static void setup_preset(struct hda_codec *codec,
869 const struct alc_config_preset *preset)
871 struct alc_spec *spec = codec->spec;
874 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
875 add_mixer(spec, preset->mixers[i]);
876 spec->cap_mixer = preset->cap_mixer;
877 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
879 add_verb(spec, preset->init_verbs[i]);
881 spec->channel_mode = preset->channel_mode;
882 spec->num_channel_mode = preset->num_channel_mode;
883 spec->need_dac_fix = preset->need_dac_fix;
884 spec->const_channel_count = preset->const_channel_count;
886 if (preset->const_channel_count)
887 spec->multiout.max_channels = preset->const_channel_count;
889 spec->multiout.max_channels = spec->channel_mode[0].channels;
890 spec->ext_channel_count = spec->channel_mode[0].channels;
892 spec->multiout.num_dacs = preset->num_dacs;
893 spec->multiout.dac_nids = preset->dac_nids;
894 spec->multiout.dig_out_nid = preset->dig_out_nid;
895 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
896 spec->multiout.hp_nid = preset->hp_nid;
898 spec->num_mux_defs = preset->num_mux_defs;
899 if (!spec->num_mux_defs)
900 spec->num_mux_defs = 1;
901 spec->input_mux = preset->input_mux;
903 spec->num_adc_nids = preset->num_adc_nids;
904 spec->adc_nids = preset->adc_nids;
905 spec->capsrc_nids = preset->capsrc_nids;
906 spec->dig_in_nid = preset->dig_in_nid;
908 spec->unsol_event = preset->unsol_event;
909 spec->init_hook = preset->init_hook;
910 #ifdef CONFIG_SND_HDA_POWER_SAVE
911 spec->power_hook = preset->power_hook;
912 spec->loopback.amplist = preset->loopbacks;
916 preset->setup(codec);
919 /* Enable GPIO mask and set output */
920 static struct hda_verb alc_gpio1_init_verbs[] = {
921 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
922 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
923 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
927 static struct hda_verb alc_gpio2_init_verbs[] = {
928 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
929 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
930 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
934 static struct hda_verb alc_gpio3_init_verbs[] = {
935 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
936 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
937 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
942 * Fix hardware PLL issue
943 * On some codecs, the analog PLL gating control must be off while
944 * the default value is 1.
946 static void alc_fix_pll(struct hda_codec *codec)
948 struct alc_spec *spec = codec->spec;
953 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
955 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
956 AC_VERB_GET_PROC_COEF, 0);
957 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
959 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
960 val & ~(1 << spec->pll_coef_bit));
963 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
964 unsigned int coef_idx, unsigned int coef_bit)
966 struct alc_spec *spec = codec->spec;
968 spec->pll_coef_idx = coef_idx;
969 spec->pll_coef_bit = coef_bit;
973 static void alc_automute_pin(struct hda_codec *codec)
975 struct alc_spec *spec = codec->spec;
976 unsigned int nid = spec->autocfg.hp_pins[0];
981 spec->jack_present = snd_hda_jack_detect(codec, nid);
982 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
983 nid = spec->autocfg.speaker_pins[i];
986 snd_hda_codec_write(codec, nid, 0,
987 AC_VERB_SET_PIN_WIDGET_CONTROL,
988 spec->jack_present ? 0 : PIN_OUT);
992 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
995 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
998 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
999 for (i = 0; i < nums; i++)
1005 static void alc_mic_automute(struct hda_codec *codec)
1007 struct alc_spec *spec = codec->spec;
1008 struct alc_mic_route *dead, *alive;
1009 unsigned int present, type;
1012 if (!spec->auto_mic)
1014 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1016 if (snd_BUG_ON(!spec->adc_nids))
1019 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1021 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1023 alive = &spec->ext_mic;
1024 dead = &spec->int_mic;
1026 alive = &spec->int_mic;
1027 dead = &spec->ext_mic;
1030 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1031 if (type == AC_WID_AUD_MIX) {
1032 /* Matrix-mixer style (e.g. ALC882) */
1033 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1036 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1038 HDA_AMP_MUTE, HDA_AMP_MUTE);
1040 /* MUX style (e.g. ALC880) */
1041 snd_hda_codec_write_cache(codec, cap_nid, 0,
1042 AC_VERB_SET_CONNECT_SEL,
1046 /* FIXME: analog mixer */
1049 /* unsolicited event for HP jack sensing */
1050 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1052 if (codec->vendor_id == 0x10ec0880)
1057 case ALC880_HP_EVENT:
1058 alc_automute_pin(codec);
1060 case ALC880_MIC_EVENT:
1061 alc_mic_automute(codec);
1066 static void alc_inithook(struct hda_codec *codec)
1068 alc_automute_pin(codec);
1069 alc_mic_automute(codec);
1072 /* additional initialization for ALC888 variants */
1073 static void alc888_coef_init(struct hda_codec *codec)
1077 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1078 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1079 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1080 if ((tmp & 0xf0) == 0x20)
1082 snd_hda_codec_read(codec, 0x20, 0,
1083 AC_VERB_SET_PROC_COEF, 0x830);
1086 snd_hda_codec_read(codec, 0x20, 0,
1087 AC_VERB_SET_PROC_COEF, 0x3030);
1090 static void alc889_coef_init(struct hda_codec *codec)
1094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1095 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1096 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1100 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1105 case ALC_INIT_GPIO1:
1106 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1108 case ALC_INIT_GPIO2:
1109 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1111 case ALC_INIT_GPIO3:
1112 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1114 case ALC_INIT_DEFAULT:
1115 switch (codec->vendor_id) {
1117 snd_hda_codec_write(codec, 0x0f, 0,
1118 AC_VERB_SET_EAPD_BTLENABLE, 2);
1119 snd_hda_codec_write(codec, 0x10, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1132 snd_hda_codec_write(codec, 0x14, 0,
1133 AC_VERB_SET_EAPD_BTLENABLE, 2);
1134 snd_hda_codec_write(codec, 0x15, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1138 switch (codec->vendor_id) {
1140 snd_hda_codec_write(codec, 0x1a, 0,
1141 AC_VERB_SET_COEF_INDEX, 7);
1142 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1143 AC_VERB_GET_PROC_COEF, 0);
1144 snd_hda_codec_write(codec, 0x1a, 0,
1145 AC_VERB_SET_COEF_INDEX, 7);
1146 snd_hda_codec_write(codec, 0x1a, 0,
1147 AC_VERB_SET_PROC_COEF,
1157 alc889_coef_init(codec);
1160 alc888_coef_init(codec);
1164 snd_hda_codec_write(codec, 0x20, 0,
1165 AC_VERB_SET_COEF_INDEX, 7);
1166 tmp = snd_hda_codec_read(codec, 0x20, 0,
1167 AC_VERB_GET_PROC_COEF, 0);
1168 snd_hda_codec_write(codec, 0x20, 0,
1169 AC_VERB_SET_COEF_INDEX, 7);
1170 snd_hda_codec_write(codec, 0x20, 0,
1171 AC_VERB_SET_PROC_COEF,
1179 static void alc_init_auto_hp(struct hda_codec *codec)
1181 struct alc_spec *spec = codec->spec;
1183 if (!spec->autocfg.hp_pins[0])
1186 if (!spec->autocfg.speaker_pins[0]) {
1187 if (spec->autocfg.line_out_pins[0] &&
1188 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1189 spec->autocfg.speaker_pins[0] =
1190 spec->autocfg.line_out_pins[0];
1195 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1196 spec->autocfg.hp_pins[0]);
1197 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1198 AC_VERB_SET_UNSOLICITED_ENABLE,
1199 AC_USRSP_EN | ALC880_HP_EVENT);
1200 spec->unsol_event = alc_sku_unsol_event;
1203 static void alc_init_auto_mic(struct hda_codec *codec)
1205 struct alc_spec *spec = codec->spec;
1206 struct auto_pin_cfg *cfg = &spec->autocfg;
1207 hda_nid_t fixed, ext;
1210 /* there must be only two mic inputs exclusively */
1211 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1212 if (cfg->input_pins[i])
1216 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1217 hda_nid_t nid = cfg->input_pins[i];
1218 unsigned int defcfg;
1221 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1222 switch (get_defcfg_connect(defcfg)) {
1223 case AC_JACK_PORT_FIXED:
1225 return; /* already occupied */
1228 case AC_JACK_PORT_COMPLEX:
1230 return; /* already occupied */
1234 return; /* invalid entry */
1237 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1238 return; /* no unsol support */
1239 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1241 spec->ext_mic.pin = ext;
1242 spec->int_mic.pin = fixed;
1243 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1244 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1246 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1247 AC_VERB_SET_UNSOLICITED_ENABLE,
1248 AC_USRSP_EN | ALC880_MIC_EVENT);
1249 spec->unsol_event = alc_sku_unsol_event;
1252 /* check subsystem ID and set up device-specific initialization;
1253 * return 1 if initialized, 0 if invalid SSID
1255 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1256 * 31 ~ 16 : Manufacture ID
1258 * 7 ~ 0 : Assembly ID
1259 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1261 static int alc_subsystem_id(struct hda_codec *codec,
1262 hda_nid_t porta, hda_nid_t porte,
1265 unsigned int ass, tmp, i;
1267 struct alc_spec *spec = codec->spec;
1269 ass = codec->subsystem_id & 0xffff;
1270 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1273 /* invalid SSID, check the special NID pin defcfg instead */
1275 * 31~30 : port connectivity
1278 * 19~16 : Check sum (15:1)
1283 if (codec->vendor_id == 0x10ec0260)
1285 ass = snd_hda_codec_get_pincfg(codec, nid);
1286 snd_printd("realtek: No valid SSID, "
1287 "checking pincfg 0x%08x for NID 0x%x\n",
1289 if (!(ass & 1) && !(ass & 0x100000))
1291 if ((ass >> 30) != 1) /* no physical connection */
1296 for (i = 1; i < 16; i++) {
1300 if (((ass >> 16) & 0xf) != tmp)
1303 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1304 ass & 0xffff, codec->vendor_id);
1308 * 2 : 0 --> Desktop, 1 --> Laptop
1309 * 3~5 : External Amplifier control
1312 tmp = (ass & 0x38) >> 3; /* external Amp control */
1315 spec->init_amp = ALC_INIT_GPIO1;
1318 spec->init_amp = ALC_INIT_GPIO2;
1321 spec->init_amp = ALC_INIT_GPIO3;
1324 spec->init_amp = ALC_INIT_DEFAULT;
1328 /* is laptop or Desktop and enable the function "Mute internal speaker
1329 * when the external headphone out jack is plugged"
1331 if (!(ass & 0x8000))
1334 * 10~8 : Jack location
1335 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1337 * 15 : 1 --> enable the function "Mute internal speaker
1338 * when the external headphone out jack is plugged"
1340 if (!spec->autocfg.hp_pins[0]) {
1342 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1351 for (i = 0; i < spec->autocfg.line_outs; i++)
1352 if (spec->autocfg.line_out_pins[i] == nid)
1354 spec->autocfg.hp_pins[0] = nid;
1357 alc_init_auto_hp(codec);
1358 alc_init_auto_mic(codec);
1362 static void alc_ssid_check(struct hda_codec *codec,
1363 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1365 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1366 struct alc_spec *spec = codec->spec;
1367 snd_printd("realtek: "
1368 "Enable default setup for auto mode as fallback\n");
1369 spec->init_amp = ALC_INIT_DEFAULT;
1370 alc_init_auto_hp(codec);
1371 alc_init_auto_mic(codec);
1376 * Fix-up pin default configurations and add default verbs
1385 const struct alc_pincfg *pins;
1386 const struct hda_verb *verbs;
1389 static void alc_pick_fixup(struct hda_codec *codec,
1390 const struct snd_pci_quirk *quirk,
1391 const struct alc_fixup *fix)
1393 const struct alc_pincfg *cfg;
1395 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1399 fix += quirk->value;
1402 for (; cfg->nid; cfg++)
1403 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1406 add_verb(codec->spec, fix->verbs);
1409 static int alc_read_coef_idx(struct hda_codec *codec,
1410 unsigned int coef_idx)
1413 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1415 val = snd_hda_codec_read(codec, 0x20, 0,
1416 AC_VERB_GET_PROC_COEF, 0);
1427 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1428 /* Mic-in jack as mic in */
1429 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1430 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1431 /* Line-in jack as Line in */
1432 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1433 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1434 /* Line-Out as Front */
1435 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1442 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1443 /* Mic-in jack as mic in */
1444 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1445 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1446 /* Line-in jack as Surround */
1447 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1448 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1449 /* Line-Out as Front */
1450 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1457 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1458 /* Mic-in jack as CLFE */
1459 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1460 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1461 /* Line-in jack as Surround */
1462 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1463 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1464 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1465 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1472 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1473 /* Mic-in jack as CLFE */
1474 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1475 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1476 /* Line-in jack as Surround */
1477 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1478 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1479 /* Line-Out as Side */
1480 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1484 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1485 { 2, alc888_4ST_ch2_intel_init },
1486 { 4, alc888_4ST_ch4_intel_init },
1487 { 6, alc888_4ST_ch6_intel_init },
1488 { 8, alc888_4ST_ch8_intel_init },
1492 * ALC888 Fujitsu Siemens Amillo xa3530
1495 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1496 /* Front Mic: set to PIN_IN (empty by default) */
1497 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1498 /* Connect Internal HP to Front */
1499 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1501 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1502 /* Connect Bass HP to Front */
1503 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1504 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1505 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1506 /* Connect Line-Out side jack (SPDIF) to Side */
1507 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1508 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1509 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1510 /* Connect Mic jack to CLFE */
1511 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1512 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1513 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1514 /* Connect Line-in jack to Surround */
1515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1517 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1518 /* Connect HP out jack to Front */
1519 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1520 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1521 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1522 /* Enable unsolicited event for HP jack and Line-out jack */
1523 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1524 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1528 static void alc_automute_amp(struct hda_codec *codec)
1530 struct alc_spec *spec = codec->spec;
1535 spec->jack_present = 0;
1536 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1537 nid = spec->autocfg.hp_pins[i];
1540 if (snd_hda_jack_detect(codec, nid)) {
1541 spec->jack_present = 1;
1546 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1547 /* Toggle internal speakers muting */
1548 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1549 nid = spec->autocfg.speaker_pins[i];
1552 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1553 HDA_AMP_MUTE, mute);
1557 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1560 if (codec->vendor_id == 0x10ec0880)
1564 if (res == ALC880_HP_EVENT)
1565 alc_automute_amp(codec);
1568 static void alc889_automute_setup(struct hda_codec *codec)
1570 struct alc_spec *spec = codec->spec;
1572 spec->autocfg.hp_pins[0] = 0x15;
1573 spec->autocfg.speaker_pins[0] = 0x14;
1574 spec->autocfg.speaker_pins[1] = 0x16;
1575 spec->autocfg.speaker_pins[2] = 0x17;
1576 spec->autocfg.speaker_pins[3] = 0x19;
1577 spec->autocfg.speaker_pins[4] = 0x1a;
1580 static void alc889_intel_init_hook(struct hda_codec *codec)
1582 alc889_coef_init(codec);
1583 alc_automute_amp(codec);
1586 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1588 struct alc_spec *spec = codec->spec;
1590 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1591 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1592 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1593 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1597 * ALC888 Acer Aspire 4930G model
1600 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1601 /* Front Mic: set to PIN_IN (empty by default) */
1602 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1603 /* Unselect Front Mic by default in input mixer 3 */
1604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1605 /* Enable unsolicited event for HP jack */
1606 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1607 /* Connect Internal HP to front */
1608 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1609 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1610 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1611 /* Connect HP out to front */
1612 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1613 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1614 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1619 * ALC888 Acer Aspire 6530G model
1622 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1623 /* Bias voltage on for external mic port */
1624 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1625 /* Front Mic: set to PIN_IN (empty by default) */
1626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1627 /* Unselect Front Mic by default in input mixer 3 */
1628 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1629 /* Enable unsolicited event for HP jack */
1630 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1631 /* Enable speaker output */
1632 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1633 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1634 /* Enable headphone output */
1635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1637 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1642 * ALC889 Acer Aspire 8930G model
1645 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1646 /* Front Mic: set to PIN_IN (empty by default) */
1647 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1648 /* Unselect Front Mic by default in input mixer 3 */
1649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1650 /* Enable unsolicited event for HP jack */
1651 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1652 /* Connect Internal Front to Front */
1653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1656 /* Connect Internal Rear to Rear */
1657 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1658 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1659 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1660 /* Connect Internal CLFE to CLFE */
1661 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1662 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1663 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1664 /* Connect HP out to Front */
1665 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1667 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1668 /* Enable all DACs */
1669 /* DAC DISABLE/MUTE 1? */
1670 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1671 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1672 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1673 /* DAC DISABLE/MUTE 2? */
1674 /* some bit here disables the other DACs. Init=0x4900 */
1675 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1676 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1678 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1679 * which makes the stereo useless. However, either the mic or the ALC889
1680 * makes the signal become a difference/sum signal instead of standard
1681 * stereo, which is annoying. So instead we flip this bit which makes the
1682 * codec replicate the sum signal to both channels, turning it into a
1685 /* DMIC_CONTROL? Init value = 0x0001 */
1686 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1687 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1691 static struct hda_input_mux alc888_2_capture_sources[2] = {
1692 /* Front mic only available on one ADC */
1699 { "Front Mic", 0xb },
1712 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1713 /* Interal mic only available on one ADC */
1720 { "Input Mix", 0xa },
1730 { "Input Mix", 0xa },
1735 static struct hda_input_mux alc889_capture_sources[3] = {
1736 /* Digital mic only available on first "ADC" */
1743 { "Front Mic", 0xb },
1744 { "Input Mix", 0xa },
1753 { "Input Mix", 0xa },
1762 { "Input Mix", 0xa },
1767 static struct snd_kcontrol_new alc888_base_mixer[] = {
1768 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1769 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1770 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1771 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1772 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1774 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1775 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1776 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1777 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1778 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1779 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1780 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1781 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1782 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1783 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1784 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1785 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1789 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1790 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1791 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1793 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1794 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1796 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1797 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1798 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1799 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1800 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1808 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1810 struct alc_spec *spec = codec->spec;
1812 spec->autocfg.hp_pins[0] = 0x15;
1813 spec->autocfg.speaker_pins[0] = 0x14;
1814 spec->autocfg.speaker_pins[1] = 0x16;
1815 spec->autocfg.speaker_pins[2] = 0x17;
1818 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1820 struct alc_spec *spec = codec->spec;
1822 spec->autocfg.hp_pins[0] = 0x15;
1823 spec->autocfg.speaker_pins[0] = 0x14;
1824 spec->autocfg.speaker_pins[1] = 0x16;
1825 spec->autocfg.speaker_pins[2] = 0x17;
1828 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1830 struct alc_spec *spec = codec->spec;
1832 spec->autocfg.hp_pins[0] = 0x15;
1833 spec->autocfg.speaker_pins[0] = 0x14;
1834 spec->autocfg.speaker_pins[1] = 0x16;
1835 spec->autocfg.speaker_pins[2] = 0x1b;
1838 #ifdef CONFIG_SND_HDA_POWER_SAVE
1839 static void alc889_power_eapd(struct hda_codec *codec, int power)
1841 snd_hda_codec_write(codec, 0x14, 0,
1842 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1843 snd_hda_codec_write(codec, 0x15, 0,
1844 AC_VERB_SET_EAPD_BTLENABLE, power ? 2 : 0);
1849 * ALC880 3-stack model
1851 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1852 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1853 * F-Mic = 0x1b, HP = 0x19
1856 static hda_nid_t alc880_dac_nids[4] = {
1857 /* front, rear, clfe, rear_surr */
1858 0x02, 0x05, 0x04, 0x03
1861 static hda_nid_t alc880_adc_nids[3] = {
1866 /* The datasheet says the node 0x07 is connected from inputs,
1867 * but it shows zero connection in the real implementation on some devices.
1868 * Note: this is a 915GAV bug, fixed on 915GLV
1870 static hda_nid_t alc880_adc_nids_alt[2] = {
1875 #define ALC880_DIGOUT_NID 0x06
1876 #define ALC880_DIGIN_NID 0x0a
1878 static struct hda_input_mux alc880_capture_source = {
1882 { "Front Mic", 0x3 },
1888 /* channel source setting (2/6 channel selection for 3-stack) */
1890 static struct hda_verb alc880_threestack_ch2_init[] = {
1891 /* set line-in to input, mute it */
1892 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1893 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1894 /* set mic-in to input vref 80%, mute it */
1895 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1896 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1901 static struct hda_verb alc880_threestack_ch6_init[] = {
1902 /* set line-in to output, unmute it */
1903 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1904 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1905 /* set mic-in to output, unmute it */
1906 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1907 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1911 static struct hda_channel_mode alc880_threestack_modes[2] = {
1912 { 2, alc880_threestack_ch2_init },
1913 { 6, alc880_threestack_ch6_init },
1916 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1917 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1918 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1919 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1920 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1925 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1926 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1928 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1929 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1930 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1931 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1932 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1933 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1935 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1936 .name = "Channel Mode",
1937 .info = alc_ch_mode_info,
1938 .get = alc_ch_mode_get,
1939 .put = alc_ch_mode_put,
1944 /* capture mixer elements */
1945 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1946 struct snd_ctl_elem_info *uinfo)
1948 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1949 struct alc_spec *spec = codec->spec;
1952 mutex_lock(&codec->control_mutex);
1953 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1955 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1956 mutex_unlock(&codec->control_mutex);
1960 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1961 unsigned int size, unsigned int __user *tlv)
1963 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1964 struct alc_spec *spec = codec->spec;
1967 mutex_lock(&codec->control_mutex);
1968 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1970 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1971 mutex_unlock(&codec->control_mutex);
1975 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol);
1978 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1979 struct snd_ctl_elem_value *ucontrol,
1982 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1983 struct alc_spec *spec = codec->spec;
1984 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1987 mutex_lock(&codec->control_mutex);
1988 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1990 err = func(kcontrol, ucontrol);
1991 mutex_unlock(&codec->control_mutex);
1995 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1996 struct snd_ctl_elem_value *ucontrol)
1998 return alc_cap_getput_caller(kcontrol, ucontrol,
1999 snd_hda_mixer_amp_volume_get);
2002 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2003 struct snd_ctl_elem_value *ucontrol)
2005 return alc_cap_getput_caller(kcontrol, ucontrol,
2006 snd_hda_mixer_amp_volume_put);
2009 /* capture mixer elements */
2010 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2012 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2013 struct snd_ctl_elem_value *ucontrol)
2015 return alc_cap_getput_caller(kcontrol, ucontrol,
2016 snd_hda_mixer_amp_switch_get);
2019 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2020 struct snd_ctl_elem_value *ucontrol)
2022 return alc_cap_getput_caller(kcontrol, ucontrol,
2023 snd_hda_mixer_amp_switch_put);
2026 #define _DEFINE_CAPMIX(num) \
2028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2029 .name = "Capture Switch", \
2030 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2032 .info = alc_cap_sw_info, \
2033 .get = alc_cap_sw_get, \
2034 .put = alc_cap_sw_put, \
2037 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2038 .name = "Capture Volume", \
2039 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2040 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2041 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2043 .info = alc_cap_vol_info, \
2044 .get = alc_cap_vol_get, \
2045 .put = alc_cap_vol_put, \
2046 .tlv = { .c = alc_cap_vol_tlv }, \
2049 #define _DEFINE_CAPSRC(num) \
2051 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2052 /* .name = "Capture Source", */ \
2053 .name = "Input Source", \
2055 .info = alc_mux_enum_info, \
2056 .get = alc_mux_enum_get, \
2057 .put = alc_mux_enum_put, \
2060 #define DEFINE_CAPMIX(num) \
2061 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2062 _DEFINE_CAPMIX(num), \
2063 _DEFINE_CAPSRC(num), \
2067 #define DEFINE_CAPMIX_NOSRC(num) \
2068 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2069 _DEFINE_CAPMIX(num), \
2073 /* up to three ADCs */
2077 DEFINE_CAPMIX_NOSRC(1);
2078 DEFINE_CAPMIX_NOSRC(2);
2079 DEFINE_CAPMIX_NOSRC(3);
2082 * ALC880 5-stack model
2084 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2086 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2087 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2090 /* additional mixers to alc880_three_stack_mixer */
2091 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2092 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2093 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2097 /* channel source setting (6/8 channel selection for 5-stack) */
2099 static struct hda_verb alc880_fivestack_ch6_init[] = {
2100 /* set line-in to input, mute it */
2101 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2102 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2107 static struct hda_verb alc880_fivestack_ch8_init[] = {
2108 /* set line-in to output, unmute it */
2109 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2110 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2114 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2115 { 6, alc880_fivestack_ch6_init },
2116 { 8, alc880_fivestack_ch8_init },
2121 * ALC880 6-stack model
2123 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2124 * Side = 0x05 (0x0f)
2125 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2126 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2129 static hda_nid_t alc880_6st_dac_nids[4] = {
2130 /* front, rear, clfe, rear_surr */
2131 0x02, 0x03, 0x04, 0x05
2134 static struct hda_input_mux alc880_6stack_capture_source = {
2138 { "Front Mic", 0x1 },
2144 /* fixed 8-channels */
2145 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2149 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2150 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2151 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2152 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2153 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2154 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2155 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2156 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2157 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2158 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2159 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2160 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2161 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2162 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2163 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2164 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2165 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2166 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2167 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2169 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2170 .name = "Channel Mode",
2171 .info = alc_ch_mode_info,
2172 .get = alc_ch_mode_get,
2173 .put = alc_ch_mode_put,
2182 * W810 has rear IO for:
2185 * Center/LFE (DAC 04)
2188 * The system also has a pair of internal speakers, and a headphone jack.
2189 * These are both connected to Line2 on the codec, hence to DAC 02.
2191 * There is a variable resistor to control the speaker or headphone
2192 * volume. This is a hardware-only device without a software API.
2194 * Plugging headphones in will disable the internal speakers. This is
2195 * implemented in hardware, not via the driver using jack sense. In
2196 * a similar fashion, plugging into the rear socket marked "front" will
2197 * disable both the speakers and headphones.
2199 * For input, there's a microphone jack, and an "audio in" jack.
2200 * These may not do anything useful with this driver yet, because I
2201 * haven't setup any initialization verbs for these yet...
2204 static hda_nid_t alc880_w810_dac_nids[3] = {
2205 /* front, rear/surround, clfe */
2209 /* fixed 6 channels */
2210 static struct hda_channel_mode alc880_w810_modes[1] = {
2214 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2215 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2216 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2217 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2218 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2219 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2220 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2221 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2222 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2223 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2232 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2233 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2237 static hda_nid_t alc880_z71v_dac_nids[1] = {
2240 #define ALC880_Z71V_HP_DAC 0x03
2242 /* fixed 2 channels */
2243 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2247 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2248 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2249 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2250 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2251 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2252 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2253 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2254 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2255 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2261 * ALC880 F1734 model
2263 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2264 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2267 static hda_nid_t alc880_f1734_dac_nids[1] = {
2270 #define ALC880_F1734_HP_DAC 0x02
2272 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2273 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2274 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2275 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2276 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2277 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2278 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2284 static struct hda_input_mux alc880_f1734_capture_source = {
2296 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2297 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2298 * Mic = 0x18, Line = 0x1a
2301 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2302 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2304 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2305 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2306 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2307 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2308 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2309 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2310 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2311 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2312 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2313 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2314 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2315 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2316 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2317 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2320 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2321 .name = "Channel Mode",
2322 .info = alc_ch_mode_info,
2323 .get = alc_ch_mode_get,
2324 .put = alc_ch_mode_put,
2330 * ALC880 ASUS W1V model
2332 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2333 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2334 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2337 /* additional mixers to alc880_asus_mixer */
2338 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2339 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2340 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2345 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2346 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2347 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2349 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2350 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2351 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2352 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2353 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2354 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2359 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2360 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2361 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2362 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2363 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2364 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2365 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2366 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2367 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2368 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2369 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2370 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2371 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2374 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2375 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2377 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2378 .name = "Channel Mode",
2379 .info = alc_ch_mode_info,
2380 .get = alc_ch_mode_get,
2381 .put = alc_ch_mode_put,
2386 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2387 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2388 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2389 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2390 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2391 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2392 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2393 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2394 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2395 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2396 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2400 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2401 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2402 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2404 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2411 * virtual master controls
2415 * slave controls for virtual master
2417 static const char *alc_slave_vols[] = {
2418 "Front Playback Volume",
2419 "Surround Playback Volume",
2420 "Center Playback Volume",
2421 "LFE Playback Volume",
2422 "Side Playback Volume",
2423 "Headphone Playback Volume",
2424 "Speaker Playback Volume",
2425 "Mono Playback Volume",
2426 "Line-Out Playback Volume",
2427 "PCM Playback Volume",
2431 static const char *alc_slave_sws[] = {
2432 "Front Playback Switch",
2433 "Surround Playback Switch",
2434 "Center Playback Switch",
2435 "LFE Playback Switch",
2436 "Side Playback Switch",
2437 "Headphone Playback Switch",
2438 "Speaker Playback Switch",
2439 "Mono Playback Switch",
2440 "IEC958 Playback Switch",
2441 "Line-Out Playback Switch",
2442 "PCM Playback Switch",
2447 * build control elements
2450 #define NID_MAPPING (-1)
2452 #define SUBDEV_SPEAKER_ (0 << 6)
2453 #define SUBDEV_HP_ (1 << 6)
2454 #define SUBDEV_LINE_ (2 << 6)
2455 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2456 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2457 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2459 static void alc_free_kctls(struct hda_codec *codec);
2461 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2462 /* additional beep mixers; the actual parameters are overwritten at build */
2463 static struct snd_kcontrol_new alc_beep_mixer[] = {
2464 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2465 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2470 static int alc_build_controls(struct hda_codec *codec)
2472 struct alc_spec *spec = codec->spec;
2473 struct snd_kcontrol *kctl;
2474 struct snd_kcontrol_new *knew;
2479 for (i = 0; i < spec->num_mixers; i++) {
2480 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2484 if (spec->cap_mixer) {
2485 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2489 if (spec->multiout.dig_out_nid) {
2490 err = snd_hda_create_spdif_out_ctls(codec,
2491 spec->multiout.dig_out_nid);
2494 if (!spec->no_analog) {
2495 err = snd_hda_create_spdif_share_sw(codec,
2499 spec->multiout.share_spdif = 1;
2502 if (spec->dig_in_nid) {
2503 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2508 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2509 /* create beep controls if needed */
2510 if (spec->beep_amp) {
2511 struct snd_kcontrol_new *knew;
2512 for (knew = alc_beep_mixer; knew->name; knew++) {
2513 struct snd_kcontrol *kctl;
2514 kctl = snd_ctl_new1(knew, codec);
2517 kctl->private_value = spec->beep_amp;
2518 err = snd_hda_ctl_add(codec, 0, kctl);
2525 /* if we have no master control, let's create it */
2526 if (!spec->no_analog &&
2527 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2528 unsigned int vmaster_tlv[4];
2529 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2530 HDA_OUTPUT, vmaster_tlv);
2531 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2532 vmaster_tlv, alc_slave_vols);
2536 if (!spec->no_analog &&
2537 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2538 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2539 NULL, alc_slave_sws);
2544 alc_free_kctls(codec); /* no longer needed */
2546 /* assign Capture Source enums to NID */
2547 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2549 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2550 for (i = 0; kctl && i < kctl->count; i++) {
2551 hda_nid_t *nids = spec->capsrc_nids;
2553 nids = spec->adc_nids;
2554 err = snd_hda_add_nids(codec, kctl, i, nids,
2555 spec->input_mux->num_items);
2559 if (spec->cap_mixer) {
2560 const char *kname = kctl ? kctl->id.name : NULL;
2561 for (knew = spec->cap_mixer; knew->name; knew++) {
2562 if (kname && strcmp(knew->name, kname) == 0)
2564 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2565 for (i = 0; kctl && i < kctl->count; i++) {
2566 err = snd_hda_add_nid(codec, kctl, i,
2574 /* other nid->control mapping */
2575 for (i = 0; i < spec->num_mixers; i++) {
2576 for (knew = spec->mixers[i]; knew->name; knew++) {
2577 if (knew->iface != NID_MAPPING)
2579 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2582 u = knew->subdevice;
2583 for (j = 0; j < 4; j++, u >>= 8) {
2588 case SUBDEV_SPEAKER_:
2589 nid = spec->autocfg.speaker_pins[nid];
2592 nid = spec->autocfg.line_out_pins[nid];
2595 nid = spec->autocfg.hp_pins[nid];
2600 err = snd_hda_add_nid(codec, kctl, 0, nid);
2604 u = knew->private_value;
2605 for (j = 0; j < 4; j++, u >>= 8) {
2609 err = snd_hda_add_nid(codec, kctl, 0, nid);
2620 * initialize the codec volumes, etc
2624 * generic initialization of ADC, input mixers and output mixers
2626 static struct hda_verb alc880_volume_init_verbs[] = {
2628 * Unmute ADC0-2 and set the default input to mic-in
2630 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2631 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2632 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2634 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2635 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2637 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2639 * Note: PASD motherboards uses the Line In 2 as the input for front
2642 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2644 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2645 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2646 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2647 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2648 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2649 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2652 * Set up output mixers (0x0c - 0x0f)
2654 /* set vol=0 to output mixers */
2655 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2656 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2657 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2658 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2659 /* set up input amps for analog loopback */
2660 /* Amp Indices: DAC = 0, mixer = 1 */
2661 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2662 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2663 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2664 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2665 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2666 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2667 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2668 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2674 * 3-stack pin configuration:
2675 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2677 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2679 * preset connection lists of input pins
2680 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2682 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2683 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2684 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2687 * Set pin mode and muting
2689 /* set front pin widgets 0x14 for output */
2690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2692 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2693 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2694 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2695 /* Mic2 (as headphone out) for HP output */
2696 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2697 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2698 /* Line In pin widget for input */
2699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2700 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2701 /* Line2 (as front mic) pin widget for input and vref at 80% */
2702 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2703 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2704 /* CD pin widget for input */
2705 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2711 * 5-stack pin configuration:
2712 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2713 * line-in/side = 0x1a, f-mic = 0x1b
2715 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2717 * preset connection lists of input pins
2718 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2720 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2721 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2724 * Set pin mode and muting
2726 /* set pin widgets 0x14-0x17 for output */
2727 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2728 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2729 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2730 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2731 /* unmute pins for output (no gain on this amp) */
2732 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2734 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2735 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2737 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2738 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2739 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2740 /* Mic2 (as headphone out) for HP output */
2741 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2743 /* Line In pin widget for input */
2744 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2746 /* Line2 (as front mic) pin widget for input and vref at 80% */
2747 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2748 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2749 /* CD pin widget for input */
2750 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2756 * W810 pin configuration:
2757 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2759 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2760 /* hphone/speaker input selector: front DAC */
2761 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2763 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2764 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2766 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2767 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2768 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2770 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2771 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2777 * Z71V pin configuration:
2778 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2780 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2786 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2787 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2788 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2789 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2795 * 6-stack pin configuration:
2796 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2797 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2799 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2800 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2802 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2803 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2804 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2805 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2806 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2807 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2808 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2809 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2811 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2812 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2813 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2814 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2815 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2816 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2817 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2818 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2825 * Uniwill pin configuration:
2826 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2829 static struct hda_verb alc880_uniwill_init_verbs[] = {
2830 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2833 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2834 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2835 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2836 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2837 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2838 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2839 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2840 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2841 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2842 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2843 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2844 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2845 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2847 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2848 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2849 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2850 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2851 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2852 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2853 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2854 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2855 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2857 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2858 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2865 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2867 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2868 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2870 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2871 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2873 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2874 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2875 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2876 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2877 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2878 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2879 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2880 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2881 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2884 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2885 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2886 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2887 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2888 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2890 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2891 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2896 static struct hda_verb alc880_beep_init_verbs[] = {
2897 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2901 /* auto-toggle front mic */
2902 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2904 unsigned int present;
2907 present = snd_hda_jack_detect(codec, 0x18);
2908 bits = present ? HDA_AMP_MUTE : 0;
2909 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2912 static void alc880_uniwill_setup(struct hda_codec *codec)
2914 struct alc_spec *spec = codec->spec;
2916 spec->autocfg.hp_pins[0] = 0x14;
2917 spec->autocfg.speaker_pins[0] = 0x15;
2918 spec->autocfg.speaker_pins[0] = 0x16;
2921 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2923 alc_automute_amp(codec);
2924 alc880_uniwill_mic_automute(codec);
2927 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2930 /* Looks like the unsol event is incompatible with the standard
2931 * definition. 4bit tag is placed at 28 bit!
2933 switch (res >> 28) {
2934 case ALC880_MIC_EVENT:
2935 alc880_uniwill_mic_automute(codec);
2938 alc_automute_amp_unsol_event(codec, res);
2943 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2945 struct alc_spec *spec = codec->spec;
2947 spec->autocfg.hp_pins[0] = 0x14;
2948 spec->autocfg.speaker_pins[0] = 0x15;
2951 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2953 unsigned int present;
2955 present = snd_hda_codec_read(codec, 0x21, 0,
2956 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2957 present &= HDA_AMP_VOLMASK;
2958 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2959 HDA_AMP_VOLMASK, present);
2960 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2961 HDA_AMP_VOLMASK, present);
2964 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2967 /* Looks like the unsol event is incompatible with the standard
2968 * definition. 4bit tag is placed at 28 bit!
2970 if ((res >> 28) == ALC880_DCVOL_EVENT)
2971 alc880_uniwill_p53_dcvol_automute(codec);
2973 alc_automute_amp_unsol_event(codec, res);
2977 * F1734 pin configuration:
2978 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2980 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2981 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2982 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2983 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2984 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2985 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2987 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2988 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2992 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2993 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2994 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2995 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2998 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2999 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3000 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3002 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3003 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3009 * ASUS pin configuration:
3010 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3012 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3013 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3014 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3015 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3016 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3018 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3019 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3020 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3021 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3022 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3023 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3024 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3027 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3028 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3029 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3031 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3032 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3033 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3034 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3040 /* Enable GPIO mask and set output */
3041 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3042 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3043 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3045 /* Clevo m520g init */
3046 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3047 /* headphone output */
3048 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3050 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3051 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3053 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3054 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3056 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3057 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3058 /* Mic1 (rear panel) */
3059 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3060 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3061 /* Mic2 (front panel) */
3062 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3063 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3066 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3067 /* change to EAPD mode */
3068 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3069 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3074 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3075 /* change to EAPD mode */
3076 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3077 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3079 /* Headphone output */
3080 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3082 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3083 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3085 /* Line In pin widget for input */
3086 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3087 /* CD pin widget for input */
3088 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3089 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3090 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3092 /* change to EAPD mode */
3093 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3094 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3100 * LG m1 express dual
3103 * Rear Line-In/Out (blue): 0x14
3104 * Build-in Mic-In: 0x15
3106 * HP-Out (green): 0x1b
3107 * Mic-In/Out (red): 0x19
3111 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3112 static hda_nid_t alc880_lg_dac_nids[3] = {
3116 /* seems analog CD is not working */
3117 static struct hda_input_mux alc880_lg_capture_source = {
3122 { "Internal Mic", 0x6 },
3126 /* 2,4,6 channel modes */
3127 static struct hda_verb alc880_lg_ch2_init[] = {
3128 /* set line-in and mic-in to input */
3129 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3130 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3134 static struct hda_verb alc880_lg_ch4_init[] = {
3135 /* set line-in to out and mic-in to input */
3136 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3137 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3141 static struct hda_verb alc880_lg_ch6_init[] = {
3142 /* set line-in and mic-in to output */
3143 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3144 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3148 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3149 { 2, alc880_lg_ch2_init },
3150 { 4, alc880_lg_ch4_init },
3151 { 6, alc880_lg_ch6_init },
3154 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3155 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3156 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3157 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3158 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3159 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3160 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3161 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3162 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3163 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3164 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3165 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3166 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3167 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3168 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3170 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3171 .name = "Channel Mode",
3172 .info = alc_ch_mode_info,
3173 .get = alc_ch_mode_get,
3174 .put = alc_ch_mode_put,
3179 static struct hda_verb alc880_lg_init_verbs[] = {
3180 /* set capture source to mic-in */
3181 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3182 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3183 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3184 /* mute all amp mixer inputs */
3185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3188 /* line-in to input */
3189 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3190 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3192 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3193 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3195 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3196 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3197 /* mic-in to input */
3198 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3199 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3200 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3202 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3203 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3204 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3206 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3210 /* toggle speaker-output according to the hp-jack state */
3211 static void alc880_lg_setup(struct hda_codec *codec)
3213 struct alc_spec *spec = codec->spec;
3215 spec->autocfg.hp_pins[0] = 0x1b;
3216 spec->autocfg.speaker_pins[0] = 0x17;
3225 * Built-in Mic-In: 0x19
3231 static struct hda_input_mux alc880_lg_lw_capture_source = {
3235 { "Internal Mic", 0x1 },
3240 #define alc880_lg_lw_modes alc880_threestack_modes
3242 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3243 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3244 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3245 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3246 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3247 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3248 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3249 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3250 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3255 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3256 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3259 .name = "Channel Mode",
3260 .info = alc_ch_mode_info,
3261 .get = alc_ch_mode_get,
3262 .put = alc_ch_mode_put,
3267 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3268 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3269 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3270 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3272 /* set capture source to mic-in */
3273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3274 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3275 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3276 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3278 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3279 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3281 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3282 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3283 /* mic-in to input */
3284 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3285 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3287 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3288 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3290 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3294 /* toggle speaker-output according to the hp-jack state */
3295 static void alc880_lg_lw_setup(struct hda_codec *codec)
3297 struct alc_spec *spec = codec->spec;
3299 spec->autocfg.hp_pins[0] = 0x1b;
3300 spec->autocfg.speaker_pins[0] = 0x14;
3303 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3304 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3305 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3306 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3308 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3309 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3313 static struct hda_input_mux alc880_medion_rim_capture_source = {
3317 { "Internal Mic", 0x1 },
3321 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3322 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3327 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3328 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3329 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3330 /* Mic2 (as headphone out) for HP output */
3331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3333 /* Internal Speaker */
3334 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3335 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3337 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3338 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3340 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3344 /* toggle speaker-output according to the hp-jack state */
3345 static void alc880_medion_rim_automute(struct hda_codec *codec)
3347 struct alc_spec *spec = codec->spec;
3348 alc_automute_amp(codec);
3350 if (spec->jack_present)
3351 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3353 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3356 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3359 /* Looks like the unsol event is incompatible with the standard
3360 * definition. 4bit tag is placed at 28 bit!
3362 if ((res >> 28) == ALC880_HP_EVENT)
3363 alc880_medion_rim_automute(codec);
3366 static void alc880_medion_rim_setup(struct hda_codec *codec)
3368 struct alc_spec *spec = codec->spec;
3370 spec->autocfg.hp_pins[0] = 0x14;
3371 spec->autocfg.speaker_pins[0] = 0x1b;
3374 #ifdef CONFIG_SND_HDA_POWER_SAVE
3375 static struct hda_amp_list alc880_loopbacks[] = {
3376 { 0x0b, HDA_INPUT, 0 },
3377 { 0x0b, HDA_INPUT, 1 },
3378 { 0x0b, HDA_INPUT, 2 },
3379 { 0x0b, HDA_INPUT, 3 },
3380 { 0x0b, HDA_INPUT, 4 },
3384 static struct hda_amp_list alc880_lg_loopbacks[] = {
3385 { 0x0b, HDA_INPUT, 1 },
3386 { 0x0b, HDA_INPUT, 6 },
3387 { 0x0b, HDA_INPUT, 7 },
3396 static int alc_init(struct hda_codec *codec)
3398 struct alc_spec *spec = codec->spec;
3402 alc_auto_init_amp(codec, spec->init_amp);
3404 for (i = 0; i < spec->num_init_verbs; i++)
3405 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3407 if (spec->init_hook)
3408 spec->init_hook(codec);
3413 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3415 struct alc_spec *spec = codec->spec;
3417 if (spec->unsol_event)
3418 spec->unsol_event(codec, res);
3421 #ifdef CONFIG_SND_HDA_POWER_SAVE
3422 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3424 struct alc_spec *spec = codec->spec;
3425 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3430 * Analog playback callbacks
3432 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3433 struct hda_codec *codec,
3434 struct snd_pcm_substream *substream)
3436 struct alc_spec *spec = codec->spec;
3437 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3441 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3442 struct hda_codec *codec,
3443 unsigned int stream_tag,
3444 unsigned int format,
3445 struct snd_pcm_substream *substream)
3447 struct alc_spec *spec = codec->spec;
3448 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3449 stream_tag, format, substream);
3452 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3453 struct hda_codec *codec,
3454 struct snd_pcm_substream *substream)
3456 struct alc_spec *spec = codec->spec;
3457 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3463 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3464 struct hda_codec *codec,
3465 struct snd_pcm_substream *substream)
3467 struct alc_spec *spec = codec->spec;
3468 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3471 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3472 struct hda_codec *codec,
3473 unsigned int stream_tag,
3474 unsigned int format,
3475 struct snd_pcm_substream *substream)
3477 struct alc_spec *spec = codec->spec;
3478 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3479 stream_tag, format, substream);
3482 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3483 struct hda_codec *codec,
3484 struct snd_pcm_substream *substream)
3486 struct alc_spec *spec = codec->spec;
3487 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3490 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3491 struct hda_codec *codec,
3492 struct snd_pcm_substream *substream)
3494 struct alc_spec *spec = codec->spec;
3495 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3501 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3502 struct hda_codec *codec,
3503 unsigned int stream_tag,
3504 unsigned int format,
3505 struct snd_pcm_substream *substream)
3507 struct alc_spec *spec = codec->spec;
3509 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3510 stream_tag, 0, format);
3514 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3515 struct hda_codec *codec,
3516 struct snd_pcm_substream *substream)
3518 struct alc_spec *spec = codec->spec;
3520 snd_hda_codec_cleanup_stream(codec,
3521 spec->adc_nids[substream->number + 1]);
3528 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3532 /* NID is set in alc_build_pcms */
3534 .open = alc880_playback_pcm_open,
3535 .prepare = alc880_playback_pcm_prepare,
3536 .cleanup = alc880_playback_pcm_cleanup
3540 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3544 /* NID is set in alc_build_pcms */
3547 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3551 /* NID is set in alc_build_pcms */
3554 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3555 .substreams = 2, /* can be overridden */
3558 /* NID is set in alc_build_pcms */
3560 .prepare = alc880_alt_capture_pcm_prepare,
3561 .cleanup = alc880_alt_capture_pcm_cleanup
3565 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3569 /* NID is set in alc_build_pcms */
3571 .open = alc880_dig_playback_pcm_open,
3572 .close = alc880_dig_playback_pcm_close,
3573 .prepare = alc880_dig_playback_pcm_prepare,
3574 .cleanup = alc880_dig_playback_pcm_cleanup
3578 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3582 /* NID is set in alc_build_pcms */
3585 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3586 static struct hda_pcm_stream alc_pcm_null_stream = {
3592 static int alc_build_pcms(struct hda_codec *codec)
3594 struct alc_spec *spec = codec->spec;
3595 struct hda_pcm *info = spec->pcm_rec;
3598 codec->num_pcms = 1;
3599 codec->pcm_info = info;
3601 if (spec->no_analog)
3604 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3605 "%s Analog", codec->chip_name);
3606 info->name = spec->stream_name_analog;
3608 if (spec->stream_analog_playback) {
3609 if (snd_BUG_ON(!spec->multiout.dac_nids))
3611 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3612 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3614 if (spec->stream_analog_capture) {
3615 if (snd_BUG_ON(!spec->adc_nids))
3617 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3618 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3621 if (spec->channel_mode) {
3622 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3623 for (i = 0; i < spec->num_channel_mode; i++) {
3624 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3625 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3631 /* SPDIF for stream index #1 */
3632 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3633 snprintf(spec->stream_name_digital,
3634 sizeof(spec->stream_name_digital),
3635 "%s Digital", codec->chip_name);
3636 codec->num_pcms = 2;
3637 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3638 info = spec->pcm_rec + 1;
3639 info->name = spec->stream_name_digital;
3640 if (spec->dig_out_type)
3641 info->pcm_type = spec->dig_out_type;
3643 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3644 if (spec->multiout.dig_out_nid &&
3645 spec->stream_digital_playback) {
3646 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3647 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3649 if (spec->dig_in_nid &&
3650 spec->stream_digital_capture) {
3651 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3652 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3654 /* FIXME: do we need this for all Realtek codec models? */
3655 codec->spdif_status_reset = 1;
3658 if (spec->no_analog)
3661 /* If the use of more than one ADC is requested for the current
3662 * model, configure a second analog capture-only PCM.
3664 /* Additional Analaog capture for index #2 */
3665 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3666 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3667 codec->num_pcms = 3;
3668 info = spec->pcm_rec + 2;
3669 info->name = spec->stream_name_analog;
3670 if (spec->alt_dac_nid) {
3671 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3672 *spec->stream_analog_alt_playback;
3673 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3676 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3677 alc_pcm_null_stream;
3678 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3680 if (spec->num_adc_nids > 1) {
3681 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3682 *spec->stream_analog_alt_capture;
3683 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3685 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3686 spec->num_adc_nids - 1;
3688 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3689 alc_pcm_null_stream;
3690 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3697 static void alc_free_kctls(struct hda_codec *codec)
3699 struct alc_spec *spec = codec->spec;
3701 if (spec->kctls.list) {
3702 struct snd_kcontrol_new *kctl = spec->kctls.list;
3704 for (i = 0; i < spec->kctls.used; i++)
3705 kfree(kctl[i].name);
3707 snd_array_free(&spec->kctls);
3710 static void alc_free(struct hda_codec *codec)
3712 struct alc_spec *spec = codec->spec;
3717 alc_free_kctls(codec);
3719 snd_hda_detach_beep_device(codec);
3722 #ifdef CONFIG_SND_HDA_POWER_SAVE
3723 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3725 struct alc_spec *spec = codec->spec;
3726 if (spec && spec->power_hook)
3727 spec->power_hook(codec, 0);
3732 #ifdef SND_HDA_NEEDS_RESUME
3733 static int alc_resume(struct hda_codec *codec)
3735 #ifdef CONFIG_SND_HDA_POWER_SAVE
3736 struct alc_spec *spec = codec->spec;
3738 codec->patch_ops.init(codec);
3739 snd_hda_codec_resume_amp(codec);
3740 snd_hda_codec_resume_cache(codec);
3741 #ifdef CONFIG_SND_HDA_POWER_SAVE
3742 if (spec && spec->power_hook)
3743 spec->power_hook(codec, 1);
3751 static struct hda_codec_ops alc_patch_ops = {
3752 .build_controls = alc_build_controls,
3753 .build_pcms = alc_build_pcms,
3756 .unsol_event = alc_unsol_event,
3757 #ifdef SND_HDA_NEEDS_RESUME
3758 .resume = alc_resume,
3760 #ifdef CONFIG_SND_HDA_POWER_SAVE
3761 .suspend = alc_suspend,
3762 .check_power_status = alc_check_power_status,
3768 * Test configuration for debugging
3770 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3773 #ifdef CONFIG_SND_DEBUG
3774 static hda_nid_t alc880_test_dac_nids[4] = {
3775 0x02, 0x03, 0x04, 0x05
3778 static struct hda_input_mux alc880_test_capture_source = {
3787 { "Surround", 0x6 },
3791 static struct hda_channel_mode alc880_test_modes[4] = {
3798 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3799 struct snd_ctl_elem_info *uinfo)
3801 static char *texts[] = {
3802 "N/A", "Line Out", "HP Out",
3803 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3805 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3807 uinfo->value.enumerated.items = 8;
3808 if (uinfo->value.enumerated.item >= 8)
3809 uinfo->value.enumerated.item = 7;
3810 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3814 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3815 struct snd_ctl_elem_value *ucontrol)
3817 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3818 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3819 unsigned int pin_ctl, item = 0;
3821 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3822 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3823 if (pin_ctl & AC_PINCTL_OUT_EN) {
3824 if (pin_ctl & AC_PINCTL_HP_EN)
3828 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3829 switch (pin_ctl & AC_PINCTL_VREFEN) {
3830 case AC_PINCTL_VREF_HIZ: item = 3; break;
3831 case AC_PINCTL_VREF_50: item = 4; break;
3832 case AC_PINCTL_VREF_GRD: item = 5; break;
3833 case AC_PINCTL_VREF_80: item = 6; break;
3834 case AC_PINCTL_VREF_100: item = 7; break;
3837 ucontrol->value.enumerated.item[0] = item;
3841 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3842 struct snd_ctl_elem_value *ucontrol)
3844 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3845 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3846 static unsigned int ctls[] = {
3847 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3848 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3849 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3850 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3851 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3852 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3854 unsigned int old_ctl, new_ctl;
3856 old_ctl = snd_hda_codec_read(codec, nid, 0,
3857 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3858 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3859 if (old_ctl != new_ctl) {
3861 snd_hda_codec_write_cache(codec, nid, 0,
3862 AC_VERB_SET_PIN_WIDGET_CONTROL,
3864 val = ucontrol->value.enumerated.item[0] >= 3 ?
3866 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3873 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3874 struct snd_ctl_elem_info *uinfo)
3876 static char *texts[] = {
3877 "Front", "Surround", "CLFE", "Side"
3879 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3881 uinfo->value.enumerated.items = 4;
3882 if (uinfo->value.enumerated.item >= 4)
3883 uinfo->value.enumerated.item = 3;
3884 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3888 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3889 struct snd_ctl_elem_value *ucontrol)
3891 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3892 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3895 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3896 ucontrol->value.enumerated.item[0] = sel & 3;
3900 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3901 struct snd_ctl_elem_value *ucontrol)
3903 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3904 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3907 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3908 if (ucontrol->value.enumerated.item[0] != sel) {
3909 sel = ucontrol->value.enumerated.item[0] & 3;
3910 snd_hda_codec_write_cache(codec, nid, 0,
3911 AC_VERB_SET_CONNECT_SEL, sel);
3917 #define PIN_CTL_TEST(xname,nid) { \
3918 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3920 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3921 .info = alc_test_pin_ctl_info, \
3922 .get = alc_test_pin_ctl_get, \
3923 .put = alc_test_pin_ctl_put, \
3924 .private_value = nid \
3927 #define PIN_SRC_TEST(xname,nid) { \
3928 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3930 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3931 .info = alc_test_pin_src_info, \
3932 .get = alc_test_pin_src_get, \
3933 .put = alc_test_pin_src_put, \
3934 .private_value = nid \
3937 static struct snd_kcontrol_new alc880_test_mixer[] = {
3938 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3939 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3940 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3941 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3942 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3943 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3944 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3945 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3946 PIN_CTL_TEST("Front Pin Mode", 0x14),
3947 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3948 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3949 PIN_CTL_TEST("Side Pin Mode", 0x17),
3950 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3951 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3952 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3953 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3954 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3955 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3956 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3957 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3958 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3959 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3960 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3961 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3962 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3963 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3964 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3965 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3966 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3967 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3970 .name = "Channel Mode",
3971 .info = alc_ch_mode_info,
3972 .get = alc_ch_mode_get,
3973 .put = alc_ch_mode_put,
3978 static struct hda_verb alc880_test_init_verbs[] = {
3979 /* Unmute inputs of 0x0c - 0x0f */
3980 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3981 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3982 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3983 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3984 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3985 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3986 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3987 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3988 /* Vol output for 0x0c-0x0f */
3989 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3990 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3991 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3993 /* Set output pins 0x14-0x17 */
3994 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3995 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3996 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3997 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3998 /* Unmute output pins 0x14-0x17 */
3999 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4000 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4001 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4002 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4003 /* Set input pins 0x18-0x1c */
4004 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4005 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4006 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4007 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4008 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4009 /* Mute input pins 0x18-0x1b */
4010 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4011 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4012 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4013 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4015 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4016 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4017 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4018 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4019 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4020 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4021 /* Analog input/passthru */
4022 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4023 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4024 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4025 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4026 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4034 static const char *alc880_models[ALC880_MODEL_LAST] = {
4035 [ALC880_3ST] = "3stack",
4036 [ALC880_TCL_S700] = "tcl",
4037 [ALC880_3ST_DIG] = "3stack-digout",
4038 [ALC880_CLEVO] = "clevo",
4039 [ALC880_5ST] = "5stack",
4040 [ALC880_5ST_DIG] = "5stack-digout",
4041 [ALC880_W810] = "w810",
4042 [ALC880_Z71V] = "z71v",
4043 [ALC880_6ST] = "6stack",
4044 [ALC880_6ST_DIG] = "6stack-digout",
4045 [ALC880_ASUS] = "asus",
4046 [ALC880_ASUS_W1V] = "asus-w1v",
4047 [ALC880_ASUS_DIG] = "asus-dig",
4048 [ALC880_ASUS_DIG2] = "asus-dig2",
4049 [ALC880_UNIWILL_DIG] = "uniwill",
4050 [ALC880_UNIWILL_P53] = "uniwill-p53",
4051 [ALC880_FUJITSU] = "fujitsu",
4052 [ALC880_F1734] = "F1734",
4054 [ALC880_LG_LW] = "lg-lw",
4055 [ALC880_MEDION_RIM] = "medion",
4056 #ifdef CONFIG_SND_DEBUG
4057 [ALC880_TEST] = "test",
4059 [ALC880_AUTO] = "auto",
4062 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4063 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4064 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4065 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4066 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4067 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4068 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4069 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4070 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4071 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4072 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4073 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4074 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4075 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4076 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4077 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4078 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4079 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4080 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4081 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4082 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4086 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4087 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4088 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4089 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4090 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4091 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4092 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4093 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4094 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4095 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4096 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4097 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4098 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4099 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4100 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4101 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4102 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4103 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4104 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4105 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4106 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4107 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4108 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4109 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4110 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4111 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4112 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4113 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4114 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4115 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4116 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4117 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4118 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4119 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4120 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4121 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4122 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4123 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4124 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4125 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4126 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4127 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4128 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4130 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4132 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4133 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4139 * ALC880 codec presets
4141 static struct alc_config_preset alc880_presets[] = {
4143 .mixers = { alc880_three_stack_mixer },
4144 .init_verbs = { alc880_volume_init_verbs,
4145 alc880_pin_3stack_init_verbs },
4146 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4147 .dac_nids = alc880_dac_nids,
4148 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4149 .channel_mode = alc880_threestack_modes,
4151 .input_mux = &alc880_capture_source,
4153 [ALC880_3ST_DIG] = {
4154 .mixers = { alc880_three_stack_mixer },
4155 .init_verbs = { alc880_volume_init_verbs,
4156 alc880_pin_3stack_init_verbs },
4157 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4158 .dac_nids = alc880_dac_nids,
4159 .dig_out_nid = ALC880_DIGOUT_NID,
4160 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4161 .channel_mode = alc880_threestack_modes,
4163 .input_mux = &alc880_capture_source,
4165 [ALC880_TCL_S700] = {
4166 .mixers = { alc880_tcl_s700_mixer },
4167 .init_verbs = { alc880_volume_init_verbs,
4168 alc880_pin_tcl_S700_init_verbs,
4169 alc880_gpio2_init_verbs },
4170 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4171 .dac_nids = alc880_dac_nids,
4172 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4173 .num_adc_nids = 1, /* single ADC */
4175 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4176 .channel_mode = alc880_2_jack_modes,
4177 .input_mux = &alc880_capture_source,
4180 .mixers = { alc880_three_stack_mixer,
4181 alc880_five_stack_mixer},
4182 .init_verbs = { alc880_volume_init_verbs,
4183 alc880_pin_5stack_init_verbs },
4184 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4185 .dac_nids = alc880_dac_nids,
4186 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4187 .channel_mode = alc880_fivestack_modes,
4188 .input_mux = &alc880_capture_source,
4190 [ALC880_5ST_DIG] = {
4191 .mixers = { alc880_three_stack_mixer,
4192 alc880_five_stack_mixer },
4193 .init_verbs = { alc880_volume_init_verbs,
4194 alc880_pin_5stack_init_verbs },
4195 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4196 .dac_nids = alc880_dac_nids,
4197 .dig_out_nid = ALC880_DIGOUT_NID,
4198 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4199 .channel_mode = alc880_fivestack_modes,
4200 .input_mux = &alc880_capture_source,
4203 .mixers = { alc880_six_stack_mixer },
4204 .init_verbs = { alc880_volume_init_verbs,
4205 alc880_pin_6stack_init_verbs },
4206 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4207 .dac_nids = alc880_6st_dac_nids,
4208 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4209 .channel_mode = alc880_sixstack_modes,
4210 .input_mux = &alc880_6stack_capture_source,
4212 [ALC880_6ST_DIG] = {
4213 .mixers = { alc880_six_stack_mixer },
4214 .init_verbs = { alc880_volume_init_verbs,
4215 alc880_pin_6stack_init_verbs },
4216 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4217 .dac_nids = alc880_6st_dac_nids,
4218 .dig_out_nid = ALC880_DIGOUT_NID,
4219 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4220 .channel_mode = alc880_sixstack_modes,
4221 .input_mux = &alc880_6stack_capture_source,
4224 .mixers = { alc880_w810_base_mixer },
4225 .init_verbs = { alc880_volume_init_verbs,
4226 alc880_pin_w810_init_verbs,
4227 alc880_gpio2_init_verbs },
4228 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4229 .dac_nids = alc880_w810_dac_nids,
4230 .dig_out_nid = ALC880_DIGOUT_NID,
4231 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4232 .channel_mode = alc880_w810_modes,
4233 .input_mux = &alc880_capture_source,
4236 .mixers = { alc880_z71v_mixer },
4237 .init_verbs = { alc880_volume_init_verbs,
4238 alc880_pin_z71v_init_verbs },
4239 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4240 .dac_nids = alc880_z71v_dac_nids,
4241 .dig_out_nid = ALC880_DIGOUT_NID,
4243 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4244 .channel_mode = alc880_2_jack_modes,
4245 .input_mux = &alc880_capture_source,
4248 .mixers = { alc880_f1734_mixer },
4249 .init_verbs = { alc880_volume_init_verbs,
4250 alc880_pin_f1734_init_verbs },
4251 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4252 .dac_nids = alc880_f1734_dac_nids,
4254 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4255 .channel_mode = alc880_2_jack_modes,
4256 .input_mux = &alc880_f1734_capture_source,
4257 .unsol_event = alc880_uniwill_p53_unsol_event,
4258 .setup = alc880_uniwill_p53_setup,
4259 .init_hook = alc_automute_amp,
4262 .mixers = { alc880_asus_mixer },
4263 .init_verbs = { alc880_volume_init_verbs,
4264 alc880_pin_asus_init_verbs,
4265 alc880_gpio1_init_verbs },
4266 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4267 .dac_nids = alc880_asus_dac_nids,
4268 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4269 .channel_mode = alc880_asus_modes,
4271 .input_mux = &alc880_capture_source,
4273 [ALC880_ASUS_DIG] = {
4274 .mixers = { alc880_asus_mixer },
4275 .init_verbs = { alc880_volume_init_verbs,
4276 alc880_pin_asus_init_verbs,
4277 alc880_gpio1_init_verbs },
4278 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4279 .dac_nids = alc880_asus_dac_nids,
4280 .dig_out_nid = ALC880_DIGOUT_NID,
4281 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4282 .channel_mode = alc880_asus_modes,
4284 .input_mux = &alc880_capture_source,
4286 [ALC880_ASUS_DIG2] = {
4287 .mixers = { alc880_asus_mixer },
4288 .init_verbs = { alc880_volume_init_verbs,
4289 alc880_pin_asus_init_verbs,
4290 alc880_gpio2_init_verbs }, /* use GPIO2 */
4291 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4292 .dac_nids = alc880_asus_dac_nids,
4293 .dig_out_nid = ALC880_DIGOUT_NID,
4294 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4295 .channel_mode = alc880_asus_modes,
4297 .input_mux = &alc880_capture_source,
4299 [ALC880_ASUS_W1V] = {
4300 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4301 .init_verbs = { alc880_volume_init_verbs,
4302 alc880_pin_asus_init_verbs,
4303 alc880_gpio1_init_verbs },
4304 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4305 .dac_nids = alc880_asus_dac_nids,
4306 .dig_out_nid = ALC880_DIGOUT_NID,
4307 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4308 .channel_mode = alc880_asus_modes,
4310 .input_mux = &alc880_capture_source,
4312 [ALC880_UNIWILL_DIG] = {
4313 .mixers = { alc880_asus_mixer },
4314 .init_verbs = { alc880_volume_init_verbs,
4315 alc880_pin_asus_init_verbs },
4316 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4317 .dac_nids = alc880_asus_dac_nids,
4318 .dig_out_nid = ALC880_DIGOUT_NID,
4319 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4320 .channel_mode = alc880_asus_modes,
4322 .input_mux = &alc880_capture_source,
4324 [ALC880_UNIWILL] = {
4325 .mixers = { alc880_uniwill_mixer },
4326 .init_verbs = { alc880_volume_init_verbs,
4327 alc880_uniwill_init_verbs },
4328 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4329 .dac_nids = alc880_asus_dac_nids,
4330 .dig_out_nid = ALC880_DIGOUT_NID,
4331 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4332 .channel_mode = alc880_threestack_modes,
4334 .input_mux = &alc880_capture_source,
4335 .unsol_event = alc880_uniwill_unsol_event,
4336 .setup = alc880_uniwill_setup,
4337 .init_hook = alc880_uniwill_init_hook,
4339 [ALC880_UNIWILL_P53] = {
4340 .mixers = { alc880_uniwill_p53_mixer },
4341 .init_verbs = { alc880_volume_init_verbs,
4342 alc880_uniwill_p53_init_verbs },
4343 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4344 .dac_nids = alc880_asus_dac_nids,
4345 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4346 .channel_mode = alc880_threestack_modes,
4347 .input_mux = &alc880_capture_source,
4348 .unsol_event = alc880_uniwill_p53_unsol_event,
4349 .setup = alc880_uniwill_p53_setup,
4350 .init_hook = alc_automute_amp,
4352 [ALC880_FUJITSU] = {
4353 .mixers = { alc880_fujitsu_mixer },
4354 .init_verbs = { alc880_volume_init_verbs,
4355 alc880_uniwill_p53_init_verbs,
4356 alc880_beep_init_verbs },
4357 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4358 .dac_nids = alc880_dac_nids,
4359 .dig_out_nid = ALC880_DIGOUT_NID,
4360 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4361 .channel_mode = alc880_2_jack_modes,
4362 .input_mux = &alc880_capture_source,
4363 .unsol_event = alc880_uniwill_p53_unsol_event,
4364 .setup = alc880_uniwill_p53_setup,
4365 .init_hook = alc_automute_amp,
4368 .mixers = { alc880_three_stack_mixer },
4369 .init_verbs = { alc880_volume_init_verbs,
4370 alc880_pin_clevo_init_verbs },
4371 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4372 .dac_nids = alc880_dac_nids,
4374 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4375 .channel_mode = alc880_threestack_modes,
4377 .input_mux = &alc880_capture_source,
4380 .mixers = { alc880_lg_mixer },
4381 .init_verbs = { alc880_volume_init_verbs,
4382 alc880_lg_init_verbs },
4383 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4384 .dac_nids = alc880_lg_dac_nids,
4385 .dig_out_nid = ALC880_DIGOUT_NID,
4386 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4387 .channel_mode = alc880_lg_ch_modes,
4389 .input_mux = &alc880_lg_capture_source,
4390 .unsol_event = alc_automute_amp_unsol_event,
4391 .setup = alc880_lg_setup,
4392 .init_hook = alc_automute_amp,
4393 #ifdef CONFIG_SND_HDA_POWER_SAVE
4394 .loopbacks = alc880_lg_loopbacks,
4398 .mixers = { alc880_lg_lw_mixer },
4399 .init_verbs = { alc880_volume_init_verbs,
4400 alc880_lg_lw_init_verbs },
4401 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4402 .dac_nids = alc880_dac_nids,
4403 .dig_out_nid = ALC880_DIGOUT_NID,
4404 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4405 .channel_mode = alc880_lg_lw_modes,
4406 .input_mux = &alc880_lg_lw_capture_source,
4407 .unsol_event = alc_automute_amp_unsol_event,
4408 .setup = alc880_lg_lw_setup,
4409 .init_hook = alc_automute_amp,
4411 [ALC880_MEDION_RIM] = {
4412 .mixers = { alc880_medion_rim_mixer },
4413 .init_verbs = { alc880_volume_init_verbs,
4414 alc880_medion_rim_init_verbs,
4415 alc_gpio2_init_verbs },
4416 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4417 .dac_nids = alc880_dac_nids,
4418 .dig_out_nid = ALC880_DIGOUT_NID,
4419 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4420 .channel_mode = alc880_2_jack_modes,
4421 .input_mux = &alc880_medion_rim_capture_source,
4422 .unsol_event = alc880_medion_rim_unsol_event,
4423 .setup = alc880_medion_rim_setup,
4424 .init_hook = alc880_medion_rim_automute,
4426 #ifdef CONFIG_SND_DEBUG
4428 .mixers = { alc880_test_mixer },
4429 .init_verbs = { alc880_test_init_verbs },
4430 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4431 .dac_nids = alc880_test_dac_nids,
4432 .dig_out_nid = ALC880_DIGOUT_NID,
4433 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4434 .channel_mode = alc880_test_modes,
4435 .input_mux = &alc880_test_capture_source,
4441 * Automatic parse of I/O pins from the BIOS configuration
4446 ALC_CTL_WIDGET_MUTE,
4449 static struct snd_kcontrol_new alc880_control_templates[] = {
4450 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4451 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4452 HDA_BIND_MUTE(NULL, 0, 0, 0),
4455 /* add dynamic controls */
4456 static int add_control(struct alc_spec *spec, int type, const char *name,
4459 struct snd_kcontrol_new *knew;
4461 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4462 knew = snd_array_new(&spec->kctls);
4465 *knew = alc880_control_templates[type];
4466 knew->name = kstrdup(name, GFP_KERNEL);
4469 if (get_amp_nid_(val))
4470 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4471 knew->private_value = val;
4475 static int add_control_with_pfx(struct alc_spec *spec, int type,
4476 const char *pfx, const char *dir,
4477 const char *sfx, unsigned long val)
4480 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4481 return add_control(spec, type, name, val);
4484 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4485 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4486 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4487 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4489 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4490 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4491 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4492 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4493 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4494 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4495 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4496 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4497 #define ALC880_PIN_CD_NID 0x1c
4499 /* fill in the dac_nids table from the parsed pin configuration */
4500 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4501 const struct auto_pin_cfg *cfg)
4507 memset(assigned, 0, sizeof(assigned));
4508 spec->multiout.dac_nids = spec->private_dac_nids;
4510 /* check the pins hardwired to audio widget */
4511 for (i = 0; i < cfg->line_outs; i++) {
4512 nid = cfg->line_out_pins[i];
4513 if (alc880_is_fixed_pin(nid)) {
4514 int idx = alc880_fixed_pin_idx(nid);
4515 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4519 /* left pins can be connect to any audio widget */
4520 for (i = 0; i < cfg->line_outs; i++) {
4521 nid = cfg->line_out_pins[i];
4522 if (alc880_is_fixed_pin(nid))
4524 /* search for an empty channel */
4525 for (j = 0; j < cfg->line_outs; j++) {
4527 spec->multiout.dac_nids[i] =
4528 alc880_idx_to_dac(j);
4534 spec->multiout.num_dacs = cfg->line_outs;
4538 /* add playback controls from the parsed DAC table */
4539 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4540 const struct auto_pin_cfg *cfg)
4542 static const char *chname[4] = {
4543 "Front", "Surround", NULL /*CLFE*/, "Side"
4548 for (i = 0; i < cfg->line_outs; i++) {
4549 if (!spec->multiout.dac_nids[i])
4551 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4554 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4556 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4560 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4562 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4566 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4568 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4572 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4574 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4580 if (cfg->line_outs == 1 &&
4581 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4585 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4586 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4590 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4591 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4600 /* add playback controls for speaker and HP outputs */
4601 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4610 if (alc880_is_fixed_pin(pin)) {
4611 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4612 /* specify the DAC as the extra output */
4613 if (!spec->multiout.hp_nid)
4614 spec->multiout.hp_nid = nid;
4616 spec->multiout.extra_out_nid[0] = nid;
4617 /* control HP volume/switch on the output mixer amp */
4618 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4619 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4620 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4623 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4624 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4627 } else if (alc880_is_multi_pin(pin)) {
4628 /* set manual connection */
4629 /* we have only a switch on HP-out PIN */
4630 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4631 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4638 /* create input playback/capture controls for the given pin */
4639 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4640 const char *ctlname,
4641 int idx, hda_nid_t mix_nid)
4645 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4646 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4649 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4650 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4656 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4658 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4659 return (pincap & AC_PINCAP_IN) != 0;
4662 /* create playback/capture controls for input pins */
4663 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4664 const struct auto_pin_cfg *cfg,
4666 hda_nid_t cap1, hda_nid_t cap2)
4668 struct alc_spec *spec = codec->spec;
4669 struct hda_input_mux *imux = &spec->private_imux[0];
4672 for (i = 0; i < AUTO_PIN_LAST; i++) {
4675 pin = cfg->input_pins[i];
4676 if (!alc_is_input_pin(codec, pin))
4680 idx = get_connection_index(codec, mixer, pin);
4682 err = new_analog_input(spec, pin,
4683 auto_pin_cfg_labels[i],
4692 idx = get_connection_index(codec, cap1, pin);
4693 if (idx < 0 && cap2)
4694 idx = get_connection_index(codec, cap2, pin);
4696 imux->items[imux->num_items].label =
4697 auto_pin_cfg_labels[i];
4698 imux->items[imux->num_items].index = idx;
4705 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4706 const struct auto_pin_cfg *cfg)
4708 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4711 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4712 unsigned int pin_type)
4714 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4717 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4721 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4722 hda_nid_t nid, int pin_type,
4725 alc_set_pin_output(codec, nid, pin_type);
4726 /* need the manual connection? */
4727 if (alc880_is_multi_pin(nid)) {
4728 struct alc_spec *spec = codec->spec;
4729 int idx = alc880_multi_pin_idx(nid);
4730 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4731 AC_VERB_SET_CONNECT_SEL,
4732 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4736 static int get_pin_type(int line_out_type)
4738 if (line_out_type == AUTO_PIN_HP_OUT)
4744 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4746 struct alc_spec *spec = codec->spec;
4749 for (i = 0; i < spec->autocfg.line_outs; i++) {
4750 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4751 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4752 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4756 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4758 struct alc_spec *spec = codec->spec;
4761 pin = spec->autocfg.speaker_pins[0];
4762 if (pin) /* connect to front */
4763 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4764 pin = spec->autocfg.hp_pins[0];
4765 if (pin) /* connect to front */
4766 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4769 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4771 struct alc_spec *spec = codec->spec;
4774 for (i = 0; i < AUTO_PIN_LAST; i++) {
4775 hda_nid_t nid = spec->autocfg.input_pins[i];
4776 if (alc_is_input_pin(codec, nid)) {
4777 alc_set_input_pin(codec, nid, i);
4778 if (nid != ALC880_PIN_CD_NID &&
4779 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4780 snd_hda_codec_write(codec, nid, 0,
4781 AC_VERB_SET_AMP_GAIN_MUTE,
4787 /* parse the BIOS configuration and set up the alc_spec */
4788 /* return 1 if successful, 0 if the proper config is not found,
4789 * or a negative error code
4791 static int alc880_parse_auto_config(struct hda_codec *codec)
4793 struct alc_spec *spec = codec->spec;
4795 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4797 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4801 if (!spec->autocfg.line_outs)
4802 return 0; /* can't find valid BIOS pin config */
4804 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4807 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4810 err = alc880_auto_create_extra_out(spec,
4811 spec->autocfg.speaker_pins[0],
4815 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4819 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4823 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4825 /* check multiple SPDIF-out (for recent codecs) */
4826 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4828 err = snd_hda_get_connections(codec,
4829 spec->autocfg.dig_out_pins[i],
4834 spec->multiout.dig_out_nid = dig_nid;
4836 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4837 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4839 spec->slave_dig_outs[i - 1] = dig_nid;
4842 if (spec->autocfg.dig_in_pin)
4843 spec->dig_in_nid = ALC880_DIGIN_NID;
4845 if (spec->kctls.list)
4846 add_mixer(spec, spec->kctls.list);
4848 add_verb(spec, alc880_volume_init_verbs);
4850 spec->num_mux_defs = 1;
4851 spec->input_mux = &spec->private_imux[0];
4853 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4858 /* additional initialization for auto-configuration model */
4859 static void alc880_auto_init(struct hda_codec *codec)
4861 struct alc_spec *spec = codec->spec;
4862 alc880_auto_init_multi_out(codec);
4863 alc880_auto_init_extra_out(codec);
4864 alc880_auto_init_analog_input(codec);
4865 if (spec->unsol_event)
4866 alc_inithook(codec);
4869 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4870 * one of two digital mic pins, e.g. on ALC272
4872 static void fixup_automic_adc(struct hda_codec *codec)
4874 struct alc_spec *spec = codec->spec;
4877 for (i = 0; i < spec->num_adc_nids; i++) {
4878 hda_nid_t cap = spec->capsrc_nids ?
4879 spec->capsrc_nids[i] : spec->adc_nids[i];
4882 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4885 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4888 spec->int_mic.mux_idx = iidx;
4889 spec->ext_mic.mux_idx = eidx;
4890 if (spec->capsrc_nids)
4891 spec->capsrc_nids += i;
4892 spec->adc_nids += i;
4893 spec->num_adc_nids = 1;
4896 snd_printd(KERN_INFO "hda_codec: %s: "
4897 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4898 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4899 spec->auto_mic = 0; /* disable auto-mic to be sure */
4902 static void set_capture_mixer(struct hda_codec *codec)
4904 struct alc_spec *spec = codec->spec;
4905 static struct snd_kcontrol_new *caps[2][3] = {
4906 { alc_capture_mixer_nosrc1,
4907 alc_capture_mixer_nosrc2,
4908 alc_capture_mixer_nosrc3 },
4909 { alc_capture_mixer1,
4911 alc_capture_mixer3 },
4913 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4915 if (spec->auto_mic) {
4917 fixup_automic_adc(codec);
4918 } else if (spec->input_mux && spec->input_mux->num_items > 1)
4922 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4926 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4927 #define set_beep_amp(spec, nid, idx, dir) \
4928 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4930 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4934 * OK, here we have finally the patch for ALC880
4937 static int patch_alc880(struct hda_codec *codec)
4939 struct alc_spec *spec;
4943 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4949 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
4952 if (board_config < 0) {
4953 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4955 board_config = ALC880_AUTO;
4958 if (board_config == ALC880_AUTO) {
4959 /* automatic parse from the BIOS config */
4960 err = alc880_parse_auto_config(codec);
4966 "hda_codec: Cannot set up configuration "
4967 "from BIOS. Using 3-stack mode...\n");
4968 board_config = ALC880_3ST;
4972 err = snd_hda_attach_beep_device(codec, 0x1);
4978 if (board_config != ALC880_AUTO)
4979 setup_preset(codec, &alc880_presets[board_config]);
4981 spec->stream_analog_playback = &alc880_pcm_analog_playback;
4982 spec->stream_analog_capture = &alc880_pcm_analog_capture;
4983 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
4985 spec->stream_digital_playback = &alc880_pcm_digital_playback;
4986 spec->stream_digital_capture = &alc880_pcm_digital_capture;
4988 if (!spec->adc_nids && spec->input_mux) {
4989 /* check whether NID 0x07 is valid */
4990 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
4992 wcap = get_wcaps_type(wcap);
4993 if (wcap != AC_WID_AUD_IN) {
4994 spec->adc_nids = alc880_adc_nids_alt;
4995 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
4997 spec->adc_nids = alc880_adc_nids;
4998 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5001 set_capture_mixer(codec);
5002 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5004 spec->vmaster_nid = 0x0c;
5006 codec->patch_ops = alc_patch_ops;
5007 if (board_config == ALC880_AUTO)
5008 spec->init_hook = alc880_auto_init;
5009 #ifdef CONFIG_SND_HDA_POWER_SAVE
5010 if (!spec->loopback.amplist)
5011 spec->loopback.amplist = alc880_loopbacks;
5013 codec->proc_widget_hook = print_realtek_coef;
5023 static hda_nid_t alc260_dac_nids[1] = {
5028 static hda_nid_t alc260_adc_nids[1] = {
5033 static hda_nid_t alc260_adc_nids_alt[1] = {
5038 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5039 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5041 static hda_nid_t alc260_dual_adc_nids[2] = {
5046 #define ALC260_DIGOUT_NID 0x03
5047 #define ALC260_DIGIN_NID 0x06
5049 static struct hda_input_mux alc260_capture_source = {
5053 { "Front Mic", 0x1 },
5059 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5060 * headphone jack and the internal CD lines since these are the only pins at
5061 * which audio can appear. For flexibility, also allow the option of
5062 * recording the mixer output on the second ADC (ADC0 doesn't have a
5063 * connection to the mixer output).
5065 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5069 { "Mic/Line", 0x0 },
5071 { "Headphone", 0x2 },
5077 { "Mic/Line", 0x0 },
5079 { "Headphone", 0x2 },
5086 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5087 * the Fujitsu S702x, but jacks are marked differently.
5089 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5096 { "Headphone", 0x5 },
5105 { "Headphone", 0x6 },
5111 /* Maxdata Favorit 100XS */
5112 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5116 { "Line/Mic", 0x0 },
5123 { "Line/Mic", 0x0 },
5131 * This is just place-holder, so there's something for alc_build_pcms to look
5132 * at when it calculates the maximum number of channels. ALC260 has no mixer
5133 * element which allows changing the channel mode, so the verb list is
5136 static struct hda_channel_mode alc260_modes[1] = {
5141 /* Mixer combinations
5143 * basic: base_output + input + pc_beep + capture
5144 * HP: base_output + input + capture_alt
5145 * HP_3013: hp_3013 + input + capture
5146 * fujitsu: fujitsu + capture
5147 * acer: acer + capture
5150 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5151 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5152 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5153 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5154 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5155 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5156 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5160 static struct snd_kcontrol_new alc260_input_mixer[] = {
5161 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5162 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5163 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5164 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5166 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5167 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5168 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5172 /* update HP, line and mono out pins according to the master switch */
5173 static void alc260_hp_master_update(struct hda_codec *codec,
5174 hda_nid_t hp, hda_nid_t line,
5177 struct alc_spec *spec = codec->spec;
5178 unsigned int val = spec->master_sw ? PIN_HP : 0;
5179 /* change HP and line-out pins */
5180 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5182 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5184 /* mono (speaker) depending on the HP jack sense */
5185 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5186 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5190 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5191 struct snd_ctl_elem_value *ucontrol)
5193 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5194 struct alc_spec *spec = codec->spec;
5195 *ucontrol->value.integer.value = spec->master_sw;
5199 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5200 struct snd_ctl_elem_value *ucontrol)
5202 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5203 struct alc_spec *spec = codec->spec;
5204 int val = !!*ucontrol->value.integer.value;
5205 hda_nid_t hp, line, mono;
5207 if (val == spec->master_sw)
5209 spec->master_sw = val;
5210 hp = (kcontrol->private_value >> 16) & 0xff;
5211 line = (kcontrol->private_value >> 8) & 0xff;
5212 mono = kcontrol->private_value & 0xff;
5213 alc260_hp_master_update(codec, hp, line, mono);
5217 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5219 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5220 .name = "Master Playback Switch",
5221 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5222 .info = snd_ctl_boolean_mono_info,
5223 .get = alc260_hp_master_sw_get,
5224 .put = alc260_hp_master_sw_put,
5225 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5227 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5228 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5229 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5230 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5231 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5233 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5237 static struct hda_verb alc260_hp_unsol_verbs[] = {
5238 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5242 static void alc260_hp_automute(struct hda_codec *codec)
5244 struct alc_spec *spec = codec->spec;
5246 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5247 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5250 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5252 if ((res >> 26) == ALC880_HP_EVENT)
5253 alc260_hp_automute(codec);
5256 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5258 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5259 .name = "Master Playback Switch",
5260 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5261 .info = snd_ctl_boolean_mono_info,
5262 .get = alc260_hp_master_sw_get,
5263 .put = alc260_hp_master_sw_put,
5264 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5266 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5267 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5268 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5269 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5270 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5271 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5272 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5273 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5277 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5278 .ops = &snd_hda_bind_vol,
5280 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5281 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5282 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5287 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5288 .ops = &snd_hda_bind_sw,
5290 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5291 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5296 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5297 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5298 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5299 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5300 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5304 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5305 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5309 static void alc260_hp_3013_automute(struct hda_codec *codec)
5311 struct alc_spec *spec = codec->spec;
5313 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5314 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5317 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5320 if ((res >> 26) == ALC880_HP_EVENT)
5321 alc260_hp_3013_automute(codec);
5324 static void alc260_hp_3012_automute(struct hda_codec *codec)
5326 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5328 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5330 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5332 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5336 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5339 if ((res >> 26) == ALC880_HP_EVENT)
5340 alc260_hp_3012_automute(codec);
5343 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5344 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5346 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5347 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5348 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5349 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5350 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5351 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5352 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5353 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5354 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5355 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5356 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5360 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5361 * versions of the ALC260 don't act on requests to enable mic bias from NID
5362 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5363 * datasheet doesn't mention this restriction. At this stage it's not clear
5364 * whether this behaviour is intentional or is a hardware bug in chip
5365 * revisions available in early 2006. Therefore for now allow the
5366 * "Headphone Jack Mode" control to span all choices, but if it turns out
5367 * that the lack of mic bias for this NID is intentional we could change the
5368 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5370 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5371 * don't appear to make the mic bias available from the "line" jack, even
5372 * though the NID used for this jack (0x14) can supply it. The theory is
5373 * that perhaps Acer have included blocking capacitors between the ALC260
5374 * and the output jack. If this turns out to be the case for all such
5375 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5376 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5378 * The C20x Tablet series have a mono internal speaker which is controlled
5379 * via the chip's Mono sum widget and pin complex, so include the necessary
5380 * controls for such models. On models without a "mono speaker" the control
5381 * won't do anything.
5383 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5384 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5385 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5386 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5387 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5389 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5391 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5392 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5393 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5394 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5395 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5396 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5397 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5398 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5402 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5404 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5405 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5406 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5407 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5408 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5409 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5410 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5414 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5415 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5417 static struct snd_kcontrol_new alc260_will_mixer[] = {
5418 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5419 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5421 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5422 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5423 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5424 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5425 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5426 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5427 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5431 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5432 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5434 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5435 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5436 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5437 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5438 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5439 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5440 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5441 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5442 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5443 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5444 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5449 * initialization verbs
5451 static struct hda_verb alc260_init_verbs[] = {
5452 /* Line In pin widget for input */
5453 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5454 /* CD pin widget for input */
5455 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5456 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5457 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5458 /* Mic2 (front panel) pin widget for input and vref at 80% */
5459 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5460 /* LINE-2 is used for line-out in rear */
5461 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5462 /* select line-out */
5463 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5465 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5467 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5469 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5470 /* mute capture amp left and right */
5471 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5472 /* set connection select to line in (default select for this ADC) */
5473 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5474 /* mute capture amp left and right */
5475 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5476 /* set connection select to line in (default select for this ADC) */
5477 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5478 /* set vol=0 Line-Out mixer amp left and right */
5479 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5480 /* unmute pin widget amp left and right (no gain on this amp) */
5481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5482 /* set vol=0 HP mixer amp left and right */
5483 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5484 /* unmute pin widget amp left and right (no gain on this amp) */
5485 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5486 /* set vol=0 Mono mixer amp left and right */
5487 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5488 /* unmute pin widget amp left and right (no gain on this amp) */
5489 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5490 /* unmute LINE-2 out pin */
5491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5492 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5495 /* mute analog inputs */
5496 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5498 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5499 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5500 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5501 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5502 /* mute Front out path */
5503 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5504 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5505 /* mute Headphone out path */
5506 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5507 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5508 /* mute Mono out path */
5509 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5510 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5514 #if 0 /* should be identical with alc260_init_verbs? */
5515 static struct hda_verb alc260_hp_init_verbs[] = {
5516 /* Headphone and output */
5517 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5519 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5520 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5521 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5522 /* Mic2 (front panel) pin widget for input and vref at 80% */
5523 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5524 /* Line In pin widget for input */
5525 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5526 /* Line-2 pin widget for output */
5527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5528 /* CD pin widget for input */
5529 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5530 /* unmute amp left and right */
5531 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5532 /* set connection select to line in (default select for this ADC) */
5533 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5534 /* unmute Line-Out mixer amp left and right (volume = 0) */
5535 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5536 /* mute pin widget amp left and right (no gain on this amp) */
5537 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5538 /* unmute HP mixer amp left and right (volume = 0) */
5539 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5540 /* mute pin widget amp left and right (no gain on this amp) */
5541 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5542 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5545 /* mute analog inputs */
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5549 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5550 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5551 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5552 /* Unmute Front out path */
5553 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5554 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5555 /* Unmute Headphone out path */
5556 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5557 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5558 /* Unmute Mono out path */
5559 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5560 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5565 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5566 /* Line out and output */
5567 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5569 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5570 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5571 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5572 /* Mic2 (front panel) pin widget for input and vref at 80% */
5573 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5574 /* Line In pin widget for input */
5575 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5576 /* Headphone pin widget for output */
5577 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5578 /* CD pin widget for input */
5579 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5580 /* unmute amp left and right */
5581 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5582 /* set connection select to line in (default select for this ADC) */
5583 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5584 /* unmute Line-Out mixer amp left and right (volume = 0) */
5585 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5586 /* mute pin widget amp left and right (no gain on this amp) */
5587 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5588 /* unmute HP mixer amp left and right (volume = 0) */
5589 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5590 /* mute pin widget amp left and right (no gain on this amp) */
5591 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5592 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5595 /* mute analog inputs */
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5599 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5600 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5601 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5602 /* Unmute Front out path */
5603 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5604 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5605 /* Unmute Headphone out path */
5606 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5607 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5608 /* Unmute Mono out path */
5609 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5610 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5614 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5615 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5616 * audio = 0x16, internal speaker = 0x10.
5618 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5619 /* Disable all GPIOs */
5620 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5621 /* Internal speaker is connected to headphone pin */
5622 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5623 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5625 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5626 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5627 /* Ensure all other unused pins are disabled and muted. */
5628 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5629 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5630 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5631 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5632 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5633 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5634 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5637 /* Disable digital (SPDIF) pins */
5638 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5639 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5641 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5642 * when acting as an output.
5644 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5646 /* Start with output sum widgets muted and their output gains at min */
5647 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5648 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5649 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5650 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5651 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5652 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5653 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5654 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5655 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5657 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5658 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5659 /* Unmute Line1 pin widget output buffer since it starts as an output.
5660 * If the pin mode is changed by the user the pin mode control will
5661 * take care of enabling the pin's input/output buffers as needed.
5662 * Therefore there's no need to enable the input buffer at this
5665 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5666 /* Unmute input buffer of pin widget used for Line-in (no equiv
5669 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5671 /* Mute capture amp left and right */
5672 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5673 /* Set ADC connection select to match default mixer setting - line
5676 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5678 /* Do the same for the second ADC: mute capture input amp and
5679 * set ADC connection to line in (on mic1 pin)
5681 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5684 /* Mute all inputs to mixer widget (even unconnected ones) */
5685 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5686 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5687 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5688 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5689 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5691 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5692 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5697 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5698 * similar laptops (adapted from Fujitsu init verbs).
5700 static struct hda_verb alc260_acer_init_verbs[] = {
5701 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5702 * the headphone jack. Turn this on and rely on the standard mute
5703 * methods whenever the user wants to turn these outputs off.
5705 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5706 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5707 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5708 /* Internal speaker/Headphone jack is connected to Line-out pin */
5709 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5710 /* Internal microphone/Mic jack is connected to Mic1 pin */
5711 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5712 /* Line In jack is connected to Line1 pin */
5713 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5714 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5715 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5716 /* Ensure all other unused pins are disabled and muted. */
5717 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5718 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5719 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5720 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5722 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5723 /* Disable digital (SPDIF) pins */
5724 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5725 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5727 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5728 * bus when acting as outputs.
5730 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5731 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5733 /* Start with output sum widgets muted and their output gains at min */
5734 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5735 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5736 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5737 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5738 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5739 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5740 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5741 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5742 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5744 /* Unmute Line-out pin widget amp left and right
5745 * (no equiv mixer ctrl)
5747 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5748 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5749 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5750 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5751 * inputs. If the pin mode is changed by the user the pin mode control
5752 * will take care of enabling the pin's input/output buffers as needed.
5753 * Therefore there's no need to enable the input buffer at this
5756 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5757 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5759 /* Mute capture amp left and right */
5760 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5761 /* Set ADC connection select to match default mixer setting - mic
5764 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5766 /* Do similar with the second ADC: mute capture input amp and
5767 * set ADC connection to mic to match ALSA's default state.
5769 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5770 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5772 /* Mute all inputs to mixer widget (even unconnected ones) */
5773 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5774 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5775 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5776 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5777 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5778 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5779 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5780 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5785 /* Initialisation sequence for Maxdata Favorit 100XS
5786 * (adapted from Acer init verbs).
5788 static struct hda_verb alc260_favorit100_init_verbs[] = {
5789 /* GPIO 0 enables the output jack.
5790 * Turn this on and rely on the standard mute
5791 * methods whenever the user wants to turn these outputs off.
5793 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5794 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5795 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5796 /* Line/Mic input jack is connected to Mic1 pin */
5797 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5798 /* Ensure all other unused pins are disabled and muted. */
5799 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5800 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5801 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5802 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5803 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5804 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5805 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5807 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 /* Disable digital (SPDIF) pins */
5810 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5811 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5813 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5814 * bus when acting as outputs.
5816 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5817 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5819 /* Start with output sum widgets muted and their output gains at min */
5820 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5821 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5822 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5823 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5824 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5825 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5826 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5827 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5828 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5830 /* Unmute Line-out pin widget amp left and right
5831 * (no equiv mixer ctrl)
5833 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5834 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5835 * inputs. If the pin mode is changed by the user the pin mode control
5836 * will take care of enabling the pin's input/output buffers as needed.
5837 * Therefore there's no need to enable the input buffer at this
5840 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5842 /* Mute capture amp left and right */
5843 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5844 /* Set ADC connection select to match default mixer setting - mic
5847 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5849 /* Do similar with the second ADC: mute capture input amp and
5850 * set ADC connection to mic to match ALSA's default state.
5852 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5853 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5855 /* Mute all inputs to mixer widget (even unconnected ones) */
5856 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5857 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5858 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5859 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5860 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5861 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5862 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5863 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5868 static struct hda_verb alc260_will_verbs[] = {
5869 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5870 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5871 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5872 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5873 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5874 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5878 static struct hda_verb alc260_replacer_672v_verbs[] = {
5879 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5880 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5881 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5883 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5884 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5885 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5887 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5891 /* toggle speaker-output according to the hp-jack state */
5892 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5894 unsigned int present;
5896 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5897 present = snd_hda_jack_detect(codec, 0x0f);
5899 snd_hda_codec_write_cache(codec, 0x01, 0,
5900 AC_VERB_SET_GPIO_DATA, 1);
5901 snd_hda_codec_write_cache(codec, 0x0f, 0,
5902 AC_VERB_SET_PIN_WIDGET_CONTROL,
5905 snd_hda_codec_write_cache(codec, 0x01, 0,
5906 AC_VERB_SET_GPIO_DATA, 0);
5907 snd_hda_codec_write_cache(codec, 0x0f, 0,
5908 AC_VERB_SET_PIN_WIDGET_CONTROL,
5913 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5916 if ((res >> 26) == ALC880_HP_EVENT)
5917 alc260_replacer_672v_automute(codec);
5920 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5921 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5922 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5923 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5924 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5925 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5926 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5927 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5928 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5929 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5930 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5934 /* Test configuration for debugging, modelled after the ALC880 test
5937 #ifdef CONFIG_SND_DEBUG
5938 static hda_nid_t alc260_test_dac_nids[1] = {
5941 static hda_nid_t alc260_test_adc_nids[2] = {
5944 /* For testing the ALC260, each input MUX needs its own definition since
5945 * the signal assignments are different. This assumes that the first ADC
5948 static struct hda_input_mux alc260_test_capture_sources[2] = {
5952 { "MIC1 pin", 0x0 },
5953 { "MIC2 pin", 0x1 },
5954 { "LINE1 pin", 0x2 },
5955 { "LINE2 pin", 0x3 },
5957 { "LINE-OUT pin", 0x5 },
5958 { "HP-OUT pin", 0x6 },
5964 { "MIC1 pin", 0x0 },
5965 { "MIC2 pin", 0x1 },
5966 { "LINE1 pin", 0x2 },
5967 { "LINE2 pin", 0x3 },
5970 { "LINE-OUT pin", 0x6 },
5971 { "HP-OUT pin", 0x7 },
5975 static struct snd_kcontrol_new alc260_test_mixer[] = {
5976 /* Output driver widgets */
5977 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5978 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5979 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5980 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
5981 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5982 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
5984 /* Modes for retasking pin widgets
5985 * Note: the ALC260 doesn't seem to act on requests to enable mic
5986 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
5987 * mention this restriction. At this stage it's not clear whether
5988 * this behaviour is intentional or is a hardware bug in chip
5989 * revisions available at least up until early 2006. Therefore for
5990 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
5991 * choices, but if it turns out that the lack of mic bias for these
5992 * NIDs is intentional we could change their modes from
5993 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5995 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
5996 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
5997 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
5998 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
5999 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6000 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6002 /* Loopback mixer controls */
6003 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6004 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6005 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6006 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6007 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6008 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6009 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6010 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6011 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6012 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6013 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6014 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6015 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6016 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6018 /* Controls for GPIO pins, assuming they are configured as outputs */
6019 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6020 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6021 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6022 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6024 /* Switches to allow the digital IO pins to be enabled. The datasheet
6025 * is ambigious as to which NID is which; testing on laptops which
6026 * make this output available should provide clarification.
6028 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6029 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6031 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6032 * this output to turn on an external amplifier.
6034 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6035 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6039 static struct hda_verb alc260_test_init_verbs[] = {
6040 /* Enable all GPIOs as outputs with an initial value of 0 */
6041 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6042 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6043 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6045 /* Enable retasking pins as output, initially without power amp */
6046 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6047 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6049 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6050 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6051 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6053 /* Disable digital (SPDIF) pins initially, but users can enable
6054 * them via a mixer switch. In the case of SPDIF-out, this initverb
6055 * payload also sets the generation to 0, output to be in "consumer"
6056 * PCM format, copyright asserted, no pre-emphasis and no validity
6059 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6060 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6062 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6063 * OUT1 sum bus when acting as an output.
6065 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6066 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6067 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6068 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6070 /* Start with output sum widgets muted and their output gains at min */
6071 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6072 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6073 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6074 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6075 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6076 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6077 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6078 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6079 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6081 /* Unmute retasking pin widget output buffers since the default
6082 * state appears to be output. As the pin mode is changed by the
6083 * user the pin mode control will take care of enabling the pin's
6084 * input/output buffers as needed.
6086 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6087 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6088 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6089 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6090 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6091 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6092 /* Also unmute the mono-out pin widget */
6093 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6095 /* Mute capture amp left and right */
6096 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6097 /* Set ADC connection select to match default mixer setting (mic1
6100 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6102 /* Do the same for the second ADC: mute capture input amp and
6103 * set ADC connection to mic1 pin
6105 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6106 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6108 /* Mute all inputs to mixer widget (even unconnected ones) */
6109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6110 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6111 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6112 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6113 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6114 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6115 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6122 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6123 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6125 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6126 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6129 * for BIOS auto-configuration
6132 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6133 const char *pfx, int *vol_bits)
6136 unsigned long vol_val, sw_val;
6139 if (nid >= 0x0f && nid < 0x11) {
6140 nid_vol = nid - 0x7;
6141 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6142 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6143 } else if (nid == 0x11) {
6144 nid_vol = nid - 0x7;
6145 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6146 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6147 } else if (nid >= 0x12 && nid <= 0x15) {
6149 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6150 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6154 if (!(*vol_bits & (1 << nid_vol))) {
6155 /* first control for the volume widget */
6156 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6159 *vol_bits |= (1 << nid_vol);
6161 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6167 /* add playback controls from the parsed DAC table */
6168 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6169 const struct auto_pin_cfg *cfg)
6175 spec->multiout.num_dacs = 1;
6176 spec->multiout.dac_nids = spec->private_dac_nids;
6177 spec->multiout.dac_nids[0] = 0x02;
6179 nid = cfg->line_out_pins[0];
6182 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6184 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6188 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6193 nid = cfg->speaker_pins[0];
6195 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6200 nid = cfg->hp_pins[0];
6202 err = alc260_add_playback_controls(spec, nid, "Headphone",
6210 /* create playback/capture controls for input pins */
6211 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6212 const struct auto_pin_cfg *cfg)
6214 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6217 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6218 hda_nid_t nid, int pin_type,
6221 alc_set_pin_output(codec, nid, pin_type);
6222 /* need the manual connection? */
6224 int idx = nid - 0x12;
6225 snd_hda_codec_write(codec, idx + 0x0b, 0,
6226 AC_VERB_SET_CONNECT_SEL, sel_idx);
6230 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6232 struct alc_spec *spec = codec->spec;
6235 nid = spec->autocfg.line_out_pins[0];
6237 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6238 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6241 nid = spec->autocfg.speaker_pins[0];
6243 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6245 nid = spec->autocfg.hp_pins[0];
6247 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6250 #define ALC260_PIN_CD_NID 0x16
6251 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6253 struct alc_spec *spec = codec->spec;
6256 for (i = 0; i < AUTO_PIN_LAST; i++) {
6257 hda_nid_t nid = spec->autocfg.input_pins[i];
6259 alc_set_input_pin(codec, nid, i);
6260 if (nid != ALC260_PIN_CD_NID &&
6261 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6262 snd_hda_codec_write(codec, nid, 0,
6263 AC_VERB_SET_AMP_GAIN_MUTE,
6270 * generic initialization of ADC, input mixers and output mixers
6272 static struct hda_verb alc260_volume_init_verbs[] = {
6274 * Unmute ADC0-1 and set the default input to mic-in
6276 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6277 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6278 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6279 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6281 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6283 * Note: PASD motherboards uses the Line In 2 as the input for
6284 * front panel mic (mic 2)
6286 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6287 /* mute analog inputs */
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6295 * Set up output mixers (0x08 - 0x0a)
6297 /* set vol=0 to output mixers */
6298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6299 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6301 /* set up input amps for analog loopback */
6302 /* Amp Indices: DAC = 0, mixer = 1 */
6303 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6304 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6305 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6306 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6307 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6308 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6313 static int alc260_parse_auto_config(struct hda_codec *codec)
6315 struct alc_spec *spec = codec->spec;
6317 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6319 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6323 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6326 if (!spec->kctls.list)
6327 return 0; /* can't find valid BIOS pin config */
6328 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6332 spec->multiout.max_channels = 2;
6334 if (spec->autocfg.dig_outs)
6335 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6336 if (spec->kctls.list)
6337 add_mixer(spec, spec->kctls.list);
6339 add_verb(spec, alc260_volume_init_verbs);
6341 spec->num_mux_defs = 1;
6342 spec->input_mux = &spec->private_imux[0];
6344 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6349 /* additional initialization for auto-configuration model */
6350 static void alc260_auto_init(struct hda_codec *codec)
6352 struct alc_spec *spec = codec->spec;
6353 alc260_auto_init_multi_out(codec);
6354 alc260_auto_init_analog_input(codec);
6355 if (spec->unsol_event)
6356 alc_inithook(codec);
6359 #ifdef CONFIG_SND_HDA_POWER_SAVE
6360 static struct hda_amp_list alc260_loopbacks[] = {
6361 { 0x07, HDA_INPUT, 0 },
6362 { 0x07, HDA_INPUT, 1 },
6363 { 0x07, HDA_INPUT, 2 },
6364 { 0x07, HDA_INPUT, 3 },
6365 { 0x07, HDA_INPUT, 4 },
6371 * ALC260 configurations
6373 static const char *alc260_models[ALC260_MODEL_LAST] = {
6374 [ALC260_BASIC] = "basic",
6376 [ALC260_HP_3013] = "hp-3013",
6377 [ALC260_HP_DC7600] = "hp-dc7600",
6378 [ALC260_FUJITSU_S702X] = "fujitsu",
6379 [ALC260_ACER] = "acer",
6380 [ALC260_WILL] = "will",
6381 [ALC260_REPLACER_672V] = "replacer",
6382 [ALC260_FAVORIT100] = "favorit100",
6383 #ifdef CONFIG_SND_DEBUG
6384 [ALC260_TEST] = "test",
6386 [ALC260_AUTO] = "auto",
6389 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6390 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6391 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6392 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6393 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6394 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6395 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6396 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6397 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6398 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6399 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6400 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6401 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6402 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6403 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6404 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6405 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6406 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6407 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6408 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6409 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6413 static struct alc_config_preset alc260_presets[] = {
6415 .mixers = { alc260_base_output_mixer,
6416 alc260_input_mixer },
6417 .init_verbs = { alc260_init_verbs },
6418 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6419 .dac_nids = alc260_dac_nids,
6420 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6421 .adc_nids = alc260_adc_nids,
6422 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6423 .channel_mode = alc260_modes,
6424 .input_mux = &alc260_capture_source,
6427 .mixers = { alc260_hp_output_mixer,
6428 alc260_input_mixer },
6429 .init_verbs = { alc260_init_verbs,
6430 alc260_hp_unsol_verbs },
6431 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6432 .dac_nids = alc260_dac_nids,
6433 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6434 .adc_nids = alc260_adc_nids_alt,
6435 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6436 .channel_mode = alc260_modes,
6437 .input_mux = &alc260_capture_source,
6438 .unsol_event = alc260_hp_unsol_event,
6439 .init_hook = alc260_hp_automute,
6441 [ALC260_HP_DC7600] = {
6442 .mixers = { alc260_hp_dc7600_mixer,
6443 alc260_input_mixer },
6444 .init_verbs = { alc260_init_verbs,
6445 alc260_hp_dc7600_verbs },
6446 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6447 .dac_nids = alc260_dac_nids,
6448 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6449 .adc_nids = alc260_adc_nids_alt,
6450 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6451 .channel_mode = alc260_modes,
6452 .input_mux = &alc260_capture_source,
6453 .unsol_event = alc260_hp_3012_unsol_event,
6454 .init_hook = alc260_hp_3012_automute,
6456 [ALC260_HP_3013] = {
6457 .mixers = { alc260_hp_3013_mixer,
6458 alc260_input_mixer },
6459 .init_verbs = { alc260_hp_3013_init_verbs,
6460 alc260_hp_3013_unsol_verbs },
6461 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6462 .dac_nids = alc260_dac_nids,
6463 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6464 .adc_nids = alc260_adc_nids_alt,
6465 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6466 .channel_mode = alc260_modes,
6467 .input_mux = &alc260_capture_source,
6468 .unsol_event = alc260_hp_3013_unsol_event,
6469 .init_hook = alc260_hp_3013_automute,
6471 [ALC260_FUJITSU_S702X] = {
6472 .mixers = { alc260_fujitsu_mixer },
6473 .init_verbs = { alc260_fujitsu_init_verbs },
6474 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6475 .dac_nids = alc260_dac_nids,
6476 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6477 .adc_nids = alc260_dual_adc_nids,
6478 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6479 .channel_mode = alc260_modes,
6480 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6481 .input_mux = alc260_fujitsu_capture_sources,
6484 .mixers = { alc260_acer_mixer },
6485 .init_verbs = { alc260_acer_init_verbs },
6486 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6487 .dac_nids = alc260_dac_nids,
6488 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6489 .adc_nids = alc260_dual_adc_nids,
6490 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6491 .channel_mode = alc260_modes,
6492 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6493 .input_mux = alc260_acer_capture_sources,
6495 [ALC260_FAVORIT100] = {
6496 .mixers = { alc260_favorit100_mixer },
6497 .init_verbs = { alc260_favorit100_init_verbs },
6498 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6499 .dac_nids = alc260_dac_nids,
6500 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6501 .adc_nids = alc260_dual_adc_nids,
6502 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6503 .channel_mode = alc260_modes,
6504 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6505 .input_mux = alc260_favorit100_capture_sources,
6508 .mixers = { alc260_will_mixer },
6509 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6510 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6511 .dac_nids = alc260_dac_nids,
6512 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6513 .adc_nids = alc260_adc_nids,
6514 .dig_out_nid = ALC260_DIGOUT_NID,
6515 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6516 .channel_mode = alc260_modes,
6517 .input_mux = &alc260_capture_source,
6519 [ALC260_REPLACER_672V] = {
6520 .mixers = { alc260_replacer_672v_mixer },
6521 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6522 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6523 .dac_nids = alc260_dac_nids,
6524 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6525 .adc_nids = alc260_adc_nids,
6526 .dig_out_nid = ALC260_DIGOUT_NID,
6527 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6528 .channel_mode = alc260_modes,
6529 .input_mux = &alc260_capture_source,
6530 .unsol_event = alc260_replacer_672v_unsol_event,
6531 .init_hook = alc260_replacer_672v_automute,
6533 #ifdef CONFIG_SND_DEBUG
6535 .mixers = { alc260_test_mixer },
6536 .init_verbs = { alc260_test_init_verbs },
6537 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6538 .dac_nids = alc260_test_dac_nids,
6539 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6540 .adc_nids = alc260_test_adc_nids,
6541 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6542 .channel_mode = alc260_modes,
6543 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6544 .input_mux = alc260_test_capture_sources,
6549 static int patch_alc260(struct hda_codec *codec)
6551 struct alc_spec *spec;
6552 int err, board_config;
6554 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6560 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6563 if (board_config < 0) {
6564 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6566 board_config = ALC260_AUTO;
6569 if (board_config == ALC260_AUTO) {
6570 /* automatic parse from the BIOS config */
6571 err = alc260_parse_auto_config(codec);
6577 "hda_codec: Cannot set up configuration "
6578 "from BIOS. Using base mode...\n");
6579 board_config = ALC260_BASIC;
6583 err = snd_hda_attach_beep_device(codec, 0x1);
6589 if (board_config != ALC260_AUTO)
6590 setup_preset(codec, &alc260_presets[board_config]);
6592 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6593 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6595 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6596 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6598 if (!spec->adc_nids && spec->input_mux) {
6599 /* check whether NID 0x04 is valid */
6600 unsigned int wcap = get_wcaps(codec, 0x04);
6601 wcap = get_wcaps_type(wcap);
6603 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6604 spec->adc_nids = alc260_adc_nids_alt;
6605 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6607 spec->adc_nids = alc260_adc_nids;
6608 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6611 set_capture_mixer(codec);
6612 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6614 spec->vmaster_nid = 0x08;
6616 codec->patch_ops = alc_patch_ops;
6617 if (board_config == ALC260_AUTO)
6618 spec->init_hook = alc260_auto_init;
6619 #ifdef CONFIG_SND_HDA_POWER_SAVE
6620 if (!spec->loopback.amplist)
6621 spec->loopback.amplist = alc260_loopbacks;
6623 codec->proc_widget_hook = print_realtek_coef;
6630 * ALC882/883/885/888/889 support
6632 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6633 * configuration. Each pin widget can choose any input DACs and a mixer.
6634 * Each ADC is connected from a mixer of all inputs. This makes possible
6635 * 6-channel independent captures.
6637 * In addition, an independent DAC for the multi-playback (not used in this
6640 #define ALC882_DIGOUT_NID 0x06
6641 #define ALC882_DIGIN_NID 0x0a
6642 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6643 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6644 #define ALC1200_DIGOUT_NID 0x10
6647 static struct hda_channel_mode alc882_ch_modes[1] = {
6652 static hda_nid_t alc882_dac_nids[4] = {
6653 /* front, rear, clfe, rear_surr */
6654 0x02, 0x03, 0x04, 0x05
6656 #define alc883_dac_nids alc882_dac_nids
6659 #define alc882_adc_nids alc880_adc_nids
6660 #define alc882_adc_nids_alt alc880_adc_nids_alt
6661 #define alc883_adc_nids alc882_adc_nids_alt
6662 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6663 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6664 #define alc889_adc_nids alc880_adc_nids
6666 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6667 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6668 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6669 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6670 #define alc889_capsrc_nids alc882_capsrc_nids
6673 /* FIXME: should be a matrix-type input source selection */
6675 static struct hda_input_mux alc882_capture_source = {
6679 { "Front Mic", 0x1 },
6685 #define alc883_capture_source alc882_capture_source
6687 static struct hda_input_mux alc889_capture_source = {
6690 { "Front Mic", 0x0 },
6696 static struct hda_input_mux mb5_capture_source = {
6705 static struct hda_input_mux alc883_3stack_6ch_intel = {
6709 { "Front Mic", 0x0 },
6715 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6723 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6733 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6741 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6745 { "Front Mic", 0x1 },
6750 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6758 static struct hda_input_mux alc889A_mb31_capture_source = {
6762 /* Front Mic (0x01) unused */
6764 /* Line 2 (0x03) unused */
6765 /* CD (0x04) unused? */
6772 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6779 static struct hda_verb alc882_3ST_ch2_init[] = {
6780 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6781 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6782 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6783 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6790 static struct hda_verb alc882_3ST_ch4_init[] = {
6791 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6792 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6793 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6794 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6795 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6802 static struct hda_verb alc882_3ST_ch6_init[] = {
6803 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6804 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6805 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6806 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6807 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6808 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6812 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6813 { 2, alc882_3ST_ch2_init },
6814 { 4, alc882_3ST_ch4_init },
6815 { 6, alc882_3ST_ch6_init },
6818 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6823 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6824 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6825 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6826 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6827 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6828 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6835 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6836 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6837 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6838 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6841 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6848 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6849 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6852 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6855 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6859 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6860 { 2, alc883_3ST_ch2_clevo_init },
6861 { 4, alc883_3ST_ch4_clevo_init },
6862 { 6, alc883_3ST_ch6_clevo_init },
6869 static struct hda_verb alc882_sixstack_ch6_init[] = {
6870 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6871 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6872 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6873 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6880 static struct hda_verb alc882_sixstack_ch8_init[] = {
6881 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6882 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6883 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6884 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6888 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6889 { 6, alc882_sixstack_ch6_init },
6890 { 8, alc882_sixstack_ch8_init },
6894 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6900 static struct hda_verb alc885_mbp_ch2_init[] = {
6901 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6902 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6903 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6910 static struct hda_verb alc885_mbp_ch4_init[] = {
6911 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6912 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6913 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6914 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6915 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6919 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6920 { 2, alc885_mbp_ch2_init },
6921 { 4, alc885_mbp_ch4_init },
6926 * Speakers/Woofer/HP = Front
6929 static struct hda_verb alc885_mb5_ch2_init[] = {
6930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6931 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6937 * Speakers/HP = Front
6941 static struct hda_verb alc885_mb5_ch6_init[] = {
6942 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6943 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6944 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6948 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6949 { 2, alc885_mb5_ch2_init },
6950 { 6, alc885_mb5_ch6_init },
6957 static struct hda_verb alc883_4ST_ch2_init[] = {
6958 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6960 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6961 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6962 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6963 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6970 static struct hda_verb alc883_4ST_ch4_init[] = {
6971 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6972 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6973 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6974 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6975 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6976 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6977 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6984 static struct hda_verb alc883_4ST_ch6_init[] = {
6985 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6986 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6987 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6988 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6989 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6990 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6991 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6992 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6999 static struct hda_verb alc883_4ST_ch8_init[] = {
7000 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7001 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7002 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7003 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7004 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7005 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7006 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7007 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7008 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7012 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7013 { 2, alc883_4ST_ch2_init },
7014 { 4, alc883_4ST_ch4_init },
7015 { 6, alc883_4ST_ch6_init },
7016 { 8, alc883_4ST_ch8_init },
7023 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7024 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7025 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7026 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7027 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7034 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7035 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7036 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7037 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7038 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7039 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7046 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7047 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7048 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7049 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7050 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7052 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7056 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7057 { 2, alc883_3ST_ch2_intel_init },
7058 { 4, alc883_3ST_ch4_intel_init },
7059 { 6, alc883_3ST_ch6_intel_init },
7065 static struct hda_verb alc889_ch2_intel_init[] = {
7066 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7067 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7068 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7069 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7070 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7071 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7078 static struct hda_verb alc889_ch6_intel_init[] = {
7079 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7080 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7081 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7082 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7083 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7084 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7091 static struct hda_verb alc889_ch8_intel_init[] = {
7092 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7093 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7094 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7095 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7096 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7102 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7103 { 2, alc889_ch2_intel_init },
7104 { 6, alc889_ch6_intel_init },
7105 { 8, alc889_ch8_intel_init },
7111 static struct hda_verb alc883_sixstack_ch6_init[] = {
7112 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7113 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7114 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7115 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7122 static struct hda_verb alc883_sixstack_ch8_init[] = {
7123 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7124 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7125 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7126 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7130 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7131 { 6, alc883_sixstack_ch6_init },
7132 { 8, alc883_sixstack_ch8_init },
7136 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7137 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7139 static struct snd_kcontrol_new alc882_base_mixer[] = {
7140 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7141 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7142 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7143 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7144 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7145 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7146 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7147 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7148 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7149 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7150 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7151 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7152 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7155 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7156 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7157 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7158 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7159 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7160 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7164 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7165 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7166 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7167 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7168 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7169 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7170 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7171 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7172 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7173 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7174 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7175 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7179 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7180 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7181 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7182 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7183 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7184 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7185 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7186 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7187 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT),
7188 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7189 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7190 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7191 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7192 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7193 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7197 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7198 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7199 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7200 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7201 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7203 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7204 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7205 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7211 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7212 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7213 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7214 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7215 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7217 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7218 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7219 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7220 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7224 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7225 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7226 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7228 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7229 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7234 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7236 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7241 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7242 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7244 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7245 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7246 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7247 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7248 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7249 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7250 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7254 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7255 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7256 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7257 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7261 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7262 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7263 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7264 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7265 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7266 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7267 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7268 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7270 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7271 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7275 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7277 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7278 .name = "Channel Mode",
7279 .info = alc_ch_mode_info,
7280 .get = alc_ch_mode_get,
7281 .put = alc_ch_mode_put,
7286 static struct hda_verb alc882_base_init_verbs[] = {
7287 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7288 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7289 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7290 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7292 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7293 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7294 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7300 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7301 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7302 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7304 /* mute analog input loopbacks */
7305 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7306 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7307 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7308 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7309 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7311 /* Front Pin: output 0 (0x0c) */
7312 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7313 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7314 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7315 /* Rear Pin: output 1 (0x0d) */
7316 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7317 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7318 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7319 /* CLFE Pin: output 2 (0x0e) */
7320 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7321 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7322 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7323 /* Side Pin: output 3 (0x0f) */
7324 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7325 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7326 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7327 /* Mic (rear) pin: input vref at 80% */
7328 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7329 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7330 /* Front Mic pin: input vref at 80% */
7331 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7332 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7333 /* Line In pin: input */
7334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7336 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7337 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7338 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7339 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7340 /* CD pin widget for input */
7341 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7343 /* FIXME: use matrix-type input source selection */
7344 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7355 /* ADC2: mute amp left and right */
7356 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7357 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7358 /* ADC3: mute amp left and right */
7359 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7360 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7365 static struct hda_verb alc882_adc1_init_verbs[] = {
7366 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7367 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7368 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7369 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7370 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7371 /* ADC1: mute amp left and right */
7372 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7373 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7377 static struct hda_verb alc882_eapd_verbs[] = {
7378 /* change to EAPD mode */
7379 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7380 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7384 static struct hda_verb alc889_eapd_verbs[] = {
7385 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7386 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7390 static struct hda_verb alc_hp15_unsol_verbs[] = {
7391 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7396 static struct hda_verb alc885_init_verbs[] = {
7397 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7399 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7400 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7402 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7403 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7404 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7406 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7410 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7411 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7412 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7414 /* mute analog input loopbacks */
7415 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7416 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7417 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7419 /* Front HP Pin: output 0 (0x0c) */
7420 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7421 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7422 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7423 /* Front Pin: output 0 (0x0c) */
7424 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7425 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7426 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7427 /* Rear Pin: output 1 (0x0d) */
7428 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7429 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7430 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7431 /* CLFE Pin: output 2 (0x0e) */
7432 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7433 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7434 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7435 /* Side Pin: output 3 (0x0f) */
7436 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7437 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7438 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7439 /* Mic (rear) pin: input vref at 80% */
7440 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7441 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7442 /* Front Mic pin: input vref at 80% */
7443 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7444 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7445 /* Line In pin: input */
7446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7447 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7449 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7455 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7456 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7457 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7459 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7460 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7461 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7462 /* ADC2: mute amp left and right */
7463 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7464 /* ADC3: mute amp left and right */
7465 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7470 static struct hda_verb alc885_init_input_verbs[] = {
7471 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7473 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7478 /* Unmute Selector 24h and set the default input to front mic */
7479 static struct hda_verb alc889_init_input_verbs[] = {
7480 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7486 #define alc883_init_verbs alc882_base_init_verbs
7489 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7490 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7491 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7492 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7493 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7494 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7495 /* FIXME: this looks suspicious...
7496 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7497 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7502 static struct hda_verb alc882_macpro_init_verbs[] = {
7503 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7505 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7506 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7507 /* Front Pin: output 0 (0x0c) */
7508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7509 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7510 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7511 /* Front Mic pin: input vref at 80% */
7512 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7513 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7514 /* Speaker: output */
7515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7516 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7517 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7518 /* Headphone output (output 0 - 0x0c) */
7519 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7520 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7521 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7523 /* FIXME: use matrix-type input source selection */
7524 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7525 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7526 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7527 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7528 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7529 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7531 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7532 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7533 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7534 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7536 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7537 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7538 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7539 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7540 /* ADC1: mute amp left and right */
7541 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7542 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7543 /* ADC2: mute amp left and right */
7544 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7545 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7546 /* ADC3: mute amp left and right */
7547 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7548 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7554 static struct hda_verb alc885_mb5_init_verbs[] = {
7556 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7557 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7558 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7559 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7564 /* Surround mixer */
7565 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7566 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7567 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7569 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7570 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7571 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7573 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7574 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7575 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7576 /* Front Pin (0x0c) */
7577 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7578 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7579 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7580 /* LFE Pin (0x0e) */
7581 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7582 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7583 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7585 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7586 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7587 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7588 /* Front Mic pin: input vref at 80% */
7589 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7590 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7592 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7593 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7595 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7596 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7597 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7598 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7602 /* Macbook Pro rev3 */
7603 static struct hda_verb alc885_mbp3_init_verbs[] = {
7604 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7605 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7606 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7607 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7609 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7610 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7611 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7613 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7614 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7615 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7616 /* Front Pin: output 0 (0x0c) */
7617 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7618 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7619 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7620 /* HP Pin: output 0 (0x0e) */
7621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7624 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7625 /* Mic (rear) pin: input vref at 80% */
7626 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7627 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7628 /* Front Mic pin: input vref at 80% */
7629 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7630 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7631 /* Line In pin: use output 1 when in LineOut mode */
7632 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7633 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7634 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7636 /* FIXME: use matrix-type input source selection */
7637 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7638 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7639 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7640 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7641 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7642 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7644 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7645 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7646 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7647 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7649 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7650 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7651 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7652 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7653 /* ADC1: mute amp left and right */
7654 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7655 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7656 /* ADC2: mute amp left and right */
7657 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7658 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7659 /* ADC3: mute amp left and right */
7660 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7661 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7667 static struct hda_verb alc885_imac91_init_verbs[] = {
7668 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7669 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7670 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7671 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7673 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7674 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7675 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7676 /* HP Pin: output 0 (0x0c) */
7677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7678 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7679 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7680 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7681 /* Internal Speakers: output 0 (0x0d) */
7682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7684 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7685 /* Mic (rear) pin: input vref at 80% */
7686 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7687 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7688 /* Front Mic pin: input vref at 80% */
7689 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7690 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7691 /* Line In pin: use output 1 when in LineOut mode */
7692 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7693 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7694 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7696 /* FIXME: use matrix-type input source selection */
7697 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7698 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7699 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7700 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7701 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7702 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7704 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7705 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7706 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7710 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7711 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7712 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7713 /* ADC1: mute amp left and right */
7714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7715 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7716 /* ADC2: mute amp left and right */
7717 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7718 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7719 /* ADC3: mute amp left and right */
7720 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7721 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7726 /* iMac 24 mixer. */
7727 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7728 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7729 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7733 /* iMac 24 init verbs. */
7734 static struct hda_verb alc885_imac24_init_verbs[] = {
7735 /* Internal speakers: output 0 (0x0c) */
7736 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7737 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7738 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7739 /* Internal speakers: output 0 (0x0c) */
7740 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7741 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7742 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7743 /* Headphone: output 0 (0x0c) */
7744 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7745 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7746 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7747 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7748 /* Front Mic: input vref at 80% */
7749 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7750 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7754 /* Toggle speaker-output according to the hp-jack state */
7755 static void alc885_imac24_setup(struct hda_codec *codec)
7757 struct alc_spec *spec = codec->spec;
7759 spec->autocfg.hp_pins[0] = 0x14;
7760 spec->autocfg.speaker_pins[0] = 0x18;
7761 spec->autocfg.speaker_pins[1] = 0x1a;
7764 static void alc885_mbp3_setup(struct hda_codec *codec)
7766 struct alc_spec *spec = codec->spec;
7768 spec->autocfg.hp_pins[0] = 0x15;
7769 spec->autocfg.speaker_pins[0] = 0x14;
7772 static void alc885_imac91_automute(struct hda_codec *codec)
7774 unsigned int present;
7776 present = snd_hda_codec_read(codec, 0x14, 0,
7777 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7778 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7779 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7780 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7781 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7785 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7788 /* Headphone insertion or removal. */
7789 if ((res >> 26) == ALC880_HP_EVENT)
7790 alc885_imac91_automute(codec);
7793 static struct hda_verb alc882_targa_verbs[] = {
7794 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7795 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7797 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7798 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7800 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7801 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7802 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7804 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7808 /* toggle speaker-output according to the hp-jack state */
7809 static void alc882_targa_automute(struct hda_codec *codec)
7811 struct alc_spec *spec = codec->spec;
7812 alc_automute_amp(codec);
7813 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7814 spec->jack_present ? 1 : 3);
7817 static void alc882_targa_setup(struct hda_codec *codec)
7819 struct alc_spec *spec = codec->spec;
7821 spec->autocfg.hp_pins[0] = 0x14;
7822 spec->autocfg.speaker_pins[0] = 0x1b;
7825 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7827 if ((res >> 26) == ALC880_HP_EVENT)
7828 alc882_targa_automute(codec);
7831 static struct hda_verb alc882_asus_a7j_verbs[] = {
7832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7833 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7836 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7839 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7840 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7841 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7843 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7844 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7845 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7849 static struct hda_verb alc882_asus_a7m_verbs[] = {
7850 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7851 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7854 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7855 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7857 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7858 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7859 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7861 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7862 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7863 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7867 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7869 unsigned int gpiostate, gpiomask, gpiodir;
7871 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7872 AC_VERB_GET_GPIO_DATA, 0);
7875 gpiostate |= (1 << pin);
7877 gpiostate &= ~(1 << pin);
7879 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7880 AC_VERB_GET_GPIO_MASK, 0);
7881 gpiomask |= (1 << pin);
7883 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7884 AC_VERB_GET_GPIO_DIRECTION, 0);
7885 gpiodir |= (1 << pin);
7888 snd_hda_codec_write(codec, codec->afg, 0,
7889 AC_VERB_SET_GPIO_MASK, gpiomask);
7890 snd_hda_codec_write(codec, codec->afg, 0,
7891 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7895 snd_hda_codec_write(codec, codec->afg, 0,
7896 AC_VERB_SET_GPIO_DATA, gpiostate);
7899 /* set up GPIO at initialization */
7900 static void alc885_macpro_init_hook(struct hda_codec *codec)
7902 alc882_gpio_mute(codec, 0, 0);
7903 alc882_gpio_mute(codec, 1, 0);
7906 /* set up GPIO and update auto-muting at initialization */
7907 static void alc885_imac24_init_hook(struct hda_codec *codec)
7909 alc885_macpro_init_hook(codec);
7910 alc_automute_amp(codec);
7914 * generic initialization of ADC, input mixers and output mixers
7916 static struct hda_verb alc883_auto_init_verbs[] = {
7918 * Unmute ADC0-2 and set the default input to mic-in
7920 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7921 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7922 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7923 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7925 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
7927 * Note: PASD motherboards uses the Line In 2 as the input for
7928 * front panel mic (mic 2)
7930 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
7931 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7932 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7933 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7934 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7938 * Set up output mixers (0x0c - 0x0f)
7940 /* set vol=0 to output mixers */
7941 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7942 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7943 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7944 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7945 /* set up input amps for analog loopback */
7946 /* Amp Indices: DAC = 0, mixer = 1 */
7947 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7948 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7949 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7950 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7951 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7952 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7953 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7954 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7955 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7956 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7958 /* FIXME: use matrix-type input source selection */
7959 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7961 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7962 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7963 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7964 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7966 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
7967 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
7968 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
7969 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
7974 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7975 static struct hda_verb alc889A_mb31_ch2_init[] = {
7976 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7977 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7978 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7979 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
7983 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
7984 static struct hda_verb alc889A_mb31_ch4_init[] = {
7985 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7986 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7987 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
7988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
7992 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
7993 static struct hda_verb alc889A_mb31_ch5_init[] = {
7994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
7995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8001 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8002 static struct hda_verb alc889A_mb31_ch6_init[] = {
8003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8004 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8005 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8006 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8010 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8011 { 2, alc889A_mb31_ch2_init },
8012 { 4, alc889A_mb31_ch4_init },
8013 { 5, alc889A_mb31_ch5_init },
8014 { 6, alc889A_mb31_ch6_init },
8017 static struct hda_verb alc883_medion_eapd_verbs[] = {
8018 /* eanable EAPD on medion laptop */
8019 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8020 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8024 #define alc883_base_mixer alc882_base_mixer
8026 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8027 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8028 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8029 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8030 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8031 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8032 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8033 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8034 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8035 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8036 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8037 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8038 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8039 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8043 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8044 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8045 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8046 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8047 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8049 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8050 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8051 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8052 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8053 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8057 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8058 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8059 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8060 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8061 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8062 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8063 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8064 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8065 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8067 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8071 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8072 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8073 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8074 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8075 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8076 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8077 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8078 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8079 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8081 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8082 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8084 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8088 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8089 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8090 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8091 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8092 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8093 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8094 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8095 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8096 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8097 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8098 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8099 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8101 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8103 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8105 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8106 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8107 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8111 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8112 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8113 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8114 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8115 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8116 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8118 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8119 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8120 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8121 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8122 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8123 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8125 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8127 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8129 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8130 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8131 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8135 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8136 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8138 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8139 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8140 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8142 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8143 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8144 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8146 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8147 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8148 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8149 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8150 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8151 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8152 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8153 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8154 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8155 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8159 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8160 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8162 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8163 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8164 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8165 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8166 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8167 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8168 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8169 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8170 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8172 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8176 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8177 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8178 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8182 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8186 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8187 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8188 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8189 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8190 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8191 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8192 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8193 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8194 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8198 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8199 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8203 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8204 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8205 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8206 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8207 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8208 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8209 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8211 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8212 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8214 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8215 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8219 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8220 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8221 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8222 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8223 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8224 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8228 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8229 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8230 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8232 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8235 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8236 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8240 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8241 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8242 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8243 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8244 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8245 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8246 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8247 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8248 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8249 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8253 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8254 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8256 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8261 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8262 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8266 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8267 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8268 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8269 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8273 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8274 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8278 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8279 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8280 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8281 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8282 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8283 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8284 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8285 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8286 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8288 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8293 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8294 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8295 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8296 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8297 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8298 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8299 0x0d, 1, 0x0, HDA_OUTPUT),
8300 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8301 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8302 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8303 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8304 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8305 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8306 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8307 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8308 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8309 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8310 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8312 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8313 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8314 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8318 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8320 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8321 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8322 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8323 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8324 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8326 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8327 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8328 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8329 /* Output switches */
8330 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8331 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8332 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8334 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8335 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8337 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8338 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8339 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8340 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8344 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8345 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8346 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8347 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8348 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8349 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8350 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8354 static struct hda_bind_ctls alc883_bind_cap_vol = {
8355 .ops = &snd_hda_bind_vol,
8357 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8358 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8363 static struct hda_bind_ctls alc883_bind_cap_switch = {
8364 .ops = &snd_hda_bind_sw,
8366 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8367 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8372 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8373 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8374 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8375 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8376 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8377 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8378 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8380 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8384 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8385 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8386 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8388 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8389 /* .name = "Capture Source", */
8390 .name = "Input Source",
8392 .info = alc_mux_enum_info,
8393 .get = alc_mux_enum_get,
8394 .put = alc_mux_enum_put,
8399 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8401 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8402 .name = "Channel Mode",
8403 .info = alc_ch_mode_info,
8404 .get = alc_ch_mode_get,
8405 .put = alc_ch_mode_put,
8410 /* toggle speaker-output according to the hp-jack state */
8411 static void alc883_mitac_setup(struct hda_codec *codec)
8413 struct alc_spec *spec = codec->spec;
8415 spec->autocfg.hp_pins[0] = 0x15;
8416 spec->autocfg.speaker_pins[0] = 0x14;
8417 spec->autocfg.speaker_pins[1] = 0x17;
8420 /* auto-toggle front mic */
8422 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8424 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8426 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8430 static struct hda_verb alc883_mitac_verbs[] = {
8432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8435 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8436 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8438 /* enable unsolicited event */
8439 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8440 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8445 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8447 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8448 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8450 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8452 /* enable unsolicited event */
8454 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8455 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8461 static struct hda_verb alc883_clevo_m720_verbs[] = {
8463 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8464 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8466 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8469 /* enable unsolicited event */
8470 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8471 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8476 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8478 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8479 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8484 /* enable unsolicited event */
8485 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8490 static struct hda_verb alc883_targa_verbs[] = {
8491 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8492 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8494 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8495 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8497 /* Connect Line-Out side jack (SPDIF) to Side */
8498 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8500 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8501 /* Connect Mic jack to CLFE */
8502 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8503 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8504 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8505 /* Connect Line-in jack to Surround */
8506 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8508 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8509 /* Connect HP out jack to Front */
8510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8511 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8512 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8514 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8519 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8521 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8522 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8526 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8529 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8530 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8534 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8535 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8536 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8537 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8538 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8539 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8543 static struct hda_verb alc883_haier_w66_verbs[] = {
8544 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8545 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8547 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8549 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8550 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8551 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8556 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8557 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8559 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8560 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8561 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8562 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8563 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8564 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8568 static struct hda_verb alc888_6st_dell_verbs[] = {
8569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8573 static struct hda_verb alc883_vaiott_verbs[] = {
8575 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8578 /* enable unsolicited event */
8579 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8584 static void alc888_3st_hp_setup(struct hda_codec *codec)
8586 struct alc_spec *spec = codec->spec;
8588 spec->autocfg.hp_pins[0] = 0x1b;
8589 spec->autocfg.speaker_pins[0] = 0x14;
8590 spec->autocfg.speaker_pins[1] = 0x16;
8591 spec->autocfg.speaker_pins[2] = 0x18;
8594 static struct hda_verb alc888_3st_hp_verbs[] = {
8595 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8596 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8597 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8598 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8605 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8606 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8607 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8608 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8609 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8616 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8617 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8618 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8619 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8620 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8621 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8628 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8631 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8632 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8633 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8634 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8638 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8639 { 2, alc888_3st_hp_2ch_init },
8640 { 4, alc888_3st_hp_4ch_init },
8641 { 6, alc888_3st_hp_6ch_init },
8644 /* toggle front-jack and RCA according to the hp-jack state */
8645 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8647 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8649 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8650 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8651 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8652 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8655 /* toggle RCA according to the front-jack state */
8656 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8658 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8660 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8661 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8664 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8667 if ((res >> 26) == ALC880_HP_EVENT)
8668 alc888_lenovo_ms7195_front_automute(codec);
8669 if ((res >> 26) == ALC880_FRONT_EVENT)
8670 alc888_lenovo_ms7195_rca_automute(codec);
8673 static struct hda_verb alc883_medion_md2_verbs[] = {
8674 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8677 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8679 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8683 /* toggle speaker-output according to the hp-jack state */
8684 static void alc883_medion_md2_setup(struct hda_codec *codec)
8686 struct alc_spec *spec = codec->spec;
8688 spec->autocfg.hp_pins[0] = 0x14;
8689 spec->autocfg.speaker_pins[0] = 0x15;
8692 /* toggle speaker-output according to the hp-jack state */
8693 #define alc883_targa_init_hook alc882_targa_init_hook
8694 #define alc883_targa_unsol_event alc882_targa_unsol_event
8696 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8698 unsigned int present;
8700 present = snd_hda_jack_detect(codec, 0x18);
8701 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8702 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8705 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8707 struct alc_spec *spec = codec->spec;
8709 spec->autocfg.hp_pins[0] = 0x15;
8710 spec->autocfg.speaker_pins[0] = 0x14;
8713 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8715 alc_automute_amp(codec);
8716 alc883_clevo_m720_mic_automute(codec);
8719 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8722 switch (res >> 26) {
8723 case ALC880_MIC_EVENT:
8724 alc883_clevo_m720_mic_automute(codec);
8727 alc_automute_amp_unsol_event(codec, res);
8732 /* toggle speaker-output according to the hp-jack state */
8733 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8735 struct alc_spec *spec = codec->spec;
8737 spec->autocfg.hp_pins[0] = 0x14;
8738 spec->autocfg.speaker_pins[0] = 0x15;
8741 static void alc883_haier_w66_setup(struct hda_codec *codec)
8743 struct alc_spec *spec = codec->spec;
8745 spec->autocfg.hp_pins[0] = 0x1b;
8746 spec->autocfg.speaker_pins[0] = 0x14;
8749 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8751 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8753 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8754 HDA_AMP_MUTE, bits);
8757 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8759 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8761 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8762 HDA_AMP_MUTE, bits);
8763 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8764 HDA_AMP_MUTE, bits);
8767 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8770 if ((res >> 26) == ALC880_HP_EVENT)
8771 alc883_lenovo_101e_all_automute(codec);
8772 if ((res >> 26) == ALC880_FRONT_EVENT)
8773 alc883_lenovo_101e_ispeaker_automute(codec);
8776 /* toggle speaker-output according to the hp-jack state */
8777 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8779 struct alc_spec *spec = codec->spec;
8781 spec->autocfg.hp_pins[0] = 0x14;
8782 spec->autocfg.speaker_pins[0] = 0x15;
8783 spec->autocfg.speaker_pins[1] = 0x16;
8786 static struct hda_verb alc883_acer_eapd_verbs[] = {
8787 /* HP Pin: output 0 (0x0c) */
8788 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8789 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8790 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8791 /* Front Pin: output 0 (0x0c) */
8792 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8793 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8795 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8796 /* eanable EAPD on medion laptop */
8797 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8798 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8799 /* enable unsolicited event */
8800 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8804 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8805 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8806 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8807 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8811 static void alc888_6st_dell_setup(struct hda_codec *codec)
8813 struct alc_spec *spec = codec->spec;
8815 spec->autocfg.hp_pins[0] = 0x1b;
8816 spec->autocfg.speaker_pins[0] = 0x14;
8817 spec->autocfg.speaker_pins[1] = 0x15;
8818 spec->autocfg.speaker_pins[2] = 0x16;
8819 spec->autocfg.speaker_pins[3] = 0x17;
8822 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8824 struct alc_spec *spec = codec->spec;
8826 spec->autocfg.hp_pins[0] = 0x1b;
8827 spec->autocfg.speaker_pins[0] = 0x14;
8828 spec->autocfg.speaker_pins[1] = 0x15;
8829 spec->autocfg.speaker_pins[2] = 0x16;
8830 spec->autocfg.speaker_pins[3] = 0x17;
8831 spec->autocfg.speaker_pins[4] = 0x1a;
8834 static void alc883_vaiott_setup(struct hda_codec *codec)
8836 struct alc_spec *spec = codec->spec;
8838 spec->autocfg.hp_pins[0] = 0x15;
8839 spec->autocfg.speaker_pins[0] = 0x14;
8840 spec->autocfg.speaker_pins[1] = 0x17;
8843 static struct hda_verb alc888_asus_m90v_verbs[] = {
8844 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8845 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8846 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8847 /* enable unsolicited event */
8848 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8849 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8853 static void alc883_mode2_setup(struct hda_codec *codec)
8855 struct alc_spec *spec = codec->spec;
8857 spec->autocfg.hp_pins[0] = 0x1b;
8858 spec->autocfg.speaker_pins[0] = 0x14;
8859 spec->autocfg.speaker_pins[1] = 0x15;
8860 spec->autocfg.speaker_pins[2] = 0x16;
8861 spec->ext_mic.pin = 0x18;
8862 spec->int_mic.pin = 0x19;
8863 spec->ext_mic.mux_idx = 0;
8864 spec->int_mic.mux_idx = 1;
8868 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8869 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8870 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8872 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8873 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8874 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8875 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8876 /* enable unsolicited event */
8877 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8881 static void alc883_eee1601_inithook(struct hda_codec *codec)
8883 struct alc_spec *spec = codec->spec;
8885 spec->autocfg.hp_pins[0] = 0x14;
8886 spec->autocfg.speaker_pins[0] = 0x1b;
8887 alc_automute_pin(codec);
8890 static struct hda_verb alc889A_mb31_verbs[] = {
8891 /* Init rear pin (used as headphone output) */
8892 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8893 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8894 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8895 /* Init line pin (used as output in 4ch and 6ch mode) */
8896 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8897 /* Init line 2 pin (used as headphone out by default) */
8898 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8899 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8903 /* Mute speakers according to the headphone jack state */
8904 static void alc889A_mb31_automute(struct hda_codec *codec)
8906 unsigned int present;
8908 /* Mute only in 2ch or 4ch mode */
8909 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8911 present = snd_hda_jack_detect(codec, 0x15);
8912 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8913 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8914 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8915 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8919 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8921 if ((res >> 26) == ALC880_HP_EVENT)
8922 alc889A_mb31_automute(codec);
8926 #ifdef CONFIG_SND_HDA_POWER_SAVE
8927 #define alc882_loopbacks alc880_loopbacks
8930 /* pcm configuration: identical with ALC880 */
8931 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8932 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8933 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8934 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8936 static hda_nid_t alc883_slave_dig_outs[] = {
8937 ALC1200_DIGOUT_NID, 0,
8940 static hda_nid_t alc1200_slave_dig_outs[] = {
8941 ALC883_DIGOUT_NID, 0,
8945 * configuration and preset
8947 static const char *alc882_models[ALC882_MODEL_LAST] = {
8948 [ALC882_3ST_DIG] = "3stack-dig",
8949 [ALC882_6ST_DIG] = "6stack-dig",
8950 [ALC882_ARIMA] = "arima",
8951 [ALC882_W2JC] = "w2jc",
8952 [ALC882_TARGA] = "targa",
8953 [ALC882_ASUS_A7J] = "asus-a7j",
8954 [ALC882_ASUS_A7M] = "asus-a7m",
8955 [ALC885_MACPRO] = "macpro",
8956 [ALC885_MB5] = "mb5",
8957 [ALC885_MBP3] = "mbp3",
8958 [ALC885_IMAC24] = "imac24",
8959 [ALC885_IMAC91] = "imac91",
8960 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8961 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8962 [ALC883_3ST_6ch] = "3stack-6ch",
8963 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8964 [ALC883_TARGA_DIG] = "targa-dig",
8965 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8966 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8967 [ALC883_ACER] = "acer",
8968 [ALC883_ACER_ASPIRE] = "acer-aspire",
8969 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8970 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8971 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8972 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8973 [ALC883_MEDION] = "medion",
8974 [ALC883_MEDION_MD2] = "medion-md2",
8975 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8976 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8977 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8978 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8979 [ALC888_LENOVO_SKY] = "lenovo-sky",
8980 [ALC883_HAIER_W66] = "haier-w66",
8981 [ALC888_3ST_HP] = "3stack-hp",
8982 [ALC888_6ST_DELL] = "6stack-dell",
8983 [ALC883_MITAC] = "mitac",
8984 [ALC883_CLEVO_M540R] = "clevo-m540r",
8985 [ALC883_CLEVO_M720] = "clevo-m720",
8986 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
8987 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
8988 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
8989 [ALC889A_INTEL] = "intel-alc889a",
8990 [ALC889_INTEL] = "intel-x58",
8991 [ALC1200_ASUS_P5Q] = "asus-p5q",
8992 [ALC889A_MB31] = "mb31",
8993 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
8994 [ALC882_AUTO] = "auto",
8997 static struct snd_pci_quirk alc882_cfg_tbl[] = {
8998 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9000 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9001 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9002 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9003 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9004 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9005 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9006 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9007 ALC888_ACER_ASPIRE_4930G),
9008 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9009 ALC888_ACER_ASPIRE_4930G),
9010 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9011 ALC888_ACER_ASPIRE_8930G),
9012 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9013 ALC888_ACER_ASPIRE_8930G),
9014 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9015 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9016 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9017 ALC888_ACER_ASPIRE_6530G),
9018 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9019 ALC888_ACER_ASPIRE_6530G),
9020 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9021 ALC888_ACER_ASPIRE_7730G),
9022 /* default Acer -- disabled as it causes more problems.
9023 * model=auto should work fine now
9025 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9027 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9029 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9030 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9031 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9032 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9033 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9034 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9036 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9037 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9038 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9039 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9040 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9041 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9042 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9043 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9044 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9045 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9046 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9048 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9049 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9050 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9051 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9052 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9053 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9054 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9055 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9056 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9058 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9059 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9060 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9061 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9062 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9063 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9064 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9065 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9066 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9067 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9068 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9069 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9070 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9071 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9072 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9073 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9074 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9075 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9076 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9077 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9080 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9081 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9082 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9083 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9084 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9085 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9086 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9088 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9089 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9090 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9091 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9092 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9093 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9094 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9095 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9096 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9097 ALC883_FUJITSU_PI2515),
9098 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9099 ALC888_FUJITSU_XA3530),
9100 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9101 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9102 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9103 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9104 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9105 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9106 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9107 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9108 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9110 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9111 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9112 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9113 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9114 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9115 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9116 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9121 /* codec SSID table for Intel Mac */
9122 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9123 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9124 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9125 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9126 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9127 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9128 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9129 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9130 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9131 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9132 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9133 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9134 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9135 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9136 * so apparently no perfect solution yet
9138 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9139 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9143 static struct alc_config_preset alc882_presets[] = {
9144 [ALC882_3ST_DIG] = {
9145 .mixers = { alc882_base_mixer },
9146 .init_verbs = { alc882_base_init_verbs,
9147 alc882_adc1_init_verbs },
9148 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9149 .dac_nids = alc882_dac_nids,
9150 .dig_out_nid = ALC882_DIGOUT_NID,
9151 .dig_in_nid = ALC882_DIGIN_NID,
9152 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9153 .channel_mode = alc882_ch_modes,
9155 .input_mux = &alc882_capture_source,
9157 [ALC882_6ST_DIG] = {
9158 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9159 .init_verbs = { alc882_base_init_verbs,
9160 alc882_adc1_init_verbs },
9161 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9162 .dac_nids = alc882_dac_nids,
9163 .dig_out_nid = ALC882_DIGOUT_NID,
9164 .dig_in_nid = ALC882_DIGIN_NID,
9165 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9166 .channel_mode = alc882_sixstack_modes,
9167 .input_mux = &alc882_capture_source,
9170 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9171 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9172 alc882_eapd_verbs },
9173 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9174 .dac_nids = alc882_dac_nids,
9175 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9176 .channel_mode = alc882_sixstack_modes,
9177 .input_mux = &alc882_capture_source,
9180 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9181 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9182 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9183 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9184 .dac_nids = alc882_dac_nids,
9185 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9186 .channel_mode = alc880_threestack_modes,
9188 .input_mux = &alc882_capture_source,
9189 .dig_out_nid = ALC882_DIGOUT_NID,
9192 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9193 .init_verbs = { alc885_mbp3_init_verbs,
9194 alc880_gpio1_init_verbs },
9196 .dac_nids = alc882_dac_nids,
9198 .channel_mode = alc885_mbp_4ch_modes,
9199 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9200 .input_mux = &alc882_capture_source,
9201 .dig_out_nid = ALC882_DIGOUT_NID,
9202 .dig_in_nid = ALC882_DIGIN_NID,
9203 .unsol_event = alc_automute_amp_unsol_event,
9204 .setup = alc885_mbp3_setup,
9205 .init_hook = alc_automute_amp,
9208 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9209 .init_verbs = { alc885_mb5_init_verbs,
9210 alc880_gpio1_init_verbs },
9211 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9212 .dac_nids = alc882_dac_nids,
9213 .channel_mode = alc885_mb5_6ch_modes,
9214 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9215 .input_mux = &mb5_capture_source,
9216 .dig_out_nid = ALC882_DIGOUT_NID,
9217 .dig_in_nid = ALC882_DIGIN_NID,
9220 .mixers = { alc882_macpro_mixer },
9221 .init_verbs = { alc882_macpro_init_verbs },
9222 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9223 .dac_nids = alc882_dac_nids,
9224 .dig_out_nid = ALC882_DIGOUT_NID,
9225 .dig_in_nid = ALC882_DIGIN_NID,
9226 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9227 .channel_mode = alc882_ch_modes,
9228 .input_mux = &alc882_capture_source,
9229 .init_hook = alc885_macpro_init_hook,
9232 .mixers = { alc885_imac24_mixer },
9233 .init_verbs = { alc885_imac24_init_verbs },
9234 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9235 .dac_nids = alc882_dac_nids,
9236 .dig_out_nid = ALC882_DIGOUT_NID,
9237 .dig_in_nid = ALC882_DIGIN_NID,
9238 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9239 .channel_mode = alc882_ch_modes,
9240 .input_mux = &alc882_capture_source,
9241 .unsol_event = alc_automute_amp_unsol_event,
9242 .setup = alc885_imac24_setup,
9243 .init_hook = alc885_imac24_init_hook,
9246 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9247 .init_verbs = { alc885_imac91_init_verbs,
9248 alc880_gpio1_init_verbs },
9249 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9250 .dac_nids = alc882_dac_nids,
9251 .channel_mode = alc885_mbp_4ch_modes,
9252 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9253 .input_mux = &alc882_capture_source,
9254 .dig_out_nid = ALC882_DIGOUT_NID,
9255 .dig_in_nid = ALC882_DIGIN_NID,
9256 .unsol_event = alc885_imac91_unsol_event,
9257 .init_hook = alc885_imac91_automute,
9260 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9261 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9262 alc880_gpio3_init_verbs, alc882_targa_verbs},
9263 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9264 .dac_nids = alc882_dac_nids,
9265 .dig_out_nid = ALC882_DIGOUT_NID,
9266 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9267 .adc_nids = alc882_adc_nids,
9268 .capsrc_nids = alc882_capsrc_nids,
9269 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9270 .channel_mode = alc882_3ST_6ch_modes,
9272 .input_mux = &alc882_capture_source,
9273 .unsol_event = alc882_targa_unsol_event,
9274 .setup = alc882_targa_setup,
9275 .init_hook = alc882_targa_automute,
9277 [ALC882_ASUS_A7J] = {
9278 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9279 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9280 alc882_asus_a7j_verbs},
9281 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9282 .dac_nids = alc882_dac_nids,
9283 .dig_out_nid = ALC882_DIGOUT_NID,
9284 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9285 .adc_nids = alc882_adc_nids,
9286 .capsrc_nids = alc882_capsrc_nids,
9287 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9288 .channel_mode = alc882_3ST_6ch_modes,
9290 .input_mux = &alc882_capture_source,
9292 [ALC882_ASUS_A7M] = {
9293 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9294 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9295 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9296 alc882_asus_a7m_verbs },
9297 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9298 .dac_nids = alc882_dac_nids,
9299 .dig_out_nid = ALC882_DIGOUT_NID,
9300 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9301 .channel_mode = alc880_threestack_modes,
9303 .input_mux = &alc882_capture_source,
9305 [ALC883_3ST_2ch_DIG] = {
9306 .mixers = { alc883_3ST_2ch_mixer },
9307 .init_verbs = { alc883_init_verbs },
9308 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9309 .dac_nids = alc883_dac_nids,
9310 .dig_out_nid = ALC883_DIGOUT_NID,
9311 .dig_in_nid = ALC883_DIGIN_NID,
9312 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9313 .channel_mode = alc883_3ST_2ch_modes,
9314 .input_mux = &alc883_capture_source,
9316 [ALC883_3ST_6ch_DIG] = {
9317 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9318 .init_verbs = { alc883_init_verbs },
9319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9320 .dac_nids = alc883_dac_nids,
9321 .dig_out_nid = ALC883_DIGOUT_NID,
9322 .dig_in_nid = ALC883_DIGIN_NID,
9323 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9324 .channel_mode = alc883_3ST_6ch_modes,
9326 .input_mux = &alc883_capture_source,
9328 [ALC883_3ST_6ch] = {
9329 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9330 .init_verbs = { alc883_init_verbs },
9331 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9332 .dac_nids = alc883_dac_nids,
9333 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9334 .channel_mode = alc883_3ST_6ch_modes,
9336 .input_mux = &alc883_capture_source,
9338 [ALC883_3ST_6ch_INTEL] = {
9339 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9340 .init_verbs = { alc883_init_verbs },
9341 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9342 .dac_nids = alc883_dac_nids,
9343 .dig_out_nid = ALC883_DIGOUT_NID,
9344 .dig_in_nid = ALC883_DIGIN_NID,
9345 .slave_dig_outs = alc883_slave_dig_outs,
9346 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9347 .channel_mode = alc883_3ST_6ch_intel_modes,
9349 .input_mux = &alc883_3stack_6ch_intel,
9352 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9353 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9354 alc_hp15_unsol_verbs },
9355 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9356 .dac_nids = alc883_dac_nids,
9357 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9358 .adc_nids = alc889_adc_nids,
9359 .dig_out_nid = ALC883_DIGOUT_NID,
9360 .dig_in_nid = ALC883_DIGIN_NID,
9361 .slave_dig_outs = alc883_slave_dig_outs,
9362 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9363 .channel_mode = alc889_8ch_intel_modes,
9364 .capsrc_nids = alc889_capsrc_nids,
9365 .input_mux = &alc889_capture_source,
9366 .setup = alc889_automute_setup,
9367 .init_hook = alc_automute_amp,
9368 .unsol_event = alc_automute_amp_unsol_event,
9372 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9373 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9374 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9375 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9376 .dac_nids = alc883_dac_nids,
9377 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9378 .adc_nids = alc889_adc_nids,
9379 .dig_out_nid = ALC883_DIGOUT_NID,
9380 .dig_in_nid = ALC883_DIGIN_NID,
9381 .slave_dig_outs = alc883_slave_dig_outs,
9382 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9383 .channel_mode = alc889_8ch_intel_modes,
9384 .capsrc_nids = alc889_capsrc_nids,
9385 .input_mux = &alc889_capture_source,
9386 .setup = alc889_automute_setup,
9387 .init_hook = alc889_intel_init_hook,
9388 .unsol_event = alc_automute_amp_unsol_event,
9391 [ALC883_6ST_DIG] = {
9392 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9393 .init_verbs = { alc883_init_verbs },
9394 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9395 .dac_nids = alc883_dac_nids,
9396 .dig_out_nid = ALC883_DIGOUT_NID,
9397 .dig_in_nid = ALC883_DIGIN_NID,
9398 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9399 .channel_mode = alc883_sixstack_modes,
9400 .input_mux = &alc883_capture_source,
9402 [ALC883_TARGA_DIG] = {
9403 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9404 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9405 alc883_targa_verbs},
9406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9407 .dac_nids = alc883_dac_nids,
9408 .dig_out_nid = ALC883_DIGOUT_NID,
9409 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9410 .channel_mode = alc883_3ST_6ch_modes,
9412 .input_mux = &alc883_capture_source,
9413 .unsol_event = alc883_targa_unsol_event,
9414 .setup = alc882_targa_setup,
9415 .init_hook = alc882_targa_automute,
9417 [ALC883_TARGA_2ch_DIG] = {
9418 .mixers = { alc883_targa_2ch_mixer},
9419 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9420 alc883_targa_verbs},
9421 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9422 .dac_nids = alc883_dac_nids,
9423 .adc_nids = alc883_adc_nids_alt,
9424 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9425 .capsrc_nids = alc883_capsrc_nids,
9426 .dig_out_nid = ALC883_DIGOUT_NID,
9427 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9428 .channel_mode = alc883_3ST_2ch_modes,
9429 .input_mux = &alc883_capture_source,
9430 .unsol_event = alc883_targa_unsol_event,
9431 .setup = alc882_targa_setup,
9432 .init_hook = alc882_targa_automute,
9434 [ALC883_TARGA_8ch_DIG] = {
9435 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9436 alc883_chmode_mixer },
9437 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9438 alc883_targa_verbs },
9439 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9440 .dac_nids = alc883_dac_nids,
9441 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9442 .adc_nids = alc883_adc_nids_rev,
9443 .capsrc_nids = alc883_capsrc_nids_rev,
9444 .dig_out_nid = ALC883_DIGOUT_NID,
9445 .dig_in_nid = ALC883_DIGIN_NID,
9446 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9447 .channel_mode = alc883_4ST_8ch_modes,
9449 .input_mux = &alc883_capture_source,
9450 .unsol_event = alc883_targa_unsol_event,
9451 .setup = alc882_targa_setup,
9452 .init_hook = alc882_targa_automute,
9455 .mixers = { alc883_base_mixer },
9456 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9457 * and the headphone jack. Turn this on and rely on the
9458 * standard mute methods whenever the user wants to turn
9459 * these outputs off.
9461 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9462 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9463 .dac_nids = alc883_dac_nids,
9464 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9465 .channel_mode = alc883_3ST_2ch_modes,
9466 .input_mux = &alc883_capture_source,
9468 [ALC883_ACER_ASPIRE] = {
9469 .mixers = { alc883_acer_aspire_mixer },
9470 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9471 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9472 .dac_nids = alc883_dac_nids,
9473 .dig_out_nid = ALC883_DIGOUT_NID,
9474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9475 .channel_mode = alc883_3ST_2ch_modes,
9476 .input_mux = &alc883_capture_source,
9477 .unsol_event = alc_automute_amp_unsol_event,
9478 .setup = alc883_acer_aspire_setup,
9479 .init_hook = alc_automute_amp,
9481 [ALC888_ACER_ASPIRE_4930G] = {
9482 .mixers = { alc888_base_mixer,
9483 alc883_chmode_mixer },
9484 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9485 alc888_acer_aspire_4930g_verbs },
9486 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9487 .dac_nids = alc883_dac_nids,
9488 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9489 .adc_nids = alc883_adc_nids_rev,
9490 .capsrc_nids = alc883_capsrc_nids_rev,
9491 .dig_out_nid = ALC883_DIGOUT_NID,
9492 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9493 .channel_mode = alc883_3ST_6ch_modes,
9496 ARRAY_SIZE(alc888_2_capture_sources),
9497 .input_mux = alc888_2_capture_sources,
9498 .unsol_event = alc_automute_amp_unsol_event,
9499 .setup = alc888_acer_aspire_4930g_setup,
9500 .init_hook = alc_automute_amp,
9502 [ALC888_ACER_ASPIRE_6530G] = {
9503 .mixers = { alc888_acer_aspire_6530_mixer },
9504 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9505 alc888_acer_aspire_6530g_verbs },
9506 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9507 .dac_nids = alc883_dac_nids,
9508 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9509 .adc_nids = alc883_adc_nids_rev,
9510 .capsrc_nids = alc883_capsrc_nids_rev,
9511 .dig_out_nid = ALC883_DIGOUT_NID,
9512 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9513 .channel_mode = alc883_3ST_2ch_modes,
9515 ARRAY_SIZE(alc888_2_capture_sources),
9516 .input_mux = alc888_acer_aspire_6530_sources,
9517 .unsol_event = alc_automute_amp_unsol_event,
9518 .setup = alc888_acer_aspire_6530g_setup,
9519 .init_hook = alc_automute_amp,
9521 [ALC888_ACER_ASPIRE_8930G] = {
9522 .mixers = { alc889_acer_aspire_8930g_mixer,
9523 alc883_chmode_mixer },
9524 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9525 alc889_acer_aspire_8930g_verbs,
9527 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9528 .dac_nids = alc883_dac_nids,
9529 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9530 .adc_nids = alc889_adc_nids,
9531 .capsrc_nids = alc889_capsrc_nids,
9532 .dig_out_nid = ALC883_DIGOUT_NID,
9533 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9534 .channel_mode = alc883_3ST_6ch_modes,
9536 .const_channel_count = 6,
9538 ARRAY_SIZE(alc889_capture_sources),
9539 .input_mux = alc889_capture_sources,
9540 .unsol_event = alc_automute_amp_unsol_event,
9541 .setup = alc889_acer_aspire_8930g_setup,
9542 .init_hook = alc_automute_amp,
9543 #ifdef CONFIG_SND_HDA_POWER_SAVE
9544 .power_hook = alc889_power_eapd,
9547 [ALC888_ACER_ASPIRE_7730G] = {
9548 .mixers = { alc883_3ST_6ch_mixer,
9549 alc883_chmode_mixer },
9550 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9551 alc888_acer_aspire_7730G_verbs },
9552 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9553 .dac_nids = alc883_dac_nids,
9554 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9555 .adc_nids = alc883_adc_nids_rev,
9556 .capsrc_nids = alc883_capsrc_nids_rev,
9557 .dig_out_nid = ALC883_DIGOUT_NID,
9558 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9559 .channel_mode = alc883_3ST_6ch_modes,
9561 .const_channel_count = 6,
9562 .input_mux = &alc883_capture_source,
9563 .unsol_event = alc_automute_amp_unsol_event,
9564 .setup = alc888_acer_aspire_6530g_setup,
9565 .init_hook = alc_automute_amp,
9568 .mixers = { alc883_fivestack_mixer,
9569 alc883_chmode_mixer },
9570 .init_verbs = { alc883_init_verbs,
9571 alc883_medion_eapd_verbs },
9572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9573 .dac_nids = alc883_dac_nids,
9574 .adc_nids = alc883_adc_nids_alt,
9575 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9576 .capsrc_nids = alc883_capsrc_nids,
9577 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9578 .channel_mode = alc883_sixstack_modes,
9579 .input_mux = &alc883_capture_source,
9581 [ALC883_MEDION_MD2] = {
9582 .mixers = { alc883_medion_md2_mixer},
9583 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9584 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9585 .dac_nids = alc883_dac_nids,
9586 .dig_out_nid = ALC883_DIGOUT_NID,
9587 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9588 .channel_mode = alc883_3ST_2ch_modes,
9589 .input_mux = &alc883_capture_source,
9590 .unsol_event = alc_automute_amp_unsol_event,
9591 .setup = alc883_medion_md2_setup,
9592 .init_hook = alc_automute_amp,
9594 [ALC883_LAPTOP_EAPD] = {
9595 .mixers = { alc883_base_mixer },
9596 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9597 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9598 .dac_nids = alc883_dac_nids,
9599 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9600 .channel_mode = alc883_3ST_2ch_modes,
9601 .input_mux = &alc883_capture_source,
9603 [ALC883_CLEVO_M540R] = {
9604 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9605 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9606 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9607 .dac_nids = alc883_dac_nids,
9608 .dig_out_nid = ALC883_DIGOUT_NID,
9609 .dig_in_nid = ALC883_DIGIN_NID,
9610 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9611 .channel_mode = alc883_3ST_6ch_clevo_modes,
9613 .input_mux = &alc883_capture_source,
9614 /* This machine has the hardware HP auto-muting, thus
9615 * we need no software mute via unsol event
9618 [ALC883_CLEVO_M720] = {
9619 .mixers = { alc883_clevo_m720_mixer },
9620 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9621 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9622 .dac_nids = alc883_dac_nids,
9623 .dig_out_nid = ALC883_DIGOUT_NID,
9624 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9625 .channel_mode = alc883_3ST_2ch_modes,
9626 .input_mux = &alc883_capture_source,
9627 .unsol_event = alc883_clevo_m720_unsol_event,
9628 .setup = alc883_clevo_m720_setup,
9629 .init_hook = alc883_clevo_m720_init_hook,
9631 [ALC883_LENOVO_101E_2ch] = {
9632 .mixers = { alc883_lenovo_101e_2ch_mixer},
9633 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9634 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9635 .dac_nids = alc883_dac_nids,
9636 .adc_nids = alc883_adc_nids_alt,
9637 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9638 .capsrc_nids = alc883_capsrc_nids,
9639 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9640 .channel_mode = alc883_3ST_2ch_modes,
9641 .input_mux = &alc883_lenovo_101e_capture_source,
9642 .unsol_event = alc883_lenovo_101e_unsol_event,
9643 .init_hook = alc883_lenovo_101e_all_automute,
9645 [ALC883_LENOVO_NB0763] = {
9646 .mixers = { alc883_lenovo_nb0763_mixer },
9647 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9648 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9649 .dac_nids = alc883_dac_nids,
9650 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9651 .channel_mode = alc883_3ST_2ch_modes,
9653 .input_mux = &alc883_lenovo_nb0763_capture_source,
9654 .unsol_event = alc_automute_amp_unsol_event,
9655 .setup = alc883_medion_md2_setup,
9656 .init_hook = alc_automute_amp,
9658 [ALC888_LENOVO_MS7195_DIG] = {
9659 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9660 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9661 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9662 .dac_nids = alc883_dac_nids,
9663 .dig_out_nid = ALC883_DIGOUT_NID,
9664 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9665 .channel_mode = alc883_3ST_6ch_modes,
9667 .input_mux = &alc883_capture_source,
9668 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9669 .init_hook = alc888_lenovo_ms7195_front_automute,
9671 [ALC883_HAIER_W66] = {
9672 .mixers = { alc883_targa_2ch_mixer},
9673 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9674 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9675 .dac_nids = alc883_dac_nids,
9676 .dig_out_nid = ALC883_DIGOUT_NID,
9677 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9678 .channel_mode = alc883_3ST_2ch_modes,
9679 .input_mux = &alc883_capture_source,
9680 .unsol_event = alc_automute_amp_unsol_event,
9681 .setup = alc883_haier_w66_setup,
9682 .init_hook = alc_automute_amp,
9685 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9686 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9687 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9688 .dac_nids = alc883_dac_nids,
9689 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9690 .channel_mode = alc888_3st_hp_modes,
9692 .input_mux = &alc883_capture_source,
9693 .unsol_event = alc_automute_amp_unsol_event,
9694 .setup = alc888_3st_hp_setup,
9695 .init_hook = alc_automute_amp,
9697 [ALC888_6ST_DELL] = {
9698 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9699 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9700 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9701 .dac_nids = alc883_dac_nids,
9702 .dig_out_nid = ALC883_DIGOUT_NID,
9703 .dig_in_nid = ALC883_DIGIN_NID,
9704 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9705 .channel_mode = alc883_sixstack_modes,
9706 .input_mux = &alc883_capture_source,
9707 .unsol_event = alc_automute_amp_unsol_event,
9708 .setup = alc888_6st_dell_setup,
9709 .init_hook = alc_automute_amp,
9712 .mixers = { alc883_mitac_mixer },
9713 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9714 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9715 .dac_nids = alc883_dac_nids,
9716 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9717 .channel_mode = alc883_3ST_2ch_modes,
9718 .input_mux = &alc883_capture_source,
9719 .unsol_event = alc_automute_amp_unsol_event,
9720 .setup = alc883_mitac_setup,
9721 .init_hook = alc_automute_amp,
9723 [ALC883_FUJITSU_PI2515] = {
9724 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9725 .init_verbs = { alc883_init_verbs,
9726 alc883_2ch_fujitsu_pi2515_verbs},
9727 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9728 .dac_nids = alc883_dac_nids,
9729 .dig_out_nid = ALC883_DIGOUT_NID,
9730 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9731 .channel_mode = alc883_3ST_2ch_modes,
9732 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9733 .unsol_event = alc_automute_amp_unsol_event,
9734 .setup = alc883_2ch_fujitsu_pi2515_setup,
9735 .init_hook = alc_automute_amp,
9737 [ALC888_FUJITSU_XA3530] = {
9738 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9739 .init_verbs = { alc883_init_verbs,
9740 alc888_fujitsu_xa3530_verbs },
9741 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9742 .dac_nids = alc883_dac_nids,
9743 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9744 .adc_nids = alc883_adc_nids_rev,
9745 .capsrc_nids = alc883_capsrc_nids_rev,
9746 .dig_out_nid = ALC883_DIGOUT_NID,
9747 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9748 .channel_mode = alc888_4ST_8ch_intel_modes,
9750 ARRAY_SIZE(alc888_2_capture_sources),
9751 .input_mux = alc888_2_capture_sources,
9752 .unsol_event = alc_automute_amp_unsol_event,
9753 .setup = alc888_fujitsu_xa3530_setup,
9754 .init_hook = alc_automute_amp,
9756 [ALC888_LENOVO_SKY] = {
9757 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9758 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9759 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9760 .dac_nids = alc883_dac_nids,
9761 .dig_out_nid = ALC883_DIGOUT_NID,
9762 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9763 .channel_mode = alc883_sixstack_modes,
9765 .input_mux = &alc883_lenovo_sky_capture_source,
9766 .unsol_event = alc_automute_amp_unsol_event,
9767 .setup = alc888_lenovo_sky_setup,
9768 .init_hook = alc_automute_amp,
9770 [ALC888_ASUS_M90V] = {
9771 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9772 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9773 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9774 .dac_nids = alc883_dac_nids,
9775 .dig_out_nid = ALC883_DIGOUT_NID,
9776 .dig_in_nid = ALC883_DIGIN_NID,
9777 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9778 .channel_mode = alc883_3ST_6ch_modes,
9780 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9781 .unsol_event = alc_sku_unsol_event,
9782 .setup = alc883_mode2_setup,
9783 .init_hook = alc_inithook,
9785 [ALC888_ASUS_EEE1601] = {
9786 .mixers = { alc883_asus_eee1601_mixer },
9787 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9788 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9789 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9790 .dac_nids = alc883_dac_nids,
9791 .dig_out_nid = ALC883_DIGOUT_NID,
9792 .dig_in_nid = ALC883_DIGIN_NID,
9793 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9794 .channel_mode = alc883_3ST_2ch_modes,
9796 .input_mux = &alc883_asus_eee1601_capture_source,
9797 .unsol_event = alc_sku_unsol_event,
9798 .init_hook = alc883_eee1601_inithook,
9800 [ALC1200_ASUS_P5Q] = {
9801 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9802 .init_verbs = { alc883_init_verbs },
9803 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9804 .dac_nids = alc883_dac_nids,
9805 .dig_out_nid = ALC1200_DIGOUT_NID,
9806 .dig_in_nid = ALC883_DIGIN_NID,
9807 .slave_dig_outs = alc1200_slave_dig_outs,
9808 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9809 .channel_mode = alc883_sixstack_modes,
9810 .input_mux = &alc883_capture_source,
9813 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9814 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9815 alc880_gpio1_init_verbs },
9816 .adc_nids = alc883_adc_nids,
9817 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9818 .capsrc_nids = alc883_capsrc_nids,
9819 .dac_nids = alc883_dac_nids,
9820 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9821 .channel_mode = alc889A_mb31_6ch_modes,
9822 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9823 .input_mux = &alc889A_mb31_capture_source,
9824 .dig_out_nid = ALC883_DIGOUT_NID,
9825 .unsol_event = alc889A_mb31_unsol_event,
9826 .init_hook = alc889A_mb31_automute,
9828 [ALC883_SONY_VAIO_TT] = {
9829 .mixers = { alc883_vaiott_mixer },
9830 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9831 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9832 .dac_nids = alc883_dac_nids,
9833 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9834 .channel_mode = alc883_3ST_2ch_modes,
9835 .input_mux = &alc883_capture_source,
9836 .unsol_event = alc_automute_amp_unsol_event,
9837 .setup = alc883_vaiott_setup,
9838 .init_hook = alc_automute_amp,
9847 PINFIX_ABIT_AW9D_MAX
9850 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9851 { 0x15, 0x01080104 }, /* side */
9852 { 0x16, 0x01011012 }, /* rear */
9853 { 0x17, 0x01016011 }, /* clfe */
9857 static const struct alc_fixup alc882_fixups[] = {
9858 [PINFIX_ABIT_AW9D_MAX] = {
9859 .pins = alc882_abit_aw9d_pinfix
9863 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9864 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9869 * BIOS auto configuration
9871 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9872 const struct auto_pin_cfg *cfg)
9874 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9877 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9878 hda_nid_t nid, int pin_type,
9882 struct alc_spec *spec = codec->spec;
9885 alc_set_pin_output(codec, nid, pin_type);
9886 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9889 idx = spec->multiout.dac_nids[dac_idx] - 2;
9890 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9894 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9896 struct alc_spec *spec = codec->spec;
9899 for (i = 0; i <= HDA_SIDE; i++) {
9900 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9901 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9903 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9908 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9910 struct alc_spec *spec = codec->spec;
9913 pin = spec->autocfg.hp_pins[0];
9914 if (pin) /* connect to front */
9916 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9917 pin = spec->autocfg.speaker_pins[0];
9919 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9922 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9924 struct alc_spec *spec = codec->spec;
9927 for (i = 0; i < AUTO_PIN_LAST; i++) {
9928 hda_nid_t nid = spec->autocfg.input_pins[i];
9931 alc_set_input_pin(codec, nid, i);
9932 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9933 snd_hda_codec_write(codec, nid, 0,
9934 AC_VERB_SET_AMP_GAIN_MUTE,
9939 static void alc882_auto_init_input_src(struct hda_codec *codec)
9941 struct alc_spec *spec = codec->spec;
9944 for (c = 0; c < spec->num_adc_nids; c++) {
9945 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9946 hda_nid_t nid = spec->capsrc_nids[c];
9947 unsigned int mux_idx;
9948 const struct hda_input_mux *imux;
9949 int conns, mute, idx, item;
9951 conns = snd_hda_get_connections(codec, nid, conn_list,
9952 ARRAY_SIZE(conn_list));
9955 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9956 imux = &spec->input_mux[mux_idx];
9957 for (idx = 0; idx < conns; idx++) {
9958 /* if the current connection is the selected one,
9959 * unmute it as default - otherwise mute it
9961 mute = AMP_IN_MUTE(idx);
9962 for (item = 0; item < imux->num_items; item++) {
9963 if (imux->items[item].index == idx) {
9964 if (spec->cur_mux[c] == item)
9965 mute = AMP_IN_UNMUTE(idx);
9969 /* check if we have a selector or mixer
9970 * we could check for the widget type instead, but
9971 * just check for Amp-In presence (in case of mixer
9972 * without amp-in there is something wrong, this
9973 * function shouldn't be used or capsrc nid is wrong)
9975 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9976 snd_hda_codec_write(codec, nid, 0,
9977 AC_VERB_SET_AMP_GAIN_MUTE,
9979 else if (mute != AMP_IN_MUTE(idx))
9980 snd_hda_codec_write(codec, nid, 0,
9981 AC_VERB_SET_CONNECT_SEL,
9987 /* add mic boosts if needed */
9988 static int alc_auto_add_mic_boost(struct hda_codec *codec)
9990 struct alc_spec *spec = codec->spec;
9994 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
9995 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
9996 err = add_control(spec, ALC_CTL_WIDGET_VOL,
9998 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10002 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10003 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10004 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10006 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10013 /* almost identical with ALC880 parser... */
10014 static int alc882_parse_auto_config(struct hda_codec *codec)
10016 struct alc_spec *spec = codec->spec;
10017 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10020 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10024 if (!spec->autocfg.line_outs)
10025 return 0; /* can't find valid BIOS pin config */
10027 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10030 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10033 err = alc880_auto_create_extra_out(spec,
10034 spec->autocfg.speaker_pins[0],
10038 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10042 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10046 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10048 /* check multiple SPDIF-out (for recent codecs) */
10049 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10051 err = snd_hda_get_connections(codec,
10052 spec->autocfg.dig_out_pins[i],
10057 spec->multiout.dig_out_nid = dig_nid;
10059 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10060 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10062 spec->slave_dig_outs[i - 1] = dig_nid;
10065 if (spec->autocfg.dig_in_pin)
10066 spec->dig_in_nid = ALC880_DIGIN_NID;
10068 if (spec->kctls.list)
10069 add_mixer(spec, spec->kctls.list);
10071 add_verb(spec, alc883_auto_init_verbs);
10072 /* if ADC 0x07 is available, initialize it, too */
10073 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10074 add_verb(spec, alc882_adc1_init_verbs);
10076 spec->num_mux_defs = 1;
10077 spec->input_mux = &spec->private_imux[0];
10079 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10081 err = alc_auto_add_mic_boost(codec);
10085 return 1; /* config found */
10088 /* additional initialization for auto-configuration model */
10089 static void alc882_auto_init(struct hda_codec *codec)
10091 struct alc_spec *spec = codec->spec;
10092 alc882_auto_init_multi_out(codec);
10093 alc882_auto_init_hp_out(codec);
10094 alc882_auto_init_analog_input(codec);
10095 alc882_auto_init_input_src(codec);
10096 if (spec->unsol_event)
10097 alc_inithook(codec);
10100 static int patch_alc882(struct hda_codec *codec)
10102 struct alc_spec *spec;
10103 int err, board_config;
10105 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10109 codec->spec = spec;
10111 switch (codec->vendor_id) {
10116 /* ALC883 and variants */
10117 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10121 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10125 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10126 board_config = snd_hda_check_board_codec_sid_config(codec,
10127 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10129 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10130 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10132 board_config = ALC882_AUTO;
10135 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10137 if (board_config == ALC882_AUTO) {
10138 /* automatic parse from the BIOS config */
10139 err = alc882_parse_auto_config(codec);
10145 "hda_codec: Cannot set up configuration "
10146 "from BIOS. Using base mode...\n");
10147 board_config = ALC882_3ST_DIG;
10151 err = snd_hda_attach_beep_device(codec, 0x1);
10157 if (board_config != ALC882_AUTO)
10158 setup_preset(codec, &alc882_presets[board_config]);
10160 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10161 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10162 /* FIXME: setup DAC5 */
10163 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10164 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10166 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10167 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10169 if (codec->vendor_id == 0x10ec0888)
10170 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10172 if (!spec->adc_nids && spec->input_mux) {
10174 spec->num_adc_nids = 0;
10175 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10176 const struct hda_input_mux *imux = spec->input_mux;
10178 hda_nid_t items[16];
10179 hda_nid_t nid = alc882_adc_nids[i];
10180 unsigned int wcap = get_wcaps(codec, nid);
10182 wcap = get_wcaps_type(wcap);
10183 if (wcap != AC_WID_AUD_IN)
10185 spec->private_adc_nids[spec->num_adc_nids] = nid;
10186 err = snd_hda_get_connections(codec, nid, &cap, 1);
10189 err = snd_hda_get_connections(codec, cap, items,
10190 ARRAY_SIZE(items));
10193 for (j = 0; j < imux->num_items; j++)
10194 if (imux->items[j].index >= err)
10196 if (j < imux->num_items)
10198 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10199 spec->num_adc_nids++;
10201 spec->adc_nids = spec->private_adc_nids;
10202 spec->capsrc_nids = spec->private_capsrc_nids;
10205 set_capture_mixer(codec);
10206 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10208 spec->vmaster_nid = 0x0c;
10210 codec->patch_ops = alc_patch_ops;
10211 if (board_config == ALC882_AUTO)
10212 spec->init_hook = alc882_auto_init;
10213 #ifdef CONFIG_SND_HDA_POWER_SAVE
10214 if (!spec->loopback.amplist)
10215 spec->loopback.amplist = alc882_loopbacks;
10217 codec->proc_widget_hook = print_realtek_coef;
10227 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10228 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10230 #define alc262_dac_nids alc260_dac_nids
10231 #define alc262_adc_nids alc882_adc_nids
10232 #define alc262_adc_nids_alt alc882_adc_nids_alt
10233 #define alc262_capsrc_nids alc882_capsrc_nids
10234 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10236 #define alc262_modes alc260_modes
10237 #define alc262_capture_source alc882_capture_source
10239 static hda_nid_t alc262_dmic_adc_nids[1] = {
10244 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10246 static struct snd_kcontrol_new alc262_base_mixer[] = {
10247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10248 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10249 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10250 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10251 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10252 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10253 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10255 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10256 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10257 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10258 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10259 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10260 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10261 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10262 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10266 /* update HP, line and mono-out pins according to the master switch */
10267 static void alc262_hp_master_update(struct hda_codec *codec)
10269 struct alc_spec *spec = codec->spec;
10270 int val = spec->master_sw;
10272 /* HP & line-out */
10273 snd_hda_codec_write_cache(codec, 0x1b, 0,
10274 AC_VERB_SET_PIN_WIDGET_CONTROL,
10276 snd_hda_codec_write_cache(codec, 0x15, 0,
10277 AC_VERB_SET_PIN_WIDGET_CONTROL,
10279 /* mono (speaker) depending on the HP jack sense */
10280 val = val && !spec->jack_present;
10281 snd_hda_codec_write_cache(codec, 0x16, 0,
10282 AC_VERB_SET_PIN_WIDGET_CONTROL,
10283 val ? PIN_OUT : 0);
10286 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10288 struct alc_spec *spec = codec->spec;
10290 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10291 alc262_hp_master_update(codec);
10294 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10296 if ((res >> 26) != ALC880_HP_EVENT)
10298 alc262_hp_bpc_automute(codec);
10301 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10303 struct alc_spec *spec = codec->spec;
10305 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10306 alc262_hp_master_update(codec);
10309 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10312 if ((res >> 26) != ALC880_HP_EVENT)
10314 alc262_hp_wildwest_automute(codec);
10317 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10319 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10320 struct snd_ctl_elem_value *ucontrol)
10322 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10323 struct alc_spec *spec = codec->spec;
10324 int val = !!*ucontrol->value.integer.value;
10326 if (val == spec->master_sw)
10328 spec->master_sw = val;
10329 alc262_hp_master_update(codec);
10333 #define ALC262_HP_MASTER_SWITCH \
10335 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10336 .name = "Master Playback Switch", \
10337 .info = snd_ctl_boolean_mono_info, \
10338 .get = alc262_hp_master_sw_get, \
10339 .put = alc262_hp_master_sw_put, \
10342 .iface = NID_MAPPING, \
10343 .name = "Master Playback Switch", \
10344 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10348 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10349 ALC262_HP_MASTER_SWITCH,
10350 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10351 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10353 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10355 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10357 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10358 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10359 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10360 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10361 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10362 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10363 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10364 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10365 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10366 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10367 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10368 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10372 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10373 ALC262_HP_MASTER_SWITCH,
10374 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10375 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10376 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10377 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10378 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10380 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10382 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10384 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10385 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10386 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10387 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10388 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10392 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10393 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10394 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10395 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10399 /* mute/unmute internal speaker according to the hp jack and mute state */
10400 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10402 struct alc_spec *spec = codec->spec;
10404 spec->autocfg.hp_pins[0] = 0x15;
10405 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10408 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10409 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10410 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10411 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10412 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10415 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10419 static struct hda_verb alc262_hp_t5735_verbs[] = {
10420 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10423 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10427 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10428 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10429 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10430 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10432 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10433 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10437 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10438 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10439 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10440 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10441 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10442 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10443 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10445 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10447 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10451 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10458 /* bind hp and internal speaker mute (with plug check) as master switch */
10459 static void alc262_hippo_master_update(struct hda_codec *codec)
10461 struct alc_spec *spec = codec->spec;
10462 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10463 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10464 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10468 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10469 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10470 HDA_AMP_MUTE, mute);
10471 /* mute internal speaker per jack sense */
10472 if (spec->jack_present)
10473 mute = HDA_AMP_MUTE;
10475 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10476 HDA_AMP_MUTE, mute);
10477 if (speaker_nid && speaker_nid != line_nid)
10478 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10479 HDA_AMP_MUTE, mute);
10482 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10484 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10485 struct snd_ctl_elem_value *ucontrol)
10487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10488 struct alc_spec *spec = codec->spec;
10489 int val = !!*ucontrol->value.integer.value;
10491 if (val == spec->master_sw)
10493 spec->master_sw = val;
10494 alc262_hippo_master_update(codec);
10498 #define ALC262_HIPPO_MASTER_SWITCH \
10500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10501 .name = "Master Playback Switch", \
10502 .info = snd_ctl_boolean_mono_info, \
10503 .get = alc262_hippo_master_sw_get, \
10504 .put = alc262_hippo_master_sw_put, \
10507 .iface = NID_MAPPING, \
10508 .name = "Master Playback Switch", \
10509 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10510 (SUBDEV_SPEAKER(0) << 16), \
10513 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10514 ALC262_HIPPO_MASTER_SWITCH,
10515 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10518 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10519 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10520 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10521 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10522 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10523 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10524 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10525 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10526 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10530 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10531 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10532 ALC262_HIPPO_MASTER_SWITCH,
10533 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10534 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10535 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10536 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10537 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10538 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10540 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10541 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10542 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10546 /* mute/unmute internal speaker according to the hp jack and mute state */
10547 static void alc262_hippo_automute(struct hda_codec *codec)
10549 struct alc_spec *spec = codec->spec;
10550 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10552 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10553 alc262_hippo_master_update(codec);
10556 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10558 if ((res >> 26) != ALC880_HP_EVENT)
10560 alc262_hippo_automute(codec);
10563 static void alc262_hippo_setup(struct hda_codec *codec)
10565 struct alc_spec *spec = codec->spec;
10567 spec->autocfg.hp_pins[0] = 0x15;
10568 spec->autocfg.speaker_pins[0] = 0x14;
10571 static void alc262_hippo1_setup(struct hda_codec *codec)
10573 struct alc_spec *spec = codec->spec;
10575 spec->autocfg.hp_pins[0] = 0x1b;
10576 spec->autocfg.speaker_pins[0] = 0x14;
10580 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10581 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10582 ALC262_HIPPO_MASTER_SWITCH,
10583 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10584 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10585 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10586 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10590 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10591 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10592 ALC262_HIPPO_MASTER_SWITCH,
10593 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10594 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10595 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10596 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10597 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10601 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10602 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10603 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10604 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10605 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10606 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10607 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10608 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10609 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10610 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10611 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10612 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10613 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10617 static struct hda_verb alc262_tyan_verbs[] = {
10618 /* Headphone automute */
10619 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10621 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10623 /* P11 AUX_IN, white 4-pin connector */
10624 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10625 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10626 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10627 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10632 /* unsolicited event for HP jack sensing */
10633 static void alc262_tyan_setup(struct hda_codec *codec)
10635 struct alc_spec *spec = codec->spec;
10637 spec->autocfg.hp_pins[0] = 0x1b;
10638 spec->autocfg.speaker_pins[0] = 0x15;
10642 #define alc262_capture_mixer alc882_capture_mixer
10643 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10646 * generic initialization of ADC, input mixers and output mixers
10648 static struct hda_verb alc262_init_verbs[] = {
10650 * Unmute ADC0-2 and set the default input to mic-in
10652 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10653 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10654 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10655 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10656 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10657 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10659 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10661 * Note: PASD motherboards uses the Line In 2 as the input for
10662 * front panel mic (mic 2)
10664 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10665 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10666 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10667 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10668 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10669 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10672 * Set up output mixers (0x0c - 0x0e)
10674 /* set vol=0 to output mixers */
10675 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10676 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10677 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10678 /* set up input amps for analog loopback */
10679 /* Amp Indices: DAC = 0, mixer = 1 */
10680 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10682 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10683 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10684 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10685 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10687 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10689 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10690 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10691 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10692 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10695 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10696 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10697 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10698 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10700 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10701 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10703 /* FIXME: use matrix-type input source selection */
10704 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10705 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10706 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10707 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10708 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10709 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10711 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10712 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10713 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10714 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10716 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10719 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10724 static struct hda_verb alc262_eapd_verbs[] = {
10725 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10726 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10730 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10732 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10733 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10735 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10736 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10740 static struct hda_verb alc262_sony_unsol_verbs[] = {
10741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10742 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10743 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10745 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10746 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10750 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10751 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10752 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10753 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10754 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10755 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10759 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10760 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10763 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10764 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10765 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10766 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10767 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10771 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10773 struct alc_spec *spec = codec->spec;
10775 spec->autocfg.hp_pins[0] = 0x15;
10776 spec->autocfg.speaker_pins[0] = 0x14;
10777 spec->ext_mic.pin = 0x18;
10778 spec->ext_mic.mux_idx = 0;
10779 spec->int_mic.pin = 0x12;
10780 spec->int_mic.mux_idx = 9;
10781 spec->auto_mic = 1;
10787 * 0x16 = internal speaker
10788 * 0x18 = external mic
10791 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10792 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10793 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10797 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10799 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10800 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10804 static struct hda_verb alc262_nec_verbs[] = {
10805 /* Unmute Speaker */
10806 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10809 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10812 /* External mic to headphone */
10813 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10814 /* External mic to speaker */
10815 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10821 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10822 * 0x1b = port replicator headphone out
10825 #define ALC_HP_EVENT 0x37
10827 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10828 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10829 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10830 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10831 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10835 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10836 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10837 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10841 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10842 /* Front Mic pin: input vref at 50% */
10843 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10844 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10848 static struct hda_input_mux alc262_fujitsu_capture_source = {
10852 { "Int Mic", 0x1 },
10857 static struct hda_input_mux alc262_HP_capture_source = {
10861 { "Front Mic", 0x1 },
10868 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10872 { "Front Mic", 0x2 },
10878 /* mute/unmute internal speaker according to the hp jacks and mute state */
10879 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10881 struct alc_spec *spec = codec->spec;
10884 if (force || !spec->sense_updated) {
10885 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10886 snd_hda_jack_detect(codec, 0x1b);
10887 spec->sense_updated = 1;
10889 /* unmute internal speaker only if both HPs are unplugged and
10890 * master switch is on
10892 if (spec->jack_present)
10893 mute = HDA_AMP_MUTE;
10895 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10896 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10897 HDA_AMP_MUTE, mute);
10900 /* unsolicited event for HP jack sensing */
10901 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10904 if ((res >> 26) != ALC_HP_EVENT)
10906 alc262_fujitsu_automute(codec, 1);
10909 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10911 alc262_fujitsu_automute(codec, 1);
10914 /* bind volumes of both NID 0x0c and 0x0d */
10915 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10916 .ops = &snd_hda_bind_vol,
10918 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10919 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10924 /* mute/unmute internal speaker according to the hp jack and mute state */
10925 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10927 struct alc_spec *spec = codec->spec;
10930 if (force || !spec->sense_updated) {
10931 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10932 spec->sense_updated = 1;
10934 if (spec->jack_present) {
10935 /* mute internal speaker */
10936 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10937 HDA_AMP_MUTE, HDA_AMP_MUTE);
10938 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10939 HDA_AMP_MUTE, HDA_AMP_MUTE);
10941 /* unmute internal speaker if necessary */
10942 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10943 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10944 HDA_AMP_MUTE, mute);
10945 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10946 HDA_AMP_MUTE, mute);
10950 /* unsolicited event for HP jack sensing */
10951 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10954 if ((res >> 26) != ALC_HP_EVENT)
10956 alc262_lenovo_3000_automute(codec, 1);
10959 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10960 int dir, int idx, long *valp)
10964 for (i = 0; i < 2; i++, valp++)
10965 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10967 *valp ? 0 : HDA_AMP_MUTE);
10971 /* bind hp and internal speaker mute (with plug check) */
10972 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10973 struct snd_ctl_elem_value *ucontrol)
10975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10976 long *valp = ucontrol->value.integer.value;
10979 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10980 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
10982 alc262_fujitsu_automute(codec, 0);
10986 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
10987 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
10989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
10990 .name = "Master Playback Switch",
10991 .subdevice = HDA_SUBDEV_AMP_FLAG,
10992 .info = snd_hda_mixer_amp_switch_info,
10993 .get = snd_hda_mixer_amp_switch_get,
10994 .put = alc262_fujitsu_master_sw_put,
10995 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
10998 .iface = NID_MAPPING,
10999 .name = "Master Playback Switch",
11000 .private_value = 0x1b,
11002 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11003 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11004 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11005 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11006 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11007 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11008 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11009 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11013 /* bind hp and internal speaker mute (with plug check) */
11014 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11015 struct snd_ctl_elem_value *ucontrol)
11017 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11018 long *valp = ucontrol->value.integer.value;
11021 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11023 alc262_lenovo_3000_automute(codec, 0);
11027 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11028 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11030 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11031 .name = "Master Playback Switch",
11032 .subdevice = HDA_SUBDEV_AMP_FLAG,
11033 .info = snd_hda_mixer_amp_switch_info,
11034 .get = snd_hda_mixer_amp_switch_get,
11035 .put = alc262_lenovo_3000_master_sw_put,
11036 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11038 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11039 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11040 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11041 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11042 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11043 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11044 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11045 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11049 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11050 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11051 ALC262_HIPPO_MASTER_SWITCH,
11052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11054 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11057 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11061 /* additional init verbs for Benq laptops */
11062 static struct hda_verb alc262_EAPD_verbs[] = {
11063 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11064 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11068 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11070 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11072 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11073 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11077 /* Samsung Q1 Ultra Vista model setup */
11078 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11079 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11080 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11081 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11083 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11084 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11088 static struct hda_verb alc262_ultra_verbs[] = {
11090 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11091 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11092 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11095 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11096 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11097 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11099 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11101 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11102 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11103 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11105 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11106 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11107 /* ADC, choose mic */
11108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11109 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11110 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11111 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11115 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11116 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11117 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11121 /* mute/unmute internal speaker according to the hp jack and mute state */
11122 static void alc262_ultra_automute(struct hda_codec *codec)
11124 struct alc_spec *spec = codec->spec;
11128 /* auto-mute only when HP is used as HP */
11129 if (!spec->cur_mux[0]) {
11130 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11131 if (spec->jack_present)
11132 mute = HDA_AMP_MUTE;
11134 /* mute/unmute internal speaker */
11135 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11136 HDA_AMP_MUTE, mute);
11137 /* mute/unmute HP */
11138 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11139 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11142 /* unsolicited event for HP jack sensing */
11143 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11146 if ((res >> 26) != ALC880_HP_EVENT)
11148 alc262_ultra_automute(codec);
11151 static struct hda_input_mux alc262_ultra_capture_source = {
11155 { "Headphone", 0x7 },
11159 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11160 struct snd_ctl_elem_value *ucontrol)
11162 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11163 struct alc_spec *spec = codec->spec;
11166 ret = alc_mux_enum_put(kcontrol, ucontrol);
11169 /* reprogram the HP pin as mic or HP according to the input source */
11170 snd_hda_codec_write_cache(codec, 0x15, 0,
11171 AC_VERB_SET_PIN_WIDGET_CONTROL,
11172 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11173 alc262_ultra_automute(codec); /* mute/unmute HP */
11177 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11178 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11179 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11181 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11182 .name = "Capture Source",
11183 .info = alc_mux_enum_info,
11184 .get = alc_mux_enum_get,
11185 .put = alc262_ultra_mux_enum_put,
11188 .iface = NID_MAPPING,
11189 .name = "Capture Source",
11190 .private_value = 0x15,
11195 /* We use two mixers depending on the output pin; 0x16 is a mono output
11196 * and thus it's bound with a different mixer.
11197 * This function returns which mixer amp should be used.
11199 static int alc262_check_volbit(hda_nid_t nid)
11203 else if (nid == 0x16)
11209 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11210 const char *pfx, int *vbits)
11215 vbit = alc262_check_volbit(nid);
11218 if (*vbits & vbit) /* a volume control for this mixer already there */
11222 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11224 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11225 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11228 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11236 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11238 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11239 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11242 /* add playback controls from the parsed DAC table */
11243 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11244 const struct auto_pin_cfg *cfg)
11250 spec->multiout.num_dacs = 1; /* only use one dac */
11251 spec->multiout.dac_nids = spec->private_dac_nids;
11252 spec->multiout.dac_nids[0] = 2;
11254 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11256 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11260 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11263 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11266 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11270 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11271 alc262_check_volbit(cfg->speaker_pins[0]) |
11272 alc262_check_volbit(cfg->hp_pins[0]);
11273 if (vbits == 1 || vbits == 2)
11274 pfx = "Master"; /* only one mixer is used */
11275 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11280 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11283 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11287 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11294 #define alc262_auto_create_input_ctls \
11295 alc880_auto_create_input_ctls
11298 * generic initialization of ADC, input mixers and output mixers
11300 static struct hda_verb alc262_volume_init_verbs[] = {
11302 * Unmute ADC0-2 and set the default input to mic-in
11304 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11306 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11307 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11308 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11309 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11311 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11313 * Note: PASD motherboards uses the Line In 2 as the input for
11314 * front panel mic (mic 2)
11316 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11317 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11318 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11319 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11324 * Set up output mixers (0x0c - 0x0f)
11326 /* set vol=0 to output mixers */
11327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11329 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11331 /* set up input amps for analog loopback */
11332 /* Amp Indices: DAC = 0, mixer = 1 */
11333 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11334 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11335 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11336 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11337 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11338 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11340 /* FIXME: use matrix-type input source selection */
11341 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11342 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11343 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11344 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11345 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11346 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11348 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11350 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11351 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11356 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11361 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11363 * Unmute ADC0-2 and set the default input to mic-in
11365 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11366 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11367 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11369 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11370 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11372 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11374 * Note: PASD motherboards uses the Line In 2 as the input for
11375 * front panel mic (mic 2)
11377 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11378 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11379 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11380 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11381 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11382 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11383 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11384 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11387 * Set up output mixers (0x0c - 0x0e)
11389 /* set vol=0 to output mixers */
11390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11392 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11394 /* set up input amps for analog loopback */
11395 /* Amp Indices: DAC = 0, mixer = 1 */
11396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11400 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11401 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11403 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11404 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11405 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11407 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11410 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11413 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11414 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11415 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11416 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11417 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11419 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11420 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11422 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11423 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11424 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11427 /* FIXME: use matrix-type input source selection */
11428 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11429 /* Input mixer1: only unmute Mic */
11430 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11431 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11432 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11433 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11434 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11435 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11436 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11437 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11438 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11440 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11442 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11443 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11444 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11445 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11446 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11447 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11448 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11450 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11455 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11456 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11457 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11458 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11460 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11465 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11467 * Unmute ADC0-2 and set the default input to mic-in
11469 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11470 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11472 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11473 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11474 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11476 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11478 * Note: PASD motherboards uses the Line In 2 as the input for front
11479 * panel mic (mic 2)
11481 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11482 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11483 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11484 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11485 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11486 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11487 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11491 * Set up output mixers (0x0c - 0x0e)
11493 /* set vol=0 to output mixers */
11494 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11495 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11496 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11498 /* set up input amps for analog loopback */
11499 /* Amp Indices: DAC = 0, mixer = 1 */
11500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11501 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11503 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11505 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11508 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11509 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11510 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11511 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11512 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11514 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11516 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11517 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11519 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11520 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11522 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11523 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11524 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11526 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11527 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11529 /* FIXME: use matrix-type input source selection */
11530 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11531 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11536 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11537 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11538 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11540 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11541 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11542 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11543 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11544 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11545 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11548 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11549 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11550 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11553 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11556 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11561 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11563 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11564 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11567 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11568 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11569 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11570 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11572 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11573 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11574 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11579 #ifdef CONFIG_SND_HDA_POWER_SAVE
11580 #define alc262_loopbacks alc880_loopbacks
11583 /* pcm configuration: identical with ALC880 */
11584 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11585 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11586 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11587 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11590 * BIOS auto configuration
11592 static int alc262_parse_auto_config(struct hda_codec *codec)
11594 struct alc_spec *spec = codec->spec;
11596 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11598 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11602 if (!spec->autocfg.line_outs) {
11603 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11604 spec->multiout.max_channels = 2;
11605 spec->no_analog = 1;
11608 return 0; /* can't find valid BIOS pin config */
11610 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11613 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11617 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11620 if (spec->autocfg.dig_outs) {
11621 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11622 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11624 if (spec->autocfg.dig_in_pin)
11625 spec->dig_in_nid = ALC262_DIGIN_NID;
11627 if (spec->kctls.list)
11628 add_mixer(spec, spec->kctls.list);
11630 add_verb(spec, alc262_volume_init_verbs);
11631 spec->num_mux_defs = 1;
11632 spec->input_mux = &spec->private_imux[0];
11634 err = alc_auto_add_mic_boost(codec);
11638 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11643 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11644 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11645 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11646 #define alc262_auto_init_input_src alc882_auto_init_input_src
11649 /* init callback for auto-configuration model -- overriding the default init */
11650 static void alc262_auto_init(struct hda_codec *codec)
11652 struct alc_spec *spec = codec->spec;
11653 alc262_auto_init_multi_out(codec);
11654 alc262_auto_init_hp_out(codec);
11655 alc262_auto_init_analog_input(codec);
11656 alc262_auto_init_input_src(codec);
11657 if (spec->unsol_event)
11658 alc_inithook(codec);
11662 * configuration and preset
11664 static const char *alc262_models[ALC262_MODEL_LAST] = {
11665 [ALC262_BASIC] = "basic",
11666 [ALC262_HIPPO] = "hippo",
11667 [ALC262_HIPPO_1] = "hippo_1",
11668 [ALC262_FUJITSU] = "fujitsu",
11669 [ALC262_HP_BPC] = "hp-bpc",
11670 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11671 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11672 [ALC262_HP_RP5700] = "hp-rp5700",
11673 [ALC262_BENQ_ED8] = "benq",
11674 [ALC262_BENQ_T31] = "benq-t31",
11675 [ALC262_SONY_ASSAMD] = "sony-assamd",
11676 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11677 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11678 [ALC262_ULTRA] = "ultra",
11679 [ALC262_LENOVO_3000] = "lenovo-3000",
11680 [ALC262_NEC] = "nec",
11681 [ALC262_TYAN] = "tyan",
11682 [ALC262_AUTO] = "auto",
11685 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11686 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11687 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11688 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11690 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11692 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11694 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11695 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11696 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11697 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11698 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11699 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11700 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11701 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11702 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11703 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11704 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11705 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11706 ALC262_HP_TC_T5735),
11707 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11708 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11709 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11710 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11711 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11712 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11713 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11714 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11715 #if 0 /* disable the quirk since model=auto works better in recent versions */
11716 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11717 ALC262_SONY_ASSAMD),
11719 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11720 ALC262_TOSHIBA_RX1),
11721 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11722 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11723 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11724 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11725 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11727 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11728 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11729 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11730 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11731 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11735 static struct alc_config_preset alc262_presets[] = {
11737 .mixers = { alc262_base_mixer },
11738 .init_verbs = { alc262_init_verbs },
11739 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11740 .dac_nids = alc262_dac_nids,
11742 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11743 .channel_mode = alc262_modes,
11744 .input_mux = &alc262_capture_source,
11747 .mixers = { alc262_hippo_mixer },
11748 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11749 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11750 .dac_nids = alc262_dac_nids,
11752 .dig_out_nid = ALC262_DIGOUT_NID,
11753 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11754 .channel_mode = alc262_modes,
11755 .input_mux = &alc262_capture_source,
11756 .unsol_event = alc262_hippo_unsol_event,
11757 .setup = alc262_hippo_setup,
11758 .init_hook = alc262_hippo_automute,
11760 [ALC262_HIPPO_1] = {
11761 .mixers = { alc262_hippo1_mixer },
11762 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11763 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11764 .dac_nids = alc262_dac_nids,
11766 .dig_out_nid = ALC262_DIGOUT_NID,
11767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11768 .channel_mode = alc262_modes,
11769 .input_mux = &alc262_capture_source,
11770 .unsol_event = alc262_hippo_unsol_event,
11771 .setup = alc262_hippo1_setup,
11772 .init_hook = alc262_hippo_automute,
11774 [ALC262_FUJITSU] = {
11775 .mixers = { alc262_fujitsu_mixer },
11776 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11777 alc262_fujitsu_unsol_verbs },
11778 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11779 .dac_nids = alc262_dac_nids,
11781 .dig_out_nid = ALC262_DIGOUT_NID,
11782 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11783 .channel_mode = alc262_modes,
11784 .input_mux = &alc262_fujitsu_capture_source,
11785 .unsol_event = alc262_fujitsu_unsol_event,
11786 .init_hook = alc262_fujitsu_init_hook,
11788 [ALC262_HP_BPC] = {
11789 .mixers = { alc262_HP_BPC_mixer },
11790 .init_verbs = { alc262_HP_BPC_init_verbs },
11791 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11792 .dac_nids = alc262_dac_nids,
11794 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11795 .channel_mode = alc262_modes,
11796 .input_mux = &alc262_HP_capture_source,
11797 .unsol_event = alc262_hp_bpc_unsol_event,
11798 .init_hook = alc262_hp_bpc_automute,
11800 [ALC262_HP_BPC_D7000_WF] = {
11801 .mixers = { alc262_HP_BPC_WildWest_mixer },
11802 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11803 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11804 .dac_nids = alc262_dac_nids,
11806 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11807 .channel_mode = alc262_modes,
11808 .input_mux = &alc262_HP_D7000_capture_source,
11809 .unsol_event = alc262_hp_wildwest_unsol_event,
11810 .init_hook = alc262_hp_wildwest_automute,
11812 [ALC262_HP_BPC_D7000_WL] = {
11813 .mixers = { alc262_HP_BPC_WildWest_mixer,
11814 alc262_HP_BPC_WildWest_option_mixer },
11815 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11816 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11817 .dac_nids = alc262_dac_nids,
11819 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11820 .channel_mode = alc262_modes,
11821 .input_mux = &alc262_HP_D7000_capture_source,
11822 .unsol_event = alc262_hp_wildwest_unsol_event,
11823 .init_hook = alc262_hp_wildwest_automute,
11825 [ALC262_HP_TC_T5735] = {
11826 .mixers = { alc262_hp_t5735_mixer },
11827 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11828 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11829 .dac_nids = alc262_dac_nids,
11831 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11832 .channel_mode = alc262_modes,
11833 .input_mux = &alc262_capture_source,
11834 .unsol_event = alc_automute_amp_unsol_event,
11835 .setup = alc262_hp_t5735_setup,
11836 .init_hook = alc_automute_amp,
11838 [ALC262_HP_RP5700] = {
11839 .mixers = { alc262_hp_rp5700_mixer },
11840 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11841 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11842 .dac_nids = alc262_dac_nids,
11843 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11844 .channel_mode = alc262_modes,
11845 .input_mux = &alc262_hp_rp5700_capture_source,
11847 [ALC262_BENQ_ED8] = {
11848 .mixers = { alc262_base_mixer },
11849 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11850 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11851 .dac_nids = alc262_dac_nids,
11853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11854 .channel_mode = alc262_modes,
11855 .input_mux = &alc262_capture_source,
11857 [ALC262_SONY_ASSAMD] = {
11858 .mixers = { alc262_sony_mixer },
11859 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11860 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11861 .dac_nids = alc262_dac_nids,
11863 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11864 .channel_mode = alc262_modes,
11865 .input_mux = &alc262_capture_source,
11866 .unsol_event = alc262_hippo_unsol_event,
11867 .setup = alc262_hippo_setup,
11868 .init_hook = alc262_hippo_automute,
11870 [ALC262_BENQ_T31] = {
11871 .mixers = { alc262_benq_t31_mixer },
11872 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11873 alc_hp15_unsol_verbs },
11874 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11875 .dac_nids = alc262_dac_nids,
11877 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11878 .channel_mode = alc262_modes,
11879 .input_mux = &alc262_capture_source,
11880 .unsol_event = alc262_hippo_unsol_event,
11881 .setup = alc262_hippo_setup,
11882 .init_hook = alc262_hippo_automute,
11885 .mixers = { alc262_ultra_mixer },
11886 .cap_mixer = alc262_ultra_capture_mixer,
11887 .init_verbs = { alc262_ultra_verbs },
11888 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11889 .dac_nids = alc262_dac_nids,
11890 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11891 .channel_mode = alc262_modes,
11892 .input_mux = &alc262_ultra_capture_source,
11893 .adc_nids = alc262_adc_nids, /* ADC0 */
11894 .capsrc_nids = alc262_capsrc_nids,
11895 .num_adc_nids = 1, /* single ADC */
11896 .unsol_event = alc262_ultra_unsol_event,
11897 .init_hook = alc262_ultra_automute,
11899 [ALC262_LENOVO_3000] = {
11900 .mixers = { alc262_lenovo_3000_mixer },
11901 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11902 alc262_lenovo_3000_unsol_verbs,
11903 alc262_lenovo_3000_init_verbs },
11904 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11905 .dac_nids = alc262_dac_nids,
11907 .dig_out_nid = ALC262_DIGOUT_NID,
11908 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11909 .channel_mode = alc262_modes,
11910 .input_mux = &alc262_fujitsu_capture_source,
11911 .unsol_event = alc262_lenovo_3000_unsol_event,
11914 .mixers = { alc262_nec_mixer },
11915 .init_verbs = { alc262_nec_verbs },
11916 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11917 .dac_nids = alc262_dac_nids,
11919 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11920 .channel_mode = alc262_modes,
11921 .input_mux = &alc262_capture_source,
11923 [ALC262_TOSHIBA_S06] = {
11924 .mixers = { alc262_toshiba_s06_mixer },
11925 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11926 alc262_eapd_verbs },
11927 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11928 .capsrc_nids = alc262_dmic_capsrc_nids,
11929 .dac_nids = alc262_dac_nids,
11930 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11931 .num_adc_nids = 1, /* single ADC */
11932 .dig_out_nid = ALC262_DIGOUT_NID,
11933 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11934 .channel_mode = alc262_modes,
11935 .unsol_event = alc_sku_unsol_event,
11936 .setup = alc262_toshiba_s06_setup,
11937 .init_hook = alc_inithook,
11939 [ALC262_TOSHIBA_RX1] = {
11940 .mixers = { alc262_toshiba_rx1_mixer },
11941 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11942 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11943 .dac_nids = alc262_dac_nids,
11945 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11946 .channel_mode = alc262_modes,
11947 .input_mux = &alc262_capture_source,
11948 .unsol_event = alc262_hippo_unsol_event,
11949 .setup = alc262_hippo_setup,
11950 .init_hook = alc262_hippo_automute,
11953 .mixers = { alc262_tyan_mixer },
11954 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11955 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11956 .dac_nids = alc262_dac_nids,
11958 .dig_out_nid = ALC262_DIGOUT_NID,
11959 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11960 .channel_mode = alc262_modes,
11961 .input_mux = &alc262_capture_source,
11962 .unsol_event = alc_automute_amp_unsol_event,
11963 .setup = alc262_tyan_setup,
11964 .init_hook = alc_automute_amp,
11968 static int patch_alc262(struct hda_codec *codec)
11970 struct alc_spec *spec;
11974 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11978 codec->spec = spec;
11980 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
11985 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11986 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
11987 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
11988 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
11992 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
11994 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
11998 if (board_config < 0) {
11999 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12001 board_config = ALC262_AUTO;
12004 if (board_config == ALC262_AUTO) {
12005 /* automatic parse from the BIOS config */
12006 err = alc262_parse_auto_config(codec);
12012 "hda_codec: Cannot set up configuration "
12013 "from BIOS. Using base mode...\n");
12014 board_config = ALC262_BASIC;
12018 if (!spec->no_analog) {
12019 err = snd_hda_attach_beep_device(codec, 0x1);
12026 if (board_config != ALC262_AUTO)
12027 setup_preset(codec, &alc262_presets[board_config]);
12029 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12030 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12032 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12033 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12035 if (!spec->adc_nids && spec->input_mux) {
12037 /* check whether the digital-mic has to be supported */
12038 for (i = 0; i < spec->input_mux->num_items; i++) {
12039 if (spec->input_mux->items[i].index >= 9)
12042 if (i < spec->input_mux->num_items) {
12043 /* use only ADC0 */
12044 spec->adc_nids = alc262_dmic_adc_nids;
12045 spec->num_adc_nids = 1;
12046 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12048 /* all analog inputs */
12049 /* check whether NID 0x07 is valid */
12050 unsigned int wcap = get_wcaps(codec, 0x07);
12053 wcap = get_wcaps_type(wcap);
12054 if (wcap != AC_WID_AUD_IN) {
12055 spec->adc_nids = alc262_adc_nids_alt;
12056 spec->num_adc_nids =
12057 ARRAY_SIZE(alc262_adc_nids_alt);
12058 spec->capsrc_nids = alc262_capsrc_nids_alt;
12060 spec->adc_nids = alc262_adc_nids;
12061 spec->num_adc_nids =
12062 ARRAY_SIZE(alc262_adc_nids);
12063 spec->capsrc_nids = alc262_capsrc_nids;
12067 if (!spec->cap_mixer && !spec->no_analog)
12068 set_capture_mixer(codec);
12069 if (!spec->no_analog)
12070 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12072 spec->vmaster_nid = 0x0c;
12074 codec->patch_ops = alc_patch_ops;
12075 if (board_config == ALC262_AUTO)
12076 spec->init_hook = alc262_auto_init;
12077 #ifdef CONFIG_SND_HDA_POWER_SAVE
12078 if (!spec->loopback.amplist)
12079 spec->loopback.amplist = alc262_loopbacks;
12081 codec->proc_widget_hook = print_realtek_coef;
12087 * ALC268 channel source setting (2 channel)
12089 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12090 #define alc268_modes alc260_modes
12092 static hda_nid_t alc268_dac_nids[2] = {
12097 static hda_nid_t alc268_adc_nids[2] = {
12102 static hda_nid_t alc268_adc_nids_alt[1] = {
12107 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12109 static struct snd_kcontrol_new alc268_base_mixer[] = {
12110 /* output mixer control */
12111 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12112 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12113 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12114 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12115 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12116 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12117 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12121 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12122 /* output mixer control */
12123 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12124 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12125 ALC262_HIPPO_MASTER_SWITCH,
12126 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12127 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12128 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12132 /* bind Beep switches of both NID 0x0f and 0x10 */
12133 static struct hda_bind_ctls alc268_bind_beep_sw = {
12134 .ops = &snd_hda_bind_sw,
12136 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12137 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12142 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12143 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12144 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12148 static struct hda_verb alc268_eapd_verbs[] = {
12149 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12150 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12154 /* Toshiba specific */
12155 static struct hda_verb alc268_toshiba_verbs[] = {
12156 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12160 /* Acer specific */
12161 /* bind volumes of both NID 0x02 and 0x03 */
12162 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12163 .ops = &snd_hda_bind_vol,
12165 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12166 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12171 /* mute/unmute internal speaker according to the hp jack and mute state */
12172 static void alc268_acer_automute(struct hda_codec *codec, int force)
12174 struct alc_spec *spec = codec->spec;
12177 if (force || !spec->sense_updated) {
12178 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12179 spec->sense_updated = 1;
12181 if (spec->jack_present)
12182 mute = HDA_AMP_MUTE; /* mute internal speaker */
12183 else /* unmute internal speaker if necessary */
12184 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12185 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12186 HDA_AMP_MUTE, mute);
12190 /* bind hp and internal speaker mute (with plug check) */
12191 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12192 struct snd_ctl_elem_value *ucontrol)
12194 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12195 long *valp = ucontrol->value.integer.value;
12198 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12200 alc268_acer_automute(codec, 0);
12204 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12205 /* output mixer control */
12206 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12208 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12209 .name = "Master Playback Switch",
12210 .subdevice = HDA_SUBDEV_AMP_FLAG,
12211 .info = snd_hda_mixer_amp_switch_info,
12212 .get = snd_hda_mixer_amp_switch_get,
12213 .put = alc268_acer_master_sw_put,
12214 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12216 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12220 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12221 /* output mixer control */
12222 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12224 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12225 .name = "Master Playback Switch",
12226 .subdevice = HDA_SUBDEV_AMP_FLAG,
12227 .info = snd_hda_mixer_amp_switch_info,
12228 .get = snd_hda_mixer_amp_switch_get,
12229 .put = alc268_acer_master_sw_put,
12230 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12232 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12233 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12234 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12238 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12239 /* output mixer control */
12240 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12242 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12243 .name = "Master Playback Switch",
12244 .subdevice = HDA_SUBDEV_AMP_FLAG,
12245 .info = snd_hda_mixer_amp_switch_info,
12246 .get = snd_hda_mixer_amp_switch_get,
12247 .put = alc268_acer_master_sw_put,
12248 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12251 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12255 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12257 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12258 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12259 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12260 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12261 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12265 static struct hda_verb alc268_acer_verbs[] = {
12266 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12267 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12268 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12272 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12276 /* unsolicited event for HP jack sensing */
12277 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12278 #define alc268_toshiba_setup alc262_hippo_setup
12279 #define alc268_toshiba_automute alc262_hippo_automute
12281 static void alc268_acer_unsol_event(struct hda_codec *codec,
12284 if ((res >> 26) != ALC880_HP_EVENT)
12286 alc268_acer_automute(codec, 1);
12289 static void alc268_acer_init_hook(struct hda_codec *codec)
12291 alc268_acer_automute(codec, 1);
12294 /* toggle speaker-output according to the hp-jack state */
12295 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12297 unsigned int present;
12298 unsigned char bits;
12300 present = snd_hda_jack_detect(codec, 0x15);
12301 bits = present ? AMP_IN_MUTE(0) : 0;
12302 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12303 AMP_IN_MUTE(0), bits);
12304 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12305 AMP_IN_MUTE(0), bits);
12308 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12311 switch (res >> 26) {
12312 case ALC880_HP_EVENT:
12313 alc268_aspire_one_speaker_automute(codec);
12315 case ALC880_MIC_EVENT:
12316 alc_mic_automute(codec);
12321 static void alc268_acer_lc_setup(struct hda_codec *codec)
12323 struct alc_spec *spec = codec->spec;
12324 spec->ext_mic.pin = 0x18;
12325 spec->ext_mic.mux_idx = 0;
12326 spec->int_mic.pin = 0x12;
12327 spec->int_mic.mux_idx = 6;
12328 spec->auto_mic = 1;
12331 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12333 alc268_aspire_one_speaker_automute(codec);
12334 alc_mic_automute(codec);
12337 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12338 /* output mixer control */
12339 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12340 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12341 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12342 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12343 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12344 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12348 static struct hda_verb alc268_dell_verbs[] = {
12349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12350 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12351 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12352 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12356 /* mute/unmute internal speaker according to the hp jack and mute state */
12357 static void alc268_dell_setup(struct hda_codec *codec)
12359 struct alc_spec *spec = codec->spec;
12361 spec->autocfg.hp_pins[0] = 0x15;
12362 spec->autocfg.speaker_pins[0] = 0x14;
12363 spec->ext_mic.pin = 0x18;
12364 spec->ext_mic.mux_idx = 0;
12365 spec->int_mic.pin = 0x19;
12366 spec->int_mic.mux_idx = 1;
12367 spec->auto_mic = 1;
12370 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12371 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12372 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12373 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12374 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12375 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12376 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12377 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12378 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12382 static struct hda_verb alc267_quanta_il1_verbs[] = {
12383 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12384 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12388 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12390 struct alc_spec *spec = codec->spec;
12391 spec->autocfg.hp_pins[0] = 0x15;
12392 spec->autocfg.speaker_pins[0] = 0x14;
12393 spec->ext_mic.pin = 0x18;
12394 spec->ext_mic.mux_idx = 0;
12395 spec->int_mic.pin = 0x19;
12396 spec->int_mic.mux_idx = 1;
12397 spec->auto_mic = 1;
12401 * generic initialization of ADC, input mixers and output mixers
12403 static struct hda_verb alc268_base_init_verbs[] = {
12404 /* Unmute DAC0-1 and set vol = 0 */
12405 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12406 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12409 * Set up output mixers (0x0c - 0x0e)
12411 /* set vol=0 to output mixers */
12412 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12413 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12415 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12416 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12418 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12419 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12420 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12422 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12423 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12424 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12425 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12427 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12429 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12430 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12433 /* set PCBEEP vol = 0, mute connections */
12434 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12435 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12436 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12438 /* Unmute Selector 23h,24h and set the default input to mic-in */
12440 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12441 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12442 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12443 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12449 * generic initialization of ADC, input mixers and output mixers
12451 static struct hda_verb alc268_volume_init_verbs[] = {
12452 /* set output DAC */
12453 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12454 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12456 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12457 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12458 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12459 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12460 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12462 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12463 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12464 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12466 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12469 /* set PCBEEP vol = 0, mute connections */
12470 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12471 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12472 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12477 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12478 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12479 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12483 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12484 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12485 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12490 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12491 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12492 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12493 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12494 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12499 static struct hda_input_mux alc268_capture_source = {
12503 { "Front Mic", 0x1 },
12509 static struct hda_input_mux alc268_acer_capture_source = {
12513 { "Internal Mic", 0x1 },
12518 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12522 { "Internal Mic", 0x6 },
12527 #ifdef CONFIG_SND_DEBUG
12528 static struct snd_kcontrol_new alc268_test_mixer[] = {
12529 /* Volume widgets */
12530 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12531 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12532 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12533 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12534 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12535 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12536 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12537 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12538 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12539 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12540 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12541 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12542 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12543 /* The below appears problematic on some hardwares */
12544 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12545 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12546 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12547 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12548 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12550 /* Modes for retasking pin widgets */
12551 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12552 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12553 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12554 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12556 /* Controls for GPIO pins, assuming they are configured as outputs */
12557 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12558 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12559 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12560 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12562 /* Switches to allow the digital SPDIF output pin to be enabled.
12563 * The ALC268 does not have an SPDIF input.
12565 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12567 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12568 * this output to turn on an external amplifier.
12570 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12571 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12577 /* create input playback/capture controls for the given pin */
12578 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12579 const char *ctlname, int idx)
12595 if (spec->multiout.dac_nids[0] != dac &&
12596 spec->multiout.dac_nids[1] != dac) {
12597 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12598 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12602 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12606 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12607 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12609 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12610 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12616 /* add playback controls from the parsed DAC table */
12617 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12618 const struct auto_pin_cfg *cfg)
12623 spec->multiout.dac_nids = spec->private_dac_nids;
12625 nid = cfg->line_out_pins[0];
12628 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12632 err = alc268_new_analog_output(spec, nid, name, 0);
12637 nid = cfg->speaker_pins[0];
12639 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12640 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12644 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12648 nid = cfg->hp_pins[0];
12650 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12655 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12657 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12658 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12665 /* create playback/capture controls for input pins */
12666 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12667 const struct auto_pin_cfg *cfg)
12669 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12672 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12673 hda_nid_t nid, int pin_type)
12677 alc_set_pin_output(codec, nid, pin_type);
12678 if (nid == 0x14 || nid == 0x16)
12682 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12685 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12687 struct alc_spec *spec = codec->spec;
12688 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12690 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12691 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12695 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12697 struct alc_spec *spec = codec->spec;
12700 pin = spec->autocfg.hp_pins[0];
12702 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12703 pin = spec->autocfg.speaker_pins[0];
12705 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12708 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12710 struct alc_spec *spec = codec->spec;
12711 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12712 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12713 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12714 unsigned int dac_vol1, dac_vol2;
12716 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12717 snd_hda_codec_write(codec, speaker_nid, 0,
12718 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12719 /* mute mixer inputs from 0x1d */
12720 snd_hda_codec_write(codec, 0x0f, 0,
12721 AC_VERB_SET_AMP_GAIN_MUTE,
12723 snd_hda_codec_write(codec, 0x10, 0,
12724 AC_VERB_SET_AMP_GAIN_MUTE,
12727 /* unmute mixer inputs from 0x1d */
12728 snd_hda_codec_write(codec, 0x0f, 0,
12729 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12730 snd_hda_codec_write(codec, 0x10, 0,
12731 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12734 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12735 if (line_nid == 0x14)
12736 dac_vol2 = AMP_OUT_ZERO;
12737 else if (line_nid == 0x15)
12738 dac_vol1 = AMP_OUT_ZERO;
12739 if (hp_nid == 0x14)
12740 dac_vol2 = AMP_OUT_ZERO;
12741 else if (hp_nid == 0x15)
12742 dac_vol1 = AMP_OUT_ZERO;
12743 if (line_nid != 0x16 || hp_nid != 0x16 ||
12744 spec->autocfg.line_out_pins[1] != 0x16 ||
12745 spec->autocfg.line_out_pins[2] != 0x16)
12746 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12748 snd_hda_codec_write(codec, 0x02, 0,
12749 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12750 snd_hda_codec_write(codec, 0x03, 0,
12751 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12754 /* pcm configuration: identical with ALC880 */
12755 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12756 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12757 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12758 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12761 * BIOS auto configuration
12763 static int alc268_parse_auto_config(struct hda_codec *codec)
12765 struct alc_spec *spec = codec->spec;
12767 static hda_nid_t alc268_ignore[] = { 0 };
12769 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12773 if (!spec->autocfg.line_outs) {
12774 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12775 spec->multiout.max_channels = 2;
12776 spec->no_analog = 1;
12779 return 0; /* can't find valid BIOS pin config */
12781 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12784 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12788 spec->multiout.max_channels = 2;
12791 /* digital only support output */
12792 if (spec->autocfg.dig_outs) {
12793 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12794 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12796 if (spec->kctls.list)
12797 add_mixer(spec, spec->kctls.list);
12799 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12800 add_mixer(spec, alc268_beep_mixer);
12802 add_verb(spec, alc268_volume_init_verbs);
12803 spec->num_mux_defs = 2;
12804 spec->input_mux = &spec->private_imux[0];
12806 err = alc_auto_add_mic_boost(codec);
12810 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12815 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12817 /* init callback for auto-configuration model -- overriding the default init */
12818 static void alc268_auto_init(struct hda_codec *codec)
12820 struct alc_spec *spec = codec->spec;
12821 alc268_auto_init_multi_out(codec);
12822 alc268_auto_init_hp_out(codec);
12823 alc268_auto_init_mono_speaker_out(codec);
12824 alc268_auto_init_analog_input(codec);
12825 if (spec->unsol_event)
12826 alc_inithook(codec);
12830 * configuration and preset
12832 static const char *alc268_models[ALC268_MODEL_LAST] = {
12833 [ALC267_QUANTA_IL1] = "quanta-il1",
12834 [ALC268_3ST] = "3stack",
12835 [ALC268_TOSHIBA] = "toshiba",
12836 [ALC268_ACER] = "acer",
12837 [ALC268_ACER_DMIC] = "acer-dmic",
12838 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12839 [ALC268_DELL] = "dell",
12840 [ALC268_ZEPTO] = "zepto",
12841 #ifdef CONFIG_SND_DEBUG
12842 [ALC268_TEST] = "test",
12844 [ALC268_AUTO] = "auto",
12847 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12848 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12849 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12850 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12851 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12852 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12853 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12854 ALC268_ACER_ASPIRE_ONE),
12855 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12856 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12857 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12858 /* almost compatible with toshiba but with optional digital outs;
12859 * auto-probing seems working fine
12861 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12863 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12864 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12865 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12866 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12867 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12868 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12872 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12873 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12874 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12875 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12876 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12881 static struct alc_config_preset alc268_presets[] = {
12882 [ALC267_QUANTA_IL1] = {
12883 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12884 alc268_capture_nosrc_mixer },
12885 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12886 alc267_quanta_il1_verbs },
12887 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12888 .dac_nids = alc268_dac_nids,
12889 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12890 .adc_nids = alc268_adc_nids_alt,
12892 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12893 .channel_mode = alc268_modes,
12894 .unsol_event = alc_sku_unsol_event,
12895 .setup = alc267_quanta_il1_setup,
12896 .init_hook = alc_inithook,
12899 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12900 alc268_beep_mixer },
12901 .init_verbs = { alc268_base_init_verbs },
12902 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12903 .dac_nids = alc268_dac_nids,
12904 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12905 .adc_nids = alc268_adc_nids_alt,
12906 .capsrc_nids = alc268_capsrc_nids,
12908 .dig_out_nid = ALC268_DIGOUT_NID,
12909 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12910 .channel_mode = alc268_modes,
12911 .input_mux = &alc268_capture_source,
12913 [ALC268_TOSHIBA] = {
12914 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12915 alc268_beep_mixer },
12916 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12917 alc268_toshiba_verbs },
12918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12919 .dac_nids = alc268_dac_nids,
12920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12921 .adc_nids = alc268_adc_nids_alt,
12922 .capsrc_nids = alc268_capsrc_nids,
12924 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12925 .channel_mode = alc268_modes,
12926 .input_mux = &alc268_capture_source,
12927 .unsol_event = alc268_toshiba_unsol_event,
12928 .setup = alc268_toshiba_setup,
12929 .init_hook = alc268_toshiba_automute,
12932 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12933 alc268_beep_mixer },
12934 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12935 alc268_acer_verbs },
12936 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12937 .dac_nids = alc268_dac_nids,
12938 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12939 .adc_nids = alc268_adc_nids_alt,
12940 .capsrc_nids = alc268_capsrc_nids,
12942 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12943 .channel_mode = alc268_modes,
12944 .input_mux = &alc268_acer_capture_source,
12945 .unsol_event = alc268_acer_unsol_event,
12946 .init_hook = alc268_acer_init_hook,
12948 [ALC268_ACER_DMIC] = {
12949 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12950 alc268_beep_mixer },
12951 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12952 alc268_acer_verbs },
12953 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12954 .dac_nids = alc268_dac_nids,
12955 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12956 .adc_nids = alc268_adc_nids_alt,
12957 .capsrc_nids = alc268_capsrc_nids,
12959 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12960 .channel_mode = alc268_modes,
12961 .input_mux = &alc268_acer_dmic_capture_source,
12962 .unsol_event = alc268_acer_unsol_event,
12963 .init_hook = alc268_acer_init_hook,
12965 [ALC268_ACER_ASPIRE_ONE] = {
12966 .mixers = { alc268_acer_aspire_one_mixer,
12968 alc268_capture_nosrc_mixer },
12969 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12970 alc268_acer_aspire_one_verbs },
12971 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12972 .dac_nids = alc268_dac_nids,
12973 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12974 .adc_nids = alc268_adc_nids_alt,
12975 .capsrc_nids = alc268_capsrc_nids,
12977 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12978 .channel_mode = alc268_modes,
12979 .unsol_event = alc268_acer_lc_unsol_event,
12980 .setup = alc268_acer_lc_setup,
12981 .init_hook = alc268_acer_lc_init_hook,
12984 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
12985 alc268_capture_nosrc_mixer },
12986 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12987 alc268_dell_verbs },
12988 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12989 .dac_nids = alc268_dac_nids,
12990 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12991 .adc_nids = alc268_adc_nids_alt,
12992 .capsrc_nids = alc268_capsrc_nids,
12994 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12995 .channel_mode = alc268_modes,
12996 .unsol_event = alc_sku_unsol_event,
12997 .setup = alc268_dell_setup,
12998 .init_hook = alc_inithook,
13001 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13002 alc268_beep_mixer },
13003 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13004 alc268_toshiba_verbs },
13005 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13006 .dac_nids = alc268_dac_nids,
13007 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13008 .adc_nids = alc268_adc_nids_alt,
13009 .capsrc_nids = alc268_capsrc_nids,
13011 .dig_out_nid = ALC268_DIGOUT_NID,
13012 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13013 .channel_mode = alc268_modes,
13014 .input_mux = &alc268_capture_source,
13015 .setup = alc268_toshiba_setup,
13016 .init_hook = alc268_toshiba_automute,
13018 #ifdef CONFIG_SND_DEBUG
13020 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13021 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13022 alc268_volume_init_verbs },
13023 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13024 .dac_nids = alc268_dac_nids,
13025 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13026 .adc_nids = alc268_adc_nids_alt,
13027 .capsrc_nids = alc268_capsrc_nids,
13029 .dig_out_nid = ALC268_DIGOUT_NID,
13030 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13031 .channel_mode = alc268_modes,
13032 .input_mux = &alc268_capture_source,
13037 static int patch_alc268(struct hda_codec *codec)
13039 struct alc_spec *spec;
13041 int i, has_beep, err;
13043 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
13047 codec->spec = spec;
13049 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13053 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13054 board_config = snd_hda_check_board_codec_sid_config(codec,
13055 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13057 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13058 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13060 board_config = ALC268_AUTO;
13063 if (board_config == ALC268_AUTO) {
13064 /* automatic parse from the BIOS config */
13065 err = alc268_parse_auto_config(codec);
13071 "hda_codec: Cannot set up configuration "
13072 "from BIOS. Using base mode...\n");
13073 board_config = ALC268_3ST;
13077 if (board_config != ALC268_AUTO)
13078 setup_preset(codec, &alc268_presets[board_config]);
13080 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13081 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13082 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13084 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13087 for (i = 0; i < spec->num_mixers; i++) {
13088 if (spec->mixers[i] == alc268_beep_mixer) {
13095 err = snd_hda_attach_beep_device(codec, 0x1);
13100 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13101 /* override the amp caps for beep generator */
13102 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13103 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13104 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13105 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13106 (0 << AC_AMPCAP_MUTE_SHIFT));
13109 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13110 /* check whether NID 0x07 is valid */
13111 unsigned int wcap = get_wcaps(codec, 0x07);
13114 spec->capsrc_nids = alc268_capsrc_nids;
13116 wcap = get_wcaps_type(wcap);
13117 if (spec->auto_mic ||
13118 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13119 spec->adc_nids = alc268_adc_nids_alt;
13120 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13121 if (spec->auto_mic)
13122 fixup_automic_adc(codec);
13123 if (spec->auto_mic || spec->input_mux->num_items == 1)
13124 add_mixer(spec, alc268_capture_nosrc_mixer);
13126 add_mixer(spec, alc268_capture_alt_mixer);
13128 spec->adc_nids = alc268_adc_nids;
13129 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13130 add_mixer(spec, alc268_capture_mixer);
13132 /* set default input source */
13133 for (i = 0; i < spec->num_adc_nids; i++)
13134 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13135 0, AC_VERB_SET_CONNECT_SEL,
13136 i < spec->num_mux_defs ?
13137 spec->input_mux[i].items[0].index :
13138 spec->input_mux->items[0].index);
13141 spec->vmaster_nid = 0x02;
13143 codec->patch_ops = alc_patch_ops;
13144 if (board_config == ALC268_AUTO)
13145 spec->init_hook = alc268_auto_init;
13147 codec->proc_widget_hook = print_realtek_coef;
13153 * ALC269 channel source setting (2 channel)
13155 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13157 #define alc269_dac_nids alc260_dac_nids
13159 static hda_nid_t alc269_adc_nids[1] = {
13164 static hda_nid_t alc269_capsrc_nids[1] = {
13168 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13172 #define alc269_modes alc260_modes
13173 #define alc269_capture_source alc880_lg_lw_capture_source
13175 static struct snd_kcontrol_new alc269_base_mixer[] = {
13176 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13177 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13182 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13183 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13184 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13185 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13187 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13191 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13192 /* output mixer control */
13193 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13196 .name = "Master Playback Switch",
13197 .subdevice = HDA_SUBDEV_AMP_FLAG,
13198 .info = snd_hda_mixer_amp_switch_info,
13199 .get = snd_hda_mixer_amp_switch_get,
13200 .put = alc268_acer_master_sw_put,
13201 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13206 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13207 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13208 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13212 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13213 /* output mixer control */
13214 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13216 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13217 .name = "Master Playback Switch",
13218 .subdevice = HDA_SUBDEV_AMP_FLAG,
13219 .info = snd_hda_mixer_amp_switch_info,
13220 .get = snd_hda_mixer_amp_switch_get,
13221 .put = alc268_acer_master_sw_put,
13222 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13224 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13226 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13227 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13228 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13229 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13230 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13231 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13232 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13236 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13237 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13238 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13239 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13240 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13244 /* capture mixer elements */
13245 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13246 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13247 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13248 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13253 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13255 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13256 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13257 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13258 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13259 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13260 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13261 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13265 static struct hda_verb alc269_lifebook_verbs[] = {
13266 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13267 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13268 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13269 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13270 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13271 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13272 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13273 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13274 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13275 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13279 /* toggle speaker-output according to the hp-jack state */
13280 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13282 unsigned int present;
13283 unsigned char bits;
13285 present = snd_hda_jack_detect(codec, 0x15);
13286 bits = present ? AMP_IN_MUTE(0) : 0;
13287 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13288 AMP_IN_MUTE(0), bits);
13289 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13290 AMP_IN_MUTE(0), bits);
13292 snd_hda_codec_write(codec, 0x20, 0,
13293 AC_VERB_SET_COEF_INDEX, 0x0c);
13294 snd_hda_codec_write(codec, 0x20, 0,
13295 AC_VERB_SET_PROC_COEF, 0x680);
13297 snd_hda_codec_write(codec, 0x20, 0,
13298 AC_VERB_SET_COEF_INDEX, 0x0c);
13299 snd_hda_codec_write(codec, 0x20, 0,
13300 AC_VERB_SET_PROC_COEF, 0x480);
13303 /* toggle speaker-output according to the hp-jacks state */
13304 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13306 unsigned int present;
13307 unsigned char bits;
13309 /* Check laptop headphone socket */
13310 present = snd_hda_jack_detect(codec, 0x15);
13312 /* Check port replicator headphone socket */
13313 present |= snd_hda_jack_detect(codec, 0x1a);
13315 bits = present ? AMP_IN_MUTE(0) : 0;
13316 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13317 AMP_IN_MUTE(0), bits);
13318 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13319 AMP_IN_MUTE(0), bits);
13321 snd_hda_codec_write(codec, 0x20, 0,
13322 AC_VERB_SET_COEF_INDEX, 0x0c);
13323 snd_hda_codec_write(codec, 0x20, 0,
13324 AC_VERB_SET_PROC_COEF, 0x680);
13326 snd_hda_codec_write(codec, 0x20, 0,
13327 AC_VERB_SET_COEF_INDEX, 0x0c);
13328 snd_hda_codec_write(codec, 0x20, 0,
13329 AC_VERB_SET_PROC_COEF, 0x480);
13332 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13334 unsigned int present_laptop;
13335 unsigned int present_dock;
13337 present_laptop = snd_hda_jack_detect(codec, 0x18);
13338 present_dock = snd_hda_jack_detect(codec, 0x1b);
13340 /* Laptop mic port overrides dock mic port, design decision */
13342 snd_hda_codec_write(codec, 0x23, 0,
13343 AC_VERB_SET_CONNECT_SEL, 0x3);
13344 if (present_laptop)
13345 snd_hda_codec_write(codec, 0x23, 0,
13346 AC_VERB_SET_CONNECT_SEL, 0x0);
13347 if (!present_dock && !present_laptop)
13348 snd_hda_codec_write(codec, 0x23, 0,
13349 AC_VERB_SET_CONNECT_SEL, 0x1);
13352 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13355 switch (res >> 26) {
13356 case ALC880_HP_EVENT:
13357 alc269_quanta_fl1_speaker_automute(codec);
13359 case ALC880_MIC_EVENT:
13360 alc_mic_automute(codec);
13365 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13368 if ((res >> 26) == ALC880_HP_EVENT)
13369 alc269_lifebook_speaker_automute(codec);
13370 if ((res >> 26) == ALC880_MIC_EVENT)
13371 alc269_lifebook_mic_autoswitch(codec);
13374 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13376 struct alc_spec *spec = codec->spec;
13377 spec->ext_mic.pin = 0x18;
13378 spec->ext_mic.mux_idx = 0;
13379 spec->int_mic.pin = 0x19;
13380 spec->int_mic.mux_idx = 1;
13381 spec->auto_mic = 1;
13384 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13386 alc269_quanta_fl1_speaker_automute(codec);
13387 alc_mic_automute(codec);
13390 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13392 alc269_lifebook_speaker_automute(codec);
13393 alc269_lifebook_mic_autoswitch(codec);
13396 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13397 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13398 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13399 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13400 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13401 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13403 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13407 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13408 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13409 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13410 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13411 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13412 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13413 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13417 /* toggle speaker-output according to the hp-jack state */
13418 static void alc269_speaker_automute(struct hda_codec *codec)
13420 struct alc_spec *spec = codec->spec;
13421 unsigned int nid = spec->autocfg.hp_pins[0];
13422 unsigned int present;
13423 unsigned char bits;
13425 present = snd_hda_jack_detect(codec, nid);
13426 bits = present ? AMP_IN_MUTE(0) : 0;
13427 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13428 AMP_IN_MUTE(0), bits);
13429 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13430 AMP_IN_MUTE(0), bits);
13433 /* unsolicited event for HP jack sensing */
13434 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13437 switch (res >> 26) {
13438 case ALC880_HP_EVENT:
13439 alc269_speaker_automute(codec);
13441 case ALC880_MIC_EVENT:
13442 alc_mic_automute(codec);
13447 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13449 struct alc_spec *spec = codec->spec;
13450 spec->ext_mic.pin = 0x18;
13451 spec->ext_mic.mux_idx = 0;
13452 spec->int_mic.pin = 0x12;
13453 spec->int_mic.mux_idx = 5;
13454 spec->auto_mic = 1;
13457 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13459 struct alc_spec *spec = codec->spec;
13460 spec->ext_mic.pin = 0x18;
13461 spec->ext_mic.mux_idx = 0;
13462 spec->int_mic.pin = 0x19;
13463 spec->int_mic.mux_idx = 1;
13464 spec->auto_mic = 1;
13467 static void alc269_eeepc_inithook(struct hda_codec *codec)
13469 alc269_speaker_automute(codec);
13470 alc_mic_automute(codec);
13474 * generic initialization of ADC, input mixers and output mixers
13476 static struct hda_verb alc269_init_verbs[] = {
13478 * Unmute ADC0 and set the default input to mic-in
13480 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13482 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13483 * analog-loopback mixer widget
13484 * Note: PASD motherboards uses the Line In 2 as the input for
13485 * front panel mic (mic 2)
13487 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13488 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13489 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13491 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13492 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13495 * Set up output mixers (0x0c - 0x0e)
13497 /* set vol=0 to output mixers */
13498 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13499 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13501 /* set up input amps for analog loopback */
13502 /* Amp Indices: DAC = 0, mixer = 1 */
13503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13504 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13505 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13506 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13507 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13508 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13510 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13511 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13512 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13513 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13514 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13515 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13516 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13518 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13519 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13520 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13522 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13523 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13524 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13526 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13527 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13529 /* FIXME: use matrix-type input source selection */
13530 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13531 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13532 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13533 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13534 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13535 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13538 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13539 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13543 #define alc269_auto_create_multi_out_ctls \
13544 alc268_auto_create_multi_out_ctls
13545 #define alc269_auto_create_input_ctls \
13546 alc268_auto_create_input_ctls
13548 #ifdef CONFIG_SND_HDA_POWER_SAVE
13549 #define alc269_loopbacks alc880_loopbacks
13552 /* pcm configuration: identical with ALC880 */
13553 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13554 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13555 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13556 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13558 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13562 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13563 /* NID is set in alc_build_pcms */
13565 .open = alc880_playback_pcm_open,
13566 .prepare = alc880_playback_pcm_prepare,
13567 .cleanup = alc880_playback_pcm_cleanup
13571 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13575 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13576 /* NID is set in alc_build_pcms */
13580 * BIOS auto configuration
13582 static int alc269_parse_auto_config(struct hda_codec *codec)
13584 struct alc_spec *spec = codec->spec;
13586 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13588 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13593 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13596 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13600 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13602 if (spec->autocfg.dig_outs)
13603 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13605 if (spec->kctls.list)
13606 add_mixer(spec, spec->kctls.list);
13608 add_verb(spec, alc269_init_verbs);
13609 spec->num_mux_defs = 1;
13610 spec->input_mux = &spec->private_imux[0];
13611 /* set default input source */
13612 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13613 0, AC_VERB_SET_CONNECT_SEL,
13614 spec->input_mux->items[0].index);
13616 err = alc_auto_add_mic_boost(codec);
13620 if (!spec->cap_mixer && !spec->no_analog)
13621 set_capture_mixer(codec);
13623 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13628 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13629 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13630 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13633 /* init callback for auto-configuration model -- overriding the default init */
13634 static void alc269_auto_init(struct hda_codec *codec)
13636 struct alc_spec *spec = codec->spec;
13637 alc269_auto_init_multi_out(codec);
13638 alc269_auto_init_hp_out(codec);
13639 alc269_auto_init_analog_input(codec);
13640 if (spec->unsol_event)
13641 alc_inithook(codec);
13645 * configuration and preset
13647 static const char *alc269_models[ALC269_MODEL_LAST] = {
13648 [ALC269_BASIC] = "basic",
13649 [ALC269_QUANTA_FL1] = "quanta",
13650 [ALC269_ASUS_AMIC] = "asus-amic",
13651 [ALC269_ASUS_DMIC] = "asus-dmic",
13652 [ALC269_FUJITSU] = "fujitsu",
13653 [ALC269_LIFEBOOK] = "lifebook",
13654 [ALC269_AUTO] = "auto",
13657 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13658 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13659 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13661 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13662 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13663 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13664 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13665 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13666 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13667 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13668 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13669 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13670 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13671 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13672 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13673 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13674 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13675 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13676 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13677 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13678 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13679 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13680 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13681 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13682 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13683 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13684 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13685 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13687 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13688 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13689 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13691 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13693 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13694 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13695 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13696 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13700 static struct alc_config_preset alc269_presets[] = {
13702 .mixers = { alc269_base_mixer },
13703 .init_verbs = { alc269_init_verbs },
13704 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13705 .dac_nids = alc269_dac_nids,
13707 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13708 .channel_mode = alc269_modes,
13709 .input_mux = &alc269_capture_source,
13711 [ALC269_QUANTA_FL1] = {
13712 .mixers = { alc269_quanta_fl1_mixer },
13713 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13714 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13715 .dac_nids = alc269_dac_nids,
13717 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13718 .channel_mode = alc269_modes,
13719 .input_mux = &alc269_capture_source,
13720 .unsol_event = alc269_quanta_fl1_unsol_event,
13721 .setup = alc269_quanta_fl1_setup,
13722 .init_hook = alc269_quanta_fl1_init_hook,
13724 [ALC269_ASUS_AMIC] = {
13725 .mixers = { alc269_eeepc_mixer },
13726 .cap_mixer = alc269_epc_capture_mixer,
13727 .init_verbs = { alc269_init_verbs,
13728 alc269_eeepc_amic_init_verbs },
13729 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13730 .dac_nids = alc269_dac_nids,
13732 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13733 .channel_mode = alc269_modes,
13734 .unsol_event = alc269_eeepc_unsol_event,
13735 .setup = alc269_eeepc_amic_setup,
13736 .init_hook = alc269_eeepc_inithook,
13738 [ALC269_ASUS_DMIC] = {
13739 .mixers = { alc269_eeepc_mixer },
13740 .cap_mixer = alc269_epc_capture_mixer,
13741 .init_verbs = { alc269_init_verbs,
13742 alc269_eeepc_dmic_init_verbs },
13743 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13744 .dac_nids = alc269_dac_nids,
13746 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13747 .channel_mode = alc269_modes,
13748 .unsol_event = alc269_eeepc_unsol_event,
13749 .setup = alc269_eeepc_dmic_setup,
13750 .init_hook = alc269_eeepc_inithook,
13752 [ALC269_FUJITSU] = {
13753 .mixers = { alc269_fujitsu_mixer },
13754 .cap_mixer = alc269_epc_capture_mixer,
13755 .init_verbs = { alc269_init_verbs,
13756 alc269_eeepc_dmic_init_verbs },
13757 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13758 .dac_nids = alc269_dac_nids,
13760 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13761 .channel_mode = alc269_modes,
13762 .unsol_event = alc269_eeepc_unsol_event,
13763 .setup = alc269_eeepc_dmic_setup,
13764 .init_hook = alc269_eeepc_inithook,
13766 [ALC269_LIFEBOOK] = {
13767 .mixers = { alc269_lifebook_mixer },
13768 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13769 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13770 .dac_nids = alc269_dac_nids,
13772 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13773 .channel_mode = alc269_modes,
13774 .input_mux = &alc269_capture_source,
13775 .unsol_event = alc269_lifebook_unsol_event,
13776 .init_hook = alc269_lifebook_init_hook,
13780 static int patch_alc269(struct hda_codec *codec)
13782 struct alc_spec *spec;
13786 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13790 codec->spec = spec;
13792 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13794 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13795 kfree(codec->chip_name);
13796 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13797 if (!codec->chip_name) {
13803 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13807 if (board_config < 0) {
13808 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13810 board_config = ALC269_AUTO;
13813 if (board_config == ALC269_AUTO) {
13814 /* automatic parse from the BIOS config */
13815 err = alc269_parse_auto_config(codec);
13821 "hda_codec: Cannot set up configuration "
13822 "from BIOS. Using base mode...\n");
13823 board_config = ALC269_BASIC;
13827 err = snd_hda_attach_beep_device(codec, 0x1);
13833 if (board_config != ALC269_AUTO)
13834 setup_preset(codec, &alc269_presets[board_config]);
13836 if (codec->subsystem_id == 0x17aa3bf8) {
13837 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13838 * fix the sample rate of analog I/O to 44.1kHz
13840 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13841 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13843 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13844 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13846 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13847 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13849 spec->adc_nids = alc269_adc_nids;
13850 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13851 spec->capsrc_nids = alc269_capsrc_nids;
13852 if (!spec->cap_mixer)
13853 set_capture_mixer(codec);
13854 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13856 spec->vmaster_nid = 0x02;
13858 codec->patch_ops = alc_patch_ops;
13859 if (board_config == ALC269_AUTO)
13860 spec->init_hook = alc269_auto_init;
13861 #ifdef CONFIG_SND_HDA_POWER_SAVE
13862 if (!spec->loopback.amplist)
13863 spec->loopback.amplist = alc269_loopbacks;
13865 codec->proc_widget_hook = print_realtek_coef;
13871 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13875 * set the path ways for 2 channel output
13876 * need to set the codec line out and mic 1 pin widgets to inputs
13878 static struct hda_verb alc861_threestack_ch2_init[] = {
13879 /* set pin widget 1Ah (line in) for input */
13880 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13881 /* set pin widget 18h (mic1/2) for input, for mic also enable
13884 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13886 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13888 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13889 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13895 * need to set the codec line out and mic 1 pin widgets to outputs
13897 static struct hda_verb alc861_threestack_ch6_init[] = {
13898 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13899 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13900 /* set pin widget 18h (mic1) for output (CLFE)*/
13901 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13903 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13904 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13906 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13908 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13909 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13914 static struct hda_channel_mode alc861_threestack_modes[2] = {
13915 { 2, alc861_threestack_ch2_init },
13916 { 6, alc861_threestack_ch6_init },
13918 /* Set mic1 as input and unmute the mixer */
13919 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13920 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13921 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13924 /* Set mic1 as output and mute mixer */
13925 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13926 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13927 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13931 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13932 { 2, alc861_uniwill_m31_ch2_init },
13933 { 4, alc861_uniwill_m31_ch4_init },
13936 /* Set mic1 and line-in as input and unmute the mixer */
13937 static struct hda_verb alc861_asus_ch2_init[] = {
13938 /* set pin widget 1Ah (line in) for input */
13939 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13940 /* set pin widget 18h (mic1/2) for input, for mic also enable
13943 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13945 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13947 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13948 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13952 /* Set mic1 nad line-in as output and mute mixer */
13953 static struct hda_verb alc861_asus_ch6_init[] = {
13954 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13955 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13956 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13957 /* set pin widget 18h (mic1) for output (CLFE)*/
13958 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13959 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13960 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13961 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13965 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13966 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13971 static struct hda_channel_mode alc861_asus_modes[2] = {
13972 { 2, alc861_asus_ch2_init },
13973 { 6, alc861_asus_ch6_init },
13978 static struct snd_kcontrol_new alc861_base_mixer[] = {
13979 /* output mixer control */
13980 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13981 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13982 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13983 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
13984 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
13986 /*Input mixer control */
13987 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
13988 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
13989 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
13990 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
13991 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
13992 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
13993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
13994 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
13995 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
13996 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14001 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14002 /* output mixer control */
14003 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14004 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14005 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14006 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14007 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14009 /* Input mixer control */
14010 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14011 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14012 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14013 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14014 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14015 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14016 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14017 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14018 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14019 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14022 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14023 .name = "Channel Mode",
14024 .info = alc_ch_mode_info,
14025 .get = alc_ch_mode_get,
14026 .put = alc_ch_mode_put,
14027 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14032 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14033 /* output mixer control */
14034 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14035 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14036 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14041 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14042 /* output mixer control */
14043 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14044 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14045 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14046 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14047 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14049 /* Input mixer control */
14050 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14051 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14052 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14053 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14054 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14055 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14056 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14057 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14058 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14059 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14062 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14063 .name = "Channel Mode",
14064 .info = alc_ch_mode_info,
14065 .get = alc_ch_mode_get,
14066 .put = alc_ch_mode_put,
14067 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14072 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14073 /* output mixer control */
14074 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14075 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14076 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14077 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14078 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14080 /* Input mixer control */
14081 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14082 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14083 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14084 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14085 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14086 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14088 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14089 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14094 .name = "Channel Mode",
14095 .info = alc_ch_mode_info,
14096 .get = alc_ch_mode_get,
14097 .put = alc_ch_mode_put,
14098 .private_value = ARRAY_SIZE(alc861_asus_modes),
14103 /* additional mixer */
14104 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14105 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14106 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14111 * generic initialization of ADC, input mixers and output mixers
14113 static struct hda_verb alc861_base_init_verbs[] = {
14115 * Unmute ADC0 and set the default input to mic-in
14117 /* port-A for surround (rear panel) */
14118 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14119 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14120 /* port-B for mic-in (rear panel) with vref */
14121 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14122 /* port-C for line-in (rear panel) */
14123 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14124 /* port-D for Front */
14125 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14126 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14127 /* port-E for HP out (front panel) */
14128 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14129 /* route front PCM to HP */
14130 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14131 /* port-F for mic-in (front panel) with vref */
14132 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14133 /* port-G for CLFE (rear panel) */
14134 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14135 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14136 /* port-H for side (rear panel) */
14137 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14138 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14140 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14141 /* route front mic to ADC1*/
14142 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14143 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14145 /* Unmute DAC0~3 & spdif out*/
14146 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14147 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14148 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14149 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14152 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14153 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14154 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14155 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14156 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14158 /* Unmute Stereo Mixer 15 */
14159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14160 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14161 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14162 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14164 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14165 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14166 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14167 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14168 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14169 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14170 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14171 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14172 /* hp used DAC 3 (Front) */
14173 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14174 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14179 static struct hda_verb alc861_threestack_init_verbs[] = {
14181 * Unmute ADC0 and set the default input to mic-in
14183 /* port-A for surround (rear panel) */
14184 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14185 /* port-B for mic-in (rear panel) with vref */
14186 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14187 /* port-C for line-in (rear panel) */
14188 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14189 /* port-D for Front */
14190 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14191 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14192 /* port-E for HP out (front panel) */
14193 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14194 /* route front PCM to HP */
14195 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14196 /* port-F for mic-in (front panel) with vref */
14197 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14198 /* port-G for CLFE (rear panel) */
14199 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14200 /* port-H for side (rear panel) */
14201 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14203 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14204 /* route front mic to ADC1*/
14205 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14206 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14207 /* Unmute DAC0~3 & spdif out*/
14208 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14209 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14210 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14211 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14212 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14214 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14215 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14216 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14217 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14218 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14220 /* Unmute Stereo Mixer 15 */
14221 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14224 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14226 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14227 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14228 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14229 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14230 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14231 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14233 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14234 /* hp used DAC 3 (Front) */
14235 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14236 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14240 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14242 * Unmute ADC0 and set the default input to mic-in
14244 /* port-A for surround (rear panel) */
14245 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14246 /* port-B for mic-in (rear panel) with vref */
14247 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14248 /* port-C for line-in (rear panel) */
14249 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14250 /* port-D for Front */
14251 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14252 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14253 /* port-E for HP out (front panel) */
14254 /* this has to be set to VREF80 */
14255 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14256 /* route front PCM to HP */
14257 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14258 /* port-F for mic-in (front panel) with vref */
14259 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14260 /* port-G for CLFE (rear panel) */
14261 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14262 /* port-H for side (rear panel) */
14263 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14265 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14266 /* route front mic to ADC1*/
14267 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14269 /* Unmute DAC0~3 & spdif out*/
14270 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14271 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14272 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14273 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14276 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14277 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14278 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14279 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14280 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14282 /* Unmute Stereo Mixer 15 */
14283 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14284 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14286 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14288 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14289 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14290 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14291 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14292 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14293 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14294 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14295 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14296 /* hp used DAC 3 (Front) */
14297 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14298 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14302 static struct hda_verb alc861_asus_init_verbs[] = {
14304 * Unmute ADC0 and set the default input to mic-in
14306 /* port-A for surround (rear panel)
14307 * according to codec#0 this is the HP jack
14309 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14310 /* route front PCM to HP */
14311 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14312 /* port-B for mic-in (rear panel) with vref */
14313 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14314 /* port-C for line-in (rear panel) */
14315 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14316 /* port-D for Front */
14317 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14318 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14319 /* port-E for HP out (front panel) */
14320 /* this has to be set to VREF80 */
14321 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14322 /* route front PCM to HP */
14323 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14324 /* port-F for mic-in (front panel) with vref */
14325 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14326 /* port-G for CLFE (rear panel) */
14327 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14328 /* port-H for side (rear panel) */
14329 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14331 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14332 /* route front mic to ADC1*/
14333 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14335 /* Unmute DAC0~3 & spdif out*/
14336 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14337 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14338 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14339 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14341 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14342 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14343 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14344 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14345 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14347 /* Unmute Stereo Mixer 15 */
14348 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14349 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14350 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14351 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14353 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14354 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14355 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14356 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14357 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14358 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14359 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14360 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14361 /* hp used DAC 3 (Front) */
14362 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14363 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14367 /* additional init verbs for ASUS laptops */
14368 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14369 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14370 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14375 * generic initialization of ADC, input mixers and output mixers
14377 static struct hda_verb alc861_auto_init_verbs[] = {
14379 * Unmute ADC0 and set the default input to mic-in
14381 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14382 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14384 /* Unmute DAC0~3 & spdif out*/
14385 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14386 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14387 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14388 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14389 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14391 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14392 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14393 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14394 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14395 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14397 /* Unmute Stereo Mixer 15 */
14398 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14399 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14400 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14401 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14403 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14404 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14405 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14406 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14407 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14409 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14410 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14413 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14415 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14417 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14418 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14419 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14421 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14426 static struct hda_verb alc861_toshiba_init_verbs[] = {
14427 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14432 /* toggle speaker-output according to the hp-jack state */
14433 static void alc861_toshiba_automute(struct hda_codec *codec)
14435 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14437 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14438 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14439 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14440 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14443 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14446 if ((res >> 26) == ALC880_HP_EVENT)
14447 alc861_toshiba_automute(codec);
14450 /* pcm configuration: identical with ALC880 */
14451 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14452 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14453 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14454 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14457 #define ALC861_DIGOUT_NID 0x07
14459 static struct hda_channel_mode alc861_8ch_modes[1] = {
14463 static hda_nid_t alc861_dac_nids[4] = {
14464 /* front, surround, clfe, side */
14465 0x03, 0x06, 0x05, 0x04
14468 static hda_nid_t alc660_dac_nids[3] = {
14469 /* front, clfe, surround */
14473 static hda_nid_t alc861_adc_nids[1] = {
14478 static struct hda_input_mux alc861_capture_source = {
14482 { "Front Mic", 0x3 },
14489 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14491 struct alc_spec *spec = codec->spec;
14492 hda_nid_t mix, srcs[5];
14495 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14497 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14500 for (i = 0; i < num; i++) {
14502 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14503 if (type != AC_WID_AUD_OUT)
14505 for (j = 0; j < spec->multiout.num_dacs; j++)
14506 if (spec->multiout.dac_nids[j] == srcs[i])
14508 if (j >= spec->multiout.num_dacs)
14514 /* fill in the dac_nids table from the parsed pin configuration */
14515 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14516 const struct auto_pin_cfg *cfg)
14518 struct alc_spec *spec = codec->spec;
14520 hda_nid_t nid, dac;
14522 spec->multiout.dac_nids = spec->private_dac_nids;
14523 for (i = 0; i < cfg->line_outs; i++) {
14524 nid = cfg->line_out_pins[i];
14525 dac = alc861_look_for_dac(codec, nid);
14528 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14533 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14534 hda_nid_t nid, unsigned int chs)
14536 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14537 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14540 /* add playback controls from the parsed DAC table */
14541 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14542 const struct auto_pin_cfg *cfg)
14544 struct alc_spec *spec = codec->spec;
14545 static const char *chname[4] = {
14546 "Front", "Surround", NULL /*CLFE*/, "Side"
14551 if (cfg->line_outs == 1) {
14552 const char *pfx = NULL;
14555 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14558 nid = spec->multiout.dac_nids[0];
14559 return alc861_create_out_sw(codec, pfx, nid, 3);
14563 for (i = 0; i < cfg->line_outs; i++) {
14564 nid = spec->multiout.dac_nids[i];
14569 err = alc861_create_out_sw(codec, "Center", nid, 1);
14572 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14576 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14584 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14586 struct alc_spec *spec = codec->spec;
14593 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14594 nid = alc861_look_for_dac(codec, pin);
14596 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14599 spec->multiout.hp_nid = nid;
14605 /* create playback/capture controls for input pins */
14606 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14607 const struct auto_pin_cfg *cfg)
14609 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14612 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14614 int pin_type, hda_nid_t dac)
14616 hda_nid_t mix, srcs[5];
14619 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14621 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14623 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14625 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14628 for (i = 0; i < num; i++) {
14630 if (srcs[i] == dac || srcs[i] == 0x15)
14631 mute = AMP_IN_UNMUTE(i);
14633 mute = AMP_IN_MUTE(i);
14634 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14639 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14641 struct alc_spec *spec = codec->spec;
14644 for (i = 0; i < spec->autocfg.line_outs; i++) {
14645 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14646 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14648 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14649 spec->multiout.dac_nids[i]);
14653 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14655 struct alc_spec *spec = codec->spec;
14657 if (spec->autocfg.hp_outs)
14658 alc861_auto_set_output_and_unmute(codec,
14659 spec->autocfg.hp_pins[0],
14661 spec->multiout.hp_nid);
14662 if (spec->autocfg.speaker_outs)
14663 alc861_auto_set_output_and_unmute(codec,
14664 spec->autocfg.speaker_pins[0],
14666 spec->multiout.dac_nids[0]);
14669 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14671 struct alc_spec *spec = codec->spec;
14674 for (i = 0; i < AUTO_PIN_LAST; i++) {
14675 hda_nid_t nid = spec->autocfg.input_pins[i];
14676 if (nid >= 0x0c && nid <= 0x11)
14677 alc_set_input_pin(codec, nid, i);
14681 /* parse the BIOS configuration and set up the alc_spec */
14682 /* return 1 if successful, 0 if the proper config is not found,
14683 * or a negative error code
14685 static int alc861_parse_auto_config(struct hda_codec *codec)
14687 struct alc_spec *spec = codec->spec;
14689 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14691 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14695 if (!spec->autocfg.line_outs)
14696 return 0; /* can't find valid BIOS pin config */
14698 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14701 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14704 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14707 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14711 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14713 if (spec->autocfg.dig_outs)
14714 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14716 if (spec->kctls.list)
14717 add_mixer(spec, spec->kctls.list);
14719 add_verb(spec, alc861_auto_init_verbs);
14721 spec->num_mux_defs = 1;
14722 spec->input_mux = &spec->private_imux[0];
14724 spec->adc_nids = alc861_adc_nids;
14725 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14726 set_capture_mixer(codec);
14728 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14733 /* additional initialization for auto-configuration model */
14734 static void alc861_auto_init(struct hda_codec *codec)
14736 struct alc_spec *spec = codec->spec;
14737 alc861_auto_init_multi_out(codec);
14738 alc861_auto_init_hp_out(codec);
14739 alc861_auto_init_analog_input(codec);
14740 if (spec->unsol_event)
14741 alc_inithook(codec);
14744 #ifdef CONFIG_SND_HDA_POWER_SAVE
14745 static struct hda_amp_list alc861_loopbacks[] = {
14746 { 0x15, HDA_INPUT, 0 },
14747 { 0x15, HDA_INPUT, 1 },
14748 { 0x15, HDA_INPUT, 2 },
14749 { 0x15, HDA_INPUT, 3 },
14756 * configuration and preset
14758 static const char *alc861_models[ALC861_MODEL_LAST] = {
14759 [ALC861_3ST] = "3stack",
14760 [ALC660_3ST] = "3stack-660",
14761 [ALC861_3ST_DIG] = "3stack-dig",
14762 [ALC861_6ST_DIG] = "6stack-dig",
14763 [ALC861_UNIWILL_M31] = "uniwill-m31",
14764 [ALC861_TOSHIBA] = "toshiba",
14765 [ALC861_ASUS] = "asus",
14766 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14767 [ALC861_AUTO] = "auto",
14770 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14771 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14772 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14773 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14774 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14775 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14776 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14777 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14778 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14779 * Any other models that need this preset?
14781 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14782 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14783 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14784 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14785 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14786 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14787 /* FIXME: the below seems conflict */
14788 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14789 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14790 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14794 static struct alc_config_preset alc861_presets[] = {
14796 .mixers = { alc861_3ST_mixer },
14797 .init_verbs = { alc861_threestack_init_verbs },
14798 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14799 .dac_nids = alc861_dac_nids,
14800 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14801 .channel_mode = alc861_threestack_modes,
14803 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14804 .adc_nids = alc861_adc_nids,
14805 .input_mux = &alc861_capture_source,
14807 [ALC861_3ST_DIG] = {
14808 .mixers = { alc861_base_mixer },
14809 .init_verbs = { alc861_threestack_init_verbs },
14810 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14811 .dac_nids = alc861_dac_nids,
14812 .dig_out_nid = ALC861_DIGOUT_NID,
14813 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14814 .channel_mode = alc861_threestack_modes,
14816 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14817 .adc_nids = alc861_adc_nids,
14818 .input_mux = &alc861_capture_source,
14820 [ALC861_6ST_DIG] = {
14821 .mixers = { alc861_base_mixer },
14822 .init_verbs = { alc861_base_init_verbs },
14823 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14824 .dac_nids = alc861_dac_nids,
14825 .dig_out_nid = ALC861_DIGOUT_NID,
14826 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14827 .channel_mode = alc861_8ch_modes,
14828 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14829 .adc_nids = alc861_adc_nids,
14830 .input_mux = &alc861_capture_source,
14833 .mixers = { alc861_3ST_mixer },
14834 .init_verbs = { alc861_threestack_init_verbs },
14835 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14836 .dac_nids = alc660_dac_nids,
14837 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14838 .channel_mode = alc861_threestack_modes,
14840 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14841 .adc_nids = alc861_adc_nids,
14842 .input_mux = &alc861_capture_source,
14844 [ALC861_UNIWILL_M31] = {
14845 .mixers = { alc861_uniwill_m31_mixer },
14846 .init_verbs = { alc861_uniwill_m31_init_verbs },
14847 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14848 .dac_nids = alc861_dac_nids,
14849 .dig_out_nid = ALC861_DIGOUT_NID,
14850 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14851 .channel_mode = alc861_uniwill_m31_modes,
14853 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14854 .adc_nids = alc861_adc_nids,
14855 .input_mux = &alc861_capture_source,
14857 [ALC861_TOSHIBA] = {
14858 .mixers = { alc861_toshiba_mixer },
14859 .init_verbs = { alc861_base_init_verbs,
14860 alc861_toshiba_init_verbs },
14861 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14862 .dac_nids = alc861_dac_nids,
14863 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14864 .channel_mode = alc883_3ST_2ch_modes,
14865 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14866 .adc_nids = alc861_adc_nids,
14867 .input_mux = &alc861_capture_source,
14868 .unsol_event = alc861_toshiba_unsol_event,
14869 .init_hook = alc861_toshiba_automute,
14872 .mixers = { alc861_asus_mixer },
14873 .init_verbs = { alc861_asus_init_verbs },
14874 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14875 .dac_nids = alc861_dac_nids,
14876 .dig_out_nid = ALC861_DIGOUT_NID,
14877 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14878 .channel_mode = alc861_asus_modes,
14881 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14882 .adc_nids = alc861_adc_nids,
14883 .input_mux = &alc861_capture_source,
14885 [ALC861_ASUS_LAPTOP] = {
14886 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14887 .init_verbs = { alc861_asus_init_verbs,
14888 alc861_asus_laptop_init_verbs },
14889 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14890 .dac_nids = alc861_dac_nids,
14891 .dig_out_nid = ALC861_DIGOUT_NID,
14892 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14893 .channel_mode = alc883_3ST_2ch_modes,
14895 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14896 .adc_nids = alc861_adc_nids,
14897 .input_mux = &alc861_capture_source,
14901 /* Pin config fixes */
14903 PINFIX_FSC_AMILO_PI1505,
14906 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14907 { 0x0b, 0x0221101f }, /* HP */
14908 { 0x0f, 0x90170310 }, /* speaker */
14912 static const struct alc_fixup alc861_fixups[] = {
14913 [PINFIX_FSC_AMILO_PI1505] = {
14914 .pins = alc861_fsc_amilo_pi1505_pinfix
14918 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14919 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14923 static int patch_alc861(struct hda_codec *codec)
14925 struct alc_spec *spec;
14929 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14933 codec->spec = spec;
14935 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14939 if (board_config < 0) {
14940 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14942 board_config = ALC861_AUTO;
14945 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14947 if (board_config == ALC861_AUTO) {
14948 /* automatic parse from the BIOS config */
14949 err = alc861_parse_auto_config(codec);
14955 "hda_codec: Cannot set up configuration "
14956 "from BIOS. Using base mode...\n");
14957 board_config = ALC861_3ST_DIG;
14961 err = snd_hda_attach_beep_device(codec, 0x23);
14967 if (board_config != ALC861_AUTO)
14968 setup_preset(codec, &alc861_presets[board_config]);
14970 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14971 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14973 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14974 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14976 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14978 spec->vmaster_nid = 0x03;
14980 codec->patch_ops = alc_patch_ops;
14981 if (board_config == ALC861_AUTO)
14982 spec->init_hook = alc861_auto_init;
14983 #ifdef CONFIG_SND_HDA_POWER_SAVE
14984 if (!spec->loopback.amplist)
14985 spec->loopback.amplist = alc861_loopbacks;
14987 codec->proc_widget_hook = print_realtek_coef;
14993 * ALC861-VD support
14997 * In addition, an independent DAC
14999 #define ALC861VD_DIGOUT_NID 0x06
15001 static hda_nid_t alc861vd_dac_nids[4] = {
15002 /* front, surr, clfe, side surr */
15003 0x02, 0x03, 0x04, 0x05
15006 /* dac_nids for ALC660vd are in a different order - according to
15007 * Realtek's driver.
15008 * This should probably result in a different mixer for 6stack models
15009 * of ALC660vd codecs, but for now there is only 3stack mixer
15010 * - and it is the same as in 861vd.
15011 * adc_nids in ALC660vd are (is) the same as in 861vd
15013 static hda_nid_t alc660vd_dac_nids[3] = {
15014 /* front, rear, clfe, rear_surr */
15018 static hda_nid_t alc861vd_adc_nids[1] = {
15023 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15026 /* FIXME: should be a matrix-type input source selection */
15027 static struct hda_input_mux alc861vd_capture_source = {
15031 { "Front Mic", 0x1 },
15037 static struct hda_input_mux alc861vd_dallas_capture_source = {
15040 { "Ext Mic", 0x0 },
15041 { "Int Mic", 0x1 },
15045 static struct hda_input_mux alc861vd_hp_capture_source = {
15048 { "Front Mic", 0x0 },
15049 { "ATAPI Mic", 0x1 },
15056 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15063 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15064 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15065 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15066 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15067 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15074 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15075 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15076 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15077 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15078 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15082 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15083 { 6, alc861vd_6stack_ch6_init },
15084 { 8, alc861vd_6stack_ch8_init },
15087 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15089 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15090 .name = "Channel Mode",
15091 .info = alc_ch_mode_info,
15092 .get = alc_ch_mode_get,
15093 .put = alc_ch_mode_put,
15098 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15099 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15101 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15102 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15103 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15105 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15106 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15108 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15110 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15112 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15113 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15115 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15116 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15118 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15120 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15125 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15126 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15131 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15132 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15137 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15138 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15141 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15143 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15147 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15151 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15152 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15160 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15161 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15162 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15163 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15167 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15171 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15181 /* Pin assignment: Speaker=0x14, HP = 0x15,
15182 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15184 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15185 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15186 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15187 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15188 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15189 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15190 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15191 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15192 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15193 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15194 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15198 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15199 * Front Mic=0x18, ATAPI Mic = 0x19,
15201 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15202 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15203 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15204 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15205 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15206 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15208 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15209 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15215 * generic initialization of ADC, input mixers and output mixers
15217 static struct hda_verb alc861vd_volume_init_verbs[] = {
15219 * Unmute ADC0 and set the default input to mic-in
15221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15224 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15225 * the analog-loopback mixer widget
15227 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15228 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15229 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15234 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15235 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15236 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15237 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15238 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15241 * Set up output mixers (0x02 - 0x05)
15243 /* set vol=0 to output mixers */
15244 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15245 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15246 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15247 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15249 /* set up input amps for analog loopback */
15250 /* Amp Indices: DAC = 0, mixer = 1 */
15251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15253 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15254 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15255 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15256 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15257 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15258 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15264 * 3-stack pin configuration:
15265 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15267 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15269 * Set pin mode and muting
15271 /* set front pin widgets 0x14 for output */
15272 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15273 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15274 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15276 /* Mic (rear) pin: input vref at 80% */
15277 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15278 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15279 /* Front Mic pin: input vref at 80% */
15280 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15281 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15282 /* Line In pin: input */
15283 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15284 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15285 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15286 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15287 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15288 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15289 /* CD pin widget for input */
15290 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15296 * 6-stack pin configuration:
15298 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15300 * Set pin mode and muting
15302 /* set front pin widgets 0x14 for output */
15303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15304 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15305 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15307 /* Rear Pin: output 1 (0x0d) */
15308 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15309 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15311 /* CLFE Pin: output 2 (0x0e) */
15312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15313 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15314 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15315 /* Side Pin: output 3 (0x0f) */
15316 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15317 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15318 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15320 /* Mic (rear) pin: input vref at 80% */
15321 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15322 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15323 /* Front Mic pin: input vref at 80% */
15324 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15325 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15326 /* Line In pin: input */
15327 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15329 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15330 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15331 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15332 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15333 /* CD pin widget for input */
15334 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15339 static struct hda_verb alc861vd_eapd_verbs[] = {
15340 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15344 static struct hda_verb alc660vd_eapd_verbs[] = {
15345 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15346 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15350 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15351 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15353 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15354 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15359 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15361 unsigned int present;
15362 unsigned char bits;
15364 present = snd_hda_jack_detect(codec, 0x18);
15365 bits = present ? HDA_AMP_MUTE : 0;
15367 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15368 HDA_AMP_MUTE, bits);
15371 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15373 struct alc_spec *spec = codec->spec;
15374 spec->autocfg.hp_pins[0] = 0x1b;
15375 spec->autocfg.speaker_pins[0] = 0x14;
15378 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15380 alc_automute_amp(codec);
15381 alc861vd_lenovo_mic_automute(codec);
15384 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15387 switch (res >> 26) {
15388 case ALC880_MIC_EVENT:
15389 alc861vd_lenovo_mic_automute(codec);
15392 alc_automute_amp_unsol_event(codec, res);
15397 static struct hda_verb alc861vd_dallas_verbs[] = {
15398 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15399 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15400 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15401 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15405 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15406 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15407 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15408 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15409 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15410 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15412 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15413 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15414 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15416 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15417 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15418 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15419 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15421 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15422 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15423 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15424 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15425 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15426 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15427 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15428 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15430 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15431 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15432 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15435 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15436 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15437 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15442 /* toggle speaker-output according to the hp-jack state */
15443 static void alc861vd_dallas_setup(struct hda_codec *codec)
15445 struct alc_spec *spec = codec->spec;
15447 spec->autocfg.hp_pins[0] = 0x15;
15448 spec->autocfg.speaker_pins[0] = 0x14;
15451 #ifdef CONFIG_SND_HDA_POWER_SAVE
15452 #define alc861vd_loopbacks alc880_loopbacks
15455 /* pcm configuration: identical with ALC880 */
15456 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15457 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15458 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15459 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15462 * configuration and preset
15464 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15465 [ALC660VD_3ST] = "3stack-660",
15466 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15467 [ALC660VD_ASUS_V1S] = "asus-v1s",
15468 [ALC861VD_3ST] = "3stack",
15469 [ALC861VD_3ST_DIG] = "3stack-digout",
15470 [ALC861VD_6ST_DIG] = "6stack-digout",
15471 [ALC861VD_LENOVO] = "lenovo",
15472 [ALC861VD_DALLAS] = "dallas",
15473 [ALC861VD_HP] = "hp",
15474 [ALC861VD_AUTO] = "auto",
15477 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15478 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15479 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15480 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15481 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15482 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15483 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15484 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15485 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15486 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15487 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15488 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15489 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15490 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15491 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15492 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15496 static struct alc_config_preset alc861vd_presets[] = {
15498 .mixers = { alc861vd_3st_mixer },
15499 .init_verbs = { alc861vd_volume_init_verbs,
15500 alc861vd_3stack_init_verbs },
15501 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15502 .dac_nids = alc660vd_dac_nids,
15503 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15504 .channel_mode = alc861vd_3stack_2ch_modes,
15505 .input_mux = &alc861vd_capture_source,
15507 [ALC660VD_3ST_DIG] = {
15508 .mixers = { alc861vd_3st_mixer },
15509 .init_verbs = { alc861vd_volume_init_verbs,
15510 alc861vd_3stack_init_verbs },
15511 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15512 .dac_nids = alc660vd_dac_nids,
15513 .dig_out_nid = ALC861VD_DIGOUT_NID,
15514 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15515 .channel_mode = alc861vd_3stack_2ch_modes,
15516 .input_mux = &alc861vd_capture_source,
15519 .mixers = { alc861vd_3st_mixer },
15520 .init_verbs = { alc861vd_volume_init_verbs,
15521 alc861vd_3stack_init_verbs },
15522 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15523 .dac_nids = alc861vd_dac_nids,
15524 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15525 .channel_mode = alc861vd_3stack_2ch_modes,
15526 .input_mux = &alc861vd_capture_source,
15528 [ALC861VD_3ST_DIG] = {
15529 .mixers = { alc861vd_3st_mixer },
15530 .init_verbs = { alc861vd_volume_init_verbs,
15531 alc861vd_3stack_init_verbs },
15532 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15533 .dac_nids = alc861vd_dac_nids,
15534 .dig_out_nid = ALC861VD_DIGOUT_NID,
15535 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15536 .channel_mode = alc861vd_3stack_2ch_modes,
15537 .input_mux = &alc861vd_capture_source,
15539 [ALC861VD_6ST_DIG] = {
15540 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15541 .init_verbs = { alc861vd_volume_init_verbs,
15542 alc861vd_6stack_init_verbs },
15543 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15544 .dac_nids = alc861vd_dac_nids,
15545 .dig_out_nid = ALC861VD_DIGOUT_NID,
15546 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15547 .channel_mode = alc861vd_6stack_modes,
15548 .input_mux = &alc861vd_capture_source,
15550 [ALC861VD_LENOVO] = {
15551 .mixers = { alc861vd_lenovo_mixer },
15552 .init_verbs = { alc861vd_volume_init_verbs,
15553 alc861vd_3stack_init_verbs,
15554 alc861vd_eapd_verbs,
15555 alc861vd_lenovo_unsol_verbs },
15556 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15557 .dac_nids = alc660vd_dac_nids,
15558 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15559 .channel_mode = alc861vd_3stack_2ch_modes,
15560 .input_mux = &alc861vd_capture_source,
15561 .unsol_event = alc861vd_lenovo_unsol_event,
15562 .setup = alc861vd_lenovo_setup,
15563 .init_hook = alc861vd_lenovo_init_hook,
15565 [ALC861VD_DALLAS] = {
15566 .mixers = { alc861vd_dallas_mixer },
15567 .init_verbs = { alc861vd_dallas_verbs },
15568 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15569 .dac_nids = alc861vd_dac_nids,
15570 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15571 .channel_mode = alc861vd_3stack_2ch_modes,
15572 .input_mux = &alc861vd_dallas_capture_source,
15573 .unsol_event = alc_automute_amp_unsol_event,
15574 .setup = alc861vd_dallas_setup,
15575 .init_hook = alc_automute_amp,
15578 .mixers = { alc861vd_hp_mixer },
15579 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15580 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15581 .dac_nids = alc861vd_dac_nids,
15582 .dig_out_nid = ALC861VD_DIGOUT_NID,
15583 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15584 .channel_mode = alc861vd_3stack_2ch_modes,
15585 .input_mux = &alc861vd_hp_capture_source,
15586 .unsol_event = alc_automute_amp_unsol_event,
15587 .setup = alc861vd_dallas_setup,
15588 .init_hook = alc_automute_amp,
15590 [ALC660VD_ASUS_V1S] = {
15591 .mixers = { alc861vd_lenovo_mixer },
15592 .init_verbs = { alc861vd_volume_init_verbs,
15593 alc861vd_3stack_init_verbs,
15594 alc861vd_eapd_verbs,
15595 alc861vd_lenovo_unsol_verbs },
15596 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15597 .dac_nids = alc660vd_dac_nids,
15598 .dig_out_nid = ALC861VD_DIGOUT_NID,
15599 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15600 .channel_mode = alc861vd_3stack_2ch_modes,
15601 .input_mux = &alc861vd_capture_source,
15602 .unsol_event = alc861vd_lenovo_unsol_event,
15603 .setup = alc861vd_lenovo_setup,
15604 .init_hook = alc861vd_lenovo_init_hook,
15609 * BIOS auto configuration
15611 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15612 const struct auto_pin_cfg *cfg)
15614 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
15618 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15619 hda_nid_t nid, int pin_type, int dac_idx)
15621 alc_set_pin_output(codec, nid, pin_type);
15624 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15626 struct alc_spec *spec = codec->spec;
15629 for (i = 0; i <= HDA_SIDE; i++) {
15630 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15631 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15633 alc861vd_auto_set_output_and_unmute(codec, nid,
15639 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15641 struct alc_spec *spec = codec->spec;
15644 pin = spec->autocfg.hp_pins[0];
15645 if (pin) /* connect to front and use dac 0 */
15646 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15647 pin = spec->autocfg.speaker_pins[0];
15649 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15652 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15654 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15656 struct alc_spec *spec = codec->spec;
15659 for (i = 0; i < AUTO_PIN_LAST; i++) {
15660 hda_nid_t nid = spec->autocfg.input_pins[i];
15661 if (alc_is_input_pin(codec, nid)) {
15662 alc_set_input_pin(codec, nid, i);
15663 if (nid != ALC861VD_PIN_CD_NID &&
15664 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15665 snd_hda_codec_write(codec, nid, 0,
15666 AC_VERB_SET_AMP_GAIN_MUTE,
15672 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15674 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15675 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15677 /* add playback controls from the parsed DAC table */
15678 /* Based on ALC880 version. But ALC861VD has separate,
15679 * different NIDs for mute/unmute switch and volume control */
15680 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15681 const struct auto_pin_cfg *cfg)
15683 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15684 hda_nid_t nid_v, nid_s;
15687 for (i = 0; i < cfg->line_outs; i++) {
15688 if (!spec->multiout.dac_nids[i])
15690 nid_v = alc861vd_idx_to_mixer_vol(
15692 spec->multiout.dac_nids[i]));
15693 nid_s = alc861vd_idx_to_mixer_switch(
15695 spec->multiout.dac_nids[i]));
15699 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15701 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15705 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15707 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15711 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15713 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15717 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15719 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15725 if (cfg->line_outs == 1 &&
15726 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15733 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15734 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15738 if (cfg->line_outs == 1 &&
15739 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15741 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15742 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15751 /* add playback controls for speaker and HP outputs */
15752 /* Based on ALC880 version. But ALC861VD has separate,
15753 * different NIDs for mute/unmute switch and volume control */
15754 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15755 hda_nid_t pin, const char *pfx)
15757 hda_nid_t nid_v, nid_s;
15763 if (alc880_is_fixed_pin(pin)) {
15764 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15765 /* specify the DAC as the extra output */
15766 if (!spec->multiout.hp_nid)
15767 spec->multiout.hp_nid = nid_v;
15769 spec->multiout.extra_out_nid[0] = nid_v;
15770 /* control HP volume/switch on the output mixer amp */
15771 nid_v = alc861vd_idx_to_mixer_vol(
15772 alc880_fixed_pin_idx(pin));
15773 nid_s = alc861vd_idx_to_mixer_switch(
15774 alc880_fixed_pin_idx(pin));
15776 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15777 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15780 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15781 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15784 } else if (alc880_is_multi_pin(pin)) {
15785 /* set manual connection */
15786 /* we have only a switch on HP-out PIN */
15787 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15788 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15795 /* parse the BIOS configuration and set up the alc_spec
15796 * return 1 if successful, 0 if the proper config is not found,
15797 * or a negative error code
15798 * Based on ALC880 version - had to change it to override
15799 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15800 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15802 struct alc_spec *spec = codec->spec;
15804 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15806 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15810 if (!spec->autocfg.line_outs)
15811 return 0; /* can't find valid BIOS pin config */
15813 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15816 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15819 err = alc861vd_auto_create_extra_out(spec,
15820 spec->autocfg.speaker_pins[0],
15824 err = alc861vd_auto_create_extra_out(spec,
15825 spec->autocfg.hp_pins[0],
15829 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15833 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15835 if (spec->autocfg.dig_outs)
15836 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15838 if (spec->kctls.list)
15839 add_mixer(spec, spec->kctls.list);
15841 add_verb(spec, alc861vd_volume_init_verbs);
15843 spec->num_mux_defs = 1;
15844 spec->input_mux = &spec->private_imux[0];
15846 err = alc_auto_add_mic_boost(codec);
15850 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15855 /* additional initialization for auto-configuration model */
15856 static void alc861vd_auto_init(struct hda_codec *codec)
15858 struct alc_spec *spec = codec->spec;
15859 alc861vd_auto_init_multi_out(codec);
15860 alc861vd_auto_init_hp_out(codec);
15861 alc861vd_auto_init_analog_input(codec);
15862 alc861vd_auto_init_input_src(codec);
15863 if (spec->unsol_event)
15864 alc_inithook(codec);
15868 ALC660VD_FIX_ASUS_GPIO1
15872 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15873 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15874 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15875 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15879 static const struct alc_fixup alc861vd_fixups[] = {
15880 [ALC660VD_FIX_ASUS_GPIO1] = {
15881 .verbs = alc660vd_fix_asus_gpio1_verbs,
15885 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15886 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15890 static int patch_alc861vd(struct hda_codec *codec)
15892 struct alc_spec *spec;
15893 int err, board_config;
15895 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15899 codec->spec = spec;
15901 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15905 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15906 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15908 board_config = ALC861VD_AUTO;
15911 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15913 if (board_config == ALC861VD_AUTO) {
15914 /* automatic parse from the BIOS config */
15915 err = alc861vd_parse_auto_config(codec);
15921 "hda_codec: Cannot set up configuration "
15922 "from BIOS. Using base mode...\n");
15923 board_config = ALC861VD_3ST;
15927 err = snd_hda_attach_beep_device(codec, 0x23);
15933 if (board_config != ALC861VD_AUTO)
15934 setup_preset(codec, &alc861vd_presets[board_config]);
15936 if (codec->vendor_id == 0x10ec0660) {
15937 /* always turn on EAPD */
15938 add_verb(spec, alc660vd_eapd_verbs);
15941 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15942 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15944 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15945 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15947 if (!spec->adc_nids) {
15948 spec->adc_nids = alc861vd_adc_nids;
15949 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15951 if (!spec->capsrc_nids)
15952 spec->capsrc_nids = alc861vd_capsrc_nids;
15954 set_capture_mixer(codec);
15955 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15957 spec->vmaster_nid = 0x02;
15959 codec->patch_ops = alc_patch_ops;
15961 if (board_config == ALC861VD_AUTO)
15962 spec->init_hook = alc861vd_auto_init;
15963 #ifdef CONFIG_SND_HDA_POWER_SAVE
15964 if (!spec->loopback.amplist)
15965 spec->loopback.amplist = alc861vd_loopbacks;
15967 codec->proc_widget_hook = print_realtek_coef;
15975 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15976 * configuration. Each pin widget can choose any input DACs and a mixer.
15977 * Each ADC is connected from a mixer of all inputs. This makes possible
15978 * 6-channel independent captures.
15980 * In addition, an independent DAC for the multi-playback (not used in this
15983 #define ALC662_DIGOUT_NID 0x06
15984 #define ALC662_DIGIN_NID 0x0a
15986 static hda_nid_t alc662_dac_nids[4] = {
15987 /* front, rear, clfe, rear_surr */
15991 static hda_nid_t alc272_dac_nids[2] = {
15995 static hda_nid_t alc662_adc_nids[2] = {
16000 static hda_nid_t alc272_adc_nids[1] = {
16005 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16006 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16010 /* FIXME: should be a matrix-type input source selection */
16011 static struct hda_input_mux alc662_capture_source = {
16015 { "Front Mic", 0x1 },
16021 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16029 static struct hda_input_mux alc663_capture_source = {
16033 { "Front Mic", 0x1 },
16038 #if 0 /* set to 1 for testing other input sources below */
16039 static struct hda_input_mux alc272_nc10_capture_source = {
16042 { "Autoselect Mic", 0x0 },
16043 { "Internal Mic", 0x1 },
16044 { "In-0x02", 0x2 },
16045 { "In-0x03", 0x3 },
16046 { "In-0x04", 0x4 },
16047 { "In-0x05", 0x5 },
16048 { "In-0x06", 0x6 },
16049 { "In-0x07", 0x7 },
16050 { "In-0x08", 0x8 },
16051 { "In-0x09", 0x9 },
16052 { "In-0x0a", 0x0a },
16053 { "In-0x0b", 0x0b },
16054 { "In-0x0c", 0x0c },
16055 { "In-0x0d", 0x0d },
16056 { "In-0x0e", 0x0e },
16057 { "In-0x0f", 0x0f },
16065 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16072 static struct hda_verb alc662_3ST_ch2_init[] = {
16073 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16074 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16075 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16076 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16083 static struct hda_verb alc662_3ST_ch6_init[] = {
16084 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16085 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16086 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16087 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16088 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16089 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16093 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16094 { 2, alc662_3ST_ch2_init },
16095 { 6, alc662_3ST_ch6_init },
16101 static struct hda_verb alc662_sixstack_ch6_init[] = {
16102 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16103 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16104 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16111 static struct hda_verb alc662_sixstack_ch8_init[] = {
16112 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16113 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16114 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16118 static struct hda_channel_mode alc662_5stack_modes[2] = {
16119 { 2, alc662_sixstack_ch6_init },
16120 { 6, alc662_sixstack_ch8_init },
16123 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16124 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16127 static struct snd_kcontrol_new alc662_base_mixer[] = {
16128 /* output mixer control */
16129 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16130 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16131 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16132 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16133 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16134 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16135 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16136 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16137 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16139 /*Input mixer control */
16140 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16141 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16142 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16143 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16144 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16145 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16151 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16152 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16153 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16154 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16157 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16158 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16159 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16161 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16162 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16166 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16167 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16168 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16169 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16170 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16171 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16172 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16173 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16174 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16175 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16176 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16177 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16178 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16179 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16180 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16181 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16182 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16183 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16187 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16188 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16189 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16190 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16191 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16192 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16193 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16194 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16195 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16196 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16200 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16201 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16202 ALC262_HIPPO_MASTER_SWITCH,
16204 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16205 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16206 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16208 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16209 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16210 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16214 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16215 ALC262_HIPPO_MASTER_SWITCH,
16216 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16217 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16218 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16219 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16220 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16224 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16228 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16229 .ops = &snd_hda_bind_vol,
16231 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16232 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16237 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16238 .ops = &snd_hda_bind_sw,
16240 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16241 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16246 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16247 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16248 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16249 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16254 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16255 .ops = &snd_hda_bind_sw,
16257 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16258 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16259 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16264 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16265 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16266 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16267 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16268 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16269 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16270 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16275 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16276 .ops = &snd_hda_bind_sw,
16278 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16279 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16280 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16285 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16286 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16287 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16288 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16289 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16290 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16291 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16295 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16296 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16297 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16299 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16300 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16301 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16302 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16306 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16307 .ops = &snd_hda_bind_vol,
16309 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16310 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16315 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16316 .ops = &snd_hda_bind_sw,
16318 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16319 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16324 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16325 HDA_BIND_VOL("Master Playback Volume",
16326 &alc663_asus_two_bind_master_vol),
16327 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16328 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16330 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16331 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16335 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16336 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16337 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16338 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16339 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16345 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16346 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16347 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16348 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16349 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16350 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16354 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16355 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16359 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16360 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16361 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16362 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16364 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16365 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16366 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16367 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16368 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16369 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16373 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16374 .ops = &snd_hda_bind_sw,
16376 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16377 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16378 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16379 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16380 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16385 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16386 .ops = &snd_hda_bind_sw,
16388 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16389 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16394 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16395 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16396 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16397 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16398 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16399 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16400 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16401 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16402 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16403 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16407 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16408 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16409 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16410 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16411 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16412 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16413 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16414 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16419 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16421 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16422 .name = "Channel Mode",
16423 .info = alc_ch_mode_info,
16424 .get = alc_ch_mode_get,
16425 .put = alc_ch_mode_put,
16430 static struct hda_verb alc662_init_verbs[] = {
16431 /* ADC: mute amp left and right */
16432 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16433 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16434 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16437 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16438 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16439 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16440 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16443 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16444 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16445 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16446 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16447 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16449 /* Front Pin: output 0 (0x0c) */
16450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16453 /* Rear Pin: output 1 (0x0d) */
16454 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16455 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16457 /* CLFE Pin: output 2 (0x0e) */
16458 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16459 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16461 /* Mic (rear) pin: input vref at 80% */
16462 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16463 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16464 /* Front Mic pin: input vref at 80% */
16465 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16466 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16467 /* Line In pin: input */
16468 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16469 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16470 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16471 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16472 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16473 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16474 /* CD pin widget for input */
16475 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16477 /* FIXME: use matrix-type input source selection */
16478 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16480 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16481 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16483 /* always trun on EAPD */
16484 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16485 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16490 static struct hda_verb alc662_sue_init_verbs[] = {
16491 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16492 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16496 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16497 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16498 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16502 /* Set Unsolicited Event*/
16503 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16504 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16505 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16510 * generic initialization of ADC, input mixers and output mixers
16512 static struct hda_verb alc662_auto_init_verbs[] = {
16514 * Unmute ADC and set the default input to mic-in
16516 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16517 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16519 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16521 * Note: PASD motherboards uses the Line In 2 as the input for front
16522 * panel mic (mic 2)
16524 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16525 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16526 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16527 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16528 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16529 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16532 * Set up output mixers (0x0c - 0x0f)
16534 /* set vol=0 to output mixers */
16535 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16536 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16537 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16539 /* set up input amps for analog loopback */
16540 /* Amp Indices: DAC = 0, mixer = 1 */
16541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16543 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16545 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16546 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16549 /* FIXME: use matrix-type input source selection */
16550 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16553 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16557 /* additional verbs for ALC663 */
16558 static struct hda_verb alc663_auto_init_verbs[] = {
16559 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16560 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16564 static struct hda_verb alc663_m51va_init_verbs[] = {
16565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16566 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16567 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16568 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16569 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16572 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16573 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16577 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16578 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16579 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16580 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16581 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16582 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16583 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16584 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16588 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16589 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16590 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16591 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16592 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16593 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16595 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16596 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16600 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16602 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16603 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16604 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16605 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16606 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16607 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16611 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16612 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16614 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16616 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16618 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16619 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16620 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16621 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16622 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16623 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16627 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16628 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16629 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16630 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16631 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16632 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16633 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16634 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16635 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16636 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16637 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16638 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16639 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16643 static struct hda_verb alc663_g71v_init_verbs[] = {
16644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16645 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16646 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16648 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16649 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16650 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16652 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16653 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16654 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16658 static struct hda_verb alc663_g50v_init_verbs[] = {
16659 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16660 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16661 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16663 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16664 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16668 static struct hda_verb alc662_ecs_init_verbs[] = {
16669 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16671 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16672 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16676 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16677 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16678 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16679 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16680 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16681 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16682 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16683 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16684 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16685 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16686 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16687 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16691 static struct hda_verb alc272_dell_init_verbs[] = {
16692 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16693 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16694 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16695 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16696 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16697 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16698 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16699 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16700 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16701 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16702 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16706 static struct hda_verb alc663_mode7_init_verbs[] = {
16707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16709 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16710 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16711 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16712 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16713 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
16714 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16715 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16716 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16717 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16718 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16719 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16720 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16721 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16725 static struct hda_verb alc663_mode8_init_verbs[] = {
16726 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16728 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16729 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16730 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16731 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16732 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16734 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16735 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16736 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16739 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16740 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16741 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16745 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16746 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16747 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16751 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16752 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16753 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16757 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16759 unsigned int present;
16760 unsigned char bits;
16762 present = snd_hda_jack_detect(codec, 0x14);
16763 bits = present ? HDA_AMP_MUTE : 0;
16765 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16766 HDA_AMP_MUTE, bits);
16769 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16771 unsigned int present;
16772 unsigned char bits;
16774 present = snd_hda_jack_detect(codec, 0x1b);
16775 bits = present ? HDA_AMP_MUTE : 0;
16777 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16778 HDA_AMP_MUTE, bits);
16779 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16780 HDA_AMP_MUTE, bits);
16783 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16786 if ((res >> 26) == ALC880_HP_EVENT)
16787 alc662_lenovo_101e_all_automute(codec);
16788 if ((res >> 26) == ALC880_FRONT_EVENT)
16789 alc662_lenovo_101e_ispeaker_automute(codec);
16792 /* unsolicited event for HP jack sensing */
16793 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16796 if ((res >> 26) == ALC880_MIC_EVENT)
16797 alc_mic_automute(codec);
16799 alc262_hippo_unsol_event(codec, res);
16802 static void alc662_eeepc_setup(struct hda_codec *codec)
16804 struct alc_spec *spec = codec->spec;
16806 alc262_hippo1_setup(codec);
16807 spec->ext_mic.pin = 0x18;
16808 spec->ext_mic.mux_idx = 0;
16809 spec->int_mic.pin = 0x19;
16810 spec->int_mic.mux_idx = 1;
16811 spec->auto_mic = 1;
16814 static void alc662_eeepc_inithook(struct hda_codec *codec)
16816 alc262_hippo_automute(codec);
16817 alc_mic_automute(codec);
16820 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16822 struct alc_spec *spec = codec->spec;
16824 spec->autocfg.hp_pins[0] = 0x14;
16825 spec->autocfg.speaker_pins[0] = 0x1b;
16828 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16830 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16832 unsigned int present;
16833 unsigned char bits;
16835 present = snd_hda_jack_detect(codec, 0x21);
16836 bits = present ? HDA_AMP_MUTE : 0;
16837 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16838 AMP_IN_MUTE(0), bits);
16839 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16840 AMP_IN_MUTE(0), bits);
16843 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16845 unsigned int present;
16846 unsigned char bits;
16848 present = snd_hda_jack_detect(codec, 0x21);
16849 bits = present ? HDA_AMP_MUTE : 0;
16850 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16851 AMP_IN_MUTE(0), bits);
16852 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16853 AMP_IN_MUTE(0), bits);
16854 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16855 AMP_IN_MUTE(0), bits);
16856 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16857 AMP_IN_MUTE(0), bits);
16860 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16862 unsigned int present;
16863 unsigned char bits;
16865 present = snd_hda_jack_detect(codec, 0x15);
16866 bits = present ? HDA_AMP_MUTE : 0;
16867 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16868 AMP_IN_MUTE(0), bits);
16869 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16870 AMP_IN_MUTE(0), bits);
16871 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16872 AMP_IN_MUTE(0), bits);
16873 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16874 AMP_IN_MUTE(0), bits);
16877 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16879 unsigned int present;
16880 unsigned char bits;
16882 present = snd_hda_jack_detect(codec, 0x1b);
16883 bits = present ? 0 : PIN_OUT;
16884 snd_hda_codec_write(codec, 0x14, 0,
16885 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16888 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16890 unsigned int present1, present2;
16892 present1 = snd_hda_jack_detect(codec, 0x21);
16893 present2 = snd_hda_jack_detect(codec, 0x15);
16895 if (present1 || present2) {
16896 snd_hda_codec_write_cache(codec, 0x14, 0,
16897 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16899 snd_hda_codec_write_cache(codec, 0x14, 0,
16900 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16904 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16906 unsigned int present1, present2;
16908 present1 = snd_hda_jack_detect(codec, 0x1b);
16909 present2 = snd_hda_jack_detect(codec, 0x15);
16911 if (present1 || present2) {
16912 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16913 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16914 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16915 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16917 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16918 AMP_IN_MUTE(0), 0);
16919 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16920 AMP_IN_MUTE(0), 0);
16924 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16926 unsigned int present1, present2;
16928 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16929 AC_VERB_GET_PIN_SENSE, 0)
16930 & AC_PINSENSE_PRESENCE;
16931 present2 = snd_hda_codec_read(codec, 0x21, 0,
16932 AC_VERB_GET_PIN_SENSE, 0)
16933 & AC_PINSENSE_PRESENCE;
16935 if (present1 || present2) {
16936 snd_hda_codec_write_cache(codec, 0x14, 0,
16937 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16938 snd_hda_codec_write_cache(codec, 0x17, 0,
16939 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16941 snd_hda_codec_write_cache(codec, 0x14, 0,
16942 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16943 snd_hda_codec_write_cache(codec, 0x17, 0,
16944 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16948 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16950 unsigned int present1, present2;
16952 present1 = snd_hda_codec_read(codec, 0x21, 0,
16953 AC_VERB_GET_PIN_SENSE, 0)
16954 & AC_PINSENSE_PRESENCE;
16955 present2 = snd_hda_codec_read(codec, 0x15, 0,
16956 AC_VERB_GET_PIN_SENSE, 0)
16957 & AC_PINSENSE_PRESENCE;
16959 if (present1 || present2) {
16960 snd_hda_codec_write_cache(codec, 0x14, 0,
16961 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16962 snd_hda_codec_write_cache(codec, 0x17, 0,
16963 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16965 snd_hda_codec_write_cache(codec, 0x14, 0,
16966 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16967 snd_hda_codec_write_cache(codec, 0x17, 0,
16968 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16972 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16975 switch (res >> 26) {
16976 case ALC880_HP_EVENT:
16977 alc663_m51va_speaker_automute(codec);
16979 case ALC880_MIC_EVENT:
16980 alc_mic_automute(codec);
16985 static void alc663_m51va_setup(struct hda_codec *codec)
16987 struct alc_spec *spec = codec->spec;
16988 spec->ext_mic.pin = 0x18;
16989 spec->ext_mic.mux_idx = 0;
16990 spec->int_mic.pin = 0x12;
16991 spec->int_mic.mux_idx = 9;
16992 spec->auto_mic = 1;
16995 static void alc663_m51va_inithook(struct hda_codec *codec)
16997 alc663_m51va_speaker_automute(codec);
16998 alc_mic_automute(codec);
17001 /* ***************** Mode1 ******************************/
17002 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17004 static void alc663_mode1_setup(struct hda_codec *codec)
17006 struct alc_spec *spec = codec->spec;
17007 spec->ext_mic.pin = 0x18;
17008 spec->ext_mic.mux_idx = 0;
17009 spec->int_mic.pin = 0x19;
17010 spec->int_mic.mux_idx = 1;
17011 spec->auto_mic = 1;
17014 #define alc663_mode1_inithook alc663_m51va_inithook
17016 /* ***************** Mode2 ******************************/
17017 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17020 switch (res >> 26) {
17021 case ALC880_HP_EVENT:
17022 alc662_f5z_speaker_automute(codec);
17024 case ALC880_MIC_EVENT:
17025 alc_mic_automute(codec);
17030 #define alc662_mode2_setup alc663_mode1_setup
17032 static void alc662_mode2_inithook(struct hda_codec *codec)
17034 alc662_f5z_speaker_automute(codec);
17035 alc_mic_automute(codec);
17037 /* ***************** Mode3 ******************************/
17038 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17041 switch (res >> 26) {
17042 case ALC880_HP_EVENT:
17043 alc663_two_hp_m1_speaker_automute(codec);
17045 case ALC880_MIC_EVENT:
17046 alc_mic_automute(codec);
17051 #define alc663_mode3_setup alc663_mode1_setup
17053 static void alc663_mode3_inithook(struct hda_codec *codec)
17055 alc663_two_hp_m1_speaker_automute(codec);
17056 alc_mic_automute(codec);
17058 /* ***************** Mode4 ******************************/
17059 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17062 switch (res >> 26) {
17063 case ALC880_HP_EVENT:
17064 alc663_21jd_two_speaker_automute(codec);
17066 case ALC880_MIC_EVENT:
17067 alc_mic_automute(codec);
17072 #define alc663_mode4_setup alc663_mode1_setup
17074 static void alc663_mode4_inithook(struct hda_codec *codec)
17076 alc663_21jd_two_speaker_automute(codec);
17077 alc_mic_automute(codec);
17079 /* ***************** Mode5 ******************************/
17080 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17083 switch (res >> 26) {
17084 case ALC880_HP_EVENT:
17085 alc663_15jd_two_speaker_automute(codec);
17087 case ALC880_MIC_EVENT:
17088 alc_mic_automute(codec);
17093 #define alc663_mode5_setup alc663_mode1_setup
17095 static void alc663_mode5_inithook(struct hda_codec *codec)
17097 alc663_15jd_two_speaker_automute(codec);
17098 alc_mic_automute(codec);
17100 /* ***************** Mode6 ******************************/
17101 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17104 switch (res >> 26) {
17105 case ALC880_HP_EVENT:
17106 alc663_two_hp_m2_speaker_automute(codec);
17108 case ALC880_MIC_EVENT:
17109 alc_mic_automute(codec);
17114 #define alc663_mode6_setup alc663_mode1_setup
17116 static void alc663_mode6_inithook(struct hda_codec *codec)
17118 alc663_two_hp_m2_speaker_automute(codec);
17119 alc_mic_automute(codec);
17122 /* ***************** Mode7 ******************************/
17123 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17126 switch (res >> 26) {
17127 case ALC880_HP_EVENT:
17128 alc663_two_hp_m7_speaker_automute(codec);
17130 case ALC880_MIC_EVENT:
17131 alc_mic_automute(codec);
17136 #define alc663_mode7_setup alc663_mode1_setup
17138 static void alc663_mode7_inithook(struct hda_codec *codec)
17140 alc663_two_hp_m7_speaker_automute(codec);
17141 alc_mic_automute(codec);
17144 /* ***************** Mode8 ******************************/
17145 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17148 switch (res >> 26) {
17149 case ALC880_HP_EVENT:
17150 alc663_two_hp_m8_speaker_automute(codec);
17152 case ALC880_MIC_EVENT:
17153 alc_mic_automute(codec);
17158 #define alc663_mode8_setup alc663_m51va_setup
17160 static void alc663_mode8_inithook(struct hda_codec *codec)
17162 alc663_two_hp_m8_speaker_automute(codec);
17163 alc_mic_automute(codec);
17166 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17168 unsigned int present;
17169 unsigned char bits;
17171 present = snd_hda_jack_detect(codec, 0x21);
17172 bits = present ? HDA_AMP_MUTE : 0;
17173 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17174 HDA_AMP_MUTE, bits);
17175 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17176 HDA_AMP_MUTE, bits);
17179 static void alc663_g71v_front_automute(struct hda_codec *codec)
17181 unsigned int present;
17182 unsigned char bits;
17184 present = snd_hda_jack_detect(codec, 0x15);
17185 bits = present ? HDA_AMP_MUTE : 0;
17186 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17187 HDA_AMP_MUTE, bits);
17190 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17193 switch (res >> 26) {
17194 case ALC880_HP_EVENT:
17195 alc663_g71v_hp_automute(codec);
17197 case ALC880_FRONT_EVENT:
17198 alc663_g71v_front_automute(codec);
17200 case ALC880_MIC_EVENT:
17201 alc_mic_automute(codec);
17206 #define alc663_g71v_setup alc663_m51va_setup
17208 static void alc663_g71v_inithook(struct hda_codec *codec)
17210 alc663_g71v_front_automute(codec);
17211 alc663_g71v_hp_automute(codec);
17212 alc_mic_automute(codec);
17215 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17218 switch (res >> 26) {
17219 case ALC880_HP_EVENT:
17220 alc663_m51va_speaker_automute(codec);
17222 case ALC880_MIC_EVENT:
17223 alc_mic_automute(codec);
17228 #define alc663_g50v_setup alc663_m51va_setup
17230 static void alc663_g50v_inithook(struct hda_codec *codec)
17232 alc663_m51va_speaker_automute(codec);
17233 alc_mic_automute(codec);
17236 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17237 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17238 ALC262_HIPPO_MASTER_SWITCH,
17240 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17241 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17242 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17244 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17245 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17246 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17250 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17251 /* Master Playback automatically created from Speaker and Headphone */
17252 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17253 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17255 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17257 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17258 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17259 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17261 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17262 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17263 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17267 #ifdef CONFIG_SND_HDA_POWER_SAVE
17268 #define alc662_loopbacks alc880_loopbacks
17272 /* pcm configuration: identical with ALC880 */
17273 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17274 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17275 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17276 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17279 * configuration and preset
17281 static const char *alc662_models[ALC662_MODEL_LAST] = {
17282 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17283 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17284 [ALC662_3ST_6ch] = "3stack-6ch",
17285 [ALC662_5ST_DIG] = "6stack-dig",
17286 [ALC662_LENOVO_101E] = "lenovo-101e",
17287 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17288 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17289 [ALC662_ECS] = "ecs",
17290 [ALC663_ASUS_M51VA] = "m51va",
17291 [ALC663_ASUS_G71V] = "g71v",
17292 [ALC663_ASUS_H13] = "h13",
17293 [ALC663_ASUS_G50V] = "g50v",
17294 [ALC663_ASUS_MODE1] = "asus-mode1",
17295 [ALC662_ASUS_MODE2] = "asus-mode2",
17296 [ALC663_ASUS_MODE3] = "asus-mode3",
17297 [ALC663_ASUS_MODE4] = "asus-mode4",
17298 [ALC663_ASUS_MODE5] = "asus-mode5",
17299 [ALC663_ASUS_MODE6] = "asus-mode6",
17300 [ALC663_ASUS_MODE7] = "asus-mode7",
17301 [ALC663_ASUS_MODE8] = "asus-mode8",
17302 [ALC272_DELL] = "dell",
17303 [ALC272_DELL_ZM1] = "dell-zm1",
17304 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17305 [ALC662_AUTO] = "auto",
17308 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17309 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17310 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17311 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17312 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17313 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17314 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17315 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17316 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17317 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17318 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17319 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17320 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17321 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17322 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17323 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17324 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17325 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17326 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17327 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17328 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17329 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17330 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17331 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17332 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17333 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17334 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17335 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17336 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17337 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17338 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17339 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17340 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17341 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17342 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17343 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17344 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17345 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17346 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17347 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17348 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17349 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17350 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17351 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17352 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17353 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17354 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17355 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17356 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17357 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17358 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17359 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17360 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17361 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17362 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17363 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17364 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17365 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17366 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17367 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17368 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17369 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17370 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17371 ALC662_3ST_6ch_DIG),
17372 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4),
17373 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17374 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17375 ALC662_3ST_6ch_DIG),
17376 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17377 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17378 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17379 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17380 ALC662_3ST_6ch_DIG),
17381 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17383 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17387 static struct alc_config_preset alc662_presets[] = {
17388 [ALC662_3ST_2ch_DIG] = {
17389 .mixers = { alc662_3ST_2ch_mixer },
17390 .init_verbs = { alc662_init_verbs },
17391 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17392 .dac_nids = alc662_dac_nids,
17393 .dig_out_nid = ALC662_DIGOUT_NID,
17394 .dig_in_nid = ALC662_DIGIN_NID,
17395 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17396 .channel_mode = alc662_3ST_2ch_modes,
17397 .input_mux = &alc662_capture_source,
17399 [ALC662_3ST_6ch_DIG] = {
17400 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17401 .init_verbs = { alc662_init_verbs },
17402 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17403 .dac_nids = alc662_dac_nids,
17404 .dig_out_nid = ALC662_DIGOUT_NID,
17405 .dig_in_nid = ALC662_DIGIN_NID,
17406 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17407 .channel_mode = alc662_3ST_6ch_modes,
17409 .input_mux = &alc662_capture_source,
17411 [ALC662_3ST_6ch] = {
17412 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17413 .init_verbs = { alc662_init_verbs },
17414 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17415 .dac_nids = alc662_dac_nids,
17416 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17417 .channel_mode = alc662_3ST_6ch_modes,
17419 .input_mux = &alc662_capture_source,
17421 [ALC662_5ST_DIG] = {
17422 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17423 .init_verbs = { alc662_init_verbs },
17424 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17425 .dac_nids = alc662_dac_nids,
17426 .dig_out_nid = ALC662_DIGOUT_NID,
17427 .dig_in_nid = ALC662_DIGIN_NID,
17428 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17429 .channel_mode = alc662_5stack_modes,
17430 .input_mux = &alc662_capture_source,
17432 [ALC662_LENOVO_101E] = {
17433 .mixers = { alc662_lenovo_101e_mixer },
17434 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17435 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17436 .dac_nids = alc662_dac_nids,
17437 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17438 .channel_mode = alc662_3ST_2ch_modes,
17439 .input_mux = &alc662_lenovo_101e_capture_source,
17440 .unsol_event = alc662_lenovo_101e_unsol_event,
17441 .init_hook = alc662_lenovo_101e_all_automute,
17443 [ALC662_ASUS_EEEPC_P701] = {
17444 .mixers = { alc662_eeepc_p701_mixer },
17445 .init_verbs = { alc662_init_verbs,
17446 alc662_eeepc_sue_init_verbs },
17447 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17448 .dac_nids = alc662_dac_nids,
17449 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17450 .channel_mode = alc662_3ST_2ch_modes,
17451 .unsol_event = alc662_eeepc_unsol_event,
17452 .setup = alc662_eeepc_setup,
17453 .init_hook = alc662_eeepc_inithook,
17455 [ALC662_ASUS_EEEPC_EP20] = {
17456 .mixers = { alc662_eeepc_ep20_mixer,
17457 alc662_chmode_mixer },
17458 .init_verbs = { alc662_init_verbs,
17459 alc662_eeepc_ep20_sue_init_verbs },
17460 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17461 .dac_nids = alc662_dac_nids,
17462 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17463 .channel_mode = alc662_3ST_6ch_modes,
17464 .input_mux = &alc662_lenovo_101e_capture_source,
17465 .unsol_event = alc662_eeepc_unsol_event,
17466 .setup = alc662_eeepc_ep20_setup,
17467 .init_hook = alc662_eeepc_ep20_inithook,
17470 .mixers = { alc662_ecs_mixer },
17471 .init_verbs = { alc662_init_verbs,
17472 alc662_ecs_init_verbs },
17473 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17474 .dac_nids = alc662_dac_nids,
17475 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17476 .channel_mode = alc662_3ST_2ch_modes,
17477 .unsol_event = alc662_eeepc_unsol_event,
17478 .setup = alc662_eeepc_setup,
17479 .init_hook = alc662_eeepc_inithook,
17481 [ALC663_ASUS_M51VA] = {
17482 .mixers = { alc663_m51va_mixer },
17483 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17484 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17485 .dac_nids = alc662_dac_nids,
17486 .dig_out_nid = ALC662_DIGOUT_NID,
17487 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17488 .channel_mode = alc662_3ST_2ch_modes,
17489 .unsol_event = alc663_m51va_unsol_event,
17490 .setup = alc663_m51va_setup,
17491 .init_hook = alc663_m51va_inithook,
17493 [ALC663_ASUS_G71V] = {
17494 .mixers = { alc663_g71v_mixer },
17495 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17496 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17497 .dac_nids = alc662_dac_nids,
17498 .dig_out_nid = ALC662_DIGOUT_NID,
17499 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17500 .channel_mode = alc662_3ST_2ch_modes,
17501 .unsol_event = alc663_g71v_unsol_event,
17502 .setup = alc663_g71v_setup,
17503 .init_hook = alc663_g71v_inithook,
17505 [ALC663_ASUS_H13] = {
17506 .mixers = { alc663_m51va_mixer },
17507 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17508 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17509 .dac_nids = alc662_dac_nids,
17510 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17511 .channel_mode = alc662_3ST_2ch_modes,
17512 .unsol_event = alc663_m51va_unsol_event,
17513 .init_hook = alc663_m51va_inithook,
17515 [ALC663_ASUS_G50V] = {
17516 .mixers = { alc663_g50v_mixer },
17517 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17518 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17519 .dac_nids = alc662_dac_nids,
17520 .dig_out_nid = ALC662_DIGOUT_NID,
17521 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17522 .channel_mode = alc662_3ST_6ch_modes,
17523 .input_mux = &alc663_capture_source,
17524 .unsol_event = alc663_g50v_unsol_event,
17525 .setup = alc663_g50v_setup,
17526 .init_hook = alc663_g50v_inithook,
17528 [ALC663_ASUS_MODE1] = {
17529 .mixers = { alc663_m51va_mixer },
17530 .cap_mixer = alc662_auto_capture_mixer,
17531 .init_verbs = { alc662_init_verbs,
17532 alc663_21jd_amic_init_verbs },
17533 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17535 .dac_nids = alc662_dac_nids,
17536 .dig_out_nid = ALC662_DIGOUT_NID,
17537 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17538 .channel_mode = alc662_3ST_2ch_modes,
17539 .unsol_event = alc663_mode1_unsol_event,
17540 .setup = alc663_mode1_setup,
17541 .init_hook = alc663_mode1_inithook,
17543 [ALC662_ASUS_MODE2] = {
17544 .mixers = { alc662_1bjd_mixer },
17545 .cap_mixer = alc662_auto_capture_mixer,
17546 .init_verbs = { alc662_init_verbs,
17547 alc662_1bjd_amic_init_verbs },
17548 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17549 .dac_nids = alc662_dac_nids,
17550 .dig_out_nid = ALC662_DIGOUT_NID,
17551 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17552 .channel_mode = alc662_3ST_2ch_modes,
17553 .unsol_event = alc662_mode2_unsol_event,
17554 .setup = alc662_mode2_setup,
17555 .init_hook = alc662_mode2_inithook,
17557 [ALC663_ASUS_MODE3] = {
17558 .mixers = { alc663_two_hp_m1_mixer },
17559 .cap_mixer = alc662_auto_capture_mixer,
17560 .init_verbs = { alc662_init_verbs,
17561 alc663_two_hp_amic_m1_init_verbs },
17562 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17564 .dac_nids = alc662_dac_nids,
17565 .dig_out_nid = ALC662_DIGOUT_NID,
17566 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17567 .channel_mode = alc662_3ST_2ch_modes,
17568 .unsol_event = alc663_mode3_unsol_event,
17569 .setup = alc663_mode3_setup,
17570 .init_hook = alc663_mode3_inithook,
17572 [ALC663_ASUS_MODE4] = {
17573 .mixers = { alc663_asus_21jd_clfe_mixer },
17574 .cap_mixer = alc662_auto_capture_mixer,
17575 .init_verbs = { alc662_init_verbs,
17576 alc663_21jd_amic_init_verbs},
17577 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17579 .dac_nids = alc662_dac_nids,
17580 .dig_out_nid = ALC662_DIGOUT_NID,
17581 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17582 .channel_mode = alc662_3ST_2ch_modes,
17583 .unsol_event = alc663_mode4_unsol_event,
17584 .setup = alc663_mode4_setup,
17585 .init_hook = alc663_mode4_inithook,
17587 [ALC663_ASUS_MODE5] = {
17588 .mixers = { alc663_asus_15jd_clfe_mixer },
17589 .cap_mixer = alc662_auto_capture_mixer,
17590 .init_verbs = { alc662_init_verbs,
17591 alc663_15jd_amic_init_verbs },
17592 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17594 .dac_nids = alc662_dac_nids,
17595 .dig_out_nid = ALC662_DIGOUT_NID,
17596 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17597 .channel_mode = alc662_3ST_2ch_modes,
17598 .unsol_event = alc663_mode5_unsol_event,
17599 .setup = alc663_mode5_setup,
17600 .init_hook = alc663_mode5_inithook,
17602 [ALC663_ASUS_MODE6] = {
17603 .mixers = { alc663_two_hp_m2_mixer },
17604 .cap_mixer = alc662_auto_capture_mixer,
17605 .init_verbs = { alc662_init_verbs,
17606 alc663_two_hp_amic_m2_init_verbs },
17607 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17609 .dac_nids = alc662_dac_nids,
17610 .dig_out_nid = ALC662_DIGOUT_NID,
17611 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17612 .channel_mode = alc662_3ST_2ch_modes,
17613 .unsol_event = alc663_mode6_unsol_event,
17614 .setup = alc663_mode6_setup,
17615 .init_hook = alc663_mode6_inithook,
17617 [ALC663_ASUS_MODE7] = {
17618 .mixers = { alc663_mode7_mixer },
17619 .cap_mixer = alc662_auto_capture_mixer,
17620 .init_verbs = { alc662_init_verbs,
17621 alc663_mode7_init_verbs },
17622 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17624 .dac_nids = alc662_dac_nids,
17625 .dig_out_nid = ALC662_DIGOUT_NID,
17626 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17627 .channel_mode = alc662_3ST_2ch_modes,
17628 .unsol_event = alc663_mode7_unsol_event,
17629 .setup = alc663_mode7_setup,
17630 .init_hook = alc663_mode7_inithook,
17632 [ALC663_ASUS_MODE8] = {
17633 .mixers = { alc663_mode8_mixer },
17634 .cap_mixer = alc662_auto_capture_mixer,
17635 .init_verbs = { alc662_init_verbs,
17636 alc663_mode8_init_verbs },
17637 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17639 .dac_nids = alc662_dac_nids,
17640 .dig_out_nid = ALC662_DIGOUT_NID,
17641 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17642 .channel_mode = alc662_3ST_2ch_modes,
17643 .unsol_event = alc663_mode8_unsol_event,
17644 .setup = alc663_mode8_setup,
17645 .init_hook = alc663_mode8_inithook,
17648 .mixers = { alc663_m51va_mixer },
17649 .cap_mixer = alc272_auto_capture_mixer,
17650 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17651 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17652 .dac_nids = alc662_dac_nids,
17653 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17654 .adc_nids = alc272_adc_nids,
17655 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17656 .capsrc_nids = alc272_capsrc_nids,
17657 .channel_mode = alc662_3ST_2ch_modes,
17658 .unsol_event = alc663_m51va_unsol_event,
17659 .setup = alc663_m51va_setup,
17660 .init_hook = alc663_m51va_inithook,
17662 [ALC272_DELL_ZM1] = {
17663 .mixers = { alc663_m51va_mixer },
17664 .cap_mixer = alc662_auto_capture_mixer,
17665 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17666 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17667 .dac_nids = alc662_dac_nids,
17668 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17669 .adc_nids = alc662_adc_nids,
17671 .capsrc_nids = alc662_capsrc_nids,
17672 .channel_mode = alc662_3ST_2ch_modes,
17673 .unsol_event = alc663_m51va_unsol_event,
17674 .setup = alc663_m51va_setup,
17675 .init_hook = alc663_m51va_inithook,
17677 [ALC272_SAMSUNG_NC10] = {
17678 .mixers = { alc272_nc10_mixer },
17679 .init_verbs = { alc662_init_verbs,
17680 alc663_21jd_amic_init_verbs },
17681 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17682 .dac_nids = alc272_dac_nids,
17683 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17684 .channel_mode = alc662_3ST_2ch_modes,
17685 /*.input_mux = &alc272_nc10_capture_source,*/
17686 .unsol_event = alc663_mode4_unsol_event,
17687 .setup = alc663_mode4_setup,
17688 .init_hook = alc663_mode4_inithook,
17694 * BIOS auto configuration
17697 /* convert from MIX nid to DAC */
17698 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17702 else if (nid >= 0x0c && nid <= 0x0e)
17703 return nid - 0x0c + 0x02;
17708 /* get MIX nid connected to the given pin targeted to DAC */
17709 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17715 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17716 for (i = 0; i < num; i++) {
17717 if (alc662_mix_to_dac(mix[i]) == dac)
17723 /* look for an empty DAC slot */
17724 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17726 struct alc_spec *spec = codec->spec;
17730 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17733 for (i = 0; i < num; i++) {
17734 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17737 for (j = 0; j < spec->multiout.num_dacs; j++)
17738 if (spec->multiout.dac_nids[j] == nid)
17740 if (j >= spec->multiout.num_dacs)
17746 /* fill in the dac_nids table from the parsed pin configuration */
17747 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17748 const struct auto_pin_cfg *cfg)
17750 struct alc_spec *spec = codec->spec;
17754 spec->multiout.dac_nids = spec->private_dac_nids;
17755 for (i = 0; i < cfg->line_outs; i++) {
17756 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17759 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17764 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17765 hda_nid_t nid, unsigned int chs)
17767 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17768 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17771 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17772 hda_nid_t nid, unsigned int chs)
17774 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17775 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17778 #define alc662_add_stereo_vol(spec, pfx, nid) \
17779 alc662_add_vol_ctl(spec, pfx, nid, 3)
17780 #define alc662_add_stereo_sw(spec, pfx, nid) \
17781 alc662_add_sw_ctl(spec, pfx, nid, 3)
17783 /* add playback controls from the parsed DAC table */
17784 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17785 const struct auto_pin_cfg *cfg)
17787 struct alc_spec *spec = codec->spec;
17788 static const char *chname[4] = {
17789 "Front", "Surround", NULL /*CLFE*/, "Side"
17791 hda_nid_t nid, mix;
17794 for (i = 0; i < cfg->line_outs; i++) {
17795 nid = spec->multiout.dac_nids[i];
17798 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17803 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17806 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17809 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17812 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17817 if (cfg->line_outs == 1 &&
17818 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17825 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17828 if (cfg->line_outs == 1 &&
17829 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17831 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17839 /* add playback controls for speaker and HP outputs */
17840 /* return DAC nid if any new DAC is assigned */
17841 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17844 struct alc_spec *spec = codec->spec;
17845 hda_nid_t nid, mix;
17850 nid = alc662_look_for_dac(codec, pin);
17852 /* the corresponding DAC is already occupied */
17853 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17854 return 0; /* no way */
17855 /* create a switch only */
17856 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17857 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17860 mix = alc662_dac_to_mix(codec, pin, nid);
17863 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17866 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17872 /* create playback/capture controls for input pins */
17873 #define alc662_auto_create_input_ctls \
17874 alc882_auto_create_input_ctls
17876 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17877 hda_nid_t nid, int pin_type,
17883 alc_set_pin_output(codec, nid, pin_type);
17884 /* need the manual connection? */
17885 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17888 for (i = 0; i < num; i++) {
17889 if (alc662_mix_to_dac(srcs[i]) != dac)
17891 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17896 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17898 struct alc_spec *spec = codec->spec;
17899 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17902 for (i = 0; i <= HDA_SIDE; i++) {
17903 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17905 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17906 spec->multiout.dac_nids[i]);
17910 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17912 struct alc_spec *spec = codec->spec;
17915 pin = spec->autocfg.hp_pins[0];
17917 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17918 spec->multiout.hp_nid);
17919 pin = spec->autocfg.speaker_pins[0];
17921 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17922 spec->multiout.extra_out_nid[0]);
17925 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17927 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17929 struct alc_spec *spec = codec->spec;
17932 for (i = 0; i < AUTO_PIN_LAST; i++) {
17933 hda_nid_t nid = spec->autocfg.input_pins[i];
17934 if (alc_is_input_pin(codec, nid)) {
17935 alc_set_input_pin(codec, nid, i);
17936 if (nid != ALC662_PIN_CD_NID &&
17937 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17938 snd_hda_codec_write(codec, nid, 0,
17939 AC_VERB_SET_AMP_GAIN_MUTE,
17945 #define alc662_auto_init_input_src alc882_auto_init_input_src
17947 static int alc662_parse_auto_config(struct hda_codec *codec)
17949 struct alc_spec *spec = codec->spec;
17951 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17953 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17957 if (!spec->autocfg.line_outs)
17958 return 0; /* can't find valid BIOS pin config */
17960 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17963 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17966 err = alc662_auto_create_extra_out(codec,
17967 spec->autocfg.speaker_pins[0],
17972 spec->multiout.extra_out_nid[0] = err;
17973 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17978 spec->multiout.hp_nid = err;
17979 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
17983 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17985 if (spec->autocfg.dig_outs)
17986 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
17988 if (spec->kctls.list)
17989 add_mixer(spec, spec->kctls.list);
17991 spec->num_mux_defs = 1;
17992 spec->input_mux = &spec->private_imux[0];
17994 add_verb(spec, alc662_auto_init_verbs);
17995 if (codec->vendor_id == 0x10ec0663)
17996 add_verb(spec, alc663_auto_init_verbs);
17998 err = alc_auto_add_mic_boost(codec);
18002 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18007 /* additional initialization for auto-configuration model */
18008 static void alc662_auto_init(struct hda_codec *codec)
18010 struct alc_spec *spec = codec->spec;
18011 alc662_auto_init_multi_out(codec);
18012 alc662_auto_init_hp_out(codec);
18013 alc662_auto_init_analog_input(codec);
18014 alc662_auto_init_input_src(codec);
18015 if (spec->unsol_event)
18016 alc_inithook(codec);
18019 static int patch_alc662(struct hda_codec *codec)
18021 struct alc_spec *spec;
18022 int err, board_config;
18024 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18028 codec->spec = spec;
18030 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18032 if (alc_read_coef_idx(codec, 0)==0x8020){
18033 kfree(codec->chip_name);
18034 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18035 if (!codec->chip_name) {
18041 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18044 if (board_config < 0) {
18045 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18047 board_config = ALC662_AUTO;
18050 if (board_config == ALC662_AUTO) {
18051 /* automatic parse from the BIOS config */
18052 err = alc662_parse_auto_config(codec);
18058 "hda_codec: Cannot set up configuration "
18059 "from BIOS. Using base mode...\n");
18060 board_config = ALC662_3ST_2ch_DIG;
18064 err = snd_hda_attach_beep_device(codec, 0x1);
18070 if (board_config != ALC662_AUTO)
18071 setup_preset(codec, &alc662_presets[board_config]);
18073 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18074 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18076 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18077 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18079 if (!spec->adc_nids) {
18080 spec->adc_nids = alc662_adc_nids;
18081 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18083 if (!spec->capsrc_nids)
18084 spec->capsrc_nids = alc662_capsrc_nids;
18086 if (!spec->cap_mixer)
18087 set_capture_mixer(codec);
18088 if (codec->vendor_id == 0x10ec0662)
18089 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18091 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18093 spec->vmaster_nid = 0x02;
18095 codec->patch_ops = alc_patch_ops;
18096 if (board_config == ALC662_AUTO)
18097 spec->init_hook = alc662_auto_init;
18098 #ifdef CONFIG_SND_HDA_POWER_SAVE
18099 if (!spec->loopback.amplist)
18100 spec->loopback.amplist = alc662_loopbacks;
18102 codec->proc_widget_hook = print_realtek_coef;
18107 static int patch_alc888(struct hda_codec *codec)
18109 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18110 kfree(codec->chip_name);
18111 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18112 if (!codec->chip_name) {
18116 return patch_alc662(codec);
18118 return patch_alc882(codec);
18124 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18125 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18126 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18127 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18128 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18129 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18130 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18131 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18132 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18133 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18134 .patch = patch_alc861 },
18135 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18136 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18137 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18138 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18139 .patch = patch_alc882 },
18140 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18141 .patch = patch_alc662 },
18142 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18143 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18144 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18145 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18146 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18147 .patch = patch_alc882 },
18148 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18149 .patch = patch_alc882 },
18150 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18151 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18152 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18153 .patch = patch_alc882 },
18154 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18155 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18156 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18157 {} /* terminator */
18160 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18162 MODULE_LICENSE("GPL");
18163 MODULE_DESCRIPTION("Realtek HD-audio codec");
18165 static struct hda_codec_preset_list realtek_list = {
18166 .preset = snd_hda_preset_realtek,
18167 .owner = THIS_MODULE,
18170 static int __init patch_realtek_init(void)
18172 return snd_hda_add_codec_preset(&realtek_list);
18175 static void __exit patch_realtek_exit(void)
18177 snd_hda_delete_codec_preset(&realtek_list);
18180 module_init(patch_realtek_init)
18181 module_exit(patch_realtek_exit)