2 * Universal Interface for Intel High Definition Audio Codec
4 * HD audio interface patch for ALC 260/880/882 codecs
6 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
8 * Takashi Iwai <tiwai@suse.de>
9 * Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <linux/init.h>
27 #include <linux/delay.h>
28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <sound/core.h>
31 #include "hda_codec.h"
32 #include "hda_local.h"
35 #define ALC880_FRONT_EVENT 0x01
36 #define ALC880_DCVOL_EVENT 0x02
37 #define ALC880_HP_EVENT 0x04
38 #define ALC880_MIC_EVENT 0x08
40 /* ALC880 board config type */
64 #ifdef CONFIG_SND_DEBUG
68 ALC880_MODEL_LAST /* last tag */
82 #ifdef CONFIG_SND_DEBUG
86 ALC260_MODEL_LAST /* last tag */
96 ALC262_HP_BPC_D7000_WL,
97 ALC262_HP_BPC_D7000_WF,
110 ALC262_MODEL_LAST /* last tag */
120 ALC268_ACER_ASPIRE_ONE,
123 #ifdef CONFIG_SND_DEBUG
127 ALC268_MODEL_LAST /* last tag */
139 ALC269_MODEL_LAST /* last tag */
156 /* ALC861-VD models */
178 ALC662_ASUS_EEEPC_P701,
179 ALC662_ASUS_EEEPC_EP20,
219 ALC883_TARGA_2ch_DIG,
220 ALC883_TARGA_8ch_DIG,
223 ALC888_ACER_ASPIRE_4930G,
224 ALC888_ACER_ASPIRE_6530G,
225 ALC888_ACER_ASPIRE_8930G,
226 ALC888_ACER_ASPIRE_7730G,
230 ALC883_LENOVO_101E_2ch,
231 ALC883_LENOVO_NB0763,
232 ALC888_LENOVO_MS7195_DIG,
240 ALC883_FUJITSU_PI2515,
241 ALC888_FUJITSU_XA3530,
242 ALC883_3ST_6ch_INTEL,
255 #define GPIO_MASK 0x03
257 /* extra amp-initialization sequence types */
266 struct alc_mic_route {
268 unsigned char mux_idx;
269 unsigned char amix_idx;
272 #define MUX_IDX_UNDEF ((unsigned char)-1)
275 /* codec parameterization */
276 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
277 unsigned int num_mixers;
278 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
279 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
281 const struct hda_verb *init_verbs[10]; /* initialization verbs
285 unsigned int num_init_verbs;
287 char stream_name_analog[32]; /* analog PCM stream */
288 struct hda_pcm_stream *stream_analog_playback;
289 struct hda_pcm_stream *stream_analog_capture;
290 struct hda_pcm_stream *stream_analog_alt_playback;
291 struct hda_pcm_stream *stream_analog_alt_capture;
293 char stream_name_digital[32]; /* digital PCM stream */
294 struct hda_pcm_stream *stream_digital_playback;
295 struct hda_pcm_stream *stream_digital_capture;
298 struct hda_multi_out multiout; /* playback set-up
299 * max_channels, dacs must be set
300 * dig_out_nid and hp_nid are optional
302 hda_nid_t alt_dac_nid;
303 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
307 unsigned int num_adc_nids;
309 hda_nid_t *capsrc_nids;
310 hda_nid_t dig_in_nid; /* digital-in NID; optional */
313 unsigned int num_mux_defs;
314 const struct hda_input_mux *input_mux;
315 unsigned int cur_mux[3];
316 struct alc_mic_route ext_mic;
317 struct alc_mic_route int_mic;
320 const struct hda_channel_mode *channel_mode;
321 int num_channel_mode;
323 int const_channel_count;
324 int ext_channel_count;
326 /* PCM information */
327 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
329 /* dynamic controls, init_verbs and input_mux */
330 struct auto_pin_cfg autocfg;
331 struct snd_array kctls;
332 struct hda_input_mux private_imux[3];
333 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
334 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
335 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
338 void (*init_hook)(struct hda_codec *codec);
339 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
340 #ifdef CONFIG_SND_HDA_POWER_SAVE
341 void (*power_hook)(struct hda_codec *codec);
344 /* for pin sensing */
345 unsigned int sense_updated: 1;
346 unsigned int jack_present: 1;
347 unsigned int master_sw: 1;
348 unsigned int auto_mic:1;
351 unsigned int no_analog :1; /* digital I/O only */
354 /* for virtual master */
355 hda_nid_t vmaster_nid;
356 #ifdef CONFIG_SND_HDA_POWER_SAVE
357 struct hda_loopback_check loopback;
362 unsigned int pll_coef_idx, pll_coef_bit;
366 * configuration template - to be copied to the spec instance
368 struct alc_config_preset {
369 struct snd_kcontrol_new *mixers[5]; /* should be identical size
372 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
373 const struct hda_verb *init_verbs[5];
374 unsigned int num_dacs;
376 hda_nid_t dig_out_nid; /* optional */
377 hda_nid_t hp_nid; /* optional */
378 hda_nid_t *slave_dig_outs;
379 unsigned int num_adc_nids;
381 hda_nid_t *capsrc_nids;
382 hda_nid_t dig_in_nid;
383 unsigned int num_channel_mode;
384 const struct hda_channel_mode *channel_mode;
386 int const_channel_count;
387 unsigned int num_mux_defs;
388 const struct hda_input_mux *input_mux;
389 void (*unsol_event)(struct hda_codec *, unsigned int);
390 void (*setup)(struct hda_codec *);
391 void (*init_hook)(struct hda_codec *);
392 #ifdef CONFIG_SND_HDA_POWER_SAVE
393 struct hda_amp_list *loopbacks;
394 void (*power_hook)(struct hda_codec *codec);
402 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
403 struct snd_ctl_elem_info *uinfo)
405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
406 struct alc_spec *spec = codec->spec;
407 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
408 if (mux_idx >= spec->num_mux_defs)
410 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
413 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
414 struct snd_ctl_elem_value *ucontrol)
416 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
417 struct alc_spec *spec = codec->spec;
418 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
420 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
424 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
425 struct snd_ctl_elem_value *ucontrol)
427 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
428 struct alc_spec *spec = codec->spec;
429 const struct hda_input_mux *imux;
430 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
431 unsigned int mux_idx;
432 hda_nid_t nid = spec->capsrc_nids ?
433 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
436 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
437 imux = &spec->input_mux[mux_idx];
439 type = get_wcaps_type(get_wcaps(codec, nid));
440 if (type == AC_WID_AUD_MIX) {
441 /* Matrix-mixer style (e.g. ALC882) */
442 unsigned int *cur_val = &spec->cur_mux[adc_idx];
445 idx = ucontrol->value.enumerated.item[0];
446 if (idx >= imux->num_items)
447 idx = imux->num_items - 1;
450 for (i = 0; i < imux->num_items; i++) {
451 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
452 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
453 imux->items[i].index,
459 /* MUX style (e.g. ALC880) */
460 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
461 &spec->cur_mux[adc_idx]);
466 * channel mode setting
468 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
469 struct snd_ctl_elem_info *uinfo)
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct alc_spec *spec = codec->spec;
473 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
474 spec->num_channel_mode);
477 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
478 struct snd_ctl_elem_value *ucontrol)
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct alc_spec *spec = codec->spec;
482 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
483 spec->num_channel_mode,
484 spec->ext_channel_count);
487 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
488 struct snd_ctl_elem_value *ucontrol)
490 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
491 struct alc_spec *spec = codec->spec;
492 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
493 spec->num_channel_mode,
494 &spec->ext_channel_count);
495 if (err >= 0 && !spec->const_channel_count) {
496 spec->multiout.max_channels = spec->ext_channel_count;
497 if (spec->need_dac_fix)
498 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
504 * Control the mode of pin widget settings via the mixer. "pc" is used
505 * instead of "%" to avoid consequences of accidently treating the % as
506 * being part of a format specifier. Maximum allowed length of a value is
507 * 63 characters plus NULL terminator.
509 * Note: some retasking pin complexes seem to ignore requests for input
510 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
511 * are requested. Therefore order this list so that this behaviour will not
512 * cause problems when mixer clients move through the enum sequentially.
513 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
516 static char *alc_pin_mode_names[] = {
517 "Mic 50pc bias", "Mic 80pc bias",
518 "Line in", "Line out", "Headphone out",
520 static unsigned char alc_pin_mode_values[] = {
521 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
523 /* The control can present all 5 options, or it can limit the options based
524 * in the pin being assumed to be exclusively an input or an output pin. In
525 * addition, "input" pins may or may not process the mic bias option
526 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
527 * accept requests for bias as of chip versions up to March 2006) and/or
528 * wiring in the computer.
530 #define ALC_PIN_DIR_IN 0x00
531 #define ALC_PIN_DIR_OUT 0x01
532 #define ALC_PIN_DIR_INOUT 0x02
533 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
534 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
536 /* Info about the pin modes supported by the different pin direction modes.
537 * For each direction the minimum and maximum values are given.
539 static signed char alc_pin_mode_dir_info[5][2] = {
540 { 0, 2 }, /* ALC_PIN_DIR_IN */
541 { 3, 4 }, /* ALC_PIN_DIR_OUT */
542 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
543 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
544 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
546 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
547 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
548 #define alc_pin_mode_n_items(_dir) \
549 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
551 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo)
554 unsigned int item_num = uinfo->value.enumerated.item;
555 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
557 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
559 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
561 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
562 item_num = alc_pin_mode_min(dir);
563 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
567 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
568 struct snd_ctl_elem_value *ucontrol)
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
572 hda_nid_t nid = kcontrol->private_value & 0xffff;
573 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
574 long *valp = ucontrol->value.integer.value;
575 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
576 AC_VERB_GET_PIN_WIDGET_CONTROL,
579 /* Find enumerated value for current pinctl setting */
580 i = alc_pin_mode_min(dir);
581 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
583 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
587 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
588 struct snd_ctl_elem_value *ucontrol)
591 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
592 hda_nid_t nid = kcontrol->private_value & 0xffff;
593 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
594 long val = *ucontrol->value.integer.value;
595 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
596 AC_VERB_GET_PIN_WIDGET_CONTROL,
599 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
600 val = alc_pin_mode_min(dir);
602 change = pinctl != alc_pin_mode_values[val];
604 /* Set pin mode to that requested */
605 snd_hda_codec_write_cache(codec, nid, 0,
606 AC_VERB_SET_PIN_WIDGET_CONTROL,
607 alc_pin_mode_values[val]);
609 /* Also enable the retasking pin's input/output as required
610 * for the requested pin mode. Enum values of 2 or less are
613 * Dynamically switching the input/output buffers probably
614 * reduces noise slightly (particularly on input) so we'll
615 * do it. However, having both input and output buffers
616 * enabled simultaneously doesn't seem to be problematic if
617 * this turns out to be necessary in the future.
620 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
621 HDA_AMP_MUTE, HDA_AMP_MUTE);
622 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
625 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
626 HDA_AMP_MUTE, HDA_AMP_MUTE);
627 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
634 #define ALC_PIN_MODE(xname, nid, dir) \
635 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
636 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
637 .info = alc_pin_mode_info, \
638 .get = alc_pin_mode_get, \
639 .put = alc_pin_mode_put, \
640 .private_value = nid | (dir<<16) }
642 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
643 * together using a mask with more than one bit set. This control is
644 * currently used only by the ALC260 test model. At this stage they are not
645 * needed for any "production" models.
647 #ifdef CONFIG_SND_DEBUG
648 #define alc_gpio_data_info snd_ctl_boolean_mono_info
650 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
651 struct snd_ctl_elem_value *ucontrol)
653 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
654 hda_nid_t nid = kcontrol->private_value & 0xffff;
655 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
656 long *valp = ucontrol->value.integer.value;
657 unsigned int val = snd_hda_codec_read(codec, nid, 0,
658 AC_VERB_GET_GPIO_DATA, 0x00);
660 *valp = (val & mask) != 0;
663 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
664 struct snd_ctl_elem_value *ucontrol)
667 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
668 hda_nid_t nid = kcontrol->private_value & 0xffff;
669 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
670 long val = *ucontrol->value.integer.value;
671 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
672 AC_VERB_GET_GPIO_DATA,
675 /* Set/unset the masked GPIO bit(s) as needed */
676 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
681 snd_hda_codec_write_cache(codec, nid, 0,
682 AC_VERB_SET_GPIO_DATA, gpio_data);
686 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
687 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
688 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
689 .info = alc_gpio_data_info, \
690 .get = alc_gpio_data_get, \
691 .put = alc_gpio_data_put, \
692 .private_value = nid | (mask<<16) }
693 #endif /* CONFIG_SND_DEBUG */
695 /* A switch control to allow the enabling of the digital IO pins on the
696 * ALC260. This is incredibly simplistic; the intention of this control is
697 * to provide something in the test model allowing digital outputs to be
698 * identified if present. If models are found which can utilise these
699 * outputs a more complete mixer control can be devised for those models if
702 #ifdef CONFIG_SND_DEBUG
703 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
705 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
706 struct snd_ctl_elem_value *ucontrol)
708 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
709 hda_nid_t nid = kcontrol->private_value & 0xffff;
710 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
711 long *valp = ucontrol->value.integer.value;
712 unsigned int val = snd_hda_codec_read(codec, nid, 0,
713 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
715 *valp = (val & mask) != 0;
718 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
719 struct snd_ctl_elem_value *ucontrol)
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
723 hda_nid_t nid = kcontrol->private_value & 0xffff;
724 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
725 long val = *ucontrol->value.integer.value;
726 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_DIGI_CONVERT_1,
730 /* Set/unset the masked control bit(s) as needed */
731 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
736 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
741 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
742 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
743 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
744 .info = alc_spdif_ctrl_info, \
745 .get = alc_spdif_ctrl_get, \
746 .put = alc_spdif_ctrl_put, \
747 .private_value = nid | (mask<<16) }
748 #endif /* CONFIG_SND_DEBUG */
750 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
751 * Again, this is only used in the ALC26x test models to help identify when
752 * the EAPD line must be asserted for features to work.
754 #ifdef CONFIG_SND_DEBUG
755 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
757 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
758 struct snd_ctl_elem_value *ucontrol)
760 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
761 hda_nid_t nid = kcontrol->private_value & 0xffff;
762 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
763 long *valp = ucontrol->value.integer.value;
764 unsigned int val = snd_hda_codec_read(codec, nid, 0,
765 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
767 *valp = (val & mask) != 0;
771 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
772 struct snd_ctl_elem_value *ucontrol)
775 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
776 hda_nid_t nid = kcontrol->private_value & 0xffff;
777 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
778 long val = *ucontrol->value.integer.value;
779 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
780 AC_VERB_GET_EAPD_BTLENABLE,
783 /* Set/unset the masked control bit(s) as needed */
784 change = (!val ? 0 : mask) != (ctrl_data & mask);
789 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
795 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
796 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
797 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
798 .info = alc_eapd_ctrl_info, \
799 .get = alc_eapd_ctrl_get, \
800 .put = alc_eapd_ctrl_put, \
801 .private_value = nid | (mask<<16) }
802 #endif /* CONFIG_SND_DEBUG */
805 * set up the input pin config (depending on the given auto-pin type)
807 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
810 unsigned int val = PIN_IN;
812 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
814 pincap = snd_hda_query_pin_caps(codec, nid);
815 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
816 if (pincap & AC_PINCAP_VREF_80)
818 else if (pincap & AC_PINCAP_VREF_50)
820 else if (pincap & AC_PINCAP_VREF_100)
822 else if (pincap & AC_PINCAP_VREF_GRD)
825 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
830 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
832 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
834 spec->mixers[spec->num_mixers++] = mix;
837 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
839 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
841 spec->init_verbs[spec->num_init_verbs++] = verb;
845 * set up from the preset table
847 static void setup_preset(struct hda_codec *codec,
848 const struct alc_config_preset *preset)
850 struct alc_spec *spec = codec->spec;
853 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
854 add_mixer(spec, preset->mixers[i]);
855 spec->cap_mixer = preset->cap_mixer;
856 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
858 add_verb(spec, preset->init_verbs[i]);
860 spec->channel_mode = preset->channel_mode;
861 spec->num_channel_mode = preset->num_channel_mode;
862 spec->need_dac_fix = preset->need_dac_fix;
863 spec->const_channel_count = preset->const_channel_count;
865 if (preset->const_channel_count)
866 spec->multiout.max_channels = preset->const_channel_count;
868 spec->multiout.max_channels = spec->channel_mode[0].channels;
869 spec->ext_channel_count = spec->channel_mode[0].channels;
871 spec->multiout.num_dacs = preset->num_dacs;
872 spec->multiout.dac_nids = preset->dac_nids;
873 spec->multiout.dig_out_nid = preset->dig_out_nid;
874 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
875 spec->multiout.hp_nid = preset->hp_nid;
877 spec->num_mux_defs = preset->num_mux_defs;
878 if (!spec->num_mux_defs)
879 spec->num_mux_defs = 1;
880 spec->input_mux = preset->input_mux;
882 spec->num_adc_nids = preset->num_adc_nids;
883 spec->adc_nids = preset->adc_nids;
884 spec->capsrc_nids = preset->capsrc_nids;
885 spec->dig_in_nid = preset->dig_in_nid;
887 spec->unsol_event = preset->unsol_event;
888 spec->init_hook = preset->init_hook;
889 #ifdef CONFIG_SND_HDA_POWER_SAVE
890 spec->power_hook = preset->power_hook;
891 spec->loopback.amplist = preset->loopbacks;
895 preset->setup(codec);
898 /* Enable GPIO mask and set output */
899 static struct hda_verb alc_gpio1_init_verbs[] = {
900 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
901 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
902 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
906 static struct hda_verb alc_gpio2_init_verbs[] = {
907 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
908 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
909 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
913 static struct hda_verb alc_gpio3_init_verbs[] = {
914 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
915 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
916 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
921 * Fix hardware PLL issue
922 * On some codecs, the analog PLL gating control must be off while
923 * the default value is 1.
925 static void alc_fix_pll(struct hda_codec *codec)
927 struct alc_spec *spec = codec->spec;
932 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
934 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
935 AC_VERB_GET_PROC_COEF, 0);
936 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
938 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
939 val & ~(1 << spec->pll_coef_bit));
942 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
943 unsigned int coef_idx, unsigned int coef_bit)
945 struct alc_spec *spec = codec->spec;
947 spec->pll_coef_idx = coef_idx;
948 spec->pll_coef_bit = coef_bit;
952 static void alc_automute_pin(struct hda_codec *codec)
954 struct alc_spec *spec = codec->spec;
955 unsigned int nid = spec->autocfg.hp_pins[0];
960 spec->jack_present = snd_hda_jack_detect(codec, nid);
961 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
962 nid = spec->autocfg.speaker_pins[i];
965 snd_hda_codec_write(codec, nid, 0,
966 AC_VERB_SET_PIN_WIDGET_CONTROL,
967 spec->jack_present ? 0 : PIN_OUT);
971 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
974 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
977 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
978 for (i = 0; i < nums; i++)
984 static void alc_mic_automute(struct hda_codec *codec)
986 struct alc_spec *spec = codec->spec;
987 struct alc_mic_route *dead, *alive;
988 unsigned int present, type;
993 if (!spec->int_mic.pin || !spec->ext_mic.pin)
995 if (snd_BUG_ON(!spec->adc_nids))
998 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1000 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1002 alive = &spec->ext_mic;
1003 dead = &spec->int_mic;
1005 alive = &spec->int_mic;
1006 dead = &spec->ext_mic;
1009 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1010 if (type == AC_WID_AUD_MIX) {
1011 /* Matrix-mixer style (e.g. ALC882) */
1012 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1015 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1017 HDA_AMP_MUTE, HDA_AMP_MUTE);
1019 /* MUX style (e.g. ALC880) */
1020 snd_hda_codec_write_cache(codec, cap_nid, 0,
1021 AC_VERB_SET_CONNECT_SEL,
1025 /* FIXME: analog mixer */
1028 /* unsolicited event for HP jack sensing */
1029 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1031 if (codec->vendor_id == 0x10ec0880)
1036 case ALC880_HP_EVENT:
1037 alc_automute_pin(codec);
1039 case ALC880_MIC_EVENT:
1040 alc_mic_automute(codec);
1045 static void alc_inithook(struct hda_codec *codec)
1047 alc_automute_pin(codec);
1048 alc_mic_automute(codec);
1051 /* additional initialization for ALC888 variants */
1052 static void alc888_coef_init(struct hda_codec *codec)
1056 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1057 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1058 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1059 if ((tmp & 0xf0) == 0x20)
1061 snd_hda_codec_read(codec, 0x20, 0,
1062 AC_VERB_SET_PROC_COEF, 0x830);
1065 snd_hda_codec_read(codec, 0x20, 0,
1066 AC_VERB_SET_PROC_COEF, 0x3030);
1069 static void alc889_coef_init(struct hda_codec *codec)
1073 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1074 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1075 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1076 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1079 /* turn on/off EAPD control (only if available) */
1080 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1082 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1084 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1085 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1089 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1094 case ALC_INIT_GPIO1:
1095 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1097 case ALC_INIT_GPIO2:
1098 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1100 case ALC_INIT_GPIO3:
1101 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1103 case ALC_INIT_DEFAULT:
1104 switch (codec->vendor_id) {
1106 set_eapd(codec, 0x0f, 1);
1107 set_eapd(codec, 0x10, 1);
1120 set_eapd(codec, 0x14, 1);
1121 set_eapd(codec, 0x15, 1);
1124 switch (codec->vendor_id) {
1126 snd_hda_codec_write(codec, 0x1a, 0,
1127 AC_VERB_SET_COEF_INDEX, 7);
1128 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1129 AC_VERB_GET_PROC_COEF, 0);
1130 snd_hda_codec_write(codec, 0x1a, 0,
1131 AC_VERB_SET_COEF_INDEX, 7);
1132 snd_hda_codec_write(codec, 0x1a, 0,
1133 AC_VERB_SET_PROC_COEF,
1143 alc889_coef_init(codec);
1146 alc888_coef_init(codec);
1148 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1151 snd_hda_codec_write(codec, 0x20, 0,
1152 AC_VERB_SET_COEF_INDEX, 7);
1153 tmp = snd_hda_codec_read(codec, 0x20, 0,
1154 AC_VERB_GET_PROC_COEF, 0);
1155 snd_hda_codec_write(codec, 0x20, 0,
1156 AC_VERB_SET_COEF_INDEX, 7);
1157 snd_hda_codec_write(codec, 0x20, 0,
1158 AC_VERB_SET_PROC_COEF,
1167 static void alc_init_auto_hp(struct hda_codec *codec)
1169 struct alc_spec *spec = codec->spec;
1171 if (!spec->autocfg.hp_pins[0])
1174 if (!spec->autocfg.speaker_pins[0]) {
1175 if (spec->autocfg.line_out_pins[0] &&
1176 spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
1177 spec->autocfg.speaker_pins[0] =
1178 spec->autocfg.line_out_pins[0];
1183 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1184 spec->autocfg.hp_pins[0]);
1185 snd_hda_codec_write_cache(codec, spec->autocfg.hp_pins[0], 0,
1186 AC_VERB_SET_UNSOLICITED_ENABLE,
1187 AC_USRSP_EN | ALC880_HP_EVENT);
1188 spec->unsol_event = alc_sku_unsol_event;
1191 static void alc_init_auto_mic(struct hda_codec *codec)
1193 struct alc_spec *spec = codec->spec;
1194 struct auto_pin_cfg *cfg = &spec->autocfg;
1195 hda_nid_t fixed, ext;
1198 /* there must be only two mic inputs exclusively */
1199 for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++)
1200 if (cfg->input_pins[i])
1204 for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) {
1205 hda_nid_t nid = cfg->input_pins[i];
1206 unsigned int defcfg;
1209 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1210 switch (get_defcfg_connect(defcfg)) {
1211 case AC_JACK_PORT_FIXED:
1213 return; /* already occupied */
1216 case AC_JACK_PORT_COMPLEX:
1218 return; /* already occupied */
1222 return; /* invalid entry */
1227 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1228 return; /* no unsol support */
1229 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1231 spec->ext_mic.pin = ext;
1232 spec->int_mic.pin = fixed;
1233 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1234 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1236 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1237 AC_VERB_SET_UNSOLICITED_ENABLE,
1238 AC_USRSP_EN | ALC880_MIC_EVENT);
1239 spec->unsol_event = alc_sku_unsol_event;
1242 /* check subsystem ID and set up device-specific initialization;
1243 * return 1 if initialized, 0 if invalid SSID
1245 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1246 * 31 ~ 16 : Manufacture ID
1248 * 7 ~ 0 : Assembly ID
1249 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1251 static int alc_subsystem_id(struct hda_codec *codec,
1252 hda_nid_t porta, hda_nid_t porte,
1255 unsigned int ass, tmp, i;
1257 struct alc_spec *spec = codec->spec;
1259 ass = codec->subsystem_id & 0xffff;
1260 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1263 /* invalid SSID, check the special NID pin defcfg instead */
1265 * 31~30 : port connectivity
1268 * 19~16 : Check sum (15:1)
1273 if (codec->vendor_id == 0x10ec0260)
1275 ass = snd_hda_codec_get_pincfg(codec, nid);
1276 snd_printd("realtek: No valid SSID, "
1277 "checking pincfg 0x%08x for NID 0x%x\n",
1279 if (!(ass & 1) && !(ass & 0x100000))
1281 if ((ass >> 30) != 1) /* no physical connection */
1286 for (i = 1; i < 16; i++) {
1290 if (((ass >> 16) & 0xf) != tmp)
1293 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1294 ass & 0xffff, codec->vendor_id);
1298 * 2 : 0 --> Desktop, 1 --> Laptop
1299 * 3~5 : External Amplifier control
1302 tmp = (ass & 0x38) >> 3; /* external Amp control */
1305 spec->init_amp = ALC_INIT_GPIO1;
1308 spec->init_amp = ALC_INIT_GPIO2;
1311 spec->init_amp = ALC_INIT_GPIO3;
1314 spec->init_amp = ALC_INIT_DEFAULT;
1318 /* is laptop or Desktop and enable the function "Mute internal speaker
1319 * when the external headphone out jack is plugged"
1321 if (!(ass & 0x8000))
1324 * 10~8 : Jack location
1325 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1327 * 15 : 1 --> enable the function "Mute internal speaker
1328 * when the external headphone out jack is plugged"
1330 if (!spec->autocfg.hp_pins[0]) {
1332 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1341 for (i = 0; i < spec->autocfg.line_outs; i++)
1342 if (spec->autocfg.line_out_pins[i] == nid)
1344 spec->autocfg.hp_pins[0] = nid;
1347 alc_init_auto_hp(codec);
1348 alc_init_auto_mic(codec);
1352 static void alc_ssid_check(struct hda_codec *codec,
1353 hda_nid_t porta, hda_nid_t porte, hda_nid_t portd)
1355 if (!alc_subsystem_id(codec, porta, porte, portd)) {
1356 struct alc_spec *spec = codec->spec;
1357 snd_printd("realtek: "
1358 "Enable default setup for auto mode as fallback\n");
1359 spec->init_amp = ALC_INIT_DEFAULT;
1360 alc_init_auto_hp(codec);
1361 alc_init_auto_mic(codec);
1366 * Fix-up pin default configurations and add default verbs
1375 const struct alc_pincfg *pins;
1376 const struct hda_verb *verbs;
1379 static void alc_pick_fixup(struct hda_codec *codec,
1380 const struct snd_pci_quirk *quirk,
1381 const struct alc_fixup *fix)
1383 const struct alc_pincfg *cfg;
1385 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1389 fix += quirk->value;
1392 for (; cfg->nid; cfg++)
1393 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1396 add_verb(codec->spec, fix->verbs);
1399 static int alc_read_coef_idx(struct hda_codec *codec,
1400 unsigned int coef_idx)
1403 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1405 val = snd_hda_codec_read(codec, 0x20, 0,
1406 AC_VERB_GET_PROC_COEF, 0);
1417 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1418 /* Mic-in jack as mic in */
1419 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1420 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1421 /* Line-in jack as Line in */
1422 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1423 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1424 /* Line-Out as Front */
1425 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1432 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1433 /* Mic-in jack as mic in */
1434 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1435 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1436 /* Line-in jack as Surround */
1437 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1438 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1439 /* Line-Out as Front */
1440 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1447 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1448 /* Mic-in jack as CLFE */
1449 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1450 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1451 /* Line-in jack as Surround */
1452 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1453 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1454 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1455 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1462 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1463 /* Mic-in jack as CLFE */
1464 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1465 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1466 /* Line-in jack as Surround */
1467 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1468 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1469 /* Line-Out as Side */
1470 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1474 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1475 { 2, alc888_4ST_ch2_intel_init },
1476 { 4, alc888_4ST_ch4_intel_init },
1477 { 6, alc888_4ST_ch6_intel_init },
1478 { 8, alc888_4ST_ch8_intel_init },
1482 * ALC888 Fujitsu Siemens Amillo xa3530
1485 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1486 /* Front Mic: set to PIN_IN (empty by default) */
1487 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1488 /* Connect Internal HP to Front */
1489 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1491 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1492 /* Connect Bass HP to Front */
1493 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1495 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1496 /* Connect Line-Out side jack (SPDIF) to Side */
1497 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1498 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1499 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1500 /* Connect Mic jack to CLFE */
1501 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1504 /* Connect Line-in jack to Surround */
1505 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1507 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1508 /* Connect HP out jack to Front */
1509 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1510 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1511 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1512 /* Enable unsolicited event for HP jack and Line-out jack */
1513 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1514 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1518 static void alc_automute_amp(struct hda_codec *codec)
1520 struct alc_spec *spec = codec->spec;
1525 spec->jack_present = 0;
1526 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1527 nid = spec->autocfg.hp_pins[i];
1530 if (snd_hda_jack_detect(codec, nid)) {
1531 spec->jack_present = 1;
1536 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1537 /* Toggle internal speakers muting */
1538 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1539 nid = spec->autocfg.speaker_pins[i];
1542 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1543 HDA_AMP_MUTE, mute);
1547 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1550 if (codec->vendor_id == 0x10ec0880)
1554 if (res == ALC880_HP_EVENT)
1555 alc_automute_amp(codec);
1558 static void alc889_automute_setup(struct hda_codec *codec)
1560 struct alc_spec *spec = codec->spec;
1562 spec->autocfg.hp_pins[0] = 0x15;
1563 spec->autocfg.speaker_pins[0] = 0x14;
1564 spec->autocfg.speaker_pins[1] = 0x16;
1565 spec->autocfg.speaker_pins[2] = 0x17;
1566 spec->autocfg.speaker_pins[3] = 0x19;
1567 spec->autocfg.speaker_pins[4] = 0x1a;
1570 static void alc889_intel_init_hook(struct hda_codec *codec)
1572 alc889_coef_init(codec);
1573 alc_automute_amp(codec);
1576 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1578 struct alc_spec *spec = codec->spec;
1580 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1581 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1582 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1583 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1587 * ALC888 Acer Aspire 4930G model
1590 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1591 /* Front Mic: set to PIN_IN (empty by default) */
1592 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1593 /* Unselect Front Mic by default in input mixer 3 */
1594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1595 /* Enable unsolicited event for HP jack */
1596 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1597 /* Connect Internal HP to front */
1598 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1599 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1600 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1601 /* Connect HP out to front */
1602 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1603 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1604 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1609 * ALC888 Acer Aspire 6530G model
1612 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1613 /* Bias voltage on for external mic port */
1614 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1615 /* Front Mic: set to PIN_IN (empty by default) */
1616 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1617 /* Unselect Front Mic by default in input mixer 3 */
1618 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1619 /* Enable unsolicited event for HP jack */
1620 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1621 /* Enable speaker output */
1622 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1623 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1624 /* Enable headphone output */
1625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1626 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1627 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1632 * ALC889 Acer Aspire 8930G model
1635 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
1636 /* Front Mic: set to PIN_IN (empty by default) */
1637 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1638 /* Unselect Front Mic by default in input mixer 3 */
1639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1640 /* Enable unsolicited event for HP jack */
1641 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1642 /* Connect Internal Front to Front */
1643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1644 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1645 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1646 /* Connect Internal Rear to Rear */
1647 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1648 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1649 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
1650 /* Connect Internal CLFE to CLFE */
1651 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1652 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1653 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1654 /* Connect HP out to Front */
1655 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
1656 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1657 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1658 /* Enable all DACs */
1659 /* DAC DISABLE/MUTE 1? */
1660 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
1661 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
1662 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1663 /* DAC DISABLE/MUTE 2? */
1664 /* some bit here disables the other DACs. Init=0x4900 */
1665 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
1666 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
1668 * This laptop has a stereo digital microphone. The mics are only 1cm apart
1669 * which makes the stereo useless. However, either the mic or the ALC889
1670 * makes the signal become a difference/sum signal instead of standard
1671 * stereo, which is annoying. So instead we flip this bit which makes the
1672 * codec replicate the sum signal to both channels, turning it into a
1675 /* DMIC_CONTROL? Init value = 0x0001 */
1676 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
1677 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
1681 static struct hda_input_mux alc888_2_capture_sources[2] = {
1682 /* Front mic only available on one ADC */
1689 { "Front Mic", 0xb },
1702 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
1703 /* Interal mic only available on one ADC */
1710 { "Input Mix", 0xa },
1720 { "Input Mix", 0xa },
1725 static struct hda_input_mux alc889_capture_sources[3] = {
1726 /* Digital mic only available on first "ADC" */
1733 { "Front Mic", 0xb },
1734 { "Input Mix", 0xa },
1743 { "Input Mix", 0xa },
1752 { "Input Mix", 0xa },
1757 static struct snd_kcontrol_new alc888_base_mixer[] = {
1758 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1759 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1760 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1761 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1762 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1764 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1765 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1766 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1767 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1768 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1769 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1770 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1771 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1772 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1779 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
1780 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1781 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1782 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1783 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1784 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
1786 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1787 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1788 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
1793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1798 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
1800 struct alc_spec *spec = codec->spec;
1802 spec->autocfg.hp_pins[0] = 0x15;
1803 spec->autocfg.speaker_pins[0] = 0x14;
1804 spec->autocfg.speaker_pins[1] = 0x16;
1805 spec->autocfg.speaker_pins[2] = 0x17;
1808 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
1810 struct alc_spec *spec = codec->spec;
1812 spec->autocfg.hp_pins[0] = 0x15;
1813 spec->autocfg.speaker_pins[0] = 0x14;
1814 spec->autocfg.speaker_pins[1] = 0x16;
1815 spec->autocfg.speaker_pins[2] = 0x17;
1818 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
1820 struct alc_spec *spec = codec->spec;
1822 spec->autocfg.hp_pins[0] = 0x15;
1823 spec->autocfg.speaker_pins[0] = 0x14;
1824 spec->autocfg.speaker_pins[1] = 0x16;
1825 spec->autocfg.speaker_pins[2] = 0x1b;
1829 * ALC880 3-stack model
1831 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
1832 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
1833 * F-Mic = 0x1b, HP = 0x19
1836 static hda_nid_t alc880_dac_nids[4] = {
1837 /* front, rear, clfe, rear_surr */
1838 0x02, 0x05, 0x04, 0x03
1841 static hda_nid_t alc880_adc_nids[3] = {
1846 /* The datasheet says the node 0x07 is connected from inputs,
1847 * but it shows zero connection in the real implementation on some devices.
1848 * Note: this is a 915GAV bug, fixed on 915GLV
1850 static hda_nid_t alc880_adc_nids_alt[2] = {
1855 #define ALC880_DIGOUT_NID 0x06
1856 #define ALC880_DIGIN_NID 0x0a
1858 static struct hda_input_mux alc880_capture_source = {
1862 { "Front Mic", 0x3 },
1868 /* channel source setting (2/6 channel selection for 3-stack) */
1870 static struct hda_verb alc880_threestack_ch2_init[] = {
1871 /* set line-in to input, mute it */
1872 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1873 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1874 /* set mic-in to input vref 80%, mute it */
1875 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1876 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1881 static struct hda_verb alc880_threestack_ch6_init[] = {
1882 /* set line-in to output, unmute it */
1883 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1884 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1885 /* set mic-in to output, unmute it */
1886 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1887 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1891 static struct hda_channel_mode alc880_threestack_modes[2] = {
1892 { 2, alc880_threestack_ch2_init },
1893 { 6, alc880_threestack_ch6_init },
1896 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
1897 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1898 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1899 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1900 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1901 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1902 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1903 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1904 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1905 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1906 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1907 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1908 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1909 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1910 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1911 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
1912 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
1913 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
1915 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1916 .name = "Channel Mode",
1917 .info = alc_ch_mode_info,
1918 .get = alc_ch_mode_get,
1919 .put = alc_ch_mode_put,
1924 /* capture mixer elements */
1925 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
1926 struct snd_ctl_elem_info *uinfo)
1928 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1929 struct alc_spec *spec = codec->spec;
1932 mutex_lock(&codec->control_mutex);
1933 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1935 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
1936 mutex_unlock(&codec->control_mutex);
1940 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
1941 unsigned int size, unsigned int __user *tlv)
1943 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1944 struct alc_spec *spec = codec->spec;
1947 mutex_lock(&codec->control_mutex);
1948 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
1950 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
1951 mutex_unlock(&codec->control_mutex);
1955 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
1956 struct snd_ctl_elem_value *ucontrol);
1958 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
1959 struct snd_ctl_elem_value *ucontrol,
1962 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1963 struct alc_spec *spec = codec->spec;
1964 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1967 mutex_lock(&codec->control_mutex);
1968 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
1970 err = func(kcontrol, ucontrol);
1971 mutex_unlock(&codec->control_mutex);
1975 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
1976 struct snd_ctl_elem_value *ucontrol)
1978 return alc_cap_getput_caller(kcontrol, ucontrol,
1979 snd_hda_mixer_amp_volume_get);
1982 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
1983 struct snd_ctl_elem_value *ucontrol)
1985 return alc_cap_getput_caller(kcontrol, ucontrol,
1986 snd_hda_mixer_amp_volume_put);
1989 /* capture mixer elements */
1990 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1992 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
1993 struct snd_ctl_elem_value *ucontrol)
1995 return alc_cap_getput_caller(kcontrol, ucontrol,
1996 snd_hda_mixer_amp_switch_get);
1999 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2000 struct snd_ctl_elem_value *ucontrol)
2002 return alc_cap_getput_caller(kcontrol, ucontrol,
2003 snd_hda_mixer_amp_switch_put);
2006 #define _DEFINE_CAPMIX(num) \
2008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2009 .name = "Capture Switch", \
2010 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2012 .info = alc_cap_sw_info, \
2013 .get = alc_cap_sw_get, \
2014 .put = alc_cap_sw_put, \
2017 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2018 .name = "Capture Volume", \
2019 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2020 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2021 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2023 .info = alc_cap_vol_info, \
2024 .get = alc_cap_vol_get, \
2025 .put = alc_cap_vol_put, \
2026 .tlv = { .c = alc_cap_vol_tlv }, \
2029 #define _DEFINE_CAPSRC(num) \
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2032 /* .name = "Capture Source", */ \
2033 .name = "Input Source", \
2035 .info = alc_mux_enum_info, \
2036 .get = alc_mux_enum_get, \
2037 .put = alc_mux_enum_put, \
2040 #define DEFINE_CAPMIX(num) \
2041 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2042 _DEFINE_CAPMIX(num), \
2043 _DEFINE_CAPSRC(num), \
2047 #define DEFINE_CAPMIX_NOSRC(num) \
2048 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2049 _DEFINE_CAPMIX(num), \
2053 /* up to three ADCs */
2057 DEFINE_CAPMIX_NOSRC(1);
2058 DEFINE_CAPMIX_NOSRC(2);
2059 DEFINE_CAPMIX_NOSRC(3);
2062 * ALC880 5-stack model
2064 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2066 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2067 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2070 /* additional mixers to alc880_three_stack_mixer */
2071 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2072 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2073 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2077 /* channel source setting (6/8 channel selection for 5-stack) */
2079 static struct hda_verb alc880_fivestack_ch6_init[] = {
2080 /* set line-in to input, mute it */
2081 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2082 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2087 static struct hda_verb alc880_fivestack_ch8_init[] = {
2088 /* set line-in to output, unmute it */
2089 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2090 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2094 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2095 { 6, alc880_fivestack_ch6_init },
2096 { 8, alc880_fivestack_ch8_init },
2101 * ALC880 6-stack model
2103 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2104 * Side = 0x05 (0x0f)
2105 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2106 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2109 static hda_nid_t alc880_6st_dac_nids[4] = {
2110 /* front, rear, clfe, rear_surr */
2111 0x02, 0x03, 0x04, 0x05
2114 static struct hda_input_mux alc880_6stack_capture_source = {
2118 { "Front Mic", 0x1 },
2124 /* fixed 8-channels */
2125 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2129 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2135 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2136 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2137 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2138 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2139 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2145 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2150 .name = "Channel Mode",
2151 .info = alc_ch_mode_info,
2152 .get = alc_ch_mode_get,
2153 .put = alc_ch_mode_put,
2162 * W810 has rear IO for:
2165 * Center/LFE (DAC 04)
2168 * The system also has a pair of internal speakers, and a headphone jack.
2169 * These are both connected to Line2 on the codec, hence to DAC 02.
2171 * There is a variable resistor to control the speaker or headphone
2172 * volume. This is a hardware-only device without a software API.
2174 * Plugging headphones in will disable the internal speakers. This is
2175 * implemented in hardware, not via the driver using jack sense. In
2176 * a similar fashion, plugging into the rear socket marked "front" will
2177 * disable both the speakers and headphones.
2179 * For input, there's a microphone jack, and an "audio in" jack.
2180 * These may not do anything useful with this driver yet, because I
2181 * haven't setup any initialization verbs for these yet...
2184 static hda_nid_t alc880_w810_dac_nids[3] = {
2185 /* front, rear/surround, clfe */
2189 /* fixed 6 channels */
2190 static struct hda_channel_mode alc880_w810_modes[1] = {
2194 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2195 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2196 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2197 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2199 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2200 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2201 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2202 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2203 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2204 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2212 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2213 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2217 static hda_nid_t alc880_z71v_dac_nids[1] = {
2220 #define ALC880_Z71V_HP_DAC 0x03
2222 /* fixed 2 channels */
2223 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2227 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2228 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2229 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2230 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2231 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2232 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2233 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2235 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2241 * ALC880 F1734 model
2243 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2244 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2247 static hda_nid_t alc880_f1734_dac_nids[1] = {
2250 #define ALC880_F1734_HP_DAC 0x02
2252 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2253 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2254 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2255 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2256 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2257 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2258 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2260 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2264 static struct hda_input_mux alc880_f1734_capture_source = {
2276 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2277 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2278 * Mic = 0x18, Line = 0x1a
2281 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2282 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2284 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2285 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2286 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2287 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2288 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2289 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2290 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2291 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2292 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2293 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2294 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2295 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2296 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2297 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2298 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2301 .name = "Channel Mode",
2302 .info = alc_ch_mode_info,
2303 .get = alc_ch_mode_get,
2304 .put = alc_ch_mode_put,
2310 * ALC880 ASUS W1V model
2312 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2313 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2314 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2317 /* additional mixers to alc880_asus_mixer */
2318 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2319 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2320 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2325 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2326 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2327 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2328 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2329 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2330 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2331 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2332 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2333 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2334 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2339 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2340 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2341 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2343 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2344 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2346 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2347 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2348 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2349 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2350 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2351 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2352 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2353 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2354 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2357 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2358 .name = "Channel Mode",
2359 .info = alc_ch_mode_info,
2360 .get = alc_ch_mode_get,
2361 .put = alc_ch_mode_put,
2366 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2367 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2368 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2369 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2370 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2371 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2372 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2373 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2374 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2375 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2376 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2380 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2381 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2382 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2383 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2384 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2385 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2386 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2391 * virtual master controls
2395 * slave controls for virtual master
2397 static const char *alc_slave_vols[] = {
2398 "Front Playback Volume",
2399 "Surround Playback Volume",
2400 "Center Playback Volume",
2401 "LFE Playback Volume",
2402 "Side Playback Volume",
2403 "Headphone Playback Volume",
2404 "Speaker Playback Volume",
2405 "Mono Playback Volume",
2406 "Line-Out Playback Volume",
2407 "PCM Playback Volume",
2411 static const char *alc_slave_sws[] = {
2412 "Front Playback Switch",
2413 "Surround Playback Switch",
2414 "Center Playback Switch",
2415 "LFE Playback Switch",
2416 "Side Playback Switch",
2417 "Headphone Playback Switch",
2418 "Speaker Playback Switch",
2419 "Mono Playback Switch",
2420 "IEC958 Playback Switch",
2421 "Line-Out Playback Switch",
2422 "PCM Playback Switch",
2427 * build control elements
2430 #define NID_MAPPING (-1)
2432 #define SUBDEV_SPEAKER_ (0 << 6)
2433 #define SUBDEV_HP_ (1 << 6)
2434 #define SUBDEV_LINE_ (2 << 6)
2435 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2436 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2437 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2439 static void alc_free_kctls(struct hda_codec *codec);
2441 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2442 /* additional beep mixers; the actual parameters are overwritten at build */
2443 static struct snd_kcontrol_new alc_beep_mixer[] = {
2444 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2445 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2450 static int alc_build_controls(struct hda_codec *codec)
2452 struct alc_spec *spec = codec->spec;
2453 struct snd_kcontrol *kctl;
2454 struct snd_kcontrol_new *knew;
2459 for (i = 0; i < spec->num_mixers; i++) {
2460 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2464 if (spec->cap_mixer) {
2465 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2469 if (spec->multiout.dig_out_nid) {
2470 err = snd_hda_create_spdif_out_ctls(codec,
2471 spec->multiout.dig_out_nid);
2474 if (!spec->no_analog) {
2475 err = snd_hda_create_spdif_share_sw(codec,
2479 spec->multiout.share_spdif = 1;
2482 if (spec->dig_in_nid) {
2483 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2488 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2489 /* create beep controls if needed */
2490 if (spec->beep_amp) {
2491 struct snd_kcontrol_new *knew;
2492 for (knew = alc_beep_mixer; knew->name; knew++) {
2493 struct snd_kcontrol *kctl;
2494 kctl = snd_ctl_new1(knew, codec);
2497 kctl->private_value = spec->beep_amp;
2498 err = snd_hda_ctl_add(codec, 0, kctl);
2505 /* if we have no master control, let's create it */
2506 if (!spec->no_analog &&
2507 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2508 unsigned int vmaster_tlv[4];
2509 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2510 HDA_OUTPUT, vmaster_tlv);
2511 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2512 vmaster_tlv, alc_slave_vols);
2516 if (!spec->no_analog &&
2517 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2518 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2519 NULL, alc_slave_sws);
2524 alc_free_kctls(codec); /* no longer needed */
2526 /* assign Capture Source enums to NID */
2527 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2529 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2530 for (i = 0; kctl && i < kctl->count; i++) {
2531 hda_nid_t *nids = spec->capsrc_nids;
2533 nids = spec->adc_nids;
2534 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2538 if (spec->cap_mixer) {
2539 const char *kname = kctl ? kctl->id.name : NULL;
2540 for (knew = spec->cap_mixer; knew->name; knew++) {
2541 if (kname && strcmp(knew->name, kname) == 0)
2543 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2544 for (i = 0; kctl && i < kctl->count; i++) {
2545 err = snd_hda_add_nid(codec, kctl, i,
2553 /* other nid->control mapping */
2554 for (i = 0; i < spec->num_mixers; i++) {
2555 for (knew = spec->mixers[i]; knew->name; knew++) {
2556 if (knew->iface != NID_MAPPING)
2558 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2561 u = knew->subdevice;
2562 for (j = 0; j < 4; j++, u >>= 8) {
2567 case SUBDEV_SPEAKER_:
2568 nid = spec->autocfg.speaker_pins[nid];
2571 nid = spec->autocfg.line_out_pins[nid];
2574 nid = spec->autocfg.hp_pins[nid];
2579 err = snd_hda_add_nid(codec, kctl, 0, nid);
2583 u = knew->private_value;
2584 for (j = 0; j < 4; j++, u >>= 8) {
2588 err = snd_hda_add_nid(codec, kctl, 0, nid);
2599 * initialize the codec volumes, etc
2603 * generic initialization of ADC, input mixers and output mixers
2605 static struct hda_verb alc880_volume_init_verbs[] = {
2607 * Unmute ADC0-2 and set the default input to mic-in
2609 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2610 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2611 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
2612 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2613 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
2614 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2616 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
2618 * Note: PASD motherboards uses the Line In 2 as the input for front
2621 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
2622 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2623 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2624 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
2625 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
2626 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
2627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
2628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
2631 * Set up output mixers (0x0c - 0x0f)
2633 /* set vol=0 to output mixers */
2634 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2635 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2636 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2637 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
2638 /* set up input amps for analog loopback */
2639 /* Amp Indices: DAC = 0, mixer = 1 */
2640 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2641 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2642 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2643 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2644 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2645 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2646 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2647 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2653 * 3-stack pin configuration:
2654 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
2656 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
2658 * preset connection lists of input pins
2659 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2661 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
2662 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2663 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
2666 * Set pin mode and muting
2668 /* set front pin widgets 0x14 for output */
2669 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2670 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2671 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2674 /* Mic2 (as headphone out) for HP output */
2675 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2677 /* Line In pin widget for input */
2678 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2680 /* Line2 (as front mic) pin widget for input and vref at 80% */
2681 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2683 /* CD pin widget for input */
2684 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2690 * 5-stack pin configuration:
2691 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
2692 * line-in/side = 0x1a, f-mic = 0x1b
2694 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
2696 * preset connection lists of input pins
2697 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
2699 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2700 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
2703 * Set pin mode and muting
2705 /* set pin widgets 0x14-0x17 for output */
2706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2709 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2710 /* unmute pins for output (no gain on this amp) */
2711 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2712 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2714 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2716 /* Mic1 (rear panel) pin widget for input and vref at 80% */
2717 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2718 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2719 /* Mic2 (as headphone out) for HP output */
2720 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2721 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2722 /* Line In pin widget for input */
2723 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2724 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2725 /* Line2 (as front mic) pin widget for input and vref at 80% */
2726 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2727 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2728 /* CD pin widget for input */
2729 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2735 * W810 pin configuration:
2736 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
2738 static struct hda_verb alc880_pin_w810_init_verbs[] = {
2739 /* hphone/speaker input selector: front DAC */
2740 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
2742 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2743 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2744 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2745 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2746 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2747 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2749 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2756 * Z71V pin configuration:
2757 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
2759 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
2760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2762 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2763 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2765 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2774 * 6-stack pin configuration:
2775 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
2776 * f-mic = 0x19, line = 0x1a, HP = 0x1b
2778 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
2779 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2781 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2782 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2784 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2785 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2786 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2787 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2790 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2791 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2792 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2793 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2794 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2795 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2796 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2797 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2798 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2804 * Uniwill pin configuration:
2805 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
2808 static struct hda_verb alc880_uniwill_init_verbs[] = {
2809 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2811 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2812 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2813 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2814 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2815 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2816 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2817 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2818 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2819 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2820 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2821 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2822 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2823 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2824 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2826 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2827 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2828 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2829 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2830 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2831 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2832 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
2833 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
2834 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2836 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2837 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
2844 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
2846 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
2847 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
2849 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2850 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2851 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2852 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2853 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2854 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2855 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2856 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2857 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2858 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2859 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
2860 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
2862 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2863 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2864 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2865 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2866 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2867 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2869 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
2870 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
2875 static struct hda_verb alc880_beep_init_verbs[] = {
2876 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
2880 /* auto-toggle front mic */
2881 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
2883 unsigned int present;
2886 present = snd_hda_jack_detect(codec, 0x18);
2887 bits = present ? HDA_AMP_MUTE : 0;
2888 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
2891 static void alc880_uniwill_setup(struct hda_codec *codec)
2893 struct alc_spec *spec = codec->spec;
2895 spec->autocfg.hp_pins[0] = 0x14;
2896 spec->autocfg.speaker_pins[0] = 0x15;
2897 spec->autocfg.speaker_pins[0] = 0x16;
2900 static void alc880_uniwill_init_hook(struct hda_codec *codec)
2902 alc_automute_amp(codec);
2903 alc880_uniwill_mic_automute(codec);
2906 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
2909 /* Looks like the unsol event is incompatible with the standard
2910 * definition. 4bit tag is placed at 28 bit!
2912 switch (res >> 28) {
2913 case ALC880_MIC_EVENT:
2914 alc880_uniwill_mic_automute(codec);
2917 alc_automute_amp_unsol_event(codec, res);
2922 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
2924 struct alc_spec *spec = codec->spec;
2926 spec->autocfg.hp_pins[0] = 0x14;
2927 spec->autocfg.speaker_pins[0] = 0x15;
2930 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
2932 unsigned int present;
2934 present = snd_hda_codec_read(codec, 0x21, 0,
2935 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
2936 present &= HDA_AMP_VOLMASK;
2937 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
2938 HDA_AMP_VOLMASK, present);
2939 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
2940 HDA_AMP_VOLMASK, present);
2943 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
2946 /* Looks like the unsol event is incompatible with the standard
2947 * definition. 4bit tag is placed at 28 bit!
2949 if ((res >> 28) == ALC880_DCVOL_EVENT)
2950 alc880_uniwill_p53_dcvol_automute(codec);
2952 alc_automute_amp_unsol_event(codec, res);
2956 * F1734 pin configuration:
2957 * HP = 0x14, speaker-out = 0x15, mic = 0x18
2959 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
2960 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
2961 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2962 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2963 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2964 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2966 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2967 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2968 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2969 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2971 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
2972 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2973 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
2974 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
2975 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2976 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2977 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2978 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2979 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2981 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
2982 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
2988 * ASUS pin configuration:
2989 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
2991 static struct hda_verb alc880_pin_asus_init_verbs[] = {
2992 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
2993 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
2994 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
2995 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
2997 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2998 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2999 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3000 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3002 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3003 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3006 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3007 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3008 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3009 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3010 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3011 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3013 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3014 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3019 /* Enable GPIO mask and set output */
3020 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3021 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3022 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3024 /* Clevo m520g init */
3025 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3026 /* headphone output */
3027 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3029 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3030 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3032 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3033 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3035 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3036 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3037 /* Mic1 (rear panel) */
3038 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3039 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3040 /* Mic2 (front panel) */
3041 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3042 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3044 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3045 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3046 /* change to EAPD mode */
3047 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3048 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3053 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3054 /* change to EAPD mode */
3055 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3056 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3058 /* Headphone output */
3059 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3061 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3062 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3064 /* Line In pin widget for input */
3065 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3066 /* CD pin widget for input */
3067 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3068 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3069 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3071 /* change to EAPD mode */
3072 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3073 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3079 * LG m1 express dual
3082 * Rear Line-In/Out (blue): 0x14
3083 * Build-in Mic-In: 0x15
3085 * HP-Out (green): 0x1b
3086 * Mic-In/Out (red): 0x19
3090 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3091 static hda_nid_t alc880_lg_dac_nids[3] = {
3095 /* seems analog CD is not working */
3096 static struct hda_input_mux alc880_lg_capture_source = {
3101 { "Internal Mic", 0x6 },
3105 /* 2,4,6 channel modes */
3106 static struct hda_verb alc880_lg_ch2_init[] = {
3107 /* set line-in and mic-in to input */
3108 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3109 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3113 static struct hda_verb alc880_lg_ch4_init[] = {
3114 /* set line-in to out and mic-in to input */
3115 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3116 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3120 static struct hda_verb alc880_lg_ch6_init[] = {
3121 /* set line-in and mic-in to output */
3122 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3123 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3127 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3128 { 2, alc880_lg_ch2_init },
3129 { 4, alc880_lg_ch4_init },
3130 { 6, alc880_lg_ch6_init },
3133 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3134 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3135 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3136 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3137 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3138 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3139 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3140 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3141 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3144 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3145 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3146 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3147 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3150 .name = "Channel Mode",
3151 .info = alc_ch_mode_info,
3152 .get = alc_ch_mode_get,
3153 .put = alc_ch_mode_put,
3158 static struct hda_verb alc880_lg_init_verbs[] = {
3159 /* set capture source to mic-in */
3160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3161 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3162 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3163 /* mute all amp mixer inputs */
3164 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3165 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3166 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3167 /* line-in to input */
3168 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3169 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3174 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3175 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3176 /* mic-in to input */
3177 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3178 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3179 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3181 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3182 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3183 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3185 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3189 /* toggle speaker-output according to the hp-jack state */
3190 static void alc880_lg_setup(struct hda_codec *codec)
3192 struct alc_spec *spec = codec->spec;
3194 spec->autocfg.hp_pins[0] = 0x1b;
3195 spec->autocfg.speaker_pins[0] = 0x17;
3204 * Built-in Mic-In: 0x19
3210 static struct hda_input_mux alc880_lg_lw_capture_source = {
3214 { "Internal Mic", 0x1 },
3219 #define alc880_lg_lw_modes alc880_threestack_modes
3221 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3224 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3225 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3226 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3227 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3228 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3229 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3230 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3231 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3232 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3233 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3234 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3235 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3237 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3238 .name = "Channel Mode",
3239 .info = alc_ch_mode_info,
3240 .get = alc_ch_mode_get,
3241 .put = alc_ch_mode_put,
3246 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3247 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3248 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3249 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3251 /* set capture source to mic-in */
3252 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3254 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3255 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3257 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3258 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3260 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3261 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3262 /* mic-in to input */
3263 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3269 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3273 /* toggle speaker-output according to the hp-jack state */
3274 static void alc880_lg_lw_setup(struct hda_codec *codec)
3276 struct alc_spec *spec = codec->spec;
3278 spec->autocfg.hp_pins[0] = 0x1b;
3279 spec->autocfg.speaker_pins[0] = 0x14;
3282 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3283 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3284 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3285 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3286 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3287 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3288 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3292 static struct hda_input_mux alc880_medion_rim_capture_source = {
3296 { "Internal Mic", 0x1 },
3300 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3301 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3304 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3306 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3307 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3309 /* Mic2 (as headphone out) for HP output */
3310 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3312 /* Internal Speaker */
3313 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3314 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3316 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3317 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3319 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3323 /* toggle speaker-output according to the hp-jack state */
3324 static void alc880_medion_rim_automute(struct hda_codec *codec)
3326 struct alc_spec *spec = codec->spec;
3327 alc_automute_amp(codec);
3329 if (spec->jack_present)
3330 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3332 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3335 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3338 /* Looks like the unsol event is incompatible with the standard
3339 * definition. 4bit tag is placed at 28 bit!
3341 if ((res >> 28) == ALC880_HP_EVENT)
3342 alc880_medion_rim_automute(codec);
3345 static void alc880_medion_rim_setup(struct hda_codec *codec)
3347 struct alc_spec *spec = codec->spec;
3349 spec->autocfg.hp_pins[0] = 0x14;
3350 spec->autocfg.speaker_pins[0] = 0x1b;
3353 #ifdef CONFIG_SND_HDA_POWER_SAVE
3354 static struct hda_amp_list alc880_loopbacks[] = {
3355 { 0x0b, HDA_INPUT, 0 },
3356 { 0x0b, HDA_INPUT, 1 },
3357 { 0x0b, HDA_INPUT, 2 },
3358 { 0x0b, HDA_INPUT, 3 },
3359 { 0x0b, HDA_INPUT, 4 },
3363 static struct hda_amp_list alc880_lg_loopbacks[] = {
3364 { 0x0b, HDA_INPUT, 1 },
3365 { 0x0b, HDA_INPUT, 6 },
3366 { 0x0b, HDA_INPUT, 7 },
3375 static int alc_init(struct hda_codec *codec)
3377 struct alc_spec *spec = codec->spec;
3381 alc_auto_init_amp(codec, spec->init_amp);
3383 for (i = 0; i < spec->num_init_verbs; i++)
3384 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3386 if (spec->init_hook)
3387 spec->init_hook(codec);
3392 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3394 struct alc_spec *spec = codec->spec;
3396 if (spec->unsol_event)
3397 spec->unsol_event(codec, res);
3400 #ifdef CONFIG_SND_HDA_POWER_SAVE
3401 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3403 struct alc_spec *spec = codec->spec;
3404 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3409 * Analog playback callbacks
3411 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3412 struct hda_codec *codec,
3413 struct snd_pcm_substream *substream)
3415 struct alc_spec *spec = codec->spec;
3416 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3420 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3421 struct hda_codec *codec,
3422 unsigned int stream_tag,
3423 unsigned int format,
3424 struct snd_pcm_substream *substream)
3426 struct alc_spec *spec = codec->spec;
3427 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3428 stream_tag, format, substream);
3431 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3432 struct hda_codec *codec,
3433 struct snd_pcm_substream *substream)
3435 struct alc_spec *spec = codec->spec;
3436 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3442 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3443 struct hda_codec *codec,
3444 struct snd_pcm_substream *substream)
3446 struct alc_spec *spec = codec->spec;
3447 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3450 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3451 struct hda_codec *codec,
3452 unsigned int stream_tag,
3453 unsigned int format,
3454 struct snd_pcm_substream *substream)
3456 struct alc_spec *spec = codec->spec;
3457 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3458 stream_tag, format, substream);
3461 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3462 struct hda_codec *codec,
3463 struct snd_pcm_substream *substream)
3465 struct alc_spec *spec = codec->spec;
3466 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3469 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3470 struct hda_codec *codec,
3471 struct snd_pcm_substream *substream)
3473 struct alc_spec *spec = codec->spec;
3474 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3480 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3481 struct hda_codec *codec,
3482 unsigned int stream_tag,
3483 unsigned int format,
3484 struct snd_pcm_substream *substream)
3486 struct alc_spec *spec = codec->spec;
3488 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3489 stream_tag, 0, format);
3493 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3494 struct hda_codec *codec,
3495 struct snd_pcm_substream *substream)
3497 struct alc_spec *spec = codec->spec;
3499 snd_hda_codec_cleanup_stream(codec,
3500 spec->adc_nids[substream->number + 1]);
3507 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3511 /* NID is set in alc_build_pcms */
3513 .open = alc880_playback_pcm_open,
3514 .prepare = alc880_playback_pcm_prepare,
3515 .cleanup = alc880_playback_pcm_cleanup
3519 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3523 /* NID is set in alc_build_pcms */
3526 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3530 /* NID is set in alc_build_pcms */
3533 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3534 .substreams = 2, /* can be overridden */
3537 /* NID is set in alc_build_pcms */
3539 .prepare = alc880_alt_capture_pcm_prepare,
3540 .cleanup = alc880_alt_capture_pcm_cleanup
3544 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3548 /* NID is set in alc_build_pcms */
3550 .open = alc880_dig_playback_pcm_open,
3551 .close = alc880_dig_playback_pcm_close,
3552 .prepare = alc880_dig_playback_pcm_prepare,
3553 .cleanup = alc880_dig_playback_pcm_cleanup
3557 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3561 /* NID is set in alc_build_pcms */
3564 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3565 static struct hda_pcm_stream alc_pcm_null_stream = {
3571 static int alc_build_pcms(struct hda_codec *codec)
3573 struct alc_spec *spec = codec->spec;
3574 struct hda_pcm *info = spec->pcm_rec;
3577 codec->num_pcms = 1;
3578 codec->pcm_info = info;
3580 if (spec->no_analog)
3583 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
3584 "%s Analog", codec->chip_name);
3585 info->name = spec->stream_name_analog;
3587 if (spec->stream_analog_playback) {
3588 if (snd_BUG_ON(!spec->multiout.dac_nids))
3590 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
3591 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
3593 if (spec->stream_analog_capture) {
3594 if (snd_BUG_ON(!spec->adc_nids))
3596 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
3597 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
3600 if (spec->channel_mode) {
3601 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
3602 for (i = 0; i < spec->num_channel_mode; i++) {
3603 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
3604 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
3610 /* SPDIF for stream index #1 */
3611 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
3612 snprintf(spec->stream_name_digital,
3613 sizeof(spec->stream_name_digital),
3614 "%s Digital", codec->chip_name);
3615 codec->num_pcms = 2;
3616 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
3617 info = spec->pcm_rec + 1;
3618 info->name = spec->stream_name_digital;
3619 if (spec->dig_out_type)
3620 info->pcm_type = spec->dig_out_type;
3622 info->pcm_type = HDA_PCM_TYPE_SPDIF;
3623 if (spec->multiout.dig_out_nid &&
3624 spec->stream_digital_playback) {
3625 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
3626 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
3628 if (spec->dig_in_nid &&
3629 spec->stream_digital_capture) {
3630 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
3631 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
3633 /* FIXME: do we need this for all Realtek codec models? */
3634 codec->spdif_status_reset = 1;
3637 if (spec->no_analog)
3640 /* If the use of more than one ADC is requested for the current
3641 * model, configure a second analog capture-only PCM.
3643 /* Additional Analaog capture for index #2 */
3644 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
3645 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
3646 codec->num_pcms = 3;
3647 info = spec->pcm_rec + 2;
3648 info->name = spec->stream_name_analog;
3649 if (spec->alt_dac_nid) {
3650 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3651 *spec->stream_analog_alt_playback;
3652 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
3655 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
3656 alc_pcm_null_stream;
3657 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
3659 if (spec->num_adc_nids > 1) {
3660 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3661 *spec->stream_analog_alt_capture;
3662 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
3664 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
3665 spec->num_adc_nids - 1;
3667 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
3668 alc_pcm_null_stream;
3669 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
3676 static inline void alc_shutup(struct hda_codec *codec)
3678 snd_hda_shutup_pins(codec);
3681 static void alc_free_kctls(struct hda_codec *codec)
3683 struct alc_spec *spec = codec->spec;
3685 if (spec->kctls.list) {
3686 struct snd_kcontrol_new *kctl = spec->kctls.list;
3688 for (i = 0; i < spec->kctls.used; i++)
3689 kfree(kctl[i].name);
3691 snd_array_free(&spec->kctls);
3694 static void alc_free(struct hda_codec *codec)
3696 struct alc_spec *spec = codec->spec;
3702 alc_free_kctls(codec);
3704 snd_hda_detach_beep_device(codec);
3707 #ifdef CONFIG_SND_HDA_POWER_SAVE
3708 static void alc_power_eapd(struct hda_codec *codec)
3710 /* We currently only handle front, HP */
3711 switch (codec->vendor_id) {
3713 set_eapd(codec, 0x0f, 0);
3714 set_eapd(codec, 0x10, 0);
3727 set_eapd(codec, 0x14, 0);
3728 set_eapd(codec, 0x15, 0);
3733 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
3735 struct alc_spec *spec = codec->spec;
3737 if (spec && spec->power_hook)
3738 spec->power_hook(codec);
3743 #ifdef SND_HDA_NEEDS_RESUME
3744 static int alc_resume(struct hda_codec *codec)
3746 codec->patch_ops.init(codec);
3747 snd_hda_codec_resume_amp(codec);
3748 snd_hda_codec_resume_cache(codec);
3755 static struct hda_codec_ops alc_patch_ops = {
3756 .build_controls = alc_build_controls,
3757 .build_pcms = alc_build_pcms,
3760 .unsol_event = alc_unsol_event,
3761 #ifdef SND_HDA_NEEDS_RESUME
3762 .resume = alc_resume,
3764 #ifdef CONFIG_SND_HDA_POWER_SAVE
3765 .suspend = alc_suspend,
3766 .check_power_status = alc_check_power_status,
3768 .reboot_notify = alc_shutup,
3773 * Test configuration for debugging
3775 * Almost all inputs/outputs are enabled. I/O pins can be configured via
3778 #ifdef CONFIG_SND_DEBUG
3779 static hda_nid_t alc880_test_dac_nids[4] = {
3780 0x02, 0x03, 0x04, 0x05
3783 static struct hda_input_mux alc880_test_capture_source = {
3792 { "Surround", 0x6 },
3796 static struct hda_channel_mode alc880_test_modes[4] = {
3803 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
3804 struct snd_ctl_elem_info *uinfo)
3806 static char *texts[] = {
3807 "N/A", "Line Out", "HP Out",
3808 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
3810 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3812 uinfo->value.enumerated.items = 8;
3813 if (uinfo->value.enumerated.item >= 8)
3814 uinfo->value.enumerated.item = 7;
3815 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3819 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
3820 struct snd_ctl_elem_value *ucontrol)
3822 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3823 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3824 unsigned int pin_ctl, item = 0;
3826 pin_ctl = snd_hda_codec_read(codec, nid, 0,
3827 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3828 if (pin_ctl & AC_PINCTL_OUT_EN) {
3829 if (pin_ctl & AC_PINCTL_HP_EN)
3833 } else if (pin_ctl & AC_PINCTL_IN_EN) {
3834 switch (pin_ctl & AC_PINCTL_VREFEN) {
3835 case AC_PINCTL_VREF_HIZ: item = 3; break;
3836 case AC_PINCTL_VREF_50: item = 4; break;
3837 case AC_PINCTL_VREF_GRD: item = 5; break;
3838 case AC_PINCTL_VREF_80: item = 6; break;
3839 case AC_PINCTL_VREF_100: item = 7; break;
3842 ucontrol->value.enumerated.item[0] = item;
3846 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
3847 struct snd_ctl_elem_value *ucontrol)
3849 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3850 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3851 static unsigned int ctls[] = {
3852 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
3853 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
3854 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
3855 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
3856 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
3857 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
3859 unsigned int old_ctl, new_ctl;
3861 old_ctl = snd_hda_codec_read(codec, nid, 0,
3862 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
3863 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
3864 if (old_ctl != new_ctl) {
3866 snd_hda_codec_write_cache(codec, nid, 0,
3867 AC_VERB_SET_PIN_WIDGET_CONTROL,
3869 val = ucontrol->value.enumerated.item[0] >= 3 ?
3871 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
3878 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
3879 struct snd_ctl_elem_info *uinfo)
3881 static char *texts[] = {
3882 "Front", "Surround", "CLFE", "Side"
3884 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
3886 uinfo->value.enumerated.items = 4;
3887 if (uinfo->value.enumerated.item >= 4)
3888 uinfo->value.enumerated.item = 3;
3889 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
3893 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
3894 struct snd_ctl_elem_value *ucontrol)
3896 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3897 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3900 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
3901 ucontrol->value.enumerated.item[0] = sel & 3;
3905 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
3906 struct snd_ctl_elem_value *ucontrol)
3908 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3909 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
3912 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
3913 if (ucontrol->value.enumerated.item[0] != sel) {
3914 sel = ucontrol->value.enumerated.item[0] & 3;
3915 snd_hda_codec_write_cache(codec, nid, 0,
3916 AC_VERB_SET_CONNECT_SEL, sel);
3922 #define PIN_CTL_TEST(xname,nid) { \
3923 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3925 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3926 .info = alc_test_pin_ctl_info, \
3927 .get = alc_test_pin_ctl_get, \
3928 .put = alc_test_pin_ctl_put, \
3929 .private_value = nid \
3932 #define PIN_SRC_TEST(xname,nid) { \
3933 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3935 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
3936 .info = alc_test_pin_src_info, \
3937 .get = alc_test_pin_src_get, \
3938 .put = alc_test_pin_src_put, \
3939 .private_value = nid \
3942 static struct snd_kcontrol_new alc880_test_mixer[] = {
3943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3944 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
3945 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
3946 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3947 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3948 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
3949 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
3950 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
3951 PIN_CTL_TEST("Front Pin Mode", 0x14),
3952 PIN_CTL_TEST("Surround Pin Mode", 0x15),
3953 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
3954 PIN_CTL_TEST("Side Pin Mode", 0x17),
3955 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
3956 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
3957 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
3958 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
3959 PIN_SRC_TEST("In-1 Pin Source", 0x18),
3960 PIN_SRC_TEST("In-2 Pin Source", 0x19),
3961 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
3962 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
3963 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
3964 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
3965 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
3966 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
3967 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
3968 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
3969 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
3970 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
3971 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
3972 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
3974 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3975 .name = "Channel Mode",
3976 .info = alc_ch_mode_info,
3977 .get = alc_ch_mode_get,
3978 .put = alc_ch_mode_put,
3983 static struct hda_verb alc880_test_init_verbs[] = {
3984 /* Unmute inputs of 0x0c - 0x0f */
3985 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3986 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3987 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3988 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3989 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3990 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3991 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3992 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3993 /* Vol output for 0x0c-0x0f */
3994 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3995 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3996 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3997 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3998 /* Set output pins 0x14-0x17 */
3999 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4000 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4001 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4002 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4003 /* Unmute output pins 0x14-0x17 */
4004 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4005 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4006 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4007 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4008 /* Set input pins 0x18-0x1c */
4009 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4010 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4011 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4012 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4013 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4014 /* Mute input pins 0x18-0x1b */
4015 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4016 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4017 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4018 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4020 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4021 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4022 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4023 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4024 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4025 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4026 /* Analog input/passthru */
4027 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4028 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4029 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4030 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4031 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4039 static const char *alc880_models[ALC880_MODEL_LAST] = {
4040 [ALC880_3ST] = "3stack",
4041 [ALC880_TCL_S700] = "tcl",
4042 [ALC880_3ST_DIG] = "3stack-digout",
4043 [ALC880_CLEVO] = "clevo",
4044 [ALC880_5ST] = "5stack",
4045 [ALC880_5ST_DIG] = "5stack-digout",
4046 [ALC880_W810] = "w810",
4047 [ALC880_Z71V] = "z71v",
4048 [ALC880_6ST] = "6stack",
4049 [ALC880_6ST_DIG] = "6stack-digout",
4050 [ALC880_ASUS] = "asus",
4051 [ALC880_ASUS_W1V] = "asus-w1v",
4052 [ALC880_ASUS_DIG] = "asus-dig",
4053 [ALC880_ASUS_DIG2] = "asus-dig2",
4054 [ALC880_UNIWILL_DIG] = "uniwill",
4055 [ALC880_UNIWILL_P53] = "uniwill-p53",
4056 [ALC880_FUJITSU] = "fujitsu",
4057 [ALC880_F1734] = "F1734",
4059 [ALC880_LG_LW] = "lg-lw",
4060 [ALC880_MEDION_RIM] = "medion",
4061 #ifdef CONFIG_SND_DEBUG
4062 [ALC880_TEST] = "test",
4064 [ALC880_AUTO] = "auto",
4067 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4068 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4069 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4070 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4071 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4072 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4073 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4074 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4075 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4076 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4077 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4078 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4079 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4080 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4081 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4082 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4083 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4084 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4085 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4086 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4087 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4088 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4089 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4090 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4091 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4092 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4093 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4094 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4095 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4096 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4097 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4098 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4099 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4100 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4101 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4102 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4103 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4104 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4105 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4106 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4107 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4108 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4109 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4110 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4111 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4112 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4113 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4114 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4115 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4116 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4117 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL),
4118 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4119 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4120 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4121 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4122 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4123 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4124 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4125 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4126 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4127 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4128 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4129 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4130 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4131 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4132 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4133 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4134 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4135 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4137 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4138 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4139 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4144 * ALC880 codec presets
4146 static struct alc_config_preset alc880_presets[] = {
4148 .mixers = { alc880_three_stack_mixer },
4149 .init_verbs = { alc880_volume_init_verbs,
4150 alc880_pin_3stack_init_verbs },
4151 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4152 .dac_nids = alc880_dac_nids,
4153 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4154 .channel_mode = alc880_threestack_modes,
4156 .input_mux = &alc880_capture_source,
4158 [ALC880_3ST_DIG] = {
4159 .mixers = { alc880_three_stack_mixer },
4160 .init_verbs = { alc880_volume_init_verbs,
4161 alc880_pin_3stack_init_verbs },
4162 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4163 .dac_nids = alc880_dac_nids,
4164 .dig_out_nid = ALC880_DIGOUT_NID,
4165 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4166 .channel_mode = alc880_threestack_modes,
4168 .input_mux = &alc880_capture_source,
4170 [ALC880_TCL_S700] = {
4171 .mixers = { alc880_tcl_s700_mixer },
4172 .init_verbs = { alc880_volume_init_verbs,
4173 alc880_pin_tcl_S700_init_verbs,
4174 alc880_gpio2_init_verbs },
4175 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4176 .dac_nids = alc880_dac_nids,
4177 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4178 .num_adc_nids = 1, /* single ADC */
4180 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4181 .channel_mode = alc880_2_jack_modes,
4182 .input_mux = &alc880_capture_source,
4185 .mixers = { alc880_three_stack_mixer,
4186 alc880_five_stack_mixer},
4187 .init_verbs = { alc880_volume_init_verbs,
4188 alc880_pin_5stack_init_verbs },
4189 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4190 .dac_nids = alc880_dac_nids,
4191 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4192 .channel_mode = alc880_fivestack_modes,
4193 .input_mux = &alc880_capture_source,
4195 [ALC880_5ST_DIG] = {
4196 .mixers = { alc880_three_stack_mixer,
4197 alc880_five_stack_mixer },
4198 .init_verbs = { alc880_volume_init_verbs,
4199 alc880_pin_5stack_init_verbs },
4200 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4201 .dac_nids = alc880_dac_nids,
4202 .dig_out_nid = ALC880_DIGOUT_NID,
4203 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4204 .channel_mode = alc880_fivestack_modes,
4205 .input_mux = &alc880_capture_source,
4208 .mixers = { alc880_six_stack_mixer },
4209 .init_verbs = { alc880_volume_init_verbs,
4210 alc880_pin_6stack_init_verbs },
4211 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4212 .dac_nids = alc880_6st_dac_nids,
4213 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4214 .channel_mode = alc880_sixstack_modes,
4215 .input_mux = &alc880_6stack_capture_source,
4217 [ALC880_6ST_DIG] = {
4218 .mixers = { alc880_six_stack_mixer },
4219 .init_verbs = { alc880_volume_init_verbs,
4220 alc880_pin_6stack_init_verbs },
4221 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4222 .dac_nids = alc880_6st_dac_nids,
4223 .dig_out_nid = ALC880_DIGOUT_NID,
4224 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4225 .channel_mode = alc880_sixstack_modes,
4226 .input_mux = &alc880_6stack_capture_source,
4229 .mixers = { alc880_w810_base_mixer },
4230 .init_verbs = { alc880_volume_init_verbs,
4231 alc880_pin_w810_init_verbs,
4232 alc880_gpio2_init_verbs },
4233 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4234 .dac_nids = alc880_w810_dac_nids,
4235 .dig_out_nid = ALC880_DIGOUT_NID,
4236 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4237 .channel_mode = alc880_w810_modes,
4238 .input_mux = &alc880_capture_source,
4241 .mixers = { alc880_z71v_mixer },
4242 .init_verbs = { alc880_volume_init_verbs,
4243 alc880_pin_z71v_init_verbs },
4244 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4245 .dac_nids = alc880_z71v_dac_nids,
4246 .dig_out_nid = ALC880_DIGOUT_NID,
4248 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4249 .channel_mode = alc880_2_jack_modes,
4250 .input_mux = &alc880_capture_source,
4253 .mixers = { alc880_f1734_mixer },
4254 .init_verbs = { alc880_volume_init_verbs,
4255 alc880_pin_f1734_init_verbs },
4256 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4257 .dac_nids = alc880_f1734_dac_nids,
4259 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4260 .channel_mode = alc880_2_jack_modes,
4261 .input_mux = &alc880_f1734_capture_source,
4262 .unsol_event = alc880_uniwill_p53_unsol_event,
4263 .setup = alc880_uniwill_p53_setup,
4264 .init_hook = alc_automute_amp,
4267 .mixers = { alc880_asus_mixer },
4268 .init_verbs = { alc880_volume_init_verbs,
4269 alc880_pin_asus_init_verbs,
4270 alc880_gpio1_init_verbs },
4271 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4272 .dac_nids = alc880_asus_dac_nids,
4273 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4274 .channel_mode = alc880_asus_modes,
4276 .input_mux = &alc880_capture_source,
4278 [ALC880_ASUS_DIG] = {
4279 .mixers = { alc880_asus_mixer },
4280 .init_verbs = { alc880_volume_init_verbs,
4281 alc880_pin_asus_init_verbs,
4282 alc880_gpio1_init_verbs },
4283 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4284 .dac_nids = alc880_asus_dac_nids,
4285 .dig_out_nid = ALC880_DIGOUT_NID,
4286 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4287 .channel_mode = alc880_asus_modes,
4289 .input_mux = &alc880_capture_source,
4291 [ALC880_ASUS_DIG2] = {
4292 .mixers = { alc880_asus_mixer },
4293 .init_verbs = { alc880_volume_init_verbs,
4294 alc880_pin_asus_init_verbs,
4295 alc880_gpio2_init_verbs }, /* use GPIO2 */
4296 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4297 .dac_nids = alc880_asus_dac_nids,
4298 .dig_out_nid = ALC880_DIGOUT_NID,
4299 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4300 .channel_mode = alc880_asus_modes,
4302 .input_mux = &alc880_capture_source,
4304 [ALC880_ASUS_W1V] = {
4305 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4306 .init_verbs = { alc880_volume_init_verbs,
4307 alc880_pin_asus_init_verbs,
4308 alc880_gpio1_init_verbs },
4309 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4310 .dac_nids = alc880_asus_dac_nids,
4311 .dig_out_nid = ALC880_DIGOUT_NID,
4312 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4313 .channel_mode = alc880_asus_modes,
4315 .input_mux = &alc880_capture_source,
4317 [ALC880_UNIWILL_DIG] = {
4318 .mixers = { alc880_asus_mixer },
4319 .init_verbs = { alc880_volume_init_verbs,
4320 alc880_pin_asus_init_verbs },
4321 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4322 .dac_nids = alc880_asus_dac_nids,
4323 .dig_out_nid = ALC880_DIGOUT_NID,
4324 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4325 .channel_mode = alc880_asus_modes,
4327 .input_mux = &alc880_capture_source,
4329 [ALC880_UNIWILL] = {
4330 .mixers = { alc880_uniwill_mixer },
4331 .init_verbs = { alc880_volume_init_verbs,
4332 alc880_uniwill_init_verbs },
4333 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4334 .dac_nids = alc880_asus_dac_nids,
4335 .dig_out_nid = ALC880_DIGOUT_NID,
4336 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4337 .channel_mode = alc880_threestack_modes,
4339 .input_mux = &alc880_capture_source,
4340 .unsol_event = alc880_uniwill_unsol_event,
4341 .setup = alc880_uniwill_setup,
4342 .init_hook = alc880_uniwill_init_hook,
4344 [ALC880_UNIWILL_P53] = {
4345 .mixers = { alc880_uniwill_p53_mixer },
4346 .init_verbs = { alc880_volume_init_verbs,
4347 alc880_uniwill_p53_init_verbs },
4348 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4349 .dac_nids = alc880_asus_dac_nids,
4350 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4351 .channel_mode = alc880_threestack_modes,
4352 .input_mux = &alc880_capture_source,
4353 .unsol_event = alc880_uniwill_p53_unsol_event,
4354 .setup = alc880_uniwill_p53_setup,
4355 .init_hook = alc_automute_amp,
4357 [ALC880_FUJITSU] = {
4358 .mixers = { alc880_fujitsu_mixer },
4359 .init_verbs = { alc880_volume_init_verbs,
4360 alc880_uniwill_p53_init_verbs,
4361 alc880_beep_init_verbs },
4362 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4363 .dac_nids = alc880_dac_nids,
4364 .dig_out_nid = ALC880_DIGOUT_NID,
4365 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4366 .channel_mode = alc880_2_jack_modes,
4367 .input_mux = &alc880_capture_source,
4368 .unsol_event = alc880_uniwill_p53_unsol_event,
4369 .setup = alc880_uniwill_p53_setup,
4370 .init_hook = alc_automute_amp,
4373 .mixers = { alc880_three_stack_mixer },
4374 .init_verbs = { alc880_volume_init_verbs,
4375 alc880_pin_clevo_init_verbs },
4376 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4377 .dac_nids = alc880_dac_nids,
4379 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4380 .channel_mode = alc880_threestack_modes,
4382 .input_mux = &alc880_capture_source,
4385 .mixers = { alc880_lg_mixer },
4386 .init_verbs = { alc880_volume_init_verbs,
4387 alc880_lg_init_verbs },
4388 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4389 .dac_nids = alc880_lg_dac_nids,
4390 .dig_out_nid = ALC880_DIGOUT_NID,
4391 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4392 .channel_mode = alc880_lg_ch_modes,
4394 .input_mux = &alc880_lg_capture_source,
4395 .unsol_event = alc_automute_amp_unsol_event,
4396 .setup = alc880_lg_setup,
4397 .init_hook = alc_automute_amp,
4398 #ifdef CONFIG_SND_HDA_POWER_SAVE
4399 .loopbacks = alc880_lg_loopbacks,
4403 .mixers = { alc880_lg_lw_mixer },
4404 .init_verbs = { alc880_volume_init_verbs,
4405 alc880_lg_lw_init_verbs },
4406 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4407 .dac_nids = alc880_dac_nids,
4408 .dig_out_nid = ALC880_DIGOUT_NID,
4409 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4410 .channel_mode = alc880_lg_lw_modes,
4411 .input_mux = &alc880_lg_lw_capture_source,
4412 .unsol_event = alc_automute_amp_unsol_event,
4413 .setup = alc880_lg_lw_setup,
4414 .init_hook = alc_automute_amp,
4416 [ALC880_MEDION_RIM] = {
4417 .mixers = { alc880_medion_rim_mixer },
4418 .init_verbs = { alc880_volume_init_verbs,
4419 alc880_medion_rim_init_verbs,
4420 alc_gpio2_init_verbs },
4421 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4422 .dac_nids = alc880_dac_nids,
4423 .dig_out_nid = ALC880_DIGOUT_NID,
4424 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4425 .channel_mode = alc880_2_jack_modes,
4426 .input_mux = &alc880_medion_rim_capture_source,
4427 .unsol_event = alc880_medion_rim_unsol_event,
4428 .setup = alc880_medion_rim_setup,
4429 .init_hook = alc880_medion_rim_automute,
4431 #ifdef CONFIG_SND_DEBUG
4433 .mixers = { alc880_test_mixer },
4434 .init_verbs = { alc880_test_init_verbs },
4435 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4436 .dac_nids = alc880_test_dac_nids,
4437 .dig_out_nid = ALC880_DIGOUT_NID,
4438 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4439 .channel_mode = alc880_test_modes,
4440 .input_mux = &alc880_test_capture_source,
4446 * Automatic parse of I/O pins from the BIOS configuration
4451 ALC_CTL_WIDGET_MUTE,
4454 static struct snd_kcontrol_new alc880_control_templates[] = {
4455 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4456 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4457 HDA_BIND_MUTE(NULL, 0, 0, 0),
4460 /* add dynamic controls */
4461 static int add_control(struct alc_spec *spec, int type, const char *name,
4464 struct snd_kcontrol_new *knew;
4466 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4467 knew = snd_array_new(&spec->kctls);
4470 *knew = alc880_control_templates[type];
4471 knew->name = kstrdup(name, GFP_KERNEL);
4474 if (get_amp_nid_(val))
4475 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4476 knew->private_value = val;
4480 static int add_control_with_pfx(struct alc_spec *spec, int type,
4481 const char *pfx, const char *dir,
4482 const char *sfx, unsigned long val)
4485 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4486 return add_control(spec, type, name, val);
4489 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4490 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", val)
4491 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4492 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", val)
4494 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4495 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4496 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4497 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4498 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4499 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4500 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4501 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4502 #define ALC880_PIN_CD_NID 0x1c
4504 /* fill in the dac_nids table from the parsed pin configuration */
4505 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4506 const struct auto_pin_cfg *cfg)
4512 memset(assigned, 0, sizeof(assigned));
4513 spec->multiout.dac_nids = spec->private_dac_nids;
4515 /* check the pins hardwired to audio widget */
4516 for (i = 0; i < cfg->line_outs; i++) {
4517 nid = cfg->line_out_pins[i];
4518 if (alc880_is_fixed_pin(nid)) {
4519 int idx = alc880_fixed_pin_idx(nid);
4520 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4524 /* left pins can be connect to any audio widget */
4525 for (i = 0; i < cfg->line_outs; i++) {
4526 nid = cfg->line_out_pins[i];
4527 if (alc880_is_fixed_pin(nid))
4529 /* search for an empty channel */
4530 for (j = 0; j < cfg->line_outs; j++) {
4532 spec->multiout.dac_nids[i] =
4533 alc880_idx_to_dac(j);
4539 spec->multiout.num_dacs = cfg->line_outs;
4543 /* add playback controls from the parsed DAC table */
4544 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4545 const struct auto_pin_cfg *cfg)
4547 static const char *chname[4] = {
4548 "Front", "Surround", NULL /*CLFE*/, "Side"
4553 for (i = 0; i < cfg->line_outs; i++) {
4554 if (!spec->multiout.dac_nids[i])
4556 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
4559 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4561 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
4565 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
4567 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
4571 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4573 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
4577 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
4579 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
4585 if (cfg->line_outs == 1 &&
4586 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4590 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4591 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
4595 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4596 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
4605 /* add playback controls for speaker and HP outputs */
4606 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
4615 if (alc880_is_fixed_pin(pin)) {
4616 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
4617 /* specify the DAC as the extra output */
4618 if (!spec->multiout.hp_nid)
4619 spec->multiout.hp_nid = nid;
4621 spec->multiout.extra_out_nid[0] = nid;
4622 /* control HP volume/switch on the output mixer amp */
4623 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
4624 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
4625 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
4628 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
4629 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
4632 } else if (alc880_is_multi_pin(pin)) {
4633 /* set manual connection */
4634 /* we have only a switch on HP-out PIN */
4635 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
4636 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
4643 /* create input playback/capture controls for the given pin */
4644 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4645 const char *ctlname,
4646 int idx, hda_nid_t mix_nid)
4650 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
4651 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4654 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
4655 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
4661 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
4663 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
4664 return (pincap & AC_PINCAP_IN) != 0;
4667 /* create playback/capture controls for input pins */
4668 static int alc_auto_create_input_ctls(struct hda_codec *codec,
4669 const struct auto_pin_cfg *cfg,
4671 hda_nid_t cap1, hda_nid_t cap2)
4673 struct alc_spec *spec = codec->spec;
4674 struct hda_input_mux *imux = &spec->private_imux[0];
4677 for (i = 0; i < AUTO_PIN_LAST; i++) {
4680 pin = cfg->input_pins[i];
4681 if (!alc_is_input_pin(codec, pin))
4685 idx = get_connection_index(codec, mixer, pin);
4687 err = new_analog_input(spec, pin,
4688 auto_pin_cfg_labels[i],
4697 idx = get_connection_index(codec, cap1, pin);
4698 if (idx < 0 && cap2)
4699 idx = get_connection_index(codec, cap2, pin);
4701 imux->items[imux->num_items].label =
4702 auto_pin_cfg_labels[i];
4703 imux->items[imux->num_items].index = idx;
4710 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
4711 const struct auto_pin_cfg *cfg)
4713 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
4716 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
4717 unsigned int pin_type)
4719 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4722 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4726 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
4727 hda_nid_t nid, int pin_type,
4730 alc_set_pin_output(codec, nid, pin_type);
4731 /* need the manual connection? */
4732 if (alc880_is_multi_pin(nid)) {
4733 struct alc_spec *spec = codec->spec;
4734 int idx = alc880_multi_pin_idx(nid);
4735 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
4736 AC_VERB_SET_CONNECT_SEL,
4737 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
4741 static int get_pin_type(int line_out_type)
4743 if (line_out_type == AUTO_PIN_HP_OUT)
4749 static void alc880_auto_init_multi_out(struct hda_codec *codec)
4751 struct alc_spec *spec = codec->spec;
4754 for (i = 0; i < spec->autocfg.line_outs; i++) {
4755 hda_nid_t nid = spec->autocfg.line_out_pins[i];
4756 int pin_type = get_pin_type(spec->autocfg.line_out_type);
4757 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
4761 static void alc880_auto_init_extra_out(struct hda_codec *codec)
4763 struct alc_spec *spec = codec->spec;
4766 pin = spec->autocfg.speaker_pins[0];
4767 if (pin) /* connect to front */
4768 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
4769 pin = spec->autocfg.hp_pins[0];
4770 if (pin) /* connect to front */
4771 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
4774 static void alc880_auto_init_analog_input(struct hda_codec *codec)
4776 struct alc_spec *spec = codec->spec;
4779 for (i = 0; i < AUTO_PIN_LAST; i++) {
4780 hda_nid_t nid = spec->autocfg.input_pins[i];
4781 if (alc_is_input_pin(codec, nid)) {
4782 alc_set_input_pin(codec, nid, i);
4783 if (nid != ALC880_PIN_CD_NID &&
4784 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
4785 snd_hda_codec_write(codec, nid, 0,
4786 AC_VERB_SET_AMP_GAIN_MUTE,
4792 /* parse the BIOS configuration and set up the alc_spec */
4793 /* return 1 if successful, 0 if the proper config is not found,
4794 * or a negative error code
4796 static int alc880_parse_auto_config(struct hda_codec *codec)
4798 struct alc_spec *spec = codec->spec;
4800 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4802 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
4806 if (!spec->autocfg.line_outs)
4807 return 0; /* can't find valid BIOS pin config */
4809 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
4812 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
4815 err = alc880_auto_create_extra_out(spec,
4816 spec->autocfg.speaker_pins[0],
4820 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
4824 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
4828 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4830 /* check multiple SPDIF-out (for recent codecs) */
4831 for (i = 0; i < spec->autocfg.dig_outs; i++) {
4833 err = snd_hda_get_connections(codec,
4834 spec->autocfg.dig_out_pins[i],
4839 spec->multiout.dig_out_nid = dig_nid;
4841 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
4842 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
4844 spec->slave_dig_outs[i - 1] = dig_nid;
4847 if (spec->autocfg.dig_in_pin)
4848 spec->dig_in_nid = ALC880_DIGIN_NID;
4850 if (spec->kctls.list)
4851 add_mixer(spec, spec->kctls.list);
4853 add_verb(spec, alc880_volume_init_verbs);
4855 spec->num_mux_defs = 1;
4856 spec->input_mux = &spec->private_imux[0];
4858 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
4863 /* additional initialization for auto-configuration model */
4864 static void alc880_auto_init(struct hda_codec *codec)
4866 struct alc_spec *spec = codec->spec;
4867 alc880_auto_init_multi_out(codec);
4868 alc880_auto_init_extra_out(codec);
4869 alc880_auto_init_analog_input(codec);
4870 if (spec->unsol_event)
4871 alc_inithook(codec);
4874 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
4875 * one of two digital mic pins, e.g. on ALC272
4877 static void fixup_automic_adc(struct hda_codec *codec)
4879 struct alc_spec *spec = codec->spec;
4882 for (i = 0; i < spec->num_adc_nids; i++) {
4883 hda_nid_t cap = spec->capsrc_nids ?
4884 spec->capsrc_nids[i] : spec->adc_nids[i];
4887 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
4890 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
4893 spec->int_mic.mux_idx = iidx;
4894 spec->ext_mic.mux_idx = eidx;
4895 if (spec->capsrc_nids)
4896 spec->capsrc_nids += i;
4897 spec->adc_nids += i;
4898 spec->num_adc_nids = 1;
4901 snd_printd(KERN_INFO "hda_codec: %s: "
4902 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
4903 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
4904 spec->auto_mic = 0; /* disable auto-mic to be sure */
4907 /* choose the ADC/MUX containing the input pin and initialize the setup */
4908 static void fixup_single_adc(struct hda_codec *codec)
4910 struct alc_spec *spec = codec->spec;
4914 /* search for the input pin; there must be only one */
4915 for (i = 0; i < AUTO_PIN_LAST; i++) {
4916 if (spec->autocfg.input_pins[i]) {
4917 pin = spec->autocfg.input_pins[i];
4924 /* set the default connection to that pin */
4925 for (i = 0; i < spec->num_adc_nids; i++) {
4926 hda_nid_t cap = spec->capsrc_nids ?
4927 spec->capsrc_nids[i] : spec->adc_nids[i];
4930 idx = get_connection_index(codec, cap, pin);
4933 /* use only this ADC */
4934 if (spec->capsrc_nids)
4935 spec->capsrc_nids += i;
4936 spec->adc_nids += i;
4937 spec->num_adc_nids = 1;
4938 /* select or unmute this route */
4939 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4940 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4943 snd_hda_codec_write_cache(codec, cap, 0,
4944 AC_VERB_SET_CONNECT_SEL, idx);
4950 static void set_capture_mixer(struct hda_codec *codec)
4952 struct alc_spec *spec = codec->spec;
4953 static struct snd_kcontrol_new *caps[2][3] = {
4954 { alc_capture_mixer_nosrc1,
4955 alc_capture_mixer_nosrc2,
4956 alc_capture_mixer_nosrc3 },
4957 { alc_capture_mixer1,
4959 alc_capture_mixer3 },
4961 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4964 fixup_automic_adc(codec);
4965 else if (spec->input_mux) {
4966 if (spec->input_mux->num_items > 1)
4968 else if (spec->input_mux->num_items == 1)
4969 fixup_single_adc(codec);
4971 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4975 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4976 #define set_beep_amp(spec, nid, idx, dir) \
4977 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4979 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
4983 * OK, here we have finally the patch for ALC880
4986 static int patch_alc880(struct hda_codec *codec)
4988 struct alc_spec *spec;
4992 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
4998 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5001 if (board_config < 0) {
5002 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5004 board_config = ALC880_AUTO;
5007 if (board_config == ALC880_AUTO) {
5008 /* automatic parse from the BIOS config */
5009 err = alc880_parse_auto_config(codec);
5015 "hda_codec: Cannot set up configuration "
5016 "from BIOS. Using 3-stack mode...\n");
5017 board_config = ALC880_3ST;
5021 err = snd_hda_attach_beep_device(codec, 0x1);
5027 if (board_config != ALC880_AUTO)
5028 setup_preset(codec, &alc880_presets[board_config]);
5030 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5031 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5032 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5034 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5035 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5037 if (!spec->adc_nids && spec->input_mux) {
5038 /* check whether NID 0x07 is valid */
5039 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5041 wcap = get_wcaps_type(wcap);
5042 if (wcap != AC_WID_AUD_IN) {
5043 spec->adc_nids = alc880_adc_nids_alt;
5044 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5046 spec->adc_nids = alc880_adc_nids;
5047 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5050 set_capture_mixer(codec);
5051 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5053 spec->vmaster_nid = 0x0c;
5055 codec->patch_ops = alc_patch_ops;
5056 if (board_config == ALC880_AUTO)
5057 spec->init_hook = alc880_auto_init;
5058 #ifdef CONFIG_SND_HDA_POWER_SAVE
5059 if (!spec->loopback.amplist)
5060 spec->loopback.amplist = alc880_loopbacks;
5071 static hda_nid_t alc260_dac_nids[1] = {
5076 static hda_nid_t alc260_adc_nids[1] = {
5081 static hda_nid_t alc260_adc_nids_alt[1] = {
5086 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5087 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5089 static hda_nid_t alc260_dual_adc_nids[2] = {
5094 #define ALC260_DIGOUT_NID 0x03
5095 #define ALC260_DIGIN_NID 0x06
5097 static struct hda_input_mux alc260_capture_source = {
5101 { "Front Mic", 0x1 },
5107 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5108 * headphone jack and the internal CD lines since these are the only pins at
5109 * which audio can appear. For flexibility, also allow the option of
5110 * recording the mixer output on the second ADC (ADC0 doesn't have a
5111 * connection to the mixer output).
5113 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5117 { "Mic/Line", 0x0 },
5119 { "Headphone", 0x2 },
5125 { "Mic/Line", 0x0 },
5127 { "Headphone", 0x2 },
5134 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5135 * the Fujitsu S702x, but jacks are marked differently.
5137 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5144 { "Headphone", 0x5 },
5153 { "Headphone", 0x6 },
5159 /* Maxdata Favorit 100XS */
5160 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5164 { "Line/Mic", 0x0 },
5171 { "Line/Mic", 0x0 },
5179 * This is just place-holder, so there's something for alc_build_pcms to look
5180 * at when it calculates the maximum number of channels. ALC260 has no mixer
5181 * element which allows changing the channel mode, so the verb list is
5184 static struct hda_channel_mode alc260_modes[1] = {
5189 /* Mixer combinations
5191 * basic: base_output + input + pc_beep + capture
5192 * HP: base_output + input + capture_alt
5193 * HP_3013: hp_3013 + input + capture
5194 * fujitsu: fujitsu + capture
5195 * acer: acer + capture
5198 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5199 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5200 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5202 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5203 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5204 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5208 static struct snd_kcontrol_new alc260_input_mixer[] = {
5209 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5210 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5211 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5212 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5213 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5214 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5215 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5216 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5220 /* update HP, line and mono out pins according to the master switch */
5221 static void alc260_hp_master_update(struct hda_codec *codec,
5222 hda_nid_t hp, hda_nid_t line,
5225 struct alc_spec *spec = codec->spec;
5226 unsigned int val = spec->master_sw ? PIN_HP : 0;
5227 /* change HP and line-out pins */
5228 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5230 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5232 /* mono (speaker) depending on the HP jack sense */
5233 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5234 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5238 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5239 struct snd_ctl_elem_value *ucontrol)
5241 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5242 struct alc_spec *spec = codec->spec;
5243 *ucontrol->value.integer.value = spec->master_sw;
5247 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5248 struct snd_ctl_elem_value *ucontrol)
5250 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5251 struct alc_spec *spec = codec->spec;
5252 int val = !!*ucontrol->value.integer.value;
5253 hda_nid_t hp, line, mono;
5255 if (val == spec->master_sw)
5257 spec->master_sw = val;
5258 hp = (kcontrol->private_value >> 16) & 0xff;
5259 line = (kcontrol->private_value >> 8) & 0xff;
5260 mono = kcontrol->private_value & 0xff;
5261 alc260_hp_master_update(codec, hp, line, mono);
5265 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5268 .name = "Master Playback Switch",
5269 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5270 .info = snd_ctl_boolean_mono_info,
5271 .get = alc260_hp_master_sw_get,
5272 .put = alc260_hp_master_sw_put,
5273 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5275 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5276 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5277 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5278 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5279 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5281 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5285 static struct hda_verb alc260_hp_unsol_verbs[] = {
5286 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5290 static void alc260_hp_automute(struct hda_codec *codec)
5292 struct alc_spec *spec = codec->spec;
5294 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5295 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5298 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5300 if ((res >> 26) == ALC880_HP_EVENT)
5301 alc260_hp_automute(codec);
5304 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5306 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5307 .name = "Master Playback Switch",
5308 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5309 .info = snd_ctl_boolean_mono_info,
5310 .get = alc260_hp_master_sw_get,
5311 .put = alc260_hp_master_sw_put,
5312 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5314 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5315 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5316 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5317 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5318 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5319 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5320 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5321 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5325 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5326 .ops = &snd_hda_bind_vol,
5328 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5329 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5330 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5335 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5336 .ops = &snd_hda_bind_sw,
5338 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5339 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5344 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5345 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5346 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5347 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5352 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5353 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5357 static void alc260_hp_3013_automute(struct hda_codec *codec)
5359 struct alc_spec *spec = codec->spec;
5361 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5362 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5365 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5368 if ((res >> 26) == ALC880_HP_EVENT)
5369 alc260_hp_3013_automute(codec);
5372 static void alc260_hp_3012_automute(struct hda_codec *codec)
5374 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5376 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5378 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5380 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5384 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5387 if ((res >> 26) == ALC880_HP_EVENT)
5388 alc260_hp_3012_automute(codec);
5391 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5392 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5394 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5396 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5397 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5398 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5399 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5400 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5401 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5402 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5403 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5404 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5408 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5409 * versions of the ALC260 don't act on requests to enable mic bias from NID
5410 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5411 * datasheet doesn't mention this restriction. At this stage it's not clear
5412 * whether this behaviour is intentional or is a hardware bug in chip
5413 * revisions available in early 2006. Therefore for now allow the
5414 * "Headphone Jack Mode" control to span all choices, but if it turns out
5415 * that the lack of mic bias for this NID is intentional we could change the
5416 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5418 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5419 * don't appear to make the mic bias available from the "line" jack, even
5420 * though the NID used for this jack (0x14) can supply it. The theory is
5421 * that perhaps Acer have included blocking capacitors between the ALC260
5422 * and the output jack. If this turns out to be the case for all such
5423 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5424 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5426 * The C20x Tablet series have a mono internal speaker which is controlled
5427 * via the chip's Mono sum widget and pin complex, so include the necessary
5428 * controls for such models. On models without a "mono speaker" the control
5429 * won't do anything.
5431 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5432 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5433 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5434 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5435 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5437 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5439 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5440 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5441 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5442 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5443 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5444 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5445 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5446 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5450 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
5452 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
5453 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5454 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5455 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5456 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5457 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5458 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5462 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
5463 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
5465 static struct snd_kcontrol_new alc260_will_mixer[] = {
5466 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5467 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5468 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5469 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5470 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5471 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5472 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5473 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5474 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5475 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5479 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
5480 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
5482 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
5483 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5484 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
5485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5486 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5487 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5488 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
5489 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
5490 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5491 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5492 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5497 * initialization verbs
5499 static struct hda_verb alc260_init_verbs[] = {
5500 /* Line In pin widget for input */
5501 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5502 /* CD pin widget for input */
5503 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5504 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5505 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5506 /* Mic2 (front panel) pin widget for input and vref at 80% */
5507 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5508 /* LINE-2 is used for line-out in rear */
5509 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5510 /* select line-out */
5511 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
5513 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5515 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5517 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5518 /* mute capture amp left and right */
5519 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5520 /* set connection select to line in (default select for this ADC) */
5521 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5522 /* mute capture amp left and right */
5523 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5524 /* set connection select to line in (default select for this ADC) */
5525 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
5526 /* set vol=0 Line-Out mixer amp left and right */
5527 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5528 /* unmute pin widget amp left and right (no gain on this amp) */
5529 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5530 /* set vol=0 HP mixer amp left and right */
5531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5532 /* unmute pin widget amp left and right (no gain on this amp) */
5533 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5534 /* set vol=0 Mono mixer amp left and right */
5535 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5536 /* unmute pin widget amp left and right (no gain on this amp) */
5537 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5538 /* unmute LINE-2 out pin */
5539 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5540 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5543 /* mute analog inputs */
5544 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5546 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5547 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5549 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5550 /* mute Front out path */
5551 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5552 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5553 /* mute Headphone out path */
5554 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5555 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5556 /* mute Mono out path */
5557 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5558 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5562 #if 0 /* should be identical with alc260_init_verbs? */
5563 static struct hda_verb alc260_hp_init_verbs[] = {
5564 /* Headphone and output */
5565 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5567 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5568 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5569 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5570 /* Mic2 (front panel) pin widget for input and vref at 80% */
5571 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5572 /* Line In pin widget for input */
5573 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5574 /* Line-2 pin widget for output */
5575 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5576 /* CD pin widget for input */
5577 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5578 /* unmute amp left and right */
5579 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5580 /* set connection select to line in (default select for this ADC) */
5581 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5582 /* unmute Line-Out mixer amp left and right (volume = 0) */
5583 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5584 /* mute pin widget amp left and right (no gain on this amp) */
5585 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5586 /* unmute HP mixer amp left and right (volume = 0) */
5587 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5588 /* mute pin widget amp left and right (no gain on this amp) */
5589 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5590 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5593 /* mute analog inputs */
5594 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5595 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5596 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5597 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5599 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5600 /* Unmute Front out path */
5601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5602 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5603 /* Unmute Headphone out path */
5604 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5605 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5606 /* Unmute Mono out path */
5607 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5608 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5613 static struct hda_verb alc260_hp_3013_init_verbs[] = {
5614 /* Line out and output */
5615 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5617 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
5618 /* Mic1 (rear panel) pin widget for input and vref at 80% */
5619 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5620 /* Mic2 (front panel) pin widget for input and vref at 80% */
5621 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5622 /* Line In pin widget for input */
5623 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5624 /* Headphone pin widget for output */
5625 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
5626 /* CD pin widget for input */
5627 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
5628 /* unmute amp left and right */
5629 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
5630 /* set connection select to line in (default select for this ADC) */
5631 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
5632 /* unmute Line-Out mixer amp left and right (volume = 0) */
5633 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5634 /* mute pin widget amp left and right (no gain on this amp) */
5635 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5636 /* unmute HP mixer amp left and right (volume = 0) */
5637 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
5638 /* mute pin widget amp left and right (no gain on this amp) */
5639 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
5640 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
5643 /* mute analog inputs */
5644 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5645 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5646 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
5647 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
5648 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
5649 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
5650 /* Unmute Front out path */
5651 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5652 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5653 /* Unmute Headphone out path */
5654 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5655 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5656 /* Unmute Mono out path */
5657 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
5658 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
5662 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
5663 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
5664 * audio = 0x16, internal speaker = 0x10.
5666 static struct hda_verb alc260_fujitsu_init_verbs[] = {
5667 /* Disable all GPIOs */
5668 {0x01, AC_VERB_SET_GPIO_MASK, 0},
5669 /* Internal speaker is connected to headphone pin */
5670 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5671 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
5672 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5673 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
5674 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5675 /* Ensure all other unused pins are disabled and muted. */
5676 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5677 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5678 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5679 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5680 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5681 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5682 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5685 /* Disable digital (SPDIF) pins */
5686 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5687 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5689 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
5690 * when acting as an output.
5692 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5694 /* Start with output sum widgets muted and their output gains at min */
5695 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5696 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5697 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5698 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5699 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5700 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5701 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5702 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5703 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5705 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
5706 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5707 /* Unmute Line1 pin widget output buffer since it starts as an output.
5708 * If the pin mode is changed by the user the pin mode control will
5709 * take care of enabling the pin's input/output buffers as needed.
5710 * Therefore there's no need to enable the input buffer at this
5713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5714 /* Unmute input buffer of pin widget used for Line-in (no equiv
5717 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5719 /* Mute capture amp left and right */
5720 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5721 /* Set ADC connection select to match default mixer setting - line
5724 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5726 /* Do the same for the second ADC: mute capture input amp and
5727 * set ADC connection to line in (on mic1 pin)
5729 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5730 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5732 /* Mute all inputs to mixer widget (even unconnected ones) */
5733 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5734 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5735 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5736 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5737 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5738 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5739 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5740 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5745 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
5746 * similar laptops (adapted from Fujitsu init verbs).
5748 static struct hda_verb alc260_acer_init_verbs[] = {
5749 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
5750 * the headphone jack. Turn this on and rely on the standard mute
5751 * methods whenever the user wants to turn these outputs off.
5753 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5754 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5755 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5756 /* Internal speaker/Headphone jack is connected to Line-out pin */
5757 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5758 /* Internal microphone/Mic jack is connected to Mic1 pin */
5759 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5760 /* Line In jack is connected to Line1 pin */
5761 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
5762 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
5763 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5764 /* Ensure all other unused pins are disabled and muted. */
5765 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5766 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5767 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5768 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5769 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5770 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5771 /* Disable digital (SPDIF) pins */
5772 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5773 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5775 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5776 * bus when acting as outputs.
5778 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5779 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5781 /* Start with output sum widgets muted and their output gains at min */
5782 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5783 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5784 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5785 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5786 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5787 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5788 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5789 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5790 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5792 /* Unmute Line-out pin widget amp left and right
5793 * (no equiv mixer ctrl)
5795 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5796 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
5797 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5798 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5799 * inputs. If the pin mode is changed by the user the pin mode control
5800 * will take care of enabling the pin's input/output buffers as needed.
5801 * Therefore there's no need to enable the input buffer at this
5804 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5805 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5807 /* Mute capture amp left and right */
5808 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5809 /* Set ADC connection select to match default mixer setting - mic
5812 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5814 /* Do similar with the second ADC: mute capture input amp and
5815 * set ADC connection to mic to match ALSA's default state.
5817 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5818 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5820 /* Mute all inputs to mixer widget (even unconnected ones) */
5821 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5822 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5823 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5824 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5827 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5828 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5833 /* Initialisation sequence for Maxdata Favorit 100XS
5834 * (adapted from Acer init verbs).
5836 static struct hda_verb alc260_favorit100_init_verbs[] = {
5837 /* GPIO 0 enables the output jack.
5838 * Turn this on and rely on the standard mute
5839 * methods whenever the user wants to turn these outputs off.
5841 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5842 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5843 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5844 /* Line/Mic input jack is connected to Mic1 pin */
5845 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
5846 /* Ensure all other unused pins are disabled and muted. */
5847 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5848 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5849 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5850 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5851 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5852 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5853 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5854 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5855 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5856 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5857 /* Disable digital (SPDIF) pins */
5858 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
5859 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
5861 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
5862 * bus when acting as outputs.
5864 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
5865 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
5867 /* Start with output sum widgets muted and their output gains at min */
5868 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5869 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5870 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5871 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5872 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5873 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5874 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5875 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
5876 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
5878 /* Unmute Line-out pin widget amp left and right
5879 * (no equiv mixer ctrl)
5881 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
5882 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
5883 * inputs. If the pin mode is changed by the user the pin mode control
5884 * will take care of enabling the pin's input/output buffers as needed.
5885 * Therefore there's no need to enable the input buffer at this
5888 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
5890 /* Mute capture amp left and right */
5891 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5892 /* Set ADC connection select to match default mixer setting - mic
5895 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
5897 /* Do similar with the second ADC: mute capture input amp and
5898 * set ADC connection to mic to match ALSA's default state.
5900 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
5901 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
5903 /* Mute all inputs to mixer widget (even unconnected ones) */
5904 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
5905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
5906 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
5907 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
5908 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
5909 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
5910 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
5911 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
5916 static struct hda_verb alc260_will_verbs[] = {
5917 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5918 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
5919 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
5920 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5921 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5922 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
5926 static struct hda_verb alc260_replacer_672v_verbs[] = {
5927 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
5928 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
5929 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
5931 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
5932 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5933 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5935 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5939 /* toggle speaker-output according to the hp-jack state */
5940 static void alc260_replacer_672v_automute(struct hda_codec *codec)
5942 unsigned int present;
5944 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
5945 present = snd_hda_jack_detect(codec, 0x0f);
5947 snd_hda_codec_write_cache(codec, 0x01, 0,
5948 AC_VERB_SET_GPIO_DATA, 1);
5949 snd_hda_codec_write_cache(codec, 0x0f, 0,
5950 AC_VERB_SET_PIN_WIDGET_CONTROL,
5953 snd_hda_codec_write_cache(codec, 0x01, 0,
5954 AC_VERB_SET_GPIO_DATA, 0);
5955 snd_hda_codec_write_cache(codec, 0x0f, 0,
5956 AC_VERB_SET_PIN_WIDGET_CONTROL,
5961 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
5964 if ((res >> 26) == ALC880_HP_EVENT)
5965 alc260_replacer_672v_automute(codec);
5968 static struct hda_verb alc260_hp_dc7600_verbs[] = {
5969 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
5970 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
5971 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5972 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
5973 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5974 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
5975 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
5976 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5977 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5978 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5982 /* Test configuration for debugging, modelled after the ALC880 test
5985 #ifdef CONFIG_SND_DEBUG
5986 static hda_nid_t alc260_test_dac_nids[1] = {
5989 static hda_nid_t alc260_test_adc_nids[2] = {
5992 /* For testing the ALC260, each input MUX needs its own definition since
5993 * the signal assignments are different. This assumes that the first ADC
5996 static struct hda_input_mux alc260_test_capture_sources[2] = {
6000 { "MIC1 pin", 0x0 },
6001 { "MIC2 pin", 0x1 },
6002 { "LINE1 pin", 0x2 },
6003 { "LINE2 pin", 0x3 },
6005 { "LINE-OUT pin", 0x5 },
6006 { "HP-OUT pin", 0x6 },
6012 { "MIC1 pin", 0x0 },
6013 { "MIC2 pin", 0x1 },
6014 { "LINE1 pin", 0x2 },
6015 { "LINE2 pin", 0x3 },
6018 { "LINE-OUT pin", 0x6 },
6019 { "HP-OUT pin", 0x7 },
6023 static struct snd_kcontrol_new alc260_test_mixer[] = {
6024 /* Output driver widgets */
6025 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6026 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6027 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6028 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6029 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6030 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6032 /* Modes for retasking pin widgets
6033 * Note: the ALC260 doesn't seem to act on requests to enable mic
6034 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6035 * mention this restriction. At this stage it's not clear whether
6036 * this behaviour is intentional or is a hardware bug in chip
6037 * revisions available at least up until early 2006. Therefore for
6038 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6039 * choices, but if it turns out that the lack of mic bias for these
6040 * NIDs is intentional we could change their modes from
6041 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6043 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6044 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6045 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6046 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6047 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6048 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6050 /* Loopback mixer controls */
6051 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6052 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6053 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6054 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6055 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6056 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6057 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6058 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6059 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6060 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6061 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6062 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6063 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6064 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6066 /* Controls for GPIO pins, assuming they are configured as outputs */
6067 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6068 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6069 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6070 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6072 /* Switches to allow the digital IO pins to be enabled. The datasheet
6073 * is ambigious as to which NID is which; testing on laptops which
6074 * make this output available should provide clarification.
6076 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6077 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6079 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6080 * this output to turn on an external amplifier.
6082 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6083 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6087 static struct hda_verb alc260_test_init_verbs[] = {
6088 /* Enable all GPIOs as outputs with an initial value of 0 */
6089 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6090 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6091 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6093 /* Enable retasking pins as output, initially without power amp */
6094 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6095 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6096 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6097 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6098 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6099 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6101 /* Disable digital (SPDIF) pins initially, but users can enable
6102 * them via a mixer switch. In the case of SPDIF-out, this initverb
6103 * payload also sets the generation to 0, output to be in "consumer"
6104 * PCM format, copyright asserted, no pre-emphasis and no validity
6107 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6108 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6110 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6111 * OUT1 sum bus when acting as an output.
6113 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6114 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6115 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6116 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6118 /* Start with output sum widgets muted and their output gains at min */
6119 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6120 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6121 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6122 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6123 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6124 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6125 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6126 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6127 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6129 /* Unmute retasking pin widget output buffers since the default
6130 * state appears to be output. As the pin mode is changed by the
6131 * user the pin mode control will take care of enabling the pin's
6132 * input/output buffers as needed.
6134 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6135 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6136 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6137 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6138 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6139 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6140 /* Also unmute the mono-out pin widget */
6141 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6143 /* Mute capture amp left and right */
6144 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6145 /* Set ADC connection select to match default mixer setting (mic1
6148 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6150 /* Do the same for the second ADC: mute capture input amp and
6151 * set ADC connection to mic1 pin
6153 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6154 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6156 /* Mute all inputs to mixer widget (even unconnected ones) */
6157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6158 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6159 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6160 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6161 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6162 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6163 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6164 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6170 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6171 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6173 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6174 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6177 * for BIOS auto-configuration
6180 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6181 const char *pfx, int *vol_bits)
6184 unsigned long vol_val, sw_val;
6187 if (nid >= 0x0f && nid < 0x11) {
6188 nid_vol = nid - 0x7;
6189 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6190 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6191 } else if (nid == 0x11) {
6192 nid_vol = nid - 0x7;
6193 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6194 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6195 } else if (nid >= 0x12 && nid <= 0x15) {
6197 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6198 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6202 if (!(*vol_bits & (1 << nid_vol))) {
6203 /* first control for the volume widget */
6204 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6207 *vol_bits |= (1 << nid_vol);
6209 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6215 /* add playback controls from the parsed DAC table */
6216 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6217 const struct auto_pin_cfg *cfg)
6223 spec->multiout.num_dacs = 1;
6224 spec->multiout.dac_nids = spec->private_dac_nids;
6225 spec->multiout.dac_nids[0] = 0x02;
6227 nid = cfg->line_out_pins[0];
6230 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6232 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6236 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6241 nid = cfg->speaker_pins[0];
6243 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6248 nid = cfg->hp_pins[0];
6250 err = alc260_add_playback_controls(spec, nid, "Headphone",
6258 /* create playback/capture controls for input pins */
6259 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6260 const struct auto_pin_cfg *cfg)
6262 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6265 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6266 hda_nid_t nid, int pin_type,
6269 alc_set_pin_output(codec, nid, pin_type);
6270 /* need the manual connection? */
6272 int idx = nid - 0x12;
6273 snd_hda_codec_write(codec, idx + 0x0b, 0,
6274 AC_VERB_SET_CONNECT_SEL, sel_idx);
6278 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6280 struct alc_spec *spec = codec->spec;
6283 nid = spec->autocfg.line_out_pins[0];
6285 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6286 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6289 nid = spec->autocfg.speaker_pins[0];
6291 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6293 nid = spec->autocfg.hp_pins[0];
6295 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6298 #define ALC260_PIN_CD_NID 0x16
6299 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6301 struct alc_spec *spec = codec->spec;
6304 for (i = 0; i < AUTO_PIN_LAST; i++) {
6305 hda_nid_t nid = spec->autocfg.input_pins[i];
6307 alc_set_input_pin(codec, nid, i);
6308 if (nid != ALC260_PIN_CD_NID &&
6309 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6310 snd_hda_codec_write(codec, nid, 0,
6311 AC_VERB_SET_AMP_GAIN_MUTE,
6318 * generic initialization of ADC, input mixers and output mixers
6320 static struct hda_verb alc260_volume_init_verbs[] = {
6322 * Unmute ADC0-1 and set the default input to mic-in
6324 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6325 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6326 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6327 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6329 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6331 * Note: PASD motherboards uses the Line In 2 as the input for
6332 * front panel mic (mic 2)
6334 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6335 /* mute analog inputs */
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6343 * Set up output mixers (0x08 - 0x0a)
6345 /* set vol=0 to output mixers */
6346 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6347 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6348 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6349 /* set up input amps for analog loopback */
6350 /* Amp Indices: DAC = 0, mixer = 1 */
6351 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6352 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6353 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6354 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6355 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6356 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6361 static int alc260_parse_auto_config(struct hda_codec *codec)
6363 struct alc_spec *spec = codec->spec;
6365 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6367 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6371 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6374 if (!spec->kctls.list)
6375 return 0; /* can't find valid BIOS pin config */
6376 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6380 spec->multiout.max_channels = 2;
6382 if (spec->autocfg.dig_outs)
6383 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6384 if (spec->kctls.list)
6385 add_mixer(spec, spec->kctls.list);
6387 add_verb(spec, alc260_volume_init_verbs);
6389 spec->num_mux_defs = 1;
6390 spec->input_mux = &spec->private_imux[0];
6392 alc_ssid_check(codec, 0x10, 0x15, 0x0f);
6397 /* additional initialization for auto-configuration model */
6398 static void alc260_auto_init(struct hda_codec *codec)
6400 struct alc_spec *spec = codec->spec;
6401 alc260_auto_init_multi_out(codec);
6402 alc260_auto_init_analog_input(codec);
6403 if (spec->unsol_event)
6404 alc_inithook(codec);
6407 #ifdef CONFIG_SND_HDA_POWER_SAVE
6408 static struct hda_amp_list alc260_loopbacks[] = {
6409 { 0x07, HDA_INPUT, 0 },
6410 { 0x07, HDA_INPUT, 1 },
6411 { 0x07, HDA_INPUT, 2 },
6412 { 0x07, HDA_INPUT, 3 },
6413 { 0x07, HDA_INPUT, 4 },
6419 * ALC260 configurations
6421 static const char *alc260_models[ALC260_MODEL_LAST] = {
6422 [ALC260_BASIC] = "basic",
6424 [ALC260_HP_3013] = "hp-3013",
6425 [ALC260_HP_DC7600] = "hp-dc7600",
6426 [ALC260_FUJITSU_S702X] = "fujitsu",
6427 [ALC260_ACER] = "acer",
6428 [ALC260_WILL] = "will",
6429 [ALC260_REPLACER_672V] = "replacer",
6430 [ALC260_FAVORIT100] = "favorit100",
6431 #ifdef CONFIG_SND_DEBUG
6432 [ALC260_TEST] = "test",
6434 [ALC260_AUTO] = "auto",
6437 static struct snd_pci_quirk alc260_cfg_tbl[] = {
6438 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
6439 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
6440 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
6441 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
6442 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
6443 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
6444 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
6445 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
6446 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
6447 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
6448 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
6449 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
6450 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
6451 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
6452 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
6453 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
6454 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
6455 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
6456 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
6457 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
6461 static struct alc_config_preset alc260_presets[] = {
6463 .mixers = { alc260_base_output_mixer,
6464 alc260_input_mixer },
6465 .init_verbs = { alc260_init_verbs },
6466 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6467 .dac_nids = alc260_dac_nids,
6468 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6469 .adc_nids = alc260_adc_nids,
6470 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6471 .channel_mode = alc260_modes,
6472 .input_mux = &alc260_capture_source,
6475 .mixers = { alc260_hp_output_mixer,
6476 alc260_input_mixer },
6477 .init_verbs = { alc260_init_verbs,
6478 alc260_hp_unsol_verbs },
6479 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6480 .dac_nids = alc260_dac_nids,
6481 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6482 .adc_nids = alc260_adc_nids_alt,
6483 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6484 .channel_mode = alc260_modes,
6485 .input_mux = &alc260_capture_source,
6486 .unsol_event = alc260_hp_unsol_event,
6487 .init_hook = alc260_hp_automute,
6489 [ALC260_HP_DC7600] = {
6490 .mixers = { alc260_hp_dc7600_mixer,
6491 alc260_input_mixer },
6492 .init_verbs = { alc260_init_verbs,
6493 alc260_hp_dc7600_verbs },
6494 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6495 .dac_nids = alc260_dac_nids,
6496 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6497 .adc_nids = alc260_adc_nids_alt,
6498 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6499 .channel_mode = alc260_modes,
6500 .input_mux = &alc260_capture_source,
6501 .unsol_event = alc260_hp_3012_unsol_event,
6502 .init_hook = alc260_hp_3012_automute,
6504 [ALC260_HP_3013] = {
6505 .mixers = { alc260_hp_3013_mixer,
6506 alc260_input_mixer },
6507 .init_verbs = { alc260_hp_3013_init_verbs,
6508 alc260_hp_3013_unsol_verbs },
6509 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6510 .dac_nids = alc260_dac_nids,
6511 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
6512 .adc_nids = alc260_adc_nids_alt,
6513 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6514 .channel_mode = alc260_modes,
6515 .input_mux = &alc260_capture_source,
6516 .unsol_event = alc260_hp_3013_unsol_event,
6517 .init_hook = alc260_hp_3013_automute,
6519 [ALC260_FUJITSU_S702X] = {
6520 .mixers = { alc260_fujitsu_mixer },
6521 .init_verbs = { alc260_fujitsu_init_verbs },
6522 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6523 .dac_nids = alc260_dac_nids,
6524 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6525 .adc_nids = alc260_dual_adc_nids,
6526 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6527 .channel_mode = alc260_modes,
6528 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
6529 .input_mux = alc260_fujitsu_capture_sources,
6532 .mixers = { alc260_acer_mixer },
6533 .init_verbs = { alc260_acer_init_verbs },
6534 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6535 .dac_nids = alc260_dac_nids,
6536 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6537 .adc_nids = alc260_dual_adc_nids,
6538 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6539 .channel_mode = alc260_modes,
6540 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
6541 .input_mux = alc260_acer_capture_sources,
6543 [ALC260_FAVORIT100] = {
6544 .mixers = { alc260_favorit100_mixer },
6545 .init_verbs = { alc260_favorit100_init_verbs },
6546 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6547 .dac_nids = alc260_dac_nids,
6548 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
6549 .adc_nids = alc260_dual_adc_nids,
6550 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6551 .channel_mode = alc260_modes,
6552 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
6553 .input_mux = alc260_favorit100_capture_sources,
6556 .mixers = { alc260_will_mixer },
6557 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
6558 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6559 .dac_nids = alc260_dac_nids,
6560 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6561 .adc_nids = alc260_adc_nids,
6562 .dig_out_nid = ALC260_DIGOUT_NID,
6563 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6564 .channel_mode = alc260_modes,
6565 .input_mux = &alc260_capture_source,
6567 [ALC260_REPLACER_672V] = {
6568 .mixers = { alc260_replacer_672v_mixer },
6569 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
6570 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
6571 .dac_nids = alc260_dac_nids,
6572 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
6573 .adc_nids = alc260_adc_nids,
6574 .dig_out_nid = ALC260_DIGOUT_NID,
6575 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6576 .channel_mode = alc260_modes,
6577 .input_mux = &alc260_capture_source,
6578 .unsol_event = alc260_replacer_672v_unsol_event,
6579 .init_hook = alc260_replacer_672v_automute,
6581 #ifdef CONFIG_SND_DEBUG
6583 .mixers = { alc260_test_mixer },
6584 .init_verbs = { alc260_test_init_verbs },
6585 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
6586 .dac_nids = alc260_test_dac_nids,
6587 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
6588 .adc_nids = alc260_test_adc_nids,
6589 .num_channel_mode = ARRAY_SIZE(alc260_modes),
6590 .channel_mode = alc260_modes,
6591 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
6592 .input_mux = alc260_test_capture_sources,
6597 static int patch_alc260(struct hda_codec *codec)
6599 struct alc_spec *spec;
6600 int err, board_config;
6602 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6608 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
6611 if (board_config < 0) {
6612 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6614 board_config = ALC260_AUTO;
6617 if (board_config == ALC260_AUTO) {
6618 /* automatic parse from the BIOS config */
6619 err = alc260_parse_auto_config(codec);
6625 "hda_codec: Cannot set up configuration "
6626 "from BIOS. Using base mode...\n");
6627 board_config = ALC260_BASIC;
6631 err = snd_hda_attach_beep_device(codec, 0x1);
6637 if (board_config != ALC260_AUTO)
6638 setup_preset(codec, &alc260_presets[board_config]);
6640 spec->stream_analog_playback = &alc260_pcm_analog_playback;
6641 spec->stream_analog_capture = &alc260_pcm_analog_capture;
6643 spec->stream_digital_playback = &alc260_pcm_digital_playback;
6644 spec->stream_digital_capture = &alc260_pcm_digital_capture;
6646 if (!spec->adc_nids && spec->input_mux) {
6647 /* check whether NID 0x04 is valid */
6648 unsigned int wcap = get_wcaps(codec, 0x04);
6649 wcap = get_wcaps_type(wcap);
6651 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
6652 spec->adc_nids = alc260_adc_nids_alt;
6653 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
6655 spec->adc_nids = alc260_adc_nids;
6656 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
6659 set_capture_mixer(codec);
6660 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
6662 spec->vmaster_nid = 0x08;
6664 codec->patch_ops = alc_patch_ops;
6665 if (board_config == ALC260_AUTO)
6666 spec->init_hook = alc260_auto_init;
6667 #ifdef CONFIG_SND_HDA_POWER_SAVE
6668 if (!spec->loopback.amplist)
6669 spec->loopback.amplist = alc260_loopbacks;
6677 * ALC882/883/885/888/889 support
6679 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
6680 * configuration. Each pin widget can choose any input DACs and a mixer.
6681 * Each ADC is connected from a mixer of all inputs. This makes possible
6682 * 6-channel independent captures.
6684 * In addition, an independent DAC for the multi-playback (not used in this
6687 #define ALC882_DIGOUT_NID 0x06
6688 #define ALC882_DIGIN_NID 0x0a
6689 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
6690 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
6691 #define ALC1200_DIGOUT_NID 0x10
6694 static struct hda_channel_mode alc882_ch_modes[1] = {
6699 static hda_nid_t alc882_dac_nids[4] = {
6700 /* front, rear, clfe, rear_surr */
6701 0x02, 0x03, 0x04, 0x05
6703 #define alc883_dac_nids alc882_dac_nids
6706 #define alc882_adc_nids alc880_adc_nids
6707 #define alc882_adc_nids_alt alc880_adc_nids_alt
6708 #define alc883_adc_nids alc882_adc_nids_alt
6709 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
6710 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
6711 #define alc889_adc_nids alc880_adc_nids
6713 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
6714 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
6715 #define alc883_capsrc_nids alc882_capsrc_nids_alt
6716 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
6717 #define alc889_capsrc_nids alc882_capsrc_nids
6720 /* FIXME: should be a matrix-type input source selection */
6722 static struct hda_input_mux alc882_capture_source = {
6726 { "Front Mic", 0x1 },
6732 #define alc883_capture_source alc882_capture_source
6734 static struct hda_input_mux alc889_capture_source = {
6737 { "Front Mic", 0x0 },
6743 static struct hda_input_mux mb5_capture_source = {
6752 static struct hda_input_mux alc883_3stack_6ch_intel = {
6756 { "Front Mic", 0x0 },
6762 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
6770 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
6780 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
6788 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
6792 { "Front Mic", 0x1 },
6797 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6805 static struct hda_input_mux alc889A_mb31_capture_source = {
6809 /* Front Mic (0x01) unused */
6811 /* Line 2 (0x03) unused */
6812 /* CD (0x04) unused? */
6819 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
6826 static struct hda_verb alc882_3ST_ch2_init[] = {
6827 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6828 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6829 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6830 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6837 static struct hda_verb alc882_3ST_ch4_init[] = {
6838 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6839 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6840 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6841 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6842 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6849 static struct hda_verb alc882_3ST_ch6_init[] = {
6850 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6851 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6852 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6853 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6854 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6855 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6859 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
6860 { 2, alc882_3ST_ch2_init },
6861 { 4, alc882_3ST_ch4_init },
6862 { 6, alc882_3ST_ch6_init },
6865 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
6870 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
6871 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
6872 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6873 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6874 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6875 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6882 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
6883 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6884 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
6885 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
6886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6895 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
6896 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6897 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6898 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6899 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
6900 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6901 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
6902 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6906 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
6907 { 2, alc883_3ST_ch2_clevo_init },
6908 { 4, alc883_3ST_ch4_clevo_init },
6909 { 6, alc883_3ST_ch6_clevo_init },
6916 static struct hda_verb alc882_sixstack_ch6_init[] = {
6917 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
6918 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6919 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6920 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6927 static struct hda_verb alc882_sixstack_ch8_init[] = {
6928 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6929 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6930 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6931 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6935 static struct hda_channel_mode alc882_sixstack_modes[2] = {
6936 { 6, alc882_sixstack_ch6_init },
6937 { 8, alc882_sixstack_ch8_init },
6941 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
6947 static struct hda_verb alc885_mbp_ch2_init[] = {
6948 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
6949 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6950 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6957 static struct hda_verb alc885_mbp_ch4_init[] = {
6958 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
6959 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6960 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
6961 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6962 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6966 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
6967 { 2, alc885_mbp_ch2_init },
6968 { 4, alc885_mbp_ch4_init },
6973 * Speakers/Woofer/HP = Front
6976 static struct hda_verb alc885_mb5_ch2_init[] = {
6977 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
6984 * Speakers/HP = Front
6988 static struct hda_verb alc885_mb5_ch6_init[] = {
6989 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6990 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6991 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6995 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
6996 { 2, alc885_mb5_ch2_init },
6997 { 6, alc885_mb5_ch6_init },
7004 static struct hda_verb alc883_4ST_ch2_init[] = {
7005 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7006 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7007 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7008 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7009 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7010 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7017 static struct hda_verb alc883_4ST_ch4_init[] = {
7018 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7019 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7020 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7021 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7022 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7023 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7024 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7031 static struct hda_verb alc883_4ST_ch6_init[] = {
7032 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7033 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7034 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7035 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7036 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7037 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7038 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7039 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7046 static struct hda_verb alc883_4ST_ch8_init[] = {
7047 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7048 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7049 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7050 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7051 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7052 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7053 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7054 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7055 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7059 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7060 { 2, alc883_4ST_ch2_init },
7061 { 4, alc883_4ST_ch4_init },
7062 { 6, alc883_4ST_ch6_init },
7063 { 8, alc883_4ST_ch8_init },
7070 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7071 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7072 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7073 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7074 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7081 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7082 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7083 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7084 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7085 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7086 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7093 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7094 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7095 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7096 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7097 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7098 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7099 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7103 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7104 { 2, alc883_3ST_ch2_intel_init },
7105 { 4, alc883_3ST_ch4_intel_init },
7106 { 6, alc883_3ST_ch6_intel_init },
7112 static struct hda_verb alc889_ch2_intel_init[] = {
7113 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7114 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7115 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7116 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7117 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7118 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7125 static struct hda_verb alc889_ch6_intel_init[] = {
7126 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7127 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7128 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7129 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7130 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7131 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7138 static struct hda_verb alc889_ch8_intel_init[] = {
7139 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7140 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7141 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7142 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7143 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7144 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7145 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7149 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7150 { 2, alc889_ch2_intel_init },
7151 { 6, alc889_ch6_intel_init },
7152 { 8, alc889_ch8_intel_init },
7158 static struct hda_verb alc883_sixstack_ch6_init[] = {
7159 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7160 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7161 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7162 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7169 static struct hda_verb alc883_sixstack_ch8_init[] = {
7170 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7171 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7172 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7173 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7177 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7178 { 6, alc883_sixstack_ch6_init },
7179 { 8, alc883_sixstack_ch8_init },
7183 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7184 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7186 static struct snd_kcontrol_new alc882_base_mixer[] = {
7187 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7188 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7190 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7193 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7194 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7195 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7196 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7197 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7198 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7199 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7200 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7201 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7202 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7203 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7205 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7207 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7211 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7212 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7213 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7214 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7215 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7216 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7217 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7218 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7219 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7220 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7221 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7226 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7227 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7228 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7229 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7230 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7231 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7232 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7234 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7235 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7236 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7237 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7238 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7239 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7240 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7244 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7245 HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7246 HDA_BIND_MUTE ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT),
7247 HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT),
7248 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7249 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7250 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7251 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7252 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7258 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7261 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7262 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7263 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7264 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7265 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7266 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7267 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7271 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7273 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7274 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7277 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7278 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7279 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7280 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7281 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7282 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7283 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7284 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7288 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7289 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7291 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7292 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7293 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7294 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7295 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7296 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7297 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7298 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7299 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7300 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7301 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7302 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7303 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7304 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7308 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7309 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7310 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7311 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7312 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7313 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7314 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7315 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7317 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7318 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7322 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7324 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7325 .name = "Channel Mode",
7326 .info = alc_ch_mode_info,
7327 .get = alc_ch_mode_get,
7328 .put = alc_ch_mode_put,
7333 static struct hda_verb alc882_base_init_verbs[] = {
7334 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7335 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7336 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7338 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7339 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7341 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7342 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7344 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7345 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7347 /* Front Pin: output 0 (0x0c) */
7348 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7349 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7350 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7351 /* Rear Pin: output 1 (0x0d) */
7352 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7353 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7354 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7355 /* CLFE Pin: output 2 (0x0e) */
7356 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7357 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7358 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7359 /* Side Pin: output 3 (0x0f) */
7360 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7361 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7362 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7363 /* Mic (rear) pin: input vref at 80% */
7364 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7365 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7366 /* Front Mic pin: input vref at 80% */
7367 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7368 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7369 /* Line In pin: input */
7370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7372 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7373 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7374 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7375 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
7376 /* CD pin widget for input */
7377 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7379 /* FIXME: use matrix-type input source selection */
7380 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7382 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7384 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7385 /* ADC2: mute amp left and right */
7386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7387 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7388 /* ADC3: mute amp left and right */
7389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7390 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7395 static struct hda_verb alc882_adc1_init_verbs[] = {
7396 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7397 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7398 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7399 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7401 /* ADC1: mute amp left and right */
7402 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7403 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7407 static struct hda_verb alc882_eapd_verbs[] = {
7408 /* change to EAPD mode */
7409 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
7410 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
7414 static struct hda_verb alc889_eapd_verbs[] = {
7415 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
7416 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
7420 static struct hda_verb alc_hp15_unsol_verbs[] = {
7421 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
7422 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7426 static struct hda_verb alc885_init_verbs[] = {
7427 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7434 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7437 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7440 /* Front HP Pin: output 0 (0x0c) */
7441 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7442 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7443 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7444 /* Front Pin: output 0 (0x0c) */
7445 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7446 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7447 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7448 /* Rear Pin: output 1 (0x0d) */
7449 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7450 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7451 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
7452 /* CLFE Pin: output 2 (0x0e) */
7453 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7454 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7455 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7456 /* Side Pin: output 3 (0x0f) */
7457 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7458 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7459 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7460 /* Mic (rear) pin: input vref at 80% */
7461 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7462 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7463 /* Front Mic pin: input vref at 80% */
7464 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7465 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7466 /* Line In pin: input */
7467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7468 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7470 /* Mixer elements: 0x18, , 0x1a, 0x1b */
7472 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7474 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7477 /* ADC2: mute amp left and right */
7478 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7479 /* ADC3: mute amp left and right */
7480 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7485 static struct hda_verb alc885_init_input_verbs[] = {
7486 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7487 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
7488 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
7493 /* Unmute Selector 24h and set the default input to front mic */
7494 static struct hda_verb alc889_init_input_verbs[] = {
7495 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
7496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7501 #define alc883_init_verbs alc882_base_init_verbs
7504 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
7505 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7506 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
7508 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
7509 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
7510 /* FIXME: this looks suspicious...
7511 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
7512 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
7517 static struct hda_verb alc882_macpro_init_verbs[] = {
7518 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7522 /* Front Pin: output 0 (0x0c) */
7523 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7524 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7525 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7526 /* Front Mic pin: input vref at 80% */
7527 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7528 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7529 /* Speaker: output */
7530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7531 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7532 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
7533 /* Headphone output (output 0 - 0x0c) */
7534 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7535 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7536 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7538 /* FIXME: use matrix-type input source selection */
7539 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7540 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7541 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7542 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7543 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7544 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7546 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7547 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7548 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7549 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7551 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7552 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7553 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7554 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7555 /* ADC1: mute amp left and right */
7556 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7557 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7558 /* ADC2: mute amp left and right */
7559 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7560 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7561 /* ADC3: mute amp left and right */
7562 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7563 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7569 static struct hda_verb alc885_mb5_init_verbs[] = {
7571 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7572 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7573 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7574 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7577 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7578 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7579 /* Surround mixer */
7580 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7581 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7582 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7584 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7585 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7586 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7588 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7589 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7590 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7591 /* Front Pin (0x0c) */
7592 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7593 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7594 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7595 /* LFE Pin (0x0e) */
7596 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
7597 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7598 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
7600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7601 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7602 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7603 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7604 /* Front Mic pin: input vref at 80% */
7605 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7606 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7608 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7609 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7611 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7612 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7613 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7614 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7618 /* Macbook Pro rev3 */
7619 static struct hda_verb alc885_mbp3_init_verbs[] = {
7620 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7621 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7622 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7623 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7625 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7626 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7627 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7629 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7630 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7631 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7632 /* Front Pin: output 0 (0x0c) */
7633 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7634 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7635 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7636 /* HP Pin: output 0 (0x0e) */
7637 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
7638 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7639 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
7640 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7641 /* Mic (rear) pin: input vref at 80% */
7642 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7643 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7644 /* Front Mic pin: input vref at 80% */
7645 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7646 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7647 /* Line In pin: use output 1 when in LineOut mode */
7648 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7649 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7650 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7652 /* FIXME: use matrix-type input source selection */
7653 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7654 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7655 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7656 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7657 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7660 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7661 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7662 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7665 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7666 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7667 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7669 /* ADC1: mute amp left and right */
7670 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7671 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7672 /* ADC2: mute amp left and right */
7673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7674 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7675 /* ADC3: mute amp left and right */
7676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7677 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7683 static struct hda_verb alc885_imac91_init_verbs[] = {
7684 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
7685 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7686 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7689 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7690 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7691 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7692 /* HP Pin: output 0 (0x0c) */
7693 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7694 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7695 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7696 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7697 /* Internal Speakers: output 0 (0x0d) */
7698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7699 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7700 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
7701 /* Mic (rear) pin: input vref at 80% */
7702 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7703 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7704 /* Front Mic pin: input vref at 80% */
7705 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7706 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7707 /* Line In pin: use output 1 when in LineOut mode */
7708 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7709 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7710 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
7712 /* FIXME: use matrix-type input source selection */
7713 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7714 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
7715 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7716 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7717 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7718 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7720 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7721 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7722 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7725 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7726 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
7727 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
7728 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7729 /* ADC1: mute amp left and right */
7730 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7731 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
7732 /* ADC2: mute amp left and right */
7733 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7734 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7735 /* ADC3: mute amp left and right */
7736 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7737 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7742 /* iMac 24 mixer. */
7743 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
7744 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7745 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
7749 /* iMac 24 init verbs. */
7750 static struct hda_verb alc885_imac24_init_verbs[] = {
7751 /* Internal speakers: output 0 (0x0c) */
7752 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7753 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7754 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
7755 /* Internal speakers: output 0 (0x0c) */
7756 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7757 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7758 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
7759 /* Headphone: output 0 (0x0c) */
7760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7762 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7763 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7764 /* Front Mic: input vref at 80% */
7765 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7766 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7770 /* Toggle speaker-output according to the hp-jack state */
7771 static void alc885_imac24_setup(struct hda_codec *codec)
7773 struct alc_spec *spec = codec->spec;
7775 spec->autocfg.hp_pins[0] = 0x14;
7776 spec->autocfg.speaker_pins[0] = 0x18;
7777 spec->autocfg.speaker_pins[1] = 0x1a;
7780 static void alc885_mbp3_setup(struct hda_codec *codec)
7782 struct alc_spec *spec = codec->spec;
7784 spec->autocfg.hp_pins[0] = 0x15;
7785 spec->autocfg.speaker_pins[0] = 0x14;
7788 static void alc885_mb5_automute(struct hda_codec *codec)
7790 unsigned int present;
7792 present = snd_hda_codec_read(codec, 0x14, 0,
7793 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7794 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7795 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7796 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7797 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7801 static void alc885_mb5_unsol_event(struct hda_codec *codec,
7804 /* Headphone insertion or removal. */
7805 if ((res >> 26) == ALC880_HP_EVENT)
7806 alc885_mb5_automute(codec);
7809 static void alc885_imac91_automute(struct hda_codec *codec)
7811 unsigned int present;
7813 present = snd_hda_codec_read(codec, 0x14, 0,
7814 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7815 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7816 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7817 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7818 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7822 static void alc885_imac91_unsol_event(struct hda_codec *codec,
7825 /* Headphone insertion or removal. */
7826 if ((res >> 26) == ALC880_HP_EVENT)
7827 alc885_imac91_automute(codec);
7830 static struct hda_verb alc882_targa_verbs[] = {
7831 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7832 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7834 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7835 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7837 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7838 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7839 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7841 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7845 /* toggle speaker-output according to the hp-jack state */
7846 static void alc882_targa_automute(struct hda_codec *codec)
7848 struct alc_spec *spec = codec->spec;
7849 alc_automute_amp(codec);
7850 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
7851 spec->jack_present ? 1 : 3);
7854 static void alc882_targa_setup(struct hda_codec *codec)
7856 struct alc_spec *spec = codec->spec;
7858 spec->autocfg.hp_pins[0] = 0x14;
7859 spec->autocfg.speaker_pins[0] = 0x1b;
7862 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
7864 if ((res >> 26) == ALC880_HP_EVENT)
7865 alc882_targa_automute(codec);
7868 static struct hda_verb alc882_asus_a7j_verbs[] = {
7869 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7870 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7872 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7873 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7874 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7876 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7877 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7878 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7880 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7881 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7882 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7886 static struct hda_verb alc882_asus_a7m_verbs[] = {
7887 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7888 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7890 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
7891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7892 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7894 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7895 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7896 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
7898 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
7899 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
7900 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
7904 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
7906 unsigned int gpiostate, gpiomask, gpiodir;
7908 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
7909 AC_VERB_GET_GPIO_DATA, 0);
7912 gpiostate |= (1 << pin);
7914 gpiostate &= ~(1 << pin);
7916 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
7917 AC_VERB_GET_GPIO_MASK, 0);
7918 gpiomask |= (1 << pin);
7920 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
7921 AC_VERB_GET_GPIO_DIRECTION, 0);
7922 gpiodir |= (1 << pin);
7925 snd_hda_codec_write(codec, codec->afg, 0,
7926 AC_VERB_SET_GPIO_MASK, gpiomask);
7927 snd_hda_codec_write(codec, codec->afg, 0,
7928 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
7932 snd_hda_codec_write(codec, codec->afg, 0,
7933 AC_VERB_SET_GPIO_DATA, gpiostate);
7936 /* set up GPIO at initialization */
7937 static void alc885_macpro_init_hook(struct hda_codec *codec)
7939 alc882_gpio_mute(codec, 0, 0);
7940 alc882_gpio_mute(codec, 1, 0);
7943 /* set up GPIO and update auto-muting at initialization */
7944 static void alc885_imac24_init_hook(struct hda_codec *codec)
7946 alc885_macpro_init_hook(codec);
7947 alc_automute_amp(codec);
7951 * generic initialization of ADC, input mixers and output mixers
7953 static struct hda_verb alc883_auto_init_verbs[] = {
7955 * Unmute ADC0-2 and set the default input to mic-in
7957 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
7958 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7959 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
7960 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7963 * Set up output mixers (0x0c - 0x0f)
7965 /* set vol=0 to output mixers */
7966 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7967 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7969 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
7970 /* set up input amps for analog loopback */
7971 /* Amp Indices: DAC = 0, mixer = 1 */
7972 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7973 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7974 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7975 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7976 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7977 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7978 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7979 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7980 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7981 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7983 /* FIXME: use matrix-type input source selection */
7984 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
7986 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7992 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
7993 static struct hda_verb alc889A_mb31_ch2_init[] = {
7994 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
7995 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
7996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
7997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8001 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8002 static struct hda_verb alc889A_mb31_ch4_init[] = {
8003 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8004 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8005 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8006 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8010 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8011 static struct hda_verb alc889A_mb31_ch5_init[] = {
8012 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8013 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8014 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8015 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8019 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8020 static struct hda_verb alc889A_mb31_ch6_init[] = {
8021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8023 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8024 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8028 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8029 { 2, alc889A_mb31_ch2_init },
8030 { 4, alc889A_mb31_ch4_init },
8031 { 5, alc889A_mb31_ch5_init },
8032 { 6, alc889A_mb31_ch6_init },
8035 static struct hda_verb alc883_medion_eapd_verbs[] = {
8036 /* eanable EAPD on medion laptop */
8037 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8038 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8042 #define alc883_base_mixer alc882_base_mixer
8044 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8045 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8046 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8048 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8050 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8051 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8052 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8053 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8054 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8055 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8056 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8057 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8061 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8062 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8063 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8064 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8065 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8066 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8067 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8068 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8069 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8070 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8071 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8075 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8076 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8077 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8078 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8079 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8080 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8081 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8082 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8083 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8084 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8085 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8089 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8090 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8091 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8092 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8093 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8094 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8095 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8096 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8097 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8098 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8099 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8100 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8101 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8102 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8106 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8107 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8108 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8109 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8110 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8111 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8112 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8113 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8114 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8115 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8116 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8117 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8118 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8119 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8120 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8122 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8123 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8124 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8125 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8129 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8130 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8131 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8132 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8133 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8134 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8136 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8137 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8138 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8140 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8141 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8142 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8143 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8144 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8145 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8147 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8148 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8153 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8154 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8155 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8156 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8157 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8158 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8160 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8161 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8162 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8163 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8164 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8165 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8166 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8167 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8169 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8170 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8171 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8172 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8177 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8178 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8179 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8180 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8181 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8182 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8183 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8184 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8185 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8187 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8188 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8189 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8190 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8191 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8192 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8193 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8194 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8195 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8196 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8200 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8201 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8202 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8204 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8205 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8206 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8207 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8208 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8209 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8210 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8211 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8212 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8216 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8217 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8221 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8222 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8223 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8224 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8228 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8229 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8230 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8231 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8232 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8233 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8237 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8238 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8239 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8240 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8241 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8242 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8246 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8247 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8248 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8249 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8250 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8253 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8254 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8258 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8259 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8260 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8262 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8263 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8264 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8265 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8266 HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8267 HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8271 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8272 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8273 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8274 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8275 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8276 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8277 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8278 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8279 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8280 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8284 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8285 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8286 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8287 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8288 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8289 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8290 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8291 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8292 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8296 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
8297 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8298 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8299 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8300 HDA_BIND_MUTE("LFE Playback Switch", 0x0f, 2, HDA_INPUT),
8301 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8302 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8303 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8304 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8305 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8306 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8307 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8311 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
8312 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8313 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8314 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
8315 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
8316 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
8317 0x0d, 1, 0x0, HDA_OUTPUT),
8318 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
8319 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
8320 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
8321 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8322 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8328 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8329 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8331 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8332 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8336 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
8338 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8339 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
8340 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
8341 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
8342 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
8344 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
8345 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
8346 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
8347 /* Output switches */
8348 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
8349 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
8350 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
8352 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
8353 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
8355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
8356 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
8357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8362 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
8363 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8364 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8365 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8366 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8367 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8368 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8372 static struct hda_bind_ctls alc883_bind_cap_vol = {
8373 .ops = &snd_hda_bind_vol,
8375 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8376 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8381 static struct hda_bind_ctls alc883_bind_cap_switch = {
8382 .ops = &snd_hda_bind_sw,
8384 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
8385 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
8390 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
8391 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8392 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8393 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8394 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8395 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8396 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8397 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8398 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8402 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
8403 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
8404 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
8406 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8407 /* .name = "Capture Source", */
8408 .name = "Input Source",
8410 .info = alc_mux_enum_info,
8411 .get = alc_mux_enum_get,
8412 .put = alc_mux_enum_put,
8417 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
8419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8420 .name = "Channel Mode",
8421 .info = alc_ch_mode_info,
8422 .get = alc_ch_mode_get,
8423 .put = alc_ch_mode_put,
8428 /* toggle speaker-output according to the hp-jack state */
8429 static void alc883_mitac_setup(struct hda_codec *codec)
8431 struct alc_spec *spec = codec->spec;
8433 spec->autocfg.hp_pins[0] = 0x15;
8434 spec->autocfg.speaker_pins[0] = 0x14;
8435 spec->autocfg.speaker_pins[1] = 0x17;
8438 /* auto-toggle front mic */
8440 static void alc883_mitac_mic_automute(struct hda_codec *codec)
8442 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
8444 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
8448 static struct hda_verb alc883_mitac_verbs[] = {
8450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8451 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8453 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8454 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8456 /* enable unsolicited event */
8457 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8458 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
8463 static struct hda_verb alc883_clevo_m540r_verbs[] = {
8465 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8466 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8468 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
8470 /* enable unsolicited event */
8472 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8473 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8479 static struct hda_verb alc883_clevo_m720_verbs[] = {
8481 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8482 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8484 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
8485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8487 /* enable unsolicited event */
8488 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8489 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8494 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
8496 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8499 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8500 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8502 /* enable unsolicited event */
8503 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8508 static struct hda_verb alc883_targa_verbs[] = {
8509 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8510 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8512 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8513 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8515 /* Connect Line-Out side jack (SPDIF) to Side */
8516 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8517 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8518 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8519 /* Connect Mic jack to CLFE */
8520 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8521 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8522 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
8523 /* Connect Line-in jack to Surround */
8524 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8525 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8526 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8527 /* Connect HP out jack to Front */
8528 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8529 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8530 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8532 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8537 static struct hda_verb alc883_lenovo_101e_verbs[] = {
8538 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8539 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
8540 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
8544 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
8545 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8546 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8547 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8548 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8552 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8555 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8556 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
8557 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8561 static struct hda_verb alc883_haier_w66_verbs[] = {
8562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8563 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8565 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8567 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8568 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8569 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8574 static struct hda_verb alc888_lenovo_sky_verbs[] = {
8575 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8576 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8577 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8578 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8580 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8581 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8582 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8586 static struct hda_verb alc888_6st_dell_verbs[] = {
8587 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8591 static struct hda_verb alc883_vaiott_verbs[] = {
8593 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8594 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8596 /* enable unsolicited event */
8597 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8602 static void alc888_3st_hp_setup(struct hda_codec *codec)
8604 struct alc_spec *spec = codec->spec;
8606 spec->autocfg.hp_pins[0] = 0x1b;
8607 spec->autocfg.speaker_pins[0] = 0x14;
8608 spec->autocfg.speaker_pins[1] = 0x16;
8609 spec->autocfg.speaker_pins[2] = 0x18;
8612 static struct hda_verb alc888_3st_hp_verbs[] = {
8613 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
8614 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
8615 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
8616 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8623 static struct hda_verb alc888_3st_hp_2ch_init[] = {
8624 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8625 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8626 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
8627 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8634 static struct hda_verb alc888_3st_hp_4ch_init[] = {
8635 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
8636 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
8637 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8638 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8639 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8646 static struct hda_verb alc888_3st_hp_6ch_init[] = {
8647 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8648 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8649 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
8650 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
8651 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
8652 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
8656 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
8657 { 2, alc888_3st_hp_2ch_init },
8658 { 4, alc888_3st_hp_4ch_init },
8659 { 6, alc888_3st_hp_6ch_init },
8662 /* toggle front-jack and RCA according to the hp-jack state */
8663 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
8665 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
8667 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8668 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8669 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8670 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8673 /* toggle RCA according to the front-jack state */
8674 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
8676 unsigned int present = snd_hda_jack_detect(codec, 0x14);
8678 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8679 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8682 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
8685 if ((res >> 26) == ALC880_HP_EVENT)
8686 alc888_lenovo_ms7195_front_automute(codec);
8687 if ((res >> 26) == ALC880_FRONT_EVENT)
8688 alc888_lenovo_ms7195_rca_automute(codec);
8691 static struct hda_verb alc883_medion_md2_verbs[] = {
8692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8697 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8701 /* toggle speaker-output according to the hp-jack state */
8702 static void alc883_medion_md2_setup(struct hda_codec *codec)
8704 struct alc_spec *spec = codec->spec;
8706 spec->autocfg.hp_pins[0] = 0x14;
8707 spec->autocfg.speaker_pins[0] = 0x15;
8710 /* toggle speaker-output according to the hp-jack state */
8711 #define alc883_targa_init_hook alc882_targa_init_hook
8712 #define alc883_targa_unsol_event alc882_targa_unsol_event
8714 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
8716 unsigned int present;
8718 present = snd_hda_jack_detect(codec, 0x18);
8719 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
8720 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8723 static void alc883_clevo_m720_setup(struct hda_codec *codec)
8725 struct alc_spec *spec = codec->spec;
8727 spec->autocfg.hp_pins[0] = 0x15;
8728 spec->autocfg.speaker_pins[0] = 0x14;
8731 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
8733 alc_automute_amp(codec);
8734 alc883_clevo_m720_mic_automute(codec);
8737 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
8740 switch (res >> 26) {
8741 case ALC880_MIC_EVENT:
8742 alc883_clevo_m720_mic_automute(codec);
8745 alc_automute_amp_unsol_event(codec, res);
8750 /* toggle speaker-output according to the hp-jack state */
8751 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
8753 struct alc_spec *spec = codec->spec;
8755 spec->autocfg.hp_pins[0] = 0x14;
8756 spec->autocfg.speaker_pins[0] = 0x15;
8759 static void alc883_haier_w66_setup(struct hda_codec *codec)
8761 struct alc_spec *spec = codec->spec;
8763 spec->autocfg.hp_pins[0] = 0x1b;
8764 spec->autocfg.speaker_pins[0] = 0x14;
8767 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
8769 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
8771 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8772 HDA_AMP_MUTE, bits);
8775 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
8777 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
8779 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
8780 HDA_AMP_MUTE, bits);
8781 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8782 HDA_AMP_MUTE, bits);
8785 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
8788 if ((res >> 26) == ALC880_HP_EVENT)
8789 alc883_lenovo_101e_all_automute(codec);
8790 if ((res >> 26) == ALC880_FRONT_EVENT)
8791 alc883_lenovo_101e_ispeaker_automute(codec);
8794 /* toggle speaker-output according to the hp-jack state */
8795 static void alc883_acer_aspire_setup(struct hda_codec *codec)
8797 struct alc_spec *spec = codec->spec;
8799 spec->autocfg.hp_pins[0] = 0x14;
8800 spec->autocfg.speaker_pins[0] = 0x15;
8801 spec->autocfg.speaker_pins[1] = 0x16;
8804 static struct hda_verb alc883_acer_eapd_verbs[] = {
8805 /* HP Pin: output 0 (0x0c) */
8806 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8808 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8809 /* Front Pin: output 0 (0x0c) */
8810 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8812 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8813 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
8814 /* eanable EAPD on medion laptop */
8815 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8816 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
8817 /* enable unsolicited event */
8818 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8822 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
8823 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8824 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
8825 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8829 static void alc888_6st_dell_setup(struct hda_codec *codec)
8831 struct alc_spec *spec = codec->spec;
8833 spec->autocfg.hp_pins[0] = 0x1b;
8834 spec->autocfg.speaker_pins[0] = 0x14;
8835 spec->autocfg.speaker_pins[1] = 0x15;
8836 spec->autocfg.speaker_pins[2] = 0x16;
8837 spec->autocfg.speaker_pins[3] = 0x17;
8840 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
8842 struct alc_spec *spec = codec->spec;
8844 spec->autocfg.hp_pins[0] = 0x1b;
8845 spec->autocfg.speaker_pins[0] = 0x14;
8846 spec->autocfg.speaker_pins[1] = 0x15;
8847 spec->autocfg.speaker_pins[2] = 0x16;
8848 spec->autocfg.speaker_pins[3] = 0x17;
8849 spec->autocfg.speaker_pins[4] = 0x1a;
8852 static void alc883_vaiott_setup(struct hda_codec *codec)
8854 struct alc_spec *spec = codec->spec;
8856 spec->autocfg.hp_pins[0] = 0x15;
8857 spec->autocfg.speaker_pins[0] = 0x14;
8858 spec->autocfg.speaker_pins[1] = 0x17;
8861 static struct hda_verb alc888_asus_m90v_verbs[] = {
8862 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8863 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8864 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8865 /* enable unsolicited event */
8866 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8867 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
8871 static void alc883_mode2_setup(struct hda_codec *codec)
8873 struct alc_spec *spec = codec->spec;
8875 spec->autocfg.hp_pins[0] = 0x1b;
8876 spec->autocfg.speaker_pins[0] = 0x14;
8877 spec->autocfg.speaker_pins[1] = 0x15;
8878 spec->autocfg.speaker_pins[2] = 0x16;
8879 spec->ext_mic.pin = 0x18;
8880 spec->int_mic.pin = 0x19;
8881 spec->ext_mic.mux_idx = 0;
8882 spec->int_mic.mux_idx = 1;
8886 static struct hda_verb alc888_asus_eee1601_verbs[] = {
8887 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8888 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8889 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8890 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8891 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8892 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
8893 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
8894 /* enable unsolicited event */
8895 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8899 static void alc883_eee1601_inithook(struct hda_codec *codec)
8901 struct alc_spec *spec = codec->spec;
8903 spec->autocfg.hp_pins[0] = 0x14;
8904 spec->autocfg.speaker_pins[0] = 0x1b;
8905 alc_automute_pin(codec);
8908 static struct hda_verb alc889A_mb31_verbs[] = {
8909 /* Init rear pin (used as headphone output) */
8910 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
8911 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
8912 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8913 /* Init line pin (used as output in 4ch and 6ch mode) */
8914 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
8915 /* Init line 2 pin (used as headphone out by default) */
8916 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
8917 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
8921 /* Mute speakers according to the headphone jack state */
8922 static void alc889A_mb31_automute(struct hda_codec *codec)
8924 unsigned int present;
8926 /* Mute only in 2ch or 4ch mode */
8927 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
8929 present = snd_hda_jack_detect(codec, 0x15);
8930 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
8931 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8932 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
8933 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
8937 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
8939 if ((res >> 26) == ALC880_HP_EVENT)
8940 alc889A_mb31_automute(codec);
8944 #ifdef CONFIG_SND_HDA_POWER_SAVE
8945 #define alc882_loopbacks alc880_loopbacks
8948 /* pcm configuration: identical with ALC880 */
8949 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
8950 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
8951 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
8952 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
8954 static hda_nid_t alc883_slave_dig_outs[] = {
8955 ALC1200_DIGOUT_NID, 0,
8958 static hda_nid_t alc1200_slave_dig_outs[] = {
8959 ALC883_DIGOUT_NID, 0,
8963 * configuration and preset
8965 static const char *alc882_models[ALC882_MODEL_LAST] = {
8966 [ALC882_3ST_DIG] = "3stack-dig",
8967 [ALC882_6ST_DIG] = "6stack-dig",
8968 [ALC882_ARIMA] = "arima",
8969 [ALC882_W2JC] = "w2jc",
8970 [ALC882_TARGA] = "targa",
8971 [ALC882_ASUS_A7J] = "asus-a7j",
8972 [ALC882_ASUS_A7M] = "asus-a7m",
8973 [ALC885_MACPRO] = "macpro",
8974 [ALC885_MB5] = "mb5",
8975 [ALC885_MBP3] = "mbp3",
8976 [ALC885_IMAC24] = "imac24",
8977 [ALC885_IMAC91] = "imac91",
8978 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
8979 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
8980 [ALC883_3ST_6ch] = "3stack-6ch",
8981 [ALC883_6ST_DIG] = "alc883-6stack-dig",
8982 [ALC883_TARGA_DIG] = "targa-dig",
8983 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
8984 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
8985 [ALC883_ACER] = "acer",
8986 [ALC883_ACER_ASPIRE] = "acer-aspire",
8987 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
8988 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
8989 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
8990 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
8991 [ALC883_MEDION] = "medion",
8992 [ALC883_MEDION_MD2] = "medion-md2",
8993 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
8994 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
8995 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
8996 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
8997 [ALC888_LENOVO_SKY] = "lenovo-sky",
8998 [ALC883_HAIER_W66] = "haier-w66",
8999 [ALC888_3ST_HP] = "3stack-hp",
9000 [ALC888_6ST_DELL] = "6stack-dell",
9001 [ALC883_MITAC] = "mitac",
9002 [ALC883_CLEVO_M540R] = "clevo-m540r",
9003 [ALC883_CLEVO_M720] = "clevo-m720",
9004 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9005 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9006 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9007 [ALC889A_INTEL] = "intel-alc889a",
9008 [ALC889_INTEL] = "intel-x58",
9009 [ALC1200_ASUS_P5Q] = "asus-p5q",
9010 [ALC889A_MB31] = "mb31",
9011 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9012 [ALC882_AUTO] = "auto",
9015 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9016 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9018 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9019 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9020 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9021 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9022 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9023 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9024 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9025 ALC888_ACER_ASPIRE_4930G),
9026 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9027 ALC888_ACER_ASPIRE_4930G),
9028 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9029 ALC888_ACER_ASPIRE_8930G),
9030 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9031 ALC888_ACER_ASPIRE_8930G),
9032 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9033 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9034 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9035 ALC888_ACER_ASPIRE_6530G),
9036 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9037 ALC888_ACER_ASPIRE_6530G),
9038 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9039 ALC888_ACER_ASPIRE_7730G),
9040 /* default Acer -- disabled as it causes more problems.
9041 * model=auto should work fine now
9043 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9045 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9047 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9048 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9049 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9050 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9051 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9052 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9054 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9055 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9056 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9057 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9058 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9059 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9060 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9061 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9062 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9063 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9064 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9066 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9067 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9068 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9069 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9070 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9071 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9072 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9073 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9074 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9076 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9077 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9078 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9079 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9080 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9081 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9082 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9083 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9084 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9085 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9086 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9087 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9088 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9089 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9090 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9091 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9092 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9093 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9094 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9095 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9096 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9097 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9098 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9099 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9100 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9101 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9102 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9103 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9104 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9106 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9107 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9108 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9109 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9110 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9111 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9112 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9113 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9114 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9115 ALC883_FUJITSU_PI2515),
9116 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9117 ALC888_FUJITSU_XA3530),
9118 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9119 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9120 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9121 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9122 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9123 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9124 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9125 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9126 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9128 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9129 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9130 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9131 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9132 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9133 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9134 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch),
9139 /* codec SSID table for Intel Mac */
9140 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9141 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9142 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9143 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9144 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9145 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9146 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9147 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9148 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9149 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9150 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9151 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9152 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9153 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9154 * so apparently no perfect solution yet
9156 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9157 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9161 static struct alc_config_preset alc882_presets[] = {
9162 [ALC882_3ST_DIG] = {
9163 .mixers = { alc882_base_mixer },
9164 .init_verbs = { alc882_base_init_verbs,
9165 alc882_adc1_init_verbs },
9166 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9167 .dac_nids = alc882_dac_nids,
9168 .dig_out_nid = ALC882_DIGOUT_NID,
9169 .dig_in_nid = ALC882_DIGIN_NID,
9170 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9171 .channel_mode = alc882_ch_modes,
9173 .input_mux = &alc882_capture_source,
9175 [ALC882_6ST_DIG] = {
9176 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9177 .init_verbs = { alc882_base_init_verbs,
9178 alc882_adc1_init_verbs },
9179 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9180 .dac_nids = alc882_dac_nids,
9181 .dig_out_nid = ALC882_DIGOUT_NID,
9182 .dig_in_nid = ALC882_DIGIN_NID,
9183 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9184 .channel_mode = alc882_sixstack_modes,
9185 .input_mux = &alc882_capture_source,
9188 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9189 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9190 alc882_eapd_verbs },
9191 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9192 .dac_nids = alc882_dac_nids,
9193 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9194 .channel_mode = alc882_sixstack_modes,
9195 .input_mux = &alc882_capture_source,
9198 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9199 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9200 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9201 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9202 .dac_nids = alc882_dac_nids,
9203 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9204 .channel_mode = alc880_threestack_modes,
9206 .input_mux = &alc882_capture_source,
9207 .dig_out_nid = ALC882_DIGOUT_NID,
9210 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9211 .init_verbs = { alc885_mbp3_init_verbs,
9212 alc880_gpio1_init_verbs },
9214 .dac_nids = alc882_dac_nids,
9216 .channel_mode = alc885_mbp_4ch_modes,
9217 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9218 .input_mux = &alc882_capture_source,
9219 .dig_out_nid = ALC882_DIGOUT_NID,
9220 .dig_in_nid = ALC882_DIGIN_NID,
9221 .unsol_event = alc_automute_amp_unsol_event,
9222 .setup = alc885_mbp3_setup,
9223 .init_hook = alc_automute_amp,
9226 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9227 .init_verbs = { alc885_mb5_init_verbs,
9228 alc880_gpio1_init_verbs },
9229 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9230 .dac_nids = alc882_dac_nids,
9231 .channel_mode = alc885_mb5_6ch_modes,
9232 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9233 .input_mux = &mb5_capture_source,
9234 .dig_out_nid = ALC882_DIGOUT_NID,
9235 .dig_in_nid = ALC882_DIGIN_NID,
9236 .unsol_event = alc885_mb5_unsol_event,
9237 .init_hook = alc885_mb5_automute,
9240 .mixers = { alc882_macpro_mixer },
9241 .init_verbs = { alc882_macpro_init_verbs },
9242 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9243 .dac_nids = alc882_dac_nids,
9244 .dig_out_nid = ALC882_DIGOUT_NID,
9245 .dig_in_nid = ALC882_DIGIN_NID,
9246 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9247 .channel_mode = alc882_ch_modes,
9248 .input_mux = &alc882_capture_source,
9249 .init_hook = alc885_macpro_init_hook,
9252 .mixers = { alc885_imac24_mixer },
9253 .init_verbs = { alc885_imac24_init_verbs },
9254 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9255 .dac_nids = alc882_dac_nids,
9256 .dig_out_nid = ALC882_DIGOUT_NID,
9257 .dig_in_nid = ALC882_DIGIN_NID,
9258 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9259 .channel_mode = alc882_ch_modes,
9260 .input_mux = &alc882_capture_source,
9261 .unsol_event = alc_automute_amp_unsol_event,
9262 .setup = alc885_imac24_setup,
9263 .init_hook = alc885_imac24_init_hook,
9266 .mixers = { alc885_imac91_mixer, alc882_chmode_mixer },
9267 .init_verbs = { alc885_imac91_init_verbs,
9268 alc880_gpio1_init_verbs },
9269 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9270 .dac_nids = alc882_dac_nids,
9271 .channel_mode = alc885_mbp_4ch_modes,
9272 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9273 .input_mux = &alc882_capture_source,
9274 .dig_out_nid = ALC882_DIGOUT_NID,
9275 .dig_in_nid = ALC882_DIGIN_NID,
9276 .unsol_event = alc885_imac91_unsol_event,
9277 .init_hook = alc885_imac91_automute,
9280 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
9281 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9282 alc880_gpio3_init_verbs, alc882_targa_verbs},
9283 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9284 .dac_nids = alc882_dac_nids,
9285 .dig_out_nid = ALC882_DIGOUT_NID,
9286 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9287 .adc_nids = alc882_adc_nids,
9288 .capsrc_nids = alc882_capsrc_nids,
9289 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9290 .channel_mode = alc882_3ST_6ch_modes,
9292 .input_mux = &alc882_capture_source,
9293 .unsol_event = alc882_targa_unsol_event,
9294 .setup = alc882_targa_setup,
9295 .init_hook = alc882_targa_automute,
9297 [ALC882_ASUS_A7J] = {
9298 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
9299 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9300 alc882_asus_a7j_verbs},
9301 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9302 .dac_nids = alc882_dac_nids,
9303 .dig_out_nid = ALC882_DIGOUT_NID,
9304 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
9305 .adc_nids = alc882_adc_nids,
9306 .capsrc_nids = alc882_capsrc_nids,
9307 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
9308 .channel_mode = alc882_3ST_6ch_modes,
9310 .input_mux = &alc882_capture_source,
9312 [ALC882_ASUS_A7M] = {
9313 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
9314 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9315 alc882_eapd_verbs, alc880_gpio1_init_verbs,
9316 alc882_asus_a7m_verbs },
9317 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9318 .dac_nids = alc882_dac_nids,
9319 .dig_out_nid = ALC882_DIGOUT_NID,
9320 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9321 .channel_mode = alc880_threestack_modes,
9323 .input_mux = &alc882_capture_source,
9325 [ALC883_3ST_2ch_DIG] = {
9326 .mixers = { alc883_3ST_2ch_mixer },
9327 .init_verbs = { alc883_init_verbs },
9328 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9329 .dac_nids = alc883_dac_nids,
9330 .dig_out_nid = ALC883_DIGOUT_NID,
9331 .dig_in_nid = ALC883_DIGIN_NID,
9332 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9333 .channel_mode = alc883_3ST_2ch_modes,
9334 .input_mux = &alc883_capture_source,
9336 [ALC883_3ST_6ch_DIG] = {
9337 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9338 .init_verbs = { alc883_init_verbs },
9339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9340 .dac_nids = alc883_dac_nids,
9341 .dig_out_nid = ALC883_DIGOUT_NID,
9342 .dig_in_nid = ALC883_DIGIN_NID,
9343 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9344 .channel_mode = alc883_3ST_6ch_modes,
9346 .input_mux = &alc883_capture_source,
9348 [ALC883_3ST_6ch] = {
9349 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9350 .init_verbs = { alc883_init_verbs },
9351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9352 .dac_nids = alc883_dac_nids,
9353 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9354 .channel_mode = alc883_3ST_6ch_modes,
9356 .input_mux = &alc883_capture_source,
9358 [ALC883_3ST_6ch_INTEL] = {
9359 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
9360 .init_verbs = { alc883_init_verbs },
9361 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9362 .dac_nids = alc883_dac_nids,
9363 .dig_out_nid = ALC883_DIGOUT_NID,
9364 .dig_in_nid = ALC883_DIGIN_NID,
9365 .slave_dig_outs = alc883_slave_dig_outs,
9366 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
9367 .channel_mode = alc883_3ST_6ch_intel_modes,
9369 .input_mux = &alc883_3stack_6ch_intel,
9372 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9373 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
9374 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 = alc_automute_amp,
9388 .unsol_event = alc_automute_amp_unsol_event,
9392 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
9393 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
9394 alc889_eapd_verbs, alc_hp15_unsol_verbs},
9395 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9396 .dac_nids = alc883_dac_nids,
9397 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9398 .adc_nids = alc889_adc_nids,
9399 .dig_out_nid = ALC883_DIGOUT_NID,
9400 .dig_in_nid = ALC883_DIGIN_NID,
9401 .slave_dig_outs = alc883_slave_dig_outs,
9402 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
9403 .channel_mode = alc889_8ch_intel_modes,
9404 .capsrc_nids = alc889_capsrc_nids,
9405 .input_mux = &alc889_capture_source,
9406 .setup = alc889_automute_setup,
9407 .init_hook = alc889_intel_init_hook,
9408 .unsol_event = alc_automute_amp_unsol_event,
9411 [ALC883_6ST_DIG] = {
9412 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9413 .init_verbs = { alc883_init_verbs },
9414 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9415 .dac_nids = alc883_dac_nids,
9416 .dig_out_nid = ALC883_DIGOUT_NID,
9417 .dig_in_nid = ALC883_DIGIN_NID,
9418 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9419 .channel_mode = alc883_sixstack_modes,
9420 .input_mux = &alc883_capture_source,
9422 [ALC883_TARGA_DIG] = {
9423 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
9424 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9425 alc883_targa_verbs},
9426 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9427 .dac_nids = alc883_dac_nids,
9428 .dig_out_nid = ALC883_DIGOUT_NID,
9429 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9430 .channel_mode = alc883_3ST_6ch_modes,
9432 .input_mux = &alc883_capture_source,
9433 .unsol_event = alc883_targa_unsol_event,
9434 .setup = alc882_targa_setup,
9435 .init_hook = alc882_targa_automute,
9437 [ALC883_TARGA_2ch_DIG] = {
9438 .mixers = { alc883_targa_2ch_mixer},
9439 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9440 alc883_targa_verbs},
9441 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9442 .dac_nids = alc883_dac_nids,
9443 .adc_nids = alc883_adc_nids_alt,
9444 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9445 .capsrc_nids = alc883_capsrc_nids,
9446 .dig_out_nid = ALC883_DIGOUT_NID,
9447 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9448 .channel_mode = alc883_3ST_2ch_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,
9454 [ALC883_TARGA_8ch_DIG] = {
9455 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
9456 alc883_chmode_mixer },
9457 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
9458 alc883_targa_verbs },
9459 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9460 .dac_nids = alc883_dac_nids,
9461 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9462 .adc_nids = alc883_adc_nids_rev,
9463 .capsrc_nids = alc883_capsrc_nids_rev,
9464 .dig_out_nid = ALC883_DIGOUT_NID,
9465 .dig_in_nid = ALC883_DIGIN_NID,
9466 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
9467 .channel_mode = alc883_4ST_8ch_modes,
9469 .input_mux = &alc883_capture_source,
9470 .unsol_event = alc883_targa_unsol_event,
9471 .setup = alc882_targa_setup,
9472 .init_hook = alc882_targa_automute,
9475 .mixers = { alc883_base_mixer },
9476 /* On TravelMate laptops, GPIO 0 enables the internal speaker
9477 * and the headphone jack. Turn this on and rely on the
9478 * standard mute methods whenever the user wants to turn
9479 * these outputs off.
9481 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
9482 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9483 .dac_nids = alc883_dac_nids,
9484 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9485 .channel_mode = alc883_3ST_2ch_modes,
9486 .input_mux = &alc883_capture_source,
9488 [ALC883_ACER_ASPIRE] = {
9489 .mixers = { alc883_acer_aspire_mixer },
9490 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
9491 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9492 .dac_nids = alc883_dac_nids,
9493 .dig_out_nid = ALC883_DIGOUT_NID,
9494 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9495 .channel_mode = alc883_3ST_2ch_modes,
9496 .input_mux = &alc883_capture_source,
9497 .unsol_event = alc_automute_amp_unsol_event,
9498 .setup = alc883_acer_aspire_setup,
9499 .init_hook = alc_automute_amp,
9501 [ALC888_ACER_ASPIRE_4930G] = {
9502 .mixers = { alc888_base_mixer,
9503 alc883_chmode_mixer },
9504 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9505 alc888_acer_aspire_4930g_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_6ch_modes),
9513 .channel_mode = alc883_3ST_6ch_modes,
9516 ARRAY_SIZE(alc888_2_capture_sources),
9517 .input_mux = alc888_2_capture_sources,
9518 .unsol_event = alc_automute_amp_unsol_event,
9519 .setup = alc888_acer_aspire_4930g_setup,
9520 .init_hook = alc_automute_amp,
9522 [ALC888_ACER_ASPIRE_6530G] = {
9523 .mixers = { alc888_acer_aspire_6530_mixer },
9524 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9525 alc888_acer_aspire_6530g_verbs },
9526 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9527 .dac_nids = alc883_dac_nids,
9528 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9529 .adc_nids = alc883_adc_nids_rev,
9530 .capsrc_nids = alc883_capsrc_nids_rev,
9531 .dig_out_nid = ALC883_DIGOUT_NID,
9532 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9533 .channel_mode = alc883_3ST_2ch_modes,
9535 ARRAY_SIZE(alc888_2_capture_sources),
9536 .input_mux = alc888_acer_aspire_6530_sources,
9537 .unsol_event = alc_automute_amp_unsol_event,
9538 .setup = alc888_acer_aspire_6530g_setup,
9539 .init_hook = alc_automute_amp,
9541 [ALC888_ACER_ASPIRE_8930G] = {
9542 .mixers = { alc889_acer_aspire_8930g_mixer,
9543 alc883_chmode_mixer },
9544 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9545 alc889_acer_aspire_8930g_verbs,
9547 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9548 .dac_nids = alc883_dac_nids,
9549 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
9550 .adc_nids = alc889_adc_nids,
9551 .capsrc_nids = alc889_capsrc_nids,
9552 .dig_out_nid = ALC883_DIGOUT_NID,
9553 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9554 .channel_mode = alc883_3ST_6ch_modes,
9556 .const_channel_count = 6,
9558 ARRAY_SIZE(alc889_capture_sources),
9559 .input_mux = alc889_capture_sources,
9560 .unsol_event = alc_automute_amp_unsol_event,
9561 .setup = alc889_acer_aspire_8930g_setup,
9562 .init_hook = alc_automute_amp,
9563 #ifdef CONFIG_SND_HDA_POWER_SAVE
9564 .power_hook = alc_power_eapd,
9567 [ALC888_ACER_ASPIRE_7730G] = {
9568 .mixers = { alc883_3ST_6ch_mixer,
9569 alc883_chmode_mixer },
9570 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
9571 alc888_acer_aspire_7730G_verbs },
9572 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9573 .dac_nids = alc883_dac_nids,
9574 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9575 .adc_nids = alc883_adc_nids_rev,
9576 .capsrc_nids = alc883_capsrc_nids_rev,
9577 .dig_out_nid = ALC883_DIGOUT_NID,
9578 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9579 .channel_mode = alc883_3ST_6ch_modes,
9581 .const_channel_count = 6,
9582 .input_mux = &alc883_capture_source,
9583 .unsol_event = alc_automute_amp_unsol_event,
9584 .setup = alc888_acer_aspire_6530g_setup,
9585 .init_hook = alc_automute_amp,
9588 .mixers = { alc883_fivestack_mixer,
9589 alc883_chmode_mixer },
9590 .init_verbs = { alc883_init_verbs,
9591 alc883_medion_eapd_verbs },
9592 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9593 .dac_nids = alc883_dac_nids,
9594 .adc_nids = alc883_adc_nids_alt,
9595 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9596 .capsrc_nids = alc883_capsrc_nids,
9597 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9598 .channel_mode = alc883_sixstack_modes,
9599 .input_mux = &alc883_capture_source,
9601 [ALC883_MEDION_MD2] = {
9602 .mixers = { alc883_medion_md2_mixer},
9603 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
9604 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9605 .dac_nids = alc883_dac_nids,
9606 .dig_out_nid = ALC883_DIGOUT_NID,
9607 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9608 .channel_mode = alc883_3ST_2ch_modes,
9609 .input_mux = &alc883_capture_source,
9610 .unsol_event = alc_automute_amp_unsol_event,
9611 .setup = alc883_medion_md2_setup,
9612 .init_hook = alc_automute_amp,
9614 [ALC883_LAPTOP_EAPD] = {
9615 .mixers = { alc883_base_mixer },
9616 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
9617 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9618 .dac_nids = alc883_dac_nids,
9619 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9620 .channel_mode = alc883_3ST_2ch_modes,
9621 .input_mux = &alc883_capture_source,
9623 [ALC883_CLEVO_M540R] = {
9624 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9625 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
9626 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9627 .dac_nids = alc883_dac_nids,
9628 .dig_out_nid = ALC883_DIGOUT_NID,
9629 .dig_in_nid = ALC883_DIGIN_NID,
9630 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
9631 .channel_mode = alc883_3ST_6ch_clevo_modes,
9633 .input_mux = &alc883_capture_source,
9634 /* This machine has the hardware HP auto-muting, thus
9635 * we need no software mute via unsol event
9638 [ALC883_CLEVO_M720] = {
9639 .mixers = { alc883_clevo_m720_mixer },
9640 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
9641 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9642 .dac_nids = alc883_dac_nids,
9643 .dig_out_nid = ALC883_DIGOUT_NID,
9644 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9645 .channel_mode = alc883_3ST_2ch_modes,
9646 .input_mux = &alc883_capture_source,
9647 .unsol_event = alc883_clevo_m720_unsol_event,
9648 .setup = alc883_clevo_m720_setup,
9649 .init_hook = alc883_clevo_m720_init_hook,
9651 [ALC883_LENOVO_101E_2ch] = {
9652 .mixers = { alc883_lenovo_101e_2ch_mixer},
9653 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
9654 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9655 .dac_nids = alc883_dac_nids,
9656 .adc_nids = alc883_adc_nids_alt,
9657 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
9658 .capsrc_nids = alc883_capsrc_nids,
9659 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9660 .channel_mode = alc883_3ST_2ch_modes,
9661 .input_mux = &alc883_lenovo_101e_capture_source,
9662 .unsol_event = alc883_lenovo_101e_unsol_event,
9663 .init_hook = alc883_lenovo_101e_all_automute,
9665 [ALC883_LENOVO_NB0763] = {
9666 .mixers = { alc883_lenovo_nb0763_mixer },
9667 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
9668 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9669 .dac_nids = alc883_dac_nids,
9670 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9671 .channel_mode = alc883_3ST_2ch_modes,
9673 .input_mux = &alc883_lenovo_nb0763_capture_source,
9674 .unsol_event = alc_automute_amp_unsol_event,
9675 .setup = alc883_medion_md2_setup,
9676 .init_hook = alc_automute_amp,
9678 [ALC888_LENOVO_MS7195_DIG] = {
9679 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9680 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
9681 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9682 .dac_nids = alc883_dac_nids,
9683 .dig_out_nid = ALC883_DIGOUT_NID,
9684 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9685 .channel_mode = alc883_3ST_6ch_modes,
9687 .input_mux = &alc883_capture_source,
9688 .unsol_event = alc883_lenovo_ms7195_unsol_event,
9689 .init_hook = alc888_lenovo_ms7195_front_automute,
9691 [ALC883_HAIER_W66] = {
9692 .mixers = { alc883_targa_2ch_mixer},
9693 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
9694 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9695 .dac_nids = alc883_dac_nids,
9696 .dig_out_nid = ALC883_DIGOUT_NID,
9697 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9698 .channel_mode = alc883_3ST_2ch_modes,
9699 .input_mux = &alc883_capture_source,
9700 .unsol_event = alc_automute_amp_unsol_event,
9701 .setup = alc883_haier_w66_setup,
9702 .init_hook = alc_automute_amp,
9705 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9706 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
9707 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9708 .dac_nids = alc883_dac_nids,
9709 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
9710 .channel_mode = alc888_3st_hp_modes,
9712 .input_mux = &alc883_capture_source,
9713 .unsol_event = alc_automute_amp_unsol_event,
9714 .setup = alc888_3st_hp_setup,
9715 .init_hook = alc_automute_amp,
9717 [ALC888_6ST_DELL] = {
9718 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9719 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
9720 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9721 .dac_nids = alc883_dac_nids,
9722 .dig_out_nid = ALC883_DIGOUT_NID,
9723 .dig_in_nid = ALC883_DIGIN_NID,
9724 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9725 .channel_mode = alc883_sixstack_modes,
9726 .input_mux = &alc883_capture_source,
9727 .unsol_event = alc_automute_amp_unsol_event,
9728 .setup = alc888_6st_dell_setup,
9729 .init_hook = alc_automute_amp,
9732 .mixers = { alc883_mitac_mixer },
9733 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
9734 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9735 .dac_nids = alc883_dac_nids,
9736 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9737 .channel_mode = alc883_3ST_2ch_modes,
9738 .input_mux = &alc883_capture_source,
9739 .unsol_event = alc_automute_amp_unsol_event,
9740 .setup = alc883_mitac_setup,
9741 .init_hook = alc_automute_amp,
9743 [ALC883_FUJITSU_PI2515] = {
9744 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
9745 .init_verbs = { alc883_init_verbs,
9746 alc883_2ch_fujitsu_pi2515_verbs},
9747 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9748 .dac_nids = alc883_dac_nids,
9749 .dig_out_nid = ALC883_DIGOUT_NID,
9750 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9751 .channel_mode = alc883_3ST_2ch_modes,
9752 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9753 .unsol_event = alc_automute_amp_unsol_event,
9754 .setup = alc883_2ch_fujitsu_pi2515_setup,
9755 .init_hook = alc_automute_amp,
9757 [ALC888_FUJITSU_XA3530] = {
9758 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
9759 .init_verbs = { alc883_init_verbs,
9760 alc888_fujitsu_xa3530_verbs },
9761 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9762 .dac_nids = alc883_dac_nids,
9763 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
9764 .adc_nids = alc883_adc_nids_rev,
9765 .capsrc_nids = alc883_capsrc_nids_rev,
9766 .dig_out_nid = ALC883_DIGOUT_NID,
9767 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
9768 .channel_mode = alc888_4ST_8ch_intel_modes,
9770 ARRAY_SIZE(alc888_2_capture_sources),
9771 .input_mux = alc888_2_capture_sources,
9772 .unsol_event = alc_automute_amp_unsol_event,
9773 .setup = alc888_fujitsu_xa3530_setup,
9774 .init_hook = alc_automute_amp,
9776 [ALC888_LENOVO_SKY] = {
9777 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
9778 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
9779 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9780 .dac_nids = alc883_dac_nids,
9781 .dig_out_nid = ALC883_DIGOUT_NID,
9782 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9783 .channel_mode = alc883_sixstack_modes,
9785 .input_mux = &alc883_lenovo_sky_capture_source,
9786 .unsol_event = alc_automute_amp_unsol_event,
9787 .setup = alc888_lenovo_sky_setup,
9788 .init_hook = alc_automute_amp,
9790 [ALC888_ASUS_M90V] = {
9791 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
9792 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
9793 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9794 .dac_nids = alc883_dac_nids,
9795 .dig_out_nid = ALC883_DIGOUT_NID,
9796 .dig_in_nid = ALC883_DIGIN_NID,
9797 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
9798 .channel_mode = alc883_3ST_6ch_modes,
9800 .input_mux = &alc883_fujitsu_pi2515_capture_source,
9801 .unsol_event = alc_sku_unsol_event,
9802 .setup = alc883_mode2_setup,
9803 .init_hook = alc_inithook,
9805 [ALC888_ASUS_EEE1601] = {
9806 .mixers = { alc883_asus_eee1601_mixer },
9807 .cap_mixer = alc883_asus_eee1601_cap_mixer,
9808 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
9809 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9810 .dac_nids = alc883_dac_nids,
9811 .dig_out_nid = ALC883_DIGOUT_NID,
9812 .dig_in_nid = ALC883_DIGIN_NID,
9813 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9814 .channel_mode = alc883_3ST_2ch_modes,
9816 .input_mux = &alc883_asus_eee1601_capture_source,
9817 .unsol_event = alc_sku_unsol_event,
9818 .init_hook = alc883_eee1601_inithook,
9820 [ALC1200_ASUS_P5Q] = {
9821 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
9822 .init_verbs = { alc883_init_verbs },
9823 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9824 .dac_nids = alc883_dac_nids,
9825 .dig_out_nid = ALC1200_DIGOUT_NID,
9826 .dig_in_nid = ALC883_DIGIN_NID,
9827 .slave_dig_outs = alc1200_slave_dig_outs,
9828 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
9829 .channel_mode = alc883_sixstack_modes,
9830 .input_mux = &alc883_capture_source,
9833 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
9834 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
9835 alc880_gpio1_init_verbs },
9836 .adc_nids = alc883_adc_nids,
9837 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
9838 .capsrc_nids = alc883_capsrc_nids,
9839 .dac_nids = alc883_dac_nids,
9840 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9841 .channel_mode = alc889A_mb31_6ch_modes,
9842 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
9843 .input_mux = &alc889A_mb31_capture_source,
9844 .dig_out_nid = ALC883_DIGOUT_NID,
9845 .unsol_event = alc889A_mb31_unsol_event,
9846 .init_hook = alc889A_mb31_automute,
9848 [ALC883_SONY_VAIO_TT] = {
9849 .mixers = { alc883_vaiott_mixer },
9850 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
9851 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
9852 .dac_nids = alc883_dac_nids,
9853 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
9854 .channel_mode = alc883_3ST_2ch_modes,
9855 .input_mux = &alc883_capture_source,
9856 .unsol_event = alc_automute_amp_unsol_event,
9857 .setup = alc883_vaiott_setup,
9858 .init_hook = alc_automute_amp,
9867 PINFIX_ABIT_AW9D_MAX
9870 static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9871 { 0x15, 0x01080104 }, /* side */
9872 { 0x16, 0x01011012 }, /* rear */
9873 { 0x17, 0x01016011 }, /* clfe */
9877 static const struct alc_fixup alc882_fixups[] = {
9878 [PINFIX_ABIT_AW9D_MAX] = {
9879 .pins = alc882_abit_aw9d_pinfix
9883 static struct snd_pci_quirk alc882_fixup_tbl[] = {
9884 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9889 * BIOS auto configuration
9891 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
9892 const struct auto_pin_cfg *cfg)
9894 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
9897 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
9898 hda_nid_t nid, int pin_type,
9902 struct alc_spec *spec = codec->spec;
9905 alc_set_pin_output(codec, nid, pin_type);
9906 if (spec->multiout.dac_nids[dac_idx] == 0x25)
9909 idx = spec->multiout.dac_nids[dac_idx] - 2;
9910 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
9914 static void alc882_auto_init_multi_out(struct hda_codec *codec)
9916 struct alc_spec *spec = codec->spec;
9919 for (i = 0; i <= HDA_SIDE; i++) {
9920 hda_nid_t nid = spec->autocfg.line_out_pins[i];
9921 int pin_type = get_pin_type(spec->autocfg.line_out_type);
9923 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
9928 static void alc882_auto_init_hp_out(struct hda_codec *codec)
9930 struct alc_spec *spec = codec->spec;
9933 pin = spec->autocfg.hp_pins[0];
9934 if (pin) /* connect to front */
9936 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
9937 pin = spec->autocfg.speaker_pins[0];
9939 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
9942 static void alc882_auto_init_analog_input(struct hda_codec *codec)
9944 struct alc_spec *spec = codec->spec;
9947 for (i = 0; i < AUTO_PIN_LAST; i++) {
9948 hda_nid_t nid = spec->autocfg.input_pins[i];
9951 alc_set_input_pin(codec, nid, i);
9952 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
9953 snd_hda_codec_write(codec, nid, 0,
9954 AC_VERB_SET_AMP_GAIN_MUTE,
9959 static void alc882_auto_init_input_src(struct hda_codec *codec)
9961 struct alc_spec *spec = codec->spec;
9964 for (c = 0; c < spec->num_adc_nids; c++) {
9965 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
9966 hda_nid_t nid = spec->capsrc_nids[c];
9967 unsigned int mux_idx;
9968 const struct hda_input_mux *imux;
9969 int conns, mute, idx, item;
9971 conns = snd_hda_get_connections(codec, nid, conn_list,
9972 ARRAY_SIZE(conn_list));
9975 mux_idx = c >= spec->num_mux_defs ? 0 : c;
9976 imux = &spec->input_mux[mux_idx];
9977 for (idx = 0; idx < conns; idx++) {
9978 /* if the current connection is the selected one,
9979 * unmute it as default - otherwise mute it
9981 mute = AMP_IN_MUTE(idx);
9982 for (item = 0; item < imux->num_items; item++) {
9983 if (imux->items[item].index == idx) {
9984 if (spec->cur_mux[c] == item)
9985 mute = AMP_IN_UNMUTE(idx);
9989 /* check if we have a selector or mixer
9990 * we could check for the widget type instead, but
9991 * just check for Amp-In presence (in case of mixer
9992 * without amp-in there is something wrong, this
9993 * function shouldn't be used or capsrc nid is wrong)
9995 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
9996 snd_hda_codec_write(codec, nid, 0,
9997 AC_VERB_SET_AMP_GAIN_MUTE,
9999 else if (mute != AMP_IN_MUTE(idx))
10000 snd_hda_codec_write(codec, nid, 0,
10001 AC_VERB_SET_CONNECT_SEL,
10007 /* add mic boosts if needed */
10008 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10010 struct alc_spec *spec = codec->spec;
10014 nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
10015 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10016 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10018 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10022 nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
10023 if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) {
10024 err = add_control(spec, ALC_CTL_WIDGET_VOL,
10026 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10033 /* almost identical with ALC880 parser... */
10034 static int alc882_parse_auto_config(struct hda_codec *codec)
10036 struct alc_spec *spec = codec->spec;
10037 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10040 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10044 if (!spec->autocfg.line_outs)
10045 return 0; /* can't find valid BIOS pin config */
10047 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10050 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10053 err = alc880_auto_create_extra_out(spec,
10054 spec->autocfg.speaker_pins[0],
10058 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10062 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10066 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10068 /* check multiple SPDIF-out (for recent codecs) */
10069 for (i = 0; i < spec->autocfg.dig_outs; i++) {
10071 err = snd_hda_get_connections(codec,
10072 spec->autocfg.dig_out_pins[i],
10077 spec->multiout.dig_out_nid = dig_nid;
10079 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
10080 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
10082 spec->slave_dig_outs[i - 1] = dig_nid;
10085 if (spec->autocfg.dig_in_pin)
10086 spec->dig_in_nid = ALC880_DIGIN_NID;
10088 if (spec->kctls.list)
10089 add_mixer(spec, spec->kctls.list);
10091 add_verb(spec, alc883_auto_init_verbs);
10092 /* if ADC 0x07 is available, initialize it, too */
10093 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10094 add_verb(spec, alc882_adc1_init_verbs);
10096 spec->num_mux_defs = 1;
10097 spec->input_mux = &spec->private_imux[0];
10099 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
10101 err = alc_auto_add_mic_boost(codec);
10105 return 1; /* config found */
10108 /* additional initialization for auto-configuration model */
10109 static void alc882_auto_init(struct hda_codec *codec)
10111 struct alc_spec *spec = codec->spec;
10112 alc882_auto_init_multi_out(codec);
10113 alc882_auto_init_hp_out(codec);
10114 alc882_auto_init_analog_input(codec);
10115 alc882_auto_init_input_src(codec);
10116 if (spec->unsol_event)
10117 alc_inithook(codec);
10120 static int patch_alc882(struct hda_codec *codec)
10122 struct alc_spec *spec;
10123 int err, board_config;
10125 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10129 codec->spec = spec;
10131 switch (codec->vendor_id) {
10136 /* ALC883 and variants */
10137 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10141 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10145 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10146 board_config = snd_hda_check_board_codec_sid_config(codec,
10147 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10149 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10150 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10152 board_config = ALC882_AUTO;
10155 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
10157 if (board_config == ALC882_AUTO) {
10158 /* automatic parse from the BIOS config */
10159 err = alc882_parse_auto_config(codec);
10165 "hda_codec: Cannot set up configuration "
10166 "from BIOS. Using base mode...\n");
10167 board_config = ALC882_3ST_DIG;
10171 err = snd_hda_attach_beep_device(codec, 0x1);
10177 if (board_config != ALC882_AUTO)
10178 setup_preset(codec, &alc882_presets[board_config]);
10180 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10181 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10182 /* FIXME: setup DAC5 */
10183 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10184 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10186 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10187 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10189 if (codec->vendor_id == 0x10ec0888)
10190 spec->init_amp = ALC_INIT_DEFAULT; /* always initialize */
10192 if (!spec->adc_nids && spec->input_mux) {
10194 spec->num_adc_nids = 0;
10195 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10196 const struct hda_input_mux *imux = spec->input_mux;
10198 hda_nid_t items[16];
10199 hda_nid_t nid = alc882_adc_nids[i];
10200 unsigned int wcap = get_wcaps(codec, nid);
10202 wcap = get_wcaps_type(wcap);
10203 if (wcap != AC_WID_AUD_IN)
10205 spec->private_adc_nids[spec->num_adc_nids] = nid;
10206 err = snd_hda_get_connections(codec, nid, &cap, 1);
10209 err = snd_hda_get_connections(codec, cap, items,
10210 ARRAY_SIZE(items));
10213 for (j = 0; j < imux->num_items; j++)
10214 if (imux->items[j].index >= err)
10216 if (j < imux->num_items)
10218 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10219 spec->num_adc_nids++;
10221 spec->adc_nids = spec->private_adc_nids;
10222 spec->capsrc_nids = spec->private_capsrc_nids;
10225 set_capture_mixer(codec);
10226 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10228 spec->vmaster_nid = 0x0c;
10230 codec->patch_ops = alc_patch_ops;
10231 if (board_config == ALC882_AUTO)
10232 spec->init_hook = alc882_auto_init;
10233 #ifdef CONFIG_SND_HDA_POWER_SAVE
10234 if (!spec->loopback.amplist)
10235 spec->loopback.amplist = alc882_loopbacks;
10246 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
10247 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
10249 #define alc262_dac_nids alc260_dac_nids
10250 #define alc262_adc_nids alc882_adc_nids
10251 #define alc262_adc_nids_alt alc882_adc_nids_alt
10252 #define alc262_capsrc_nids alc882_capsrc_nids
10253 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
10255 #define alc262_modes alc260_modes
10256 #define alc262_capture_source alc882_capture_source
10258 static hda_nid_t alc262_dmic_adc_nids[1] = {
10263 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
10265 static struct snd_kcontrol_new alc262_base_mixer[] = {
10266 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10267 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10268 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10269 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10270 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10271 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10272 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10273 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10274 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10275 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10276 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10277 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10278 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
10279 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10280 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
10281 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
10285 /* update HP, line and mono-out pins according to the master switch */
10286 static void alc262_hp_master_update(struct hda_codec *codec)
10288 struct alc_spec *spec = codec->spec;
10289 int val = spec->master_sw;
10291 /* HP & line-out */
10292 snd_hda_codec_write_cache(codec, 0x1b, 0,
10293 AC_VERB_SET_PIN_WIDGET_CONTROL,
10295 snd_hda_codec_write_cache(codec, 0x15, 0,
10296 AC_VERB_SET_PIN_WIDGET_CONTROL,
10298 /* mono (speaker) depending on the HP jack sense */
10299 val = val && !spec->jack_present;
10300 snd_hda_codec_write_cache(codec, 0x16, 0,
10301 AC_VERB_SET_PIN_WIDGET_CONTROL,
10302 val ? PIN_OUT : 0);
10305 static void alc262_hp_bpc_automute(struct hda_codec *codec)
10307 struct alc_spec *spec = codec->spec;
10309 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10310 alc262_hp_master_update(codec);
10313 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
10315 if ((res >> 26) != ALC880_HP_EVENT)
10317 alc262_hp_bpc_automute(codec);
10320 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
10322 struct alc_spec *spec = codec->spec;
10324 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
10325 alc262_hp_master_update(codec);
10328 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
10331 if ((res >> 26) != ALC880_HP_EVENT)
10333 alc262_hp_wildwest_automute(codec);
10336 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
10338 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
10339 struct snd_ctl_elem_value *ucontrol)
10341 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10342 struct alc_spec *spec = codec->spec;
10343 int val = !!*ucontrol->value.integer.value;
10345 if (val == spec->master_sw)
10347 spec->master_sw = val;
10348 alc262_hp_master_update(codec);
10352 #define ALC262_HP_MASTER_SWITCH \
10354 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10355 .name = "Master Playback Switch", \
10356 .info = snd_ctl_boolean_mono_info, \
10357 .get = alc262_hp_master_sw_get, \
10358 .put = alc262_hp_master_sw_put, \
10361 .iface = NID_MAPPING, \
10362 .name = "Master Playback Switch", \
10363 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
10367 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
10368 ALC262_HP_MASTER_SWITCH,
10369 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10370 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10371 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10372 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10374 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10382 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10383 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10384 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10385 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10386 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
10387 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
10391 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
10392 ALC262_HP_MASTER_SWITCH,
10393 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10394 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10395 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10396 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10397 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
10399 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
10401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
10402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
10403 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
10404 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10405 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10406 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10407 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10411 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
10412 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10413 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10414 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
10418 /* mute/unmute internal speaker according to the hp jack and mute state */
10419 static void alc262_hp_t5735_setup(struct hda_codec *codec)
10421 struct alc_spec *spec = codec->spec;
10423 spec->autocfg.hp_pins[0] = 0x15;
10424 spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
10427 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
10428 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10429 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10430 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10431 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10432 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10433 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10434 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10438 static struct hda_verb alc262_hp_t5735_verbs[] = {
10439 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10440 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10442 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
10446 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
10447 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10448 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
10449 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
10450 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
10451 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
10452 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
10456 static struct hda_verb alc262_hp_rp5700_verbs[] = {
10457 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10458 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10459 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10460 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10461 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10462 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10464 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
10465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10466 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
10470 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
10477 /* bind hp and internal speaker mute (with plug check) as master switch */
10478 static void alc262_hippo_master_update(struct hda_codec *codec)
10480 struct alc_spec *spec = codec->spec;
10481 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10482 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
10483 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
10487 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
10488 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
10489 HDA_AMP_MUTE, mute);
10490 /* mute internal speaker per jack sense */
10491 if (spec->jack_present)
10492 mute = HDA_AMP_MUTE;
10494 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
10495 HDA_AMP_MUTE, mute);
10496 if (speaker_nid && speaker_nid != line_nid)
10497 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
10498 HDA_AMP_MUTE, mute);
10501 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
10503 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
10504 struct snd_ctl_elem_value *ucontrol)
10506 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10507 struct alc_spec *spec = codec->spec;
10508 int val = !!*ucontrol->value.integer.value;
10510 if (val == spec->master_sw)
10512 spec->master_sw = val;
10513 alc262_hippo_master_update(codec);
10517 #define ALC262_HIPPO_MASTER_SWITCH \
10519 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
10520 .name = "Master Playback Switch", \
10521 .info = snd_ctl_boolean_mono_info, \
10522 .get = alc262_hippo_master_sw_get, \
10523 .put = alc262_hippo_master_sw_put, \
10526 .iface = NID_MAPPING, \
10527 .name = "Master Playback Switch", \
10528 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
10529 (SUBDEV_SPEAKER(0) << 16), \
10532 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
10533 ALC262_HIPPO_MASTER_SWITCH,
10534 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10535 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10536 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10537 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10538 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10539 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10540 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10541 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10542 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10543 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10544 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10545 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10549 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
10550 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10551 ALC262_HIPPO_MASTER_SWITCH,
10552 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
10553 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
10554 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10555 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10556 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10557 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10558 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10559 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10560 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10561 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10565 /* mute/unmute internal speaker according to the hp jack and mute state */
10566 static void alc262_hippo_automute(struct hda_codec *codec)
10568 struct alc_spec *spec = codec->spec;
10569 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
10571 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
10572 alc262_hippo_master_update(codec);
10575 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
10577 if ((res >> 26) != ALC880_HP_EVENT)
10579 alc262_hippo_automute(codec);
10582 static void alc262_hippo_setup(struct hda_codec *codec)
10584 struct alc_spec *spec = codec->spec;
10586 spec->autocfg.hp_pins[0] = 0x15;
10587 spec->autocfg.speaker_pins[0] = 0x14;
10590 static void alc262_hippo1_setup(struct hda_codec *codec)
10592 struct alc_spec *spec = codec->spec;
10594 spec->autocfg.hp_pins[0] = 0x1b;
10595 spec->autocfg.speaker_pins[0] = 0x14;
10599 static struct snd_kcontrol_new alc262_sony_mixer[] = {
10600 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10601 ALC262_HIPPO_MASTER_SWITCH,
10602 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10603 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10604 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10605 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10609 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
10610 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10611 ALC262_HIPPO_MASTER_SWITCH,
10612 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10613 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10614 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10615 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10616 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10620 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
10621 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10622 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
10623 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
10624 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
10625 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
10626 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
10627 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10628 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10629 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10630 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
10631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
10632 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
10636 static struct hda_verb alc262_tyan_verbs[] = {
10637 /* Headphone automute */
10638 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10639 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10640 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10642 /* P11 AUX_IN, white 4-pin connector */
10643 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10644 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
10645 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
10646 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
10651 /* unsolicited event for HP jack sensing */
10652 static void alc262_tyan_setup(struct hda_codec *codec)
10654 struct alc_spec *spec = codec->spec;
10656 spec->autocfg.hp_pins[0] = 0x1b;
10657 spec->autocfg.speaker_pins[0] = 0x15;
10661 #define alc262_capture_mixer alc882_capture_mixer
10662 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
10665 * generic initialization of ADC, input mixers and output mixers
10667 static struct hda_verb alc262_init_verbs[] = {
10669 * Unmute ADC0-2 and set the default input to mic-in
10671 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
10672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10673 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
10674 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10675 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
10676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10678 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
10680 * Note: PASD motherboards uses the Line In 2 as the input for
10681 * front panel mic (mic 2)
10683 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
10684 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
10685 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
10686 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
10687 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
10688 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
10691 * Set up output mixers (0x0c - 0x0e)
10693 /* set vol=0 to output mixers */
10694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10696 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
10697 /* set up input amps for analog loopback */
10698 /* Amp Indices: DAC = 0, mixer = 1 */
10699 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10700 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10701 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10702 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10703 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
10704 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10706 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10707 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10708 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
10709 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10710 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10711 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
10713 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10714 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10715 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10716 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10717 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10719 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
10720 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
10722 /* FIXME: use matrix-type input source selection */
10723 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
10724 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
10725 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10726 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10727 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10728 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10730 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10731 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10732 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10733 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10735 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
10736 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
10737 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
10738 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
10743 static struct hda_verb alc262_eapd_verbs[] = {
10744 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
10745 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
10749 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
10750 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10751 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
10752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
10754 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10755 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10759 static struct hda_verb alc262_sony_unsol_verbs[] = {
10760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
10761 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10762 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
10764 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10765 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10769 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
10770 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
10771 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
10772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10774 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10778 static struct hda_verb alc262_toshiba_s06_verbs[] = {
10779 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
10780 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10781 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10782 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
10783 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
10784 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10785 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
10786 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10790 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
10792 struct alc_spec *spec = codec->spec;
10794 spec->autocfg.hp_pins[0] = 0x15;
10795 spec->autocfg.speaker_pins[0] = 0x14;
10796 spec->ext_mic.pin = 0x18;
10797 spec->ext_mic.mux_idx = 0;
10798 spec->int_mic.pin = 0x12;
10799 spec->int_mic.mux_idx = 9;
10800 spec->auto_mic = 1;
10806 * 0x16 = internal speaker
10807 * 0x18 = external mic
10810 static struct snd_kcontrol_new alc262_nec_mixer[] = {
10811 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
10812 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
10814 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
10815 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
10816 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
10818 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
10819 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
10823 static struct hda_verb alc262_nec_verbs[] = {
10824 /* Unmute Speaker */
10825 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
10828 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
10829 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
10831 /* External mic to headphone */
10832 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10833 /* External mic to speaker */
10834 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
10840 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
10841 * 0x1b = port replicator headphone out
10844 #define ALC_HP_EVENT 0x37
10846 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
10847 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10848 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10849 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10850 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10854 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
10855 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
10856 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
10860 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
10861 /* Front Mic pin: input vref at 50% */
10862 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
10863 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
10867 static struct hda_input_mux alc262_fujitsu_capture_source = {
10871 { "Int Mic", 0x1 },
10876 static struct hda_input_mux alc262_HP_capture_source = {
10880 { "Front Mic", 0x1 },
10887 static struct hda_input_mux alc262_HP_D7000_capture_source = {
10891 { "Front Mic", 0x2 },
10897 /* mute/unmute internal speaker according to the hp jacks and mute state */
10898 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
10900 struct alc_spec *spec = codec->spec;
10903 if (force || !spec->sense_updated) {
10904 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
10905 snd_hda_jack_detect(codec, 0x1b);
10906 spec->sense_updated = 1;
10908 /* unmute internal speaker only if both HPs are unplugged and
10909 * master switch is on
10911 if (spec->jack_present)
10912 mute = HDA_AMP_MUTE;
10914 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
10915 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
10916 HDA_AMP_MUTE, mute);
10919 /* unsolicited event for HP jack sensing */
10920 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
10923 if ((res >> 26) != ALC_HP_EVENT)
10925 alc262_fujitsu_automute(codec, 1);
10928 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
10930 alc262_fujitsu_automute(codec, 1);
10933 /* bind volumes of both NID 0x0c and 0x0d */
10934 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
10935 .ops = &snd_hda_bind_vol,
10937 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
10938 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
10943 /* mute/unmute internal speaker according to the hp jack and mute state */
10944 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
10946 struct alc_spec *spec = codec->spec;
10949 if (force || !spec->sense_updated) {
10950 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
10951 spec->sense_updated = 1;
10953 if (spec->jack_present) {
10954 /* mute internal speaker */
10955 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10956 HDA_AMP_MUTE, HDA_AMP_MUTE);
10957 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10958 HDA_AMP_MUTE, HDA_AMP_MUTE);
10960 /* unmute internal speaker if necessary */
10961 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
10962 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10963 HDA_AMP_MUTE, mute);
10964 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
10965 HDA_AMP_MUTE, mute);
10969 /* unsolicited event for HP jack sensing */
10970 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
10973 if ((res >> 26) != ALC_HP_EVENT)
10975 alc262_lenovo_3000_automute(codec, 1);
10978 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
10979 int dir, int idx, long *valp)
10983 for (i = 0; i < 2; i++, valp++)
10984 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
10986 *valp ? 0 : HDA_AMP_MUTE);
10990 /* bind hp and internal speaker mute (with plug check) */
10991 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
10992 struct snd_ctl_elem_value *ucontrol)
10994 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
10995 long *valp = ucontrol->value.integer.value;
10998 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
10999 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11001 alc262_fujitsu_automute(codec, 0);
11005 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11006 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11008 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11009 .name = "Master Playback Switch",
11010 .subdevice = HDA_SUBDEV_AMP_FLAG,
11011 .info = snd_hda_mixer_amp_switch_info,
11012 .get = snd_hda_mixer_amp_switch_get,
11013 .put = alc262_fujitsu_master_sw_put,
11014 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11017 .iface = NID_MAPPING,
11018 .name = "Master Playback Switch",
11019 .private_value = 0x1b,
11021 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11022 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11023 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11024 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11025 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11026 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11027 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11028 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11032 /* bind hp and internal speaker mute (with plug check) */
11033 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11034 struct snd_ctl_elem_value *ucontrol)
11036 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11037 long *valp = ucontrol->value.integer.value;
11040 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11042 alc262_lenovo_3000_automute(codec, 0);
11046 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11047 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11049 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11050 .name = "Master Playback Switch",
11051 .subdevice = HDA_SUBDEV_AMP_FLAG,
11052 .info = snd_hda_mixer_amp_switch_info,
11053 .get = snd_hda_mixer_amp_switch_get,
11054 .put = alc262_lenovo_3000_master_sw_put,
11055 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11057 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11058 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11059 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11062 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11063 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11064 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11068 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11069 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11070 ALC262_HIPPO_MASTER_SWITCH,
11071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11072 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11073 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11074 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11075 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11076 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11080 /* additional init verbs for Benq laptops */
11081 static struct hda_verb alc262_EAPD_verbs[] = {
11082 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11083 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11087 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11088 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11089 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11091 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11092 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11096 /* Samsung Q1 Ultra Vista model setup */
11097 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11098 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11099 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11100 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11101 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11102 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11103 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11107 static struct hda_verb alc262_ultra_verbs[] = {
11109 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11110 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11111 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11113 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11114 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11115 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11116 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11118 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11119 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11120 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11121 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11122 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11124 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11125 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11126 /* ADC, choose mic */
11127 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11128 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11129 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11130 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11131 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11132 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11133 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11134 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11135 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11136 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11140 /* mute/unmute internal speaker according to the hp jack and mute state */
11141 static void alc262_ultra_automute(struct hda_codec *codec)
11143 struct alc_spec *spec = codec->spec;
11147 /* auto-mute only when HP is used as HP */
11148 if (!spec->cur_mux[0]) {
11149 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11150 if (spec->jack_present)
11151 mute = HDA_AMP_MUTE;
11153 /* mute/unmute internal speaker */
11154 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11155 HDA_AMP_MUTE, mute);
11156 /* mute/unmute HP */
11157 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11158 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11161 /* unsolicited event for HP jack sensing */
11162 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11165 if ((res >> 26) != ALC880_HP_EVENT)
11167 alc262_ultra_automute(codec);
11170 static struct hda_input_mux alc262_ultra_capture_source = {
11174 { "Headphone", 0x7 },
11178 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11179 struct snd_ctl_elem_value *ucontrol)
11181 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11182 struct alc_spec *spec = codec->spec;
11185 ret = alc_mux_enum_put(kcontrol, ucontrol);
11188 /* reprogram the HP pin as mic or HP according to the input source */
11189 snd_hda_codec_write_cache(codec, 0x15, 0,
11190 AC_VERB_SET_PIN_WIDGET_CONTROL,
11191 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11192 alc262_ultra_automute(codec); /* mute/unmute HP */
11196 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11197 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11198 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11200 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11201 .name = "Capture Source",
11202 .info = alc_mux_enum_info,
11203 .get = alc_mux_enum_get,
11204 .put = alc262_ultra_mux_enum_put,
11207 .iface = NID_MAPPING,
11208 .name = "Capture Source",
11209 .private_value = 0x15,
11214 /* We use two mixers depending on the output pin; 0x16 is a mono output
11215 * and thus it's bound with a different mixer.
11216 * This function returns which mixer amp should be used.
11218 static int alc262_check_volbit(hda_nid_t nid)
11222 else if (nid == 0x16)
11228 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
11229 const char *pfx, int *vbits)
11234 vbit = alc262_check_volbit(nid);
11237 if (*vbits & vbit) /* a volume control for this mixer already there */
11241 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
11243 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
11244 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val);
11247 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
11255 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
11257 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
11258 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val);
11261 /* add playback controls from the parsed DAC table */
11262 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11263 const struct auto_pin_cfg *cfg)
11269 spec->multiout.num_dacs = 1; /* only use one dac */
11270 spec->multiout.dac_nids = spec->private_dac_nids;
11271 spec->multiout.dac_nids[0] = 2;
11273 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
11275 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11279 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx);
11282 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker");
11285 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone");
11289 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
11290 alc262_check_volbit(cfg->speaker_pins[0]) |
11291 alc262_check_volbit(cfg->hp_pins[0]);
11292 if (vbits == 1 || vbits == 2)
11293 pfx = "Master"; /* only one mixer is used */
11294 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
11299 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits);
11302 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker",
11306 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone",
11313 #define alc262_auto_create_input_ctls \
11314 alc882_auto_create_input_ctls
11317 * generic initialization of ADC, input mixers and output mixers
11319 static struct hda_verb alc262_volume_init_verbs[] = {
11321 * Unmute ADC0-2 and set the default input to mic-in
11323 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11324 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11325 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11326 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11327 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11328 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11330 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11332 * Note: PASD motherboards uses the Line In 2 as the input for
11333 * front panel mic (mic 2)
11335 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11343 * Set up output mixers (0x0c - 0x0f)
11345 /* set vol=0 to output mixers */
11346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11350 /* set up input amps for analog loopback */
11351 /* Amp Indices: DAC = 0, mixer = 1 */
11352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11359 /* FIXME: use matrix-type input source selection */
11360 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11361 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11363 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11364 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11365 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11367 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11368 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11369 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11370 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11372 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11373 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11374 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11375 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11380 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
11382 * Unmute ADC0-2 and set the default input to mic-in
11384 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11385 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11386 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11387 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11388 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11391 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11393 * Note: PASD motherboards uses the Line In 2 as the input for
11394 * front panel mic (mic 2)
11396 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11397 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11398 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11399 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11400 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11401 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11402 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11403 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11406 * Set up output mixers (0x0c - 0x0e)
11408 /* set vol=0 to output mixers */
11409 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11410 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11411 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11413 /* set up input amps for analog loopback */
11414 /* Amp Indices: DAC = 0, mixer = 1 */
11415 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11416 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11417 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11418 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11419 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11420 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11422 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11423 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11424 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
11426 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11429 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11430 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11432 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11433 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11434 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11435 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11436 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11439 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11440 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11441 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11442 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11443 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11446 /* FIXME: use matrix-type input source selection */
11447 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
11448 /* Input mixer1: only unmute Mic */
11449 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11450 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11451 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11452 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11453 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11454 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11455 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11460 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11465 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11467 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
11471 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11472 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11473 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11474 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
11475 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
11476 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
11477 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
11479 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11484 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
11486 * Unmute ADC0-2 and set the default input to mic-in
11488 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11489 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11490 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11491 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11492 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11493 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11495 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11497 * Note: PASD motherboards uses the Line In 2 as the input for front
11498 * panel mic (mic 2)
11500 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11501 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11510 * Set up output mixers (0x0c - 0x0e)
11512 /* set vol=0 to output mixers */
11513 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11514 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11515 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11517 /* set up input amps for analog loopback */
11518 /* Amp Indices: DAC = 0, mixer = 1 */
11519 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11521 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11523 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
11528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
11529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
11530 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
11531 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11532 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
11533 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
11535 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11538 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11539 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11541 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
11542 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11543 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
11545 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11546 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
11548 /* FIXME: use matrix-type input source selection */
11549 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11550 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
11552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
11553 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
11554 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
11555 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
11556 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11557 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
11559 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11560 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11561 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11562 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11563 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11564 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11565 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11568 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11569 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
11570 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
11571 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
11572 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
11573 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
11575 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11580 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
11582 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
11583 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
11584 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
11586 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
11587 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
11588 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11589 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
11591 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
11592 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11593 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11598 #ifdef CONFIG_SND_HDA_POWER_SAVE
11599 #define alc262_loopbacks alc880_loopbacks
11602 /* pcm configuration: identical with ALC880 */
11603 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
11604 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
11605 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
11606 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
11609 * BIOS auto configuration
11611 static int alc262_parse_auto_config(struct hda_codec *codec)
11613 struct alc_spec *spec = codec->spec;
11615 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
11617 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
11621 if (!spec->autocfg.line_outs) {
11622 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
11623 spec->multiout.max_channels = 2;
11624 spec->no_analog = 1;
11627 return 0; /* can't find valid BIOS pin config */
11629 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
11632 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
11636 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
11639 if (spec->autocfg.dig_outs) {
11640 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
11641 spec->dig_out_type = spec->autocfg.dig_out_type[0];
11643 if (spec->autocfg.dig_in_pin)
11644 spec->dig_in_nid = ALC262_DIGIN_NID;
11646 if (spec->kctls.list)
11647 add_mixer(spec, spec->kctls.list);
11649 add_verb(spec, alc262_volume_init_verbs);
11650 spec->num_mux_defs = 1;
11651 spec->input_mux = &spec->private_imux[0];
11653 err = alc_auto_add_mic_boost(codec);
11657 alc_ssid_check(codec, 0x15, 0x14, 0x1b);
11662 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
11663 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
11664 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
11665 #define alc262_auto_init_input_src alc882_auto_init_input_src
11668 /* init callback for auto-configuration model -- overriding the default init */
11669 static void alc262_auto_init(struct hda_codec *codec)
11671 struct alc_spec *spec = codec->spec;
11672 alc262_auto_init_multi_out(codec);
11673 alc262_auto_init_hp_out(codec);
11674 alc262_auto_init_analog_input(codec);
11675 alc262_auto_init_input_src(codec);
11676 if (spec->unsol_event)
11677 alc_inithook(codec);
11681 * configuration and preset
11683 static const char *alc262_models[ALC262_MODEL_LAST] = {
11684 [ALC262_BASIC] = "basic",
11685 [ALC262_HIPPO] = "hippo",
11686 [ALC262_HIPPO_1] = "hippo_1",
11687 [ALC262_FUJITSU] = "fujitsu",
11688 [ALC262_HP_BPC] = "hp-bpc",
11689 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
11690 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
11691 [ALC262_HP_RP5700] = "hp-rp5700",
11692 [ALC262_BENQ_ED8] = "benq",
11693 [ALC262_BENQ_T31] = "benq-t31",
11694 [ALC262_SONY_ASSAMD] = "sony-assamd",
11695 [ALC262_TOSHIBA_S06] = "toshiba-s06",
11696 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
11697 [ALC262_ULTRA] = "ultra",
11698 [ALC262_LENOVO_3000] = "lenovo-3000",
11699 [ALC262_NEC] = "nec",
11700 [ALC262_TYAN] = "tyan",
11701 [ALC262_AUTO] = "auto",
11704 static struct snd_pci_quirk alc262_cfg_tbl[] = {
11705 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
11706 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
11707 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
11709 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
11711 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
11713 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
11714 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
11715 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
11716 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
11717 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
11718 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
11719 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
11720 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
11721 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
11722 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
11723 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
11724 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
11725 ALC262_HP_TC_T5735),
11726 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
11727 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11728 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
11729 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
11730 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
11731 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
11732 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
11733 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
11734 #if 0 /* disable the quirk since model=auto works better in recent versions */
11735 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
11736 ALC262_SONY_ASSAMD),
11738 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
11739 ALC262_TOSHIBA_RX1),
11740 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
11741 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
11742 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
11743 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
11744 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
11746 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
11747 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
11748 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
11749 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
11750 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
11754 static struct alc_config_preset alc262_presets[] = {
11756 .mixers = { alc262_base_mixer },
11757 .init_verbs = { alc262_init_verbs },
11758 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11759 .dac_nids = alc262_dac_nids,
11761 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11762 .channel_mode = alc262_modes,
11763 .input_mux = &alc262_capture_source,
11766 .mixers = { alc262_hippo_mixer },
11767 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
11768 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11769 .dac_nids = alc262_dac_nids,
11771 .dig_out_nid = ALC262_DIGOUT_NID,
11772 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11773 .channel_mode = alc262_modes,
11774 .input_mux = &alc262_capture_source,
11775 .unsol_event = alc262_hippo_unsol_event,
11776 .setup = alc262_hippo_setup,
11777 .init_hook = alc262_hippo_automute,
11779 [ALC262_HIPPO_1] = {
11780 .mixers = { alc262_hippo1_mixer },
11781 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
11782 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11783 .dac_nids = alc262_dac_nids,
11785 .dig_out_nid = ALC262_DIGOUT_NID,
11786 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11787 .channel_mode = alc262_modes,
11788 .input_mux = &alc262_capture_source,
11789 .unsol_event = alc262_hippo_unsol_event,
11790 .setup = alc262_hippo1_setup,
11791 .init_hook = alc262_hippo_automute,
11793 [ALC262_FUJITSU] = {
11794 .mixers = { alc262_fujitsu_mixer },
11795 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11796 alc262_fujitsu_unsol_verbs },
11797 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11798 .dac_nids = alc262_dac_nids,
11800 .dig_out_nid = ALC262_DIGOUT_NID,
11801 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11802 .channel_mode = alc262_modes,
11803 .input_mux = &alc262_fujitsu_capture_source,
11804 .unsol_event = alc262_fujitsu_unsol_event,
11805 .init_hook = alc262_fujitsu_init_hook,
11807 [ALC262_HP_BPC] = {
11808 .mixers = { alc262_HP_BPC_mixer },
11809 .init_verbs = { alc262_HP_BPC_init_verbs },
11810 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11811 .dac_nids = alc262_dac_nids,
11813 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11814 .channel_mode = alc262_modes,
11815 .input_mux = &alc262_HP_capture_source,
11816 .unsol_event = alc262_hp_bpc_unsol_event,
11817 .init_hook = alc262_hp_bpc_automute,
11819 [ALC262_HP_BPC_D7000_WF] = {
11820 .mixers = { alc262_HP_BPC_WildWest_mixer },
11821 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11822 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11823 .dac_nids = alc262_dac_nids,
11825 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11826 .channel_mode = alc262_modes,
11827 .input_mux = &alc262_HP_D7000_capture_source,
11828 .unsol_event = alc262_hp_wildwest_unsol_event,
11829 .init_hook = alc262_hp_wildwest_automute,
11831 [ALC262_HP_BPC_D7000_WL] = {
11832 .mixers = { alc262_HP_BPC_WildWest_mixer,
11833 alc262_HP_BPC_WildWest_option_mixer },
11834 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
11835 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11836 .dac_nids = alc262_dac_nids,
11838 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11839 .channel_mode = alc262_modes,
11840 .input_mux = &alc262_HP_D7000_capture_source,
11841 .unsol_event = alc262_hp_wildwest_unsol_event,
11842 .init_hook = alc262_hp_wildwest_automute,
11844 [ALC262_HP_TC_T5735] = {
11845 .mixers = { alc262_hp_t5735_mixer },
11846 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
11847 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11848 .dac_nids = alc262_dac_nids,
11850 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11851 .channel_mode = alc262_modes,
11852 .input_mux = &alc262_capture_source,
11853 .unsol_event = alc_automute_amp_unsol_event,
11854 .setup = alc262_hp_t5735_setup,
11855 .init_hook = alc_automute_amp,
11857 [ALC262_HP_RP5700] = {
11858 .mixers = { alc262_hp_rp5700_mixer },
11859 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
11860 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11861 .dac_nids = alc262_dac_nids,
11862 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11863 .channel_mode = alc262_modes,
11864 .input_mux = &alc262_hp_rp5700_capture_source,
11866 [ALC262_BENQ_ED8] = {
11867 .mixers = { alc262_base_mixer },
11868 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
11869 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11870 .dac_nids = alc262_dac_nids,
11872 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11873 .channel_mode = alc262_modes,
11874 .input_mux = &alc262_capture_source,
11876 [ALC262_SONY_ASSAMD] = {
11877 .mixers = { alc262_sony_mixer },
11878 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
11879 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11880 .dac_nids = alc262_dac_nids,
11882 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11883 .channel_mode = alc262_modes,
11884 .input_mux = &alc262_capture_source,
11885 .unsol_event = alc262_hippo_unsol_event,
11886 .setup = alc262_hippo_setup,
11887 .init_hook = alc262_hippo_automute,
11889 [ALC262_BENQ_T31] = {
11890 .mixers = { alc262_benq_t31_mixer },
11891 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
11892 alc_hp15_unsol_verbs },
11893 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11894 .dac_nids = alc262_dac_nids,
11896 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11897 .channel_mode = alc262_modes,
11898 .input_mux = &alc262_capture_source,
11899 .unsol_event = alc262_hippo_unsol_event,
11900 .setup = alc262_hippo_setup,
11901 .init_hook = alc262_hippo_automute,
11904 .mixers = { alc262_ultra_mixer },
11905 .cap_mixer = alc262_ultra_capture_mixer,
11906 .init_verbs = { alc262_ultra_verbs },
11907 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11908 .dac_nids = alc262_dac_nids,
11909 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11910 .channel_mode = alc262_modes,
11911 .input_mux = &alc262_ultra_capture_source,
11912 .adc_nids = alc262_adc_nids, /* ADC0 */
11913 .capsrc_nids = alc262_capsrc_nids,
11914 .num_adc_nids = 1, /* single ADC */
11915 .unsol_event = alc262_ultra_unsol_event,
11916 .init_hook = alc262_ultra_automute,
11918 [ALC262_LENOVO_3000] = {
11919 .mixers = { alc262_lenovo_3000_mixer },
11920 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
11921 alc262_lenovo_3000_unsol_verbs,
11922 alc262_lenovo_3000_init_verbs },
11923 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11924 .dac_nids = alc262_dac_nids,
11926 .dig_out_nid = ALC262_DIGOUT_NID,
11927 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11928 .channel_mode = alc262_modes,
11929 .input_mux = &alc262_fujitsu_capture_source,
11930 .unsol_event = alc262_lenovo_3000_unsol_event,
11933 .mixers = { alc262_nec_mixer },
11934 .init_verbs = { alc262_nec_verbs },
11935 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11936 .dac_nids = alc262_dac_nids,
11938 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11939 .channel_mode = alc262_modes,
11940 .input_mux = &alc262_capture_source,
11942 [ALC262_TOSHIBA_S06] = {
11943 .mixers = { alc262_toshiba_s06_mixer },
11944 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
11945 alc262_eapd_verbs },
11946 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11947 .capsrc_nids = alc262_dmic_capsrc_nids,
11948 .dac_nids = alc262_dac_nids,
11949 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
11950 .num_adc_nids = 1, /* single ADC */
11951 .dig_out_nid = ALC262_DIGOUT_NID,
11952 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11953 .channel_mode = alc262_modes,
11954 .unsol_event = alc_sku_unsol_event,
11955 .setup = alc262_toshiba_s06_setup,
11956 .init_hook = alc_inithook,
11958 [ALC262_TOSHIBA_RX1] = {
11959 .mixers = { alc262_toshiba_rx1_mixer },
11960 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
11961 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11962 .dac_nids = alc262_dac_nids,
11964 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11965 .channel_mode = alc262_modes,
11966 .input_mux = &alc262_capture_source,
11967 .unsol_event = alc262_hippo_unsol_event,
11968 .setup = alc262_hippo_setup,
11969 .init_hook = alc262_hippo_automute,
11972 .mixers = { alc262_tyan_mixer },
11973 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
11974 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
11975 .dac_nids = alc262_dac_nids,
11977 .dig_out_nid = ALC262_DIGOUT_NID,
11978 .num_channel_mode = ARRAY_SIZE(alc262_modes),
11979 .channel_mode = alc262_modes,
11980 .input_mux = &alc262_capture_source,
11981 .unsol_event = alc_automute_amp_unsol_event,
11982 .setup = alc262_tyan_setup,
11983 .init_hook = alc_automute_amp,
11987 static int patch_alc262(struct hda_codec *codec)
11989 struct alc_spec *spec;
11993 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
11997 codec->spec = spec;
11999 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12004 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12005 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12006 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12007 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12011 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12013 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12017 if (board_config < 0) {
12018 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12020 board_config = ALC262_AUTO;
12023 if (board_config == ALC262_AUTO) {
12024 /* automatic parse from the BIOS config */
12025 err = alc262_parse_auto_config(codec);
12031 "hda_codec: Cannot set up configuration "
12032 "from BIOS. Using base mode...\n");
12033 board_config = ALC262_BASIC;
12037 if (!spec->no_analog) {
12038 err = snd_hda_attach_beep_device(codec, 0x1);
12045 if (board_config != ALC262_AUTO)
12046 setup_preset(codec, &alc262_presets[board_config]);
12048 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12049 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12051 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12052 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12054 if (!spec->adc_nids && spec->input_mux) {
12056 /* check whether the digital-mic has to be supported */
12057 for (i = 0; i < spec->input_mux->num_items; i++) {
12058 if (spec->input_mux->items[i].index >= 9)
12061 if (i < spec->input_mux->num_items) {
12062 /* use only ADC0 */
12063 spec->adc_nids = alc262_dmic_adc_nids;
12064 spec->num_adc_nids = 1;
12065 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12067 /* all analog inputs */
12068 /* check whether NID 0x07 is valid */
12069 unsigned int wcap = get_wcaps(codec, 0x07);
12072 wcap = get_wcaps_type(wcap);
12073 if (wcap != AC_WID_AUD_IN) {
12074 spec->adc_nids = alc262_adc_nids_alt;
12075 spec->num_adc_nids =
12076 ARRAY_SIZE(alc262_adc_nids_alt);
12077 spec->capsrc_nids = alc262_capsrc_nids_alt;
12079 spec->adc_nids = alc262_adc_nids;
12080 spec->num_adc_nids =
12081 ARRAY_SIZE(alc262_adc_nids);
12082 spec->capsrc_nids = alc262_capsrc_nids;
12086 if (!spec->cap_mixer && !spec->no_analog)
12087 set_capture_mixer(codec);
12088 if (!spec->no_analog)
12089 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12091 spec->vmaster_nid = 0x0c;
12093 codec->patch_ops = alc_patch_ops;
12094 if (board_config == ALC262_AUTO)
12095 spec->init_hook = alc262_auto_init;
12096 #ifdef CONFIG_SND_HDA_POWER_SAVE
12097 if (!spec->loopback.amplist)
12098 spec->loopback.amplist = alc262_loopbacks;
12105 * ALC268 channel source setting (2 channel)
12107 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12108 #define alc268_modes alc260_modes
12110 static hda_nid_t alc268_dac_nids[2] = {
12115 static hda_nid_t alc268_adc_nids[2] = {
12120 static hda_nid_t alc268_adc_nids_alt[1] = {
12125 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12127 static struct snd_kcontrol_new alc268_base_mixer[] = {
12128 /* output mixer control */
12129 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12130 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12131 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12132 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12133 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12134 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12135 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12139 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12140 /* output mixer control */
12141 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12142 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12143 ALC262_HIPPO_MASTER_SWITCH,
12144 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12146 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12150 /* bind Beep switches of both NID 0x0f and 0x10 */
12151 static struct hda_bind_ctls alc268_bind_beep_sw = {
12152 .ops = &snd_hda_bind_sw,
12154 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12155 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12160 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12161 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12162 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12166 static struct hda_verb alc268_eapd_verbs[] = {
12167 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12168 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12172 /* Toshiba specific */
12173 static struct hda_verb alc268_toshiba_verbs[] = {
12174 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12178 /* Acer specific */
12179 /* bind volumes of both NID 0x02 and 0x03 */
12180 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12181 .ops = &snd_hda_bind_vol,
12183 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
12184 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
12189 /* mute/unmute internal speaker according to the hp jack and mute state */
12190 static void alc268_acer_automute(struct hda_codec *codec, int force)
12192 struct alc_spec *spec = codec->spec;
12195 if (force || !spec->sense_updated) {
12196 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
12197 spec->sense_updated = 1;
12199 if (spec->jack_present)
12200 mute = HDA_AMP_MUTE; /* mute internal speaker */
12201 else /* unmute internal speaker if necessary */
12202 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
12203 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
12204 HDA_AMP_MUTE, mute);
12208 /* bind hp and internal speaker mute (with plug check) */
12209 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
12210 struct snd_ctl_elem_value *ucontrol)
12212 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12213 long *valp = ucontrol->value.integer.value;
12216 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
12218 alc268_acer_automute(codec, 0);
12222 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
12223 /* output mixer control */
12224 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12226 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12227 .name = "Master Playback Switch",
12228 .subdevice = HDA_SUBDEV_AMP_FLAG,
12229 .info = snd_hda_mixer_amp_switch_info,
12230 .get = snd_hda_mixer_amp_switch_get,
12231 .put = alc268_acer_master_sw_put,
12232 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12234 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
12238 static struct snd_kcontrol_new alc268_acer_mixer[] = {
12239 /* output mixer control */
12240 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12242 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12243 .name = "Master Playback Switch",
12244 .subdevice = HDA_SUBDEV_AMP_FLAG,
12245 .info = snd_hda_mixer_amp_switch_info,
12246 .get = snd_hda_mixer_amp_switch_get,
12247 .put = alc268_acer_master_sw_put,
12248 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12250 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12251 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12252 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12256 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
12257 /* output mixer control */
12258 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
12260 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12261 .name = "Master Playback Switch",
12262 .subdevice = HDA_SUBDEV_AMP_FLAG,
12263 .info = snd_hda_mixer_amp_switch_info,
12264 .get = snd_hda_mixer_amp_switch_get,
12265 .put = alc268_acer_master_sw_put,
12266 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12268 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12269 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12273 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
12274 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12277 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
12278 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
12279 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
12283 static struct hda_verb alc268_acer_verbs[] = {
12284 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
12285 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
12286 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
12288 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
12290 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12294 /* unsolicited event for HP jack sensing */
12295 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
12296 #define alc268_toshiba_setup alc262_hippo_setup
12297 #define alc268_toshiba_automute alc262_hippo_automute
12299 static void alc268_acer_unsol_event(struct hda_codec *codec,
12302 if ((res >> 26) != ALC880_HP_EVENT)
12304 alc268_acer_automute(codec, 1);
12307 static void alc268_acer_init_hook(struct hda_codec *codec)
12309 alc268_acer_automute(codec, 1);
12312 /* toggle speaker-output according to the hp-jack state */
12313 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
12315 unsigned int present;
12316 unsigned char bits;
12318 present = snd_hda_jack_detect(codec, 0x15);
12319 bits = present ? AMP_IN_MUTE(0) : 0;
12320 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
12321 AMP_IN_MUTE(0), bits);
12322 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
12323 AMP_IN_MUTE(0), bits);
12326 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
12329 switch (res >> 26) {
12330 case ALC880_HP_EVENT:
12331 alc268_aspire_one_speaker_automute(codec);
12333 case ALC880_MIC_EVENT:
12334 alc_mic_automute(codec);
12339 static void alc268_acer_lc_setup(struct hda_codec *codec)
12341 struct alc_spec *spec = codec->spec;
12342 spec->ext_mic.pin = 0x18;
12343 spec->ext_mic.mux_idx = 0;
12344 spec->int_mic.pin = 0x12;
12345 spec->int_mic.mux_idx = 6;
12346 spec->auto_mic = 1;
12349 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
12351 alc268_aspire_one_speaker_automute(codec);
12352 alc_mic_automute(codec);
12355 static struct snd_kcontrol_new alc268_dell_mixer[] = {
12356 /* output mixer control */
12357 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12358 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12359 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12360 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12362 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
12366 static struct hda_verb alc268_dell_verbs[] = {
12367 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12368 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12369 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12370 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12374 /* mute/unmute internal speaker according to the hp jack and mute state */
12375 static void alc268_dell_setup(struct hda_codec *codec)
12377 struct alc_spec *spec = codec->spec;
12379 spec->autocfg.hp_pins[0] = 0x15;
12380 spec->autocfg.speaker_pins[0] = 0x14;
12381 spec->ext_mic.pin = 0x18;
12382 spec->ext_mic.mux_idx = 0;
12383 spec->int_mic.pin = 0x19;
12384 spec->int_mic.mux_idx = 1;
12385 spec->auto_mic = 1;
12388 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
12389 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12390 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12391 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12393 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12394 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
12395 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
12396 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
12400 static struct hda_verb alc267_quanta_il1_verbs[] = {
12401 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12402 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
12406 static void alc267_quanta_il1_setup(struct hda_codec *codec)
12408 struct alc_spec *spec = codec->spec;
12409 spec->autocfg.hp_pins[0] = 0x15;
12410 spec->autocfg.speaker_pins[0] = 0x14;
12411 spec->ext_mic.pin = 0x18;
12412 spec->ext_mic.mux_idx = 0;
12413 spec->int_mic.pin = 0x19;
12414 spec->int_mic.mux_idx = 1;
12415 spec->auto_mic = 1;
12419 * generic initialization of ADC, input mixers and output mixers
12421 static struct hda_verb alc268_base_init_verbs[] = {
12422 /* Unmute DAC0-1 and set vol = 0 */
12423 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12424 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12427 * Set up output mixers (0x0c - 0x0e)
12429 /* set vol=0 to output mixers */
12430 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12431 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
12433 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12434 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12436 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
12438 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
12439 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12440 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12441 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12442 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12443 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12446 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12447 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12448 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12449 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12451 /* set PCBEEP vol = 0, mute connections */
12452 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12453 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12454 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12456 /* Unmute Selector 23h,24h and set the default input to mic-in */
12458 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
12459 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12460 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
12461 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
12467 * generic initialization of ADC, input mixers and output mixers
12469 static struct hda_verb alc268_volume_init_verbs[] = {
12470 /* set output DAC */
12471 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12472 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12474 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12475 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12476 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12477 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12478 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12480 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12481 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12482 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12484 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12485 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
12487 /* set PCBEEP vol = 0, mute connections */
12488 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12489 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12490 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12495 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
12496 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12497 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12501 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
12502 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12503 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12508 static struct snd_kcontrol_new alc268_capture_mixer[] = {
12509 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12510 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
12511 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
12512 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
12517 static struct hda_input_mux alc268_capture_source = {
12521 { "Front Mic", 0x1 },
12527 static struct hda_input_mux alc268_acer_capture_source = {
12531 { "Internal Mic", 0x1 },
12536 static struct hda_input_mux alc268_acer_dmic_capture_source = {
12540 { "Internal Mic", 0x6 },
12545 #ifdef CONFIG_SND_DEBUG
12546 static struct snd_kcontrol_new alc268_test_mixer[] = {
12547 /* Volume widgets */
12548 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
12549 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
12550 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
12551 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
12552 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
12553 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
12554 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
12555 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
12556 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
12557 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
12558 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
12559 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
12560 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
12561 /* The below appears problematic on some hardwares */
12562 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
12563 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
12564 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
12565 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
12566 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
12568 /* Modes for retasking pin widgets */
12569 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
12570 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
12571 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
12572 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
12574 /* Controls for GPIO pins, assuming they are configured as outputs */
12575 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
12576 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
12577 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
12578 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
12580 /* Switches to allow the digital SPDIF output pin to be enabled.
12581 * The ALC268 does not have an SPDIF input.
12583 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
12585 /* A switch allowing EAPD to be enabled. Some laptops seem to use
12586 * this output to turn on an external amplifier.
12588 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
12589 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
12595 /* create input playback/capture controls for the given pin */
12596 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12597 const char *ctlname, int idx)
12614 if (spec->multiout.dac_nids[0] != dac &&
12615 spec->multiout.dac_nids[1] != dac) {
12616 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
12617 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
12621 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
12625 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12626 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
12628 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
12629 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
12635 /* add playback controls from the parsed DAC table */
12636 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
12637 const struct auto_pin_cfg *cfg)
12642 spec->multiout.dac_nids = spec->private_dac_nids;
12644 nid = cfg->line_out_pins[0];
12647 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12651 err = alc268_new_analog_output(spec, nid, name, 0);
12656 nid = cfg->speaker_pins[0];
12658 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
12659 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
12663 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
12667 nid = cfg->hp_pins[0];
12669 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
12674 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
12676 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
12677 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
12684 /* create playback/capture controls for input pins */
12685 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
12686 const struct auto_pin_cfg *cfg)
12688 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
12691 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
12692 hda_nid_t nid, int pin_type)
12696 alc_set_pin_output(codec, nid, pin_type);
12697 if (nid == 0x14 || nid == 0x16)
12701 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
12704 static void alc268_auto_init_multi_out(struct hda_codec *codec)
12706 struct alc_spec *spec = codec->spec;
12707 hda_nid_t nid = spec->autocfg.line_out_pins[0];
12709 int pin_type = get_pin_type(spec->autocfg.line_out_type);
12710 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
12714 static void alc268_auto_init_hp_out(struct hda_codec *codec)
12716 struct alc_spec *spec = codec->spec;
12719 pin = spec->autocfg.hp_pins[0];
12721 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
12722 pin = spec->autocfg.speaker_pins[0];
12724 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
12727 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
12729 struct alc_spec *spec = codec->spec;
12730 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
12731 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
12732 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
12733 unsigned int dac_vol1, dac_vol2;
12735 if (line_nid == 0x1d || speaker_nid == 0x1d) {
12736 snd_hda_codec_write(codec, speaker_nid, 0,
12737 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
12738 /* mute mixer inputs from 0x1d */
12739 snd_hda_codec_write(codec, 0x0f, 0,
12740 AC_VERB_SET_AMP_GAIN_MUTE,
12742 snd_hda_codec_write(codec, 0x10, 0,
12743 AC_VERB_SET_AMP_GAIN_MUTE,
12746 /* unmute mixer inputs from 0x1d */
12747 snd_hda_codec_write(codec, 0x0f, 0,
12748 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12749 snd_hda_codec_write(codec, 0x10, 0,
12750 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
12753 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
12754 if (line_nid == 0x14)
12755 dac_vol2 = AMP_OUT_ZERO;
12756 else if (line_nid == 0x15)
12757 dac_vol1 = AMP_OUT_ZERO;
12758 if (hp_nid == 0x14)
12759 dac_vol2 = AMP_OUT_ZERO;
12760 else if (hp_nid == 0x15)
12761 dac_vol1 = AMP_OUT_ZERO;
12762 if (line_nid != 0x16 || hp_nid != 0x16 ||
12763 spec->autocfg.line_out_pins[1] != 0x16 ||
12764 spec->autocfg.line_out_pins[2] != 0x16)
12765 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
12767 snd_hda_codec_write(codec, 0x02, 0,
12768 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
12769 snd_hda_codec_write(codec, 0x03, 0,
12770 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
12773 /* pcm configuration: identical with ALC880 */
12774 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
12775 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
12776 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
12777 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
12780 * BIOS auto configuration
12782 static int alc268_parse_auto_config(struct hda_codec *codec)
12784 struct alc_spec *spec = codec->spec;
12786 static hda_nid_t alc268_ignore[] = { 0 };
12788 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12792 if (!spec->autocfg.line_outs) {
12793 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12794 spec->multiout.max_channels = 2;
12795 spec->no_analog = 1;
12798 return 0; /* can't find valid BIOS pin config */
12800 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
12803 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
12807 spec->multiout.max_channels = 2;
12810 /* digital only support output */
12811 if (spec->autocfg.dig_outs) {
12812 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
12813 spec->dig_out_type = spec->autocfg.dig_out_type[0];
12815 if (spec->kctls.list)
12816 add_mixer(spec, spec->kctls.list);
12818 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
12819 add_mixer(spec, alc268_beep_mixer);
12821 add_verb(spec, alc268_volume_init_verbs);
12822 spec->num_mux_defs = 2;
12823 spec->input_mux = &spec->private_imux[0];
12825 err = alc_auto_add_mic_boost(codec);
12829 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
12834 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
12836 /* init callback for auto-configuration model -- overriding the default init */
12837 static void alc268_auto_init(struct hda_codec *codec)
12839 struct alc_spec *spec = codec->spec;
12840 alc268_auto_init_multi_out(codec);
12841 alc268_auto_init_hp_out(codec);
12842 alc268_auto_init_mono_speaker_out(codec);
12843 alc268_auto_init_analog_input(codec);
12844 if (spec->unsol_event)
12845 alc_inithook(codec);
12849 * configuration and preset
12851 static const char *alc268_models[ALC268_MODEL_LAST] = {
12852 [ALC267_QUANTA_IL1] = "quanta-il1",
12853 [ALC268_3ST] = "3stack",
12854 [ALC268_TOSHIBA] = "toshiba",
12855 [ALC268_ACER] = "acer",
12856 [ALC268_ACER_DMIC] = "acer-dmic",
12857 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
12858 [ALC268_DELL] = "dell",
12859 [ALC268_ZEPTO] = "zepto",
12860 #ifdef CONFIG_SND_DEBUG
12861 [ALC268_TEST] = "test",
12863 [ALC268_AUTO] = "auto",
12866 static struct snd_pci_quirk alc268_cfg_tbl[] = {
12867 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
12868 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
12869 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
12870 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
12871 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
12872 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12873 ALC268_ACER_ASPIRE_ONE),
12874 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12875 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12876 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12877 /* almost compatible with toshiba but with optional digital outs;
12878 * auto-probing seems working fine
12880 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
12882 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
12883 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
12884 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
12885 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
12886 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
12887 SND_PCI_QUIRK(0x1854, 0x1775, "LG R510", ALC268_DELL),
12891 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
12892 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
12893 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
12894 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
12895 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
12900 static struct alc_config_preset alc268_presets[] = {
12901 [ALC267_QUANTA_IL1] = {
12902 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
12903 alc268_capture_nosrc_mixer },
12904 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12905 alc267_quanta_il1_verbs },
12906 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12907 .dac_nids = alc268_dac_nids,
12908 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12909 .adc_nids = alc268_adc_nids_alt,
12911 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12912 .channel_mode = alc268_modes,
12913 .unsol_event = alc_sku_unsol_event,
12914 .setup = alc267_quanta_il1_setup,
12915 .init_hook = alc_inithook,
12918 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
12919 alc268_beep_mixer },
12920 .init_verbs = { alc268_base_init_verbs },
12921 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12922 .dac_nids = alc268_dac_nids,
12923 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12924 .adc_nids = alc268_adc_nids_alt,
12925 .capsrc_nids = alc268_capsrc_nids,
12927 .dig_out_nid = ALC268_DIGOUT_NID,
12928 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12929 .channel_mode = alc268_modes,
12930 .input_mux = &alc268_capture_source,
12932 [ALC268_TOSHIBA] = {
12933 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
12934 alc268_beep_mixer },
12935 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12936 alc268_toshiba_verbs },
12937 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12938 .dac_nids = alc268_dac_nids,
12939 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12940 .adc_nids = alc268_adc_nids_alt,
12941 .capsrc_nids = alc268_capsrc_nids,
12943 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12944 .channel_mode = alc268_modes,
12945 .input_mux = &alc268_capture_source,
12946 .unsol_event = alc268_toshiba_unsol_event,
12947 .setup = alc268_toshiba_setup,
12948 .init_hook = alc268_toshiba_automute,
12951 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
12952 alc268_beep_mixer },
12953 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12954 alc268_acer_verbs },
12955 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12956 .dac_nids = alc268_dac_nids,
12957 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12958 .adc_nids = alc268_adc_nids_alt,
12959 .capsrc_nids = alc268_capsrc_nids,
12961 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12962 .channel_mode = alc268_modes,
12963 .input_mux = &alc268_acer_capture_source,
12964 .unsol_event = alc268_acer_unsol_event,
12965 .init_hook = alc268_acer_init_hook,
12967 [ALC268_ACER_DMIC] = {
12968 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
12969 alc268_beep_mixer },
12970 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12971 alc268_acer_verbs },
12972 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12973 .dac_nids = alc268_dac_nids,
12974 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12975 .adc_nids = alc268_adc_nids_alt,
12976 .capsrc_nids = alc268_capsrc_nids,
12978 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12979 .channel_mode = alc268_modes,
12980 .input_mux = &alc268_acer_dmic_capture_source,
12981 .unsol_event = alc268_acer_unsol_event,
12982 .init_hook = alc268_acer_init_hook,
12984 [ALC268_ACER_ASPIRE_ONE] = {
12985 .mixers = { alc268_acer_aspire_one_mixer,
12987 alc268_capture_nosrc_mixer },
12988 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
12989 alc268_acer_aspire_one_verbs },
12990 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
12991 .dac_nids = alc268_dac_nids,
12992 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
12993 .adc_nids = alc268_adc_nids_alt,
12994 .capsrc_nids = alc268_capsrc_nids,
12996 .num_channel_mode = ARRAY_SIZE(alc268_modes),
12997 .channel_mode = alc268_modes,
12998 .unsol_event = alc268_acer_lc_unsol_event,
12999 .setup = alc268_acer_lc_setup,
13000 .init_hook = alc268_acer_lc_init_hook,
13003 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13004 alc268_capture_nosrc_mixer },
13005 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13006 alc268_dell_verbs },
13007 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13008 .dac_nids = alc268_dac_nids,
13009 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13010 .adc_nids = alc268_adc_nids_alt,
13011 .capsrc_nids = alc268_capsrc_nids,
13013 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13014 .channel_mode = alc268_modes,
13015 .unsol_event = alc_sku_unsol_event,
13016 .setup = alc268_dell_setup,
13017 .init_hook = alc_inithook,
13020 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13021 alc268_beep_mixer },
13022 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13023 alc268_toshiba_verbs },
13024 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13025 .dac_nids = alc268_dac_nids,
13026 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13027 .adc_nids = alc268_adc_nids_alt,
13028 .capsrc_nids = alc268_capsrc_nids,
13030 .dig_out_nid = ALC268_DIGOUT_NID,
13031 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13032 .channel_mode = alc268_modes,
13033 .input_mux = &alc268_capture_source,
13034 .setup = alc268_toshiba_setup,
13035 .init_hook = alc268_toshiba_automute,
13037 #ifdef CONFIG_SND_DEBUG
13039 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13040 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13041 alc268_volume_init_verbs },
13042 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13043 .dac_nids = alc268_dac_nids,
13044 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13045 .adc_nids = alc268_adc_nids_alt,
13046 .capsrc_nids = alc268_capsrc_nids,
13048 .dig_out_nid = ALC268_DIGOUT_NID,
13049 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13050 .channel_mode = alc268_modes,
13051 .input_mux = &alc268_capture_source,
13056 static int patch_alc268(struct hda_codec *codec)
13058 struct alc_spec *spec;
13060 int i, has_beep, err;
13062 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13066 codec->spec = spec;
13068 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13072 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13073 board_config = snd_hda_check_board_codec_sid_config(codec,
13074 ALC882_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13076 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13077 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13079 board_config = ALC268_AUTO;
13082 if (board_config == ALC268_AUTO) {
13083 /* automatic parse from the BIOS config */
13084 err = alc268_parse_auto_config(codec);
13090 "hda_codec: Cannot set up configuration "
13091 "from BIOS. Using base mode...\n");
13092 board_config = ALC268_3ST;
13096 if (board_config != ALC268_AUTO)
13097 setup_preset(codec, &alc268_presets[board_config]);
13099 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13100 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13101 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13103 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13106 for (i = 0; i < spec->num_mixers; i++) {
13107 if (spec->mixers[i] == alc268_beep_mixer) {
13114 err = snd_hda_attach_beep_device(codec, 0x1);
13119 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13120 /* override the amp caps for beep generator */
13121 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13122 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13123 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13124 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13125 (0 << AC_AMPCAP_MUTE_SHIFT));
13128 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13129 /* check whether NID 0x07 is valid */
13130 unsigned int wcap = get_wcaps(codec, 0x07);
13133 spec->capsrc_nids = alc268_capsrc_nids;
13135 wcap = get_wcaps_type(wcap);
13136 if (spec->auto_mic ||
13137 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13138 spec->adc_nids = alc268_adc_nids_alt;
13139 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13140 if (spec->auto_mic)
13141 fixup_automic_adc(codec);
13142 if (spec->auto_mic || spec->input_mux->num_items == 1)
13143 add_mixer(spec, alc268_capture_nosrc_mixer);
13145 add_mixer(spec, alc268_capture_alt_mixer);
13147 spec->adc_nids = alc268_adc_nids;
13148 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13149 add_mixer(spec, alc268_capture_mixer);
13151 /* set default input source */
13152 for (i = 0; i < spec->num_adc_nids; i++)
13153 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13154 0, AC_VERB_SET_CONNECT_SEL,
13155 i < spec->num_mux_defs ?
13156 spec->input_mux[i].items[0].index :
13157 spec->input_mux->items[0].index);
13160 spec->vmaster_nid = 0x02;
13162 codec->patch_ops = alc_patch_ops;
13163 if (board_config == ALC268_AUTO)
13164 spec->init_hook = alc268_auto_init;
13170 * ALC269 channel source setting (2 channel)
13172 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13174 #define alc269_dac_nids alc260_dac_nids
13176 static hda_nid_t alc269_adc_nids[1] = {
13181 static hda_nid_t alc269_capsrc_nids[1] = {
13185 /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),
13189 #define alc269_modes alc260_modes
13190 #define alc269_capture_source alc880_lg_lw_capture_source
13192 static struct snd_kcontrol_new alc269_base_mixer[] = {
13193 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13194 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13195 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
13196 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
13197 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13198 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13200 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13201 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13202 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13203 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13204 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
13208 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
13209 /* output mixer control */
13210 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13212 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13213 .name = "Master Playback Switch",
13214 .subdevice = HDA_SUBDEV_AMP_FLAG,
13215 .info = snd_hda_mixer_amp_switch_info,
13216 .get = snd_hda_mixer_amp_switch_get,
13217 .put = alc268_acer_master_sw_put,
13218 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13220 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13221 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13222 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13223 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13224 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13225 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13229 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
13230 /* output mixer control */
13231 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13234 .name = "Master Playback Switch",
13235 .subdevice = HDA_SUBDEV_AMP_FLAG,
13236 .info = snd_hda_mixer_amp_switch_info,
13237 .get = snd_hda_mixer_amp_switch_get,
13238 .put = alc268_acer_master_sw_put,
13239 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13241 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
13242 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
13243 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13244 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
13245 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
13246 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13247 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
13248 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
13249 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
13253 static struct snd_kcontrol_new alc269_eeepc_mixer[] = {
13254 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13255 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13256 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13257 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13261 /* capture mixer elements */
13262 static struct snd_kcontrol_new alc269_epc_capture_mixer[] = {
13263 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
13264 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
13265 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13270 #define alc269_fujitsu_mixer alc269_eeepc_mixer
13272 static struct hda_verb alc269_quanta_fl1_verbs[] = {
13273 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13274 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13275 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13276 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13277 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13278 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13282 static struct hda_verb alc269_lifebook_verbs[] = {
13283 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13284 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
13285 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13286 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13287 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13288 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13289 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13290 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13291 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13292 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13296 /* toggle speaker-output according to the hp-jack state */
13297 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
13299 unsigned int present;
13300 unsigned char bits;
13302 present = snd_hda_jack_detect(codec, 0x15);
13303 bits = present ? AMP_IN_MUTE(0) : 0;
13304 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13305 AMP_IN_MUTE(0), bits);
13306 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13307 AMP_IN_MUTE(0), bits);
13309 snd_hda_codec_write(codec, 0x20, 0,
13310 AC_VERB_SET_COEF_INDEX, 0x0c);
13311 snd_hda_codec_write(codec, 0x20, 0,
13312 AC_VERB_SET_PROC_COEF, 0x680);
13314 snd_hda_codec_write(codec, 0x20, 0,
13315 AC_VERB_SET_COEF_INDEX, 0x0c);
13316 snd_hda_codec_write(codec, 0x20, 0,
13317 AC_VERB_SET_PROC_COEF, 0x480);
13320 /* toggle speaker-output according to the hp-jacks state */
13321 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
13323 unsigned int present;
13324 unsigned char bits;
13326 /* Check laptop headphone socket */
13327 present = snd_hda_jack_detect(codec, 0x15);
13329 /* Check port replicator headphone socket */
13330 present |= snd_hda_jack_detect(codec, 0x1a);
13332 bits = present ? AMP_IN_MUTE(0) : 0;
13333 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13334 AMP_IN_MUTE(0), bits);
13335 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13336 AMP_IN_MUTE(0), bits);
13338 snd_hda_codec_write(codec, 0x20, 0,
13339 AC_VERB_SET_COEF_INDEX, 0x0c);
13340 snd_hda_codec_write(codec, 0x20, 0,
13341 AC_VERB_SET_PROC_COEF, 0x680);
13343 snd_hda_codec_write(codec, 0x20, 0,
13344 AC_VERB_SET_COEF_INDEX, 0x0c);
13345 snd_hda_codec_write(codec, 0x20, 0,
13346 AC_VERB_SET_PROC_COEF, 0x480);
13349 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
13351 unsigned int present_laptop;
13352 unsigned int present_dock;
13354 present_laptop = snd_hda_jack_detect(codec, 0x18);
13355 present_dock = snd_hda_jack_detect(codec, 0x1b);
13357 /* Laptop mic port overrides dock mic port, design decision */
13359 snd_hda_codec_write(codec, 0x23, 0,
13360 AC_VERB_SET_CONNECT_SEL, 0x3);
13361 if (present_laptop)
13362 snd_hda_codec_write(codec, 0x23, 0,
13363 AC_VERB_SET_CONNECT_SEL, 0x0);
13364 if (!present_dock && !present_laptop)
13365 snd_hda_codec_write(codec, 0x23, 0,
13366 AC_VERB_SET_CONNECT_SEL, 0x1);
13369 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
13372 switch (res >> 26) {
13373 case ALC880_HP_EVENT:
13374 alc269_quanta_fl1_speaker_automute(codec);
13376 case ALC880_MIC_EVENT:
13377 alc_mic_automute(codec);
13382 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
13385 if ((res >> 26) == ALC880_HP_EVENT)
13386 alc269_lifebook_speaker_automute(codec);
13387 if ((res >> 26) == ALC880_MIC_EVENT)
13388 alc269_lifebook_mic_autoswitch(codec);
13391 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
13393 struct alc_spec *spec = codec->spec;
13394 spec->ext_mic.pin = 0x18;
13395 spec->ext_mic.mux_idx = 0;
13396 spec->int_mic.pin = 0x19;
13397 spec->int_mic.mux_idx = 1;
13398 spec->auto_mic = 1;
13401 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
13403 alc269_quanta_fl1_speaker_automute(codec);
13404 alc_mic_automute(codec);
13407 static void alc269_lifebook_init_hook(struct hda_codec *codec)
13409 alc269_lifebook_speaker_automute(codec);
13410 alc269_lifebook_mic_autoswitch(codec);
13413 static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {
13414 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13415 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
13416 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13417 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
13418 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13419 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13420 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13424 static struct hda_verb alc269_eeepc_amic_init_verbs[] = {
13425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
13426 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
13427 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
13428 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
13429 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13430 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
13434 /* toggle speaker-output according to the hp-jack state */
13435 static void alc269_speaker_automute(struct hda_codec *codec)
13437 struct alc_spec *spec = codec->spec;
13438 unsigned int nid = spec->autocfg.hp_pins[0];
13439 unsigned int present;
13440 unsigned char bits;
13442 present = snd_hda_jack_detect(codec, nid);
13443 bits = present ? AMP_IN_MUTE(0) : 0;
13444 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
13445 AMP_IN_MUTE(0), bits);
13446 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
13447 AMP_IN_MUTE(0), bits);
13450 /* unsolicited event for HP jack sensing */
13451 static void alc269_eeepc_unsol_event(struct hda_codec *codec,
13454 switch (res >> 26) {
13455 case ALC880_HP_EVENT:
13456 alc269_speaker_automute(codec);
13458 case ALC880_MIC_EVENT:
13459 alc_mic_automute(codec);
13464 static void alc269_eeepc_dmic_setup(struct hda_codec *codec)
13466 struct alc_spec *spec = codec->spec;
13467 spec->ext_mic.pin = 0x18;
13468 spec->ext_mic.mux_idx = 0;
13469 spec->int_mic.pin = 0x12;
13470 spec->int_mic.mux_idx = 5;
13471 spec->auto_mic = 1;
13474 static void alc269_eeepc_amic_setup(struct hda_codec *codec)
13476 struct alc_spec *spec = codec->spec;
13477 spec->ext_mic.pin = 0x18;
13478 spec->ext_mic.mux_idx = 0;
13479 spec->int_mic.pin = 0x19;
13480 spec->int_mic.mux_idx = 1;
13481 spec->auto_mic = 1;
13484 static void alc269_eeepc_inithook(struct hda_codec *codec)
13486 alc269_speaker_automute(codec);
13487 alc_mic_automute(codec);
13491 * generic initialization of ADC, input mixers and output mixers
13493 static struct hda_verb alc269_init_verbs[] = {
13495 * Unmute ADC0 and set the default input to mic-in
13497 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13499 /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the
13500 * analog-loopback mixer widget
13501 * Note: PASD motherboards uses the Line In 2 as the input for
13502 * front panel mic (mic 2)
13504 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
13505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13509 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
13512 * Set up output mixers (0x0c - 0x0e)
13514 /* set vol=0 to output mixers */
13515 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13516 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13518 /* set up input amps for analog loopback */
13519 /* Amp Indices: DAC = 0, mixer = 1 */
13520 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13521 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13522 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13523 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13524 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13525 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13527 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13528 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13529 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13530 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13531 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13532 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13533 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13535 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13536 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13537 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13538 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13539 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13540 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13541 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13543 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
13544 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
13546 /* FIXME: use matrix-type input source selection */
13547 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
13548 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
13549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
13550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
13551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
13552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
13555 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13556 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13560 #define alc269_auto_create_multi_out_ctls \
13561 alc268_auto_create_multi_out_ctls
13562 #define alc269_auto_create_input_ctls \
13563 alc268_auto_create_input_ctls
13565 #ifdef CONFIG_SND_HDA_POWER_SAVE
13566 #define alc269_loopbacks alc880_loopbacks
13569 /* pcm configuration: identical with ALC880 */
13570 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
13571 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
13572 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
13573 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
13575 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
13579 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13580 /* NID is set in alc_build_pcms */
13582 .open = alc880_playback_pcm_open,
13583 .prepare = alc880_playback_pcm_prepare,
13584 .cleanup = alc880_playback_pcm_cleanup
13588 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
13592 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
13593 /* NID is set in alc_build_pcms */
13597 * BIOS auto configuration
13599 static int alc269_parse_auto_config(struct hda_codec *codec)
13601 struct alc_spec *spec = codec->spec;
13603 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
13605 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13610 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
13613 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
13617 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
13619 if (spec->autocfg.dig_outs)
13620 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
13622 if (spec->kctls.list)
13623 add_mixer(spec, spec->kctls.list);
13625 add_verb(spec, alc269_init_verbs);
13626 spec->num_mux_defs = 1;
13627 spec->input_mux = &spec->private_imux[0];
13628 /* set default input source */
13629 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
13630 0, AC_VERB_SET_CONNECT_SEL,
13631 spec->input_mux->items[0].index);
13633 err = alc_auto_add_mic_boost(codec);
13637 if (!spec->cap_mixer && !spec->no_analog)
13638 set_capture_mixer(codec);
13640 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
13645 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
13646 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
13647 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
13650 /* init callback for auto-configuration model -- overriding the default init */
13651 static void alc269_auto_init(struct hda_codec *codec)
13653 struct alc_spec *spec = codec->spec;
13654 alc269_auto_init_multi_out(codec);
13655 alc269_auto_init_hp_out(codec);
13656 alc269_auto_init_analog_input(codec);
13657 if (spec->unsol_event)
13658 alc_inithook(codec);
13662 * configuration and preset
13664 static const char *alc269_models[ALC269_MODEL_LAST] = {
13665 [ALC269_BASIC] = "basic",
13666 [ALC269_QUANTA_FL1] = "quanta",
13667 [ALC269_ASUS_AMIC] = "asus-amic",
13668 [ALC269_ASUS_DMIC] = "asus-dmic",
13669 [ALC269_FUJITSU] = "fujitsu",
13670 [ALC269_LIFEBOOK] = "lifebook",
13671 [ALC269_AUTO] = "auto",
13674 static struct snd_pci_quirk alc269_cfg_tbl[] = {
13675 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
13676 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
13678 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC),
13679 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC),
13680 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC),
13681 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC),
13682 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC),
13683 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC),
13684 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC),
13685 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC),
13686 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC),
13687 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC),
13688 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC),
13689 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC),
13690 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC),
13691 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC),
13692 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC),
13693 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC),
13694 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC),
13695 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC),
13696 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC),
13697 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC),
13698 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC),
13699 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC),
13700 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC),
13701 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC),
13702 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC),
13703 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC),
13704 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC),
13705 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC),
13706 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
13708 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
13710 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC),
13711 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC),
13712 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
13713 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
13717 static struct alc_config_preset alc269_presets[] = {
13719 .mixers = { alc269_base_mixer },
13720 .init_verbs = { alc269_init_verbs },
13721 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13722 .dac_nids = alc269_dac_nids,
13724 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13725 .channel_mode = alc269_modes,
13726 .input_mux = &alc269_capture_source,
13728 [ALC269_QUANTA_FL1] = {
13729 .mixers = { alc269_quanta_fl1_mixer },
13730 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
13731 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13732 .dac_nids = alc269_dac_nids,
13734 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13735 .channel_mode = alc269_modes,
13736 .input_mux = &alc269_capture_source,
13737 .unsol_event = alc269_quanta_fl1_unsol_event,
13738 .setup = alc269_quanta_fl1_setup,
13739 .init_hook = alc269_quanta_fl1_init_hook,
13741 [ALC269_ASUS_AMIC] = {
13742 .mixers = { alc269_eeepc_mixer },
13743 .cap_mixer = alc269_epc_capture_mixer,
13744 .init_verbs = { alc269_init_verbs,
13745 alc269_eeepc_amic_init_verbs },
13746 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13747 .dac_nids = alc269_dac_nids,
13749 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13750 .channel_mode = alc269_modes,
13751 .unsol_event = alc269_eeepc_unsol_event,
13752 .setup = alc269_eeepc_amic_setup,
13753 .init_hook = alc269_eeepc_inithook,
13755 [ALC269_ASUS_DMIC] = {
13756 .mixers = { alc269_eeepc_mixer },
13757 .cap_mixer = alc269_epc_capture_mixer,
13758 .init_verbs = { alc269_init_verbs,
13759 alc269_eeepc_dmic_init_verbs },
13760 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13761 .dac_nids = alc269_dac_nids,
13763 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13764 .channel_mode = alc269_modes,
13765 .unsol_event = alc269_eeepc_unsol_event,
13766 .setup = alc269_eeepc_dmic_setup,
13767 .init_hook = alc269_eeepc_inithook,
13769 [ALC269_FUJITSU] = {
13770 .mixers = { alc269_fujitsu_mixer },
13771 .cap_mixer = alc269_epc_capture_mixer,
13772 .init_verbs = { alc269_init_verbs,
13773 alc269_eeepc_dmic_init_verbs },
13774 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13775 .dac_nids = alc269_dac_nids,
13777 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13778 .channel_mode = alc269_modes,
13779 .unsol_event = alc269_eeepc_unsol_event,
13780 .setup = alc269_eeepc_dmic_setup,
13781 .init_hook = alc269_eeepc_inithook,
13783 [ALC269_LIFEBOOK] = {
13784 .mixers = { alc269_lifebook_mixer },
13785 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
13786 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
13787 .dac_nids = alc269_dac_nids,
13789 .num_channel_mode = ARRAY_SIZE(alc269_modes),
13790 .channel_mode = alc269_modes,
13791 .input_mux = &alc269_capture_source,
13792 .unsol_event = alc269_lifebook_unsol_event,
13793 .init_hook = alc269_lifebook_init_hook,
13797 static int patch_alc269(struct hda_codec *codec)
13799 struct alc_spec *spec;
13803 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13807 codec->spec = spec;
13809 alc_fix_pll_init(codec, 0x20, 0x04, 15);
13811 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
13812 kfree(codec->chip_name);
13813 codec->chip_name = kstrdup("ALC259", GFP_KERNEL);
13814 if (!codec->chip_name) {
13820 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
13824 if (board_config < 0) {
13825 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13827 board_config = ALC269_AUTO;
13830 if (board_config == ALC269_AUTO) {
13831 /* automatic parse from the BIOS config */
13832 err = alc269_parse_auto_config(codec);
13838 "hda_codec: Cannot set up configuration "
13839 "from BIOS. Using base mode...\n");
13840 board_config = ALC269_BASIC;
13844 err = snd_hda_attach_beep_device(codec, 0x1);
13850 if (board_config != ALC269_AUTO)
13851 setup_preset(codec, &alc269_presets[board_config]);
13853 if (codec->subsystem_id == 0x17aa3bf8) {
13854 /* Due to a hardware problem on Lenovo Ideadpad, we need to
13855 * fix the sample rate of analog I/O to 44.1kHz
13857 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
13858 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
13860 spec->stream_analog_playback = &alc269_pcm_analog_playback;
13861 spec->stream_analog_capture = &alc269_pcm_analog_capture;
13863 spec->stream_digital_playback = &alc269_pcm_digital_playback;
13864 spec->stream_digital_capture = &alc269_pcm_digital_capture;
13866 spec->adc_nids = alc269_adc_nids;
13867 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
13868 spec->capsrc_nids = alc269_capsrc_nids;
13869 if (!spec->cap_mixer)
13870 set_capture_mixer(codec);
13871 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
13873 spec->vmaster_nid = 0x02;
13875 codec->patch_ops = alc_patch_ops;
13876 if (board_config == ALC269_AUTO)
13877 spec->init_hook = alc269_auto_init;
13878 #ifdef CONFIG_SND_HDA_POWER_SAVE
13879 if (!spec->loopback.amplist)
13880 spec->loopback.amplist = alc269_loopbacks;
13887 * ALC861 channel source setting (2/6 channel selection for 3-stack)
13891 * set the path ways for 2 channel output
13892 * need to set the codec line out and mic 1 pin widgets to inputs
13894 static struct hda_verb alc861_threestack_ch2_init[] = {
13895 /* set pin widget 1Ah (line in) for input */
13896 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13897 /* set pin widget 18h (mic1/2) for input, for mic also enable
13900 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13902 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13904 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13905 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13911 * need to set the codec line out and mic 1 pin widgets to outputs
13913 static struct hda_verb alc861_threestack_ch6_init[] = {
13914 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13915 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13916 /* set pin widget 18h (mic1) for output (CLFE)*/
13917 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13919 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13920 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13922 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13924 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13925 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13930 static struct hda_channel_mode alc861_threestack_modes[2] = {
13931 { 2, alc861_threestack_ch2_init },
13932 { 6, alc861_threestack_ch6_init },
13934 /* Set mic1 as input and unmute the mixer */
13935 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
13936 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13937 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13940 /* Set mic1 as output and mute mixer */
13941 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
13942 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13943 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13947 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
13948 { 2, alc861_uniwill_m31_ch2_init },
13949 { 4, alc861_uniwill_m31_ch4_init },
13952 /* Set mic1 and line-in as input and unmute the mixer */
13953 static struct hda_verb alc861_asus_ch2_init[] = {
13954 /* set pin widget 1Ah (line in) for input */
13955 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
13956 /* set pin widget 18h (mic1/2) for input, for mic also enable
13959 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
13961 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
13963 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
13964 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
13968 /* Set mic1 nad line-in as output and mute mixer */
13969 static struct hda_verb alc861_asus_ch6_init[] = {
13970 /* set pin widget 1Ah (line in) for output (Back Surround)*/
13971 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13972 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13973 /* set pin widget 18h (mic1) for output (CLFE)*/
13974 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
13975 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
13976 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
13977 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
13979 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
13981 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
13982 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
13987 static struct hda_channel_mode alc861_asus_modes[2] = {
13988 { 2, alc861_asus_ch2_init },
13989 { 6, alc861_asus_ch6_init },
13994 static struct snd_kcontrol_new alc861_base_mixer[] = {
13995 /* output mixer control */
13996 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
13997 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
13998 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
13999 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14000 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14002 /*Input mixer control */
14003 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14004 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14005 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14006 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14007 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14008 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14009 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14010 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14011 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14012 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14017 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
14018 /* output mixer control */
14019 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14020 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14021 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14022 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14023 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14025 /* Input mixer control */
14026 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14027 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14028 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14029 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14030 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14031 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14033 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14034 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14035 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14038 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14039 .name = "Channel Mode",
14040 .info = alc_ch_mode_info,
14041 .get = alc_ch_mode_get,
14042 .put = alc_ch_mode_put,
14043 .private_value = ARRAY_SIZE(alc861_threestack_modes),
14048 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
14049 /* output mixer control */
14050 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14052 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14057 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
14058 /* output mixer control */
14059 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14060 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14061 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14062 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14063 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
14065 /* Input mixer control */
14066 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14067 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
14068 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14069 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14070 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14071 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14072 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14073 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14074 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14075 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
14078 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14079 .name = "Channel Mode",
14080 .info = alc_ch_mode_info,
14081 .get = alc_ch_mode_get,
14082 .put = alc_ch_mode_put,
14083 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
14088 static struct snd_kcontrol_new alc861_asus_mixer[] = {
14089 /* output mixer control */
14090 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
14092 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
14093 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
14094 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
14096 /* Input mixer control */
14097 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
14098 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14099 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14100 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14101 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
14102 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
14103 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
14104 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
14105 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
14106 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
14109 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14110 .name = "Channel Mode",
14111 .info = alc_ch_mode_info,
14112 .get = alc_ch_mode_get,
14113 .put = alc_ch_mode_put,
14114 .private_value = ARRAY_SIZE(alc861_asus_modes),
14119 /* additional mixer */
14120 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
14121 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
14122 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
14127 * generic initialization of ADC, input mixers and output mixers
14129 static struct hda_verb alc861_base_init_verbs[] = {
14131 * Unmute ADC0 and set the default input to mic-in
14133 /* port-A for surround (rear panel) */
14134 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14135 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
14136 /* port-B for mic-in (rear panel) with vref */
14137 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14138 /* port-C for line-in (rear panel) */
14139 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14140 /* port-D for Front */
14141 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14142 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14143 /* port-E for HP out (front panel) */
14144 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14145 /* route front PCM to HP */
14146 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14147 /* port-F for mic-in (front panel) with vref */
14148 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14149 /* port-G for CLFE (rear panel) */
14150 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14151 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14152 /* port-H for side (rear panel) */
14153 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14154 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
14156 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14157 /* route front mic to ADC1*/
14158 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14161 /* Unmute DAC0~3 & spdif out*/
14162 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14163 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14164 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14165 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14166 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14168 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14169 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14170 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14171 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14172 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14174 /* Unmute Stereo Mixer 15 */
14175 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14176 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14177 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14178 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14180 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14181 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14182 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14183 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14185 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14186 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14187 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14188 /* hp used DAC 3 (Front) */
14189 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14190 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14195 static struct hda_verb alc861_threestack_init_verbs[] = {
14197 * Unmute ADC0 and set the default input to mic-in
14199 /* port-A for surround (rear panel) */
14200 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14201 /* port-B for mic-in (rear panel) with vref */
14202 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14203 /* port-C for line-in (rear panel) */
14204 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14205 /* port-D for Front */
14206 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14207 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14208 /* port-E for HP out (front panel) */
14209 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
14210 /* route front PCM to HP */
14211 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14212 /* port-F for mic-in (front panel) with vref */
14213 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14214 /* port-G for CLFE (rear panel) */
14215 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14216 /* port-H for side (rear panel) */
14217 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14219 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14220 /* route front mic to ADC1*/
14221 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14222 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14223 /* Unmute DAC0~3 & spdif out*/
14224 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14225 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14226 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14227 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14228 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14230 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14231 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14232 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14233 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14234 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14236 /* Unmute Stereo Mixer 15 */
14237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14238 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14239 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14242 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14243 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14244 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14245 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14246 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14247 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14248 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14249 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14250 /* hp used DAC 3 (Front) */
14251 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14252 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14256 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
14258 * Unmute ADC0 and set the default input to mic-in
14260 /* port-A for surround (rear panel) */
14261 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14262 /* port-B for mic-in (rear panel) with vref */
14263 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14264 /* port-C for line-in (rear panel) */
14265 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14266 /* port-D for Front */
14267 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14268 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14269 /* port-E for HP out (front panel) */
14270 /* this has to be set to VREF80 */
14271 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14272 /* route front PCM to HP */
14273 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14274 /* port-F for mic-in (front panel) with vref */
14275 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14276 /* port-G for CLFE (rear panel) */
14277 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14278 /* port-H for side (rear panel) */
14279 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
14281 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14282 /* route front mic to ADC1*/
14283 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14284 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14285 /* Unmute DAC0~3 & spdif out*/
14286 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14287 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14288 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14289 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14292 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14293 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14294 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14295 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14296 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14298 /* Unmute Stereo Mixer 15 */
14299 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14300 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14301 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14302 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14304 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14305 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14306 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14307 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14309 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14310 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14311 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14312 /* hp used DAC 3 (Front) */
14313 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14314 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14318 static struct hda_verb alc861_asus_init_verbs[] = {
14320 * Unmute ADC0 and set the default input to mic-in
14322 /* port-A for surround (rear panel)
14323 * according to codec#0 this is the HP jack
14325 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
14326 /* route front PCM to HP */
14327 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
14328 /* port-B for mic-in (rear panel) with vref */
14329 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14330 /* port-C for line-in (rear panel) */
14331 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14332 /* port-D for Front */
14333 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14334 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
14335 /* port-E for HP out (front panel) */
14336 /* this has to be set to VREF80 */
14337 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14338 /* route front PCM to HP */
14339 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
14340 /* port-F for mic-in (front panel) with vref */
14341 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
14342 /* port-G for CLFE (rear panel) */
14343 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14344 /* port-H for side (rear panel) */
14345 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
14347 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
14348 /* route front mic to ADC1*/
14349 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
14350 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14351 /* Unmute DAC0~3 & spdif out*/
14352 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14353 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14354 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14355 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14356 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14357 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14358 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14359 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14360 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14361 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14363 /* Unmute Stereo Mixer 15 */
14364 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14365 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14366 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14367 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
14369 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14370 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14371 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14372 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14373 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14374 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14375 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14377 /* hp used DAC 3 (Front) */
14378 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
14379 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14383 /* additional init verbs for ASUS laptops */
14384 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
14385 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
14386 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
14391 * generic initialization of ADC, input mixers and output mixers
14393 static struct hda_verb alc861_auto_init_verbs[] = {
14395 * Unmute ADC0 and set the default input to mic-in
14397 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
14398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14400 /* Unmute DAC0~3 & spdif out*/
14401 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14402 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14403 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14404 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
14405 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14407 /* Unmute Mixer 14 (mic) 1c (Line in)*/
14408 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14409 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14410 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14411 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14413 /* Unmute Stereo Mixer 15 */
14414 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14415 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14416 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
14417 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
14419 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14420 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14421 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14422 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14423 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14424 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14425 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14426 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14428 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14429 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14430 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14431 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14432 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
14433 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
14434 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
14435 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
14437 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
14442 static struct hda_verb alc861_toshiba_init_verbs[] = {
14443 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14448 /* toggle speaker-output according to the hp-jack state */
14449 static void alc861_toshiba_automute(struct hda_codec *codec)
14451 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
14453 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
14454 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
14455 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
14456 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
14459 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
14462 if ((res >> 26) == ALC880_HP_EVENT)
14463 alc861_toshiba_automute(codec);
14466 /* pcm configuration: identical with ALC880 */
14467 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
14468 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
14469 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
14470 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
14473 #define ALC861_DIGOUT_NID 0x07
14475 static struct hda_channel_mode alc861_8ch_modes[1] = {
14479 static hda_nid_t alc861_dac_nids[4] = {
14480 /* front, surround, clfe, side */
14481 0x03, 0x06, 0x05, 0x04
14484 static hda_nid_t alc660_dac_nids[3] = {
14485 /* front, clfe, surround */
14489 static hda_nid_t alc861_adc_nids[1] = {
14494 static struct hda_input_mux alc861_capture_source = {
14498 { "Front Mic", 0x3 },
14505 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
14507 struct alc_spec *spec = codec->spec;
14508 hda_nid_t mix, srcs[5];
14511 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
14513 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14516 for (i = 0; i < num; i++) {
14518 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
14519 if (type != AC_WID_AUD_OUT)
14521 for (j = 0; j < spec->multiout.num_dacs; j++)
14522 if (spec->multiout.dac_nids[j] == srcs[i])
14524 if (j >= spec->multiout.num_dacs)
14530 /* fill in the dac_nids table from the parsed pin configuration */
14531 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
14532 const struct auto_pin_cfg *cfg)
14534 struct alc_spec *spec = codec->spec;
14536 hda_nid_t nid, dac;
14538 spec->multiout.dac_nids = spec->private_dac_nids;
14539 for (i = 0; i < cfg->line_outs; i++) {
14540 nid = cfg->line_out_pins[i];
14541 dac = alc861_look_for_dac(codec, nid);
14544 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
14549 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
14550 hda_nid_t nid, unsigned int chs)
14552 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
14553 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
14556 /* add playback controls from the parsed DAC table */
14557 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
14558 const struct auto_pin_cfg *cfg)
14560 struct alc_spec *spec = codec->spec;
14561 static const char *chname[4] = {
14562 "Front", "Surround", NULL /*CLFE*/, "Side"
14567 if (cfg->line_outs == 1) {
14568 const char *pfx = NULL;
14571 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
14574 nid = spec->multiout.dac_nids[0];
14575 return alc861_create_out_sw(codec, pfx, nid, 3);
14579 for (i = 0; i < cfg->line_outs; i++) {
14580 nid = spec->multiout.dac_nids[i];
14585 err = alc861_create_out_sw(codec, "Center", nid, 1);
14588 err = alc861_create_out_sw(codec, "LFE", nid, 2);
14592 err = alc861_create_out_sw(codec, chname[i], nid, 3);
14600 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
14602 struct alc_spec *spec = codec->spec;
14609 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
14610 nid = alc861_look_for_dac(codec, pin);
14612 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
14615 spec->multiout.hp_nid = nid;
14621 /* create playback/capture controls for input pins */
14622 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
14623 const struct auto_pin_cfg *cfg)
14625 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
14628 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
14630 int pin_type, hda_nid_t dac)
14632 hda_nid_t mix, srcs[5];
14635 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
14637 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14639 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
14641 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
14644 for (i = 0; i < num; i++) {
14646 if (srcs[i] == dac || srcs[i] == 0x15)
14647 mute = AMP_IN_UNMUTE(i);
14649 mute = AMP_IN_MUTE(i);
14650 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
14655 static void alc861_auto_init_multi_out(struct hda_codec *codec)
14657 struct alc_spec *spec = codec->spec;
14660 for (i = 0; i < spec->autocfg.line_outs; i++) {
14661 hda_nid_t nid = spec->autocfg.line_out_pins[i];
14662 int pin_type = get_pin_type(spec->autocfg.line_out_type);
14664 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
14665 spec->multiout.dac_nids[i]);
14669 static void alc861_auto_init_hp_out(struct hda_codec *codec)
14671 struct alc_spec *spec = codec->spec;
14673 if (spec->autocfg.hp_outs)
14674 alc861_auto_set_output_and_unmute(codec,
14675 spec->autocfg.hp_pins[0],
14677 spec->multiout.hp_nid);
14678 if (spec->autocfg.speaker_outs)
14679 alc861_auto_set_output_and_unmute(codec,
14680 spec->autocfg.speaker_pins[0],
14682 spec->multiout.dac_nids[0]);
14685 static void alc861_auto_init_analog_input(struct hda_codec *codec)
14687 struct alc_spec *spec = codec->spec;
14690 for (i = 0; i < AUTO_PIN_LAST; i++) {
14691 hda_nid_t nid = spec->autocfg.input_pins[i];
14692 if (nid >= 0x0c && nid <= 0x11)
14693 alc_set_input_pin(codec, nid, i);
14697 /* parse the BIOS configuration and set up the alc_spec */
14698 /* return 1 if successful, 0 if the proper config is not found,
14699 * or a negative error code
14701 static int alc861_parse_auto_config(struct hda_codec *codec)
14703 struct alc_spec *spec = codec->spec;
14705 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
14707 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14711 if (!spec->autocfg.line_outs)
14712 return 0; /* can't find valid BIOS pin config */
14714 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
14717 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
14720 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
14723 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
14727 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14729 if (spec->autocfg.dig_outs)
14730 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
14732 if (spec->kctls.list)
14733 add_mixer(spec, spec->kctls.list);
14735 add_verb(spec, alc861_auto_init_verbs);
14737 spec->num_mux_defs = 1;
14738 spec->input_mux = &spec->private_imux[0];
14740 spec->adc_nids = alc861_adc_nids;
14741 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
14742 set_capture_mixer(codec);
14744 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b);
14749 /* additional initialization for auto-configuration model */
14750 static void alc861_auto_init(struct hda_codec *codec)
14752 struct alc_spec *spec = codec->spec;
14753 alc861_auto_init_multi_out(codec);
14754 alc861_auto_init_hp_out(codec);
14755 alc861_auto_init_analog_input(codec);
14756 if (spec->unsol_event)
14757 alc_inithook(codec);
14760 #ifdef CONFIG_SND_HDA_POWER_SAVE
14761 static struct hda_amp_list alc861_loopbacks[] = {
14762 { 0x15, HDA_INPUT, 0 },
14763 { 0x15, HDA_INPUT, 1 },
14764 { 0x15, HDA_INPUT, 2 },
14765 { 0x15, HDA_INPUT, 3 },
14772 * configuration and preset
14774 static const char *alc861_models[ALC861_MODEL_LAST] = {
14775 [ALC861_3ST] = "3stack",
14776 [ALC660_3ST] = "3stack-660",
14777 [ALC861_3ST_DIG] = "3stack-dig",
14778 [ALC861_6ST_DIG] = "6stack-dig",
14779 [ALC861_UNIWILL_M31] = "uniwill-m31",
14780 [ALC861_TOSHIBA] = "toshiba",
14781 [ALC861_ASUS] = "asus",
14782 [ALC861_ASUS_LAPTOP] = "asus-laptop",
14783 [ALC861_AUTO] = "auto",
14786 static struct snd_pci_quirk alc861_cfg_tbl[] = {
14787 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
14788 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14789 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
14790 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
14791 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
14792 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
14793 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
14794 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
14795 * Any other models that need this preset?
14797 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
14798 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
14799 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
14800 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
14801 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
14802 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
14803 /* FIXME: the below seems conflict */
14804 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
14805 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
14806 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
14810 static struct alc_config_preset alc861_presets[] = {
14812 .mixers = { alc861_3ST_mixer },
14813 .init_verbs = { alc861_threestack_init_verbs },
14814 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14815 .dac_nids = alc861_dac_nids,
14816 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14817 .channel_mode = alc861_threestack_modes,
14819 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14820 .adc_nids = alc861_adc_nids,
14821 .input_mux = &alc861_capture_source,
14823 [ALC861_3ST_DIG] = {
14824 .mixers = { alc861_base_mixer },
14825 .init_verbs = { alc861_threestack_init_verbs },
14826 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14827 .dac_nids = alc861_dac_nids,
14828 .dig_out_nid = ALC861_DIGOUT_NID,
14829 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14830 .channel_mode = alc861_threestack_modes,
14832 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14833 .adc_nids = alc861_adc_nids,
14834 .input_mux = &alc861_capture_source,
14836 [ALC861_6ST_DIG] = {
14837 .mixers = { alc861_base_mixer },
14838 .init_verbs = { alc861_base_init_verbs },
14839 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14840 .dac_nids = alc861_dac_nids,
14841 .dig_out_nid = ALC861_DIGOUT_NID,
14842 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
14843 .channel_mode = alc861_8ch_modes,
14844 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14845 .adc_nids = alc861_adc_nids,
14846 .input_mux = &alc861_capture_source,
14849 .mixers = { alc861_3ST_mixer },
14850 .init_verbs = { alc861_threestack_init_verbs },
14851 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
14852 .dac_nids = alc660_dac_nids,
14853 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
14854 .channel_mode = alc861_threestack_modes,
14856 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14857 .adc_nids = alc861_adc_nids,
14858 .input_mux = &alc861_capture_source,
14860 [ALC861_UNIWILL_M31] = {
14861 .mixers = { alc861_uniwill_m31_mixer },
14862 .init_verbs = { alc861_uniwill_m31_init_verbs },
14863 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14864 .dac_nids = alc861_dac_nids,
14865 .dig_out_nid = ALC861_DIGOUT_NID,
14866 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
14867 .channel_mode = alc861_uniwill_m31_modes,
14869 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14870 .adc_nids = alc861_adc_nids,
14871 .input_mux = &alc861_capture_source,
14873 [ALC861_TOSHIBA] = {
14874 .mixers = { alc861_toshiba_mixer },
14875 .init_verbs = { alc861_base_init_verbs,
14876 alc861_toshiba_init_verbs },
14877 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14878 .dac_nids = alc861_dac_nids,
14879 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14880 .channel_mode = alc883_3ST_2ch_modes,
14881 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14882 .adc_nids = alc861_adc_nids,
14883 .input_mux = &alc861_capture_source,
14884 .unsol_event = alc861_toshiba_unsol_event,
14885 .init_hook = alc861_toshiba_automute,
14888 .mixers = { alc861_asus_mixer },
14889 .init_verbs = { alc861_asus_init_verbs },
14890 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14891 .dac_nids = alc861_dac_nids,
14892 .dig_out_nid = ALC861_DIGOUT_NID,
14893 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
14894 .channel_mode = alc861_asus_modes,
14897 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14898 .adc_nids = alc861_adc_nids,
14899 .input_mux = &alc861_capture_source,
14901 [ALC861_ASUS_LAPTOP] = {
14902 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
14903 .init_verbs = { alc861_asus_init_verbs,
14904 alc861_asus_laptop_init_verbs },
14905 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
14906 .dac_nids = alc861_dac_nids,
14907 .dig_out_nid = ALC861_DIGOUT_NID,
14908 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
14909 .channel_mode = alc883_3ST_2ch_modes,
14911 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
14912 .adc_nids = alc861_adc_nids,
14913 .input_mux = &alc861_capture_source,
14917 /* Pin config fixes */
14919 PINFIX_FSC_AMILO_PI1505,
14922 static struct alc_pincfg alc861_fsc_amilo_pi1505_pinfix[] = {
14923 { 0x0b, 0x0221101f }, /* HP */
14924 { 0x0f, 0x90170310 }, /* speaker */
14928 static const struct alc_fixup alc861_fixups[] = {
14929 [PINFIX_FSC_AMILO_PI1505] = {
14930 .pins = alc861_fsc_amilo_pi1505_pinfix
14934 static struct snd_pci_quirk alc861_fixup_tbl[] = {
14935 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
14939 static int patch_alc861(struct hda_codec *codec)
14941 struct alc_spec *spec;
14945 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
14949 codec->spec = spec;
14951 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
14955 if (board_config < 0) {
14956 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
14958 board_config = ALC861_AUTO;
14961 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
14963 if (board_config == ALC861_AUTO) {
14964 /* automatic parse from the BIOS config */
14965 err = alc861_parse_auto_config(codec);
14971 "hda_codec: Cannot set up configuration "
14972 "from BIOS. Using base mode...\n");
14973 board_config = ALC861_3ST_DIG;
14977 err = snd_hda_attach_beep_device(codec, 0x23);
14983 if (board_config != ALC861_AUTO)
14984 setup_preset(codec, &alc861_presets[board_config]);
14986 spec->stream_analog_playback = &alc861_pcm_analog_playback;
14987 spec->stream_analog_capture = &alc861_pcm_analog_capture;
14989 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14990 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14992 if (!spec->cap_mixer)
14993 set_capture_mixer(codec);
14994 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14996 spec->vmaster_nid = 0x03;
14998 codec->patch_ops = alc_patch_ops;
14999 if (board_config == ALC861_AUTO) {
15000 spec->init_hook = alc861_auto_init;
15001 #ifdef CONFIG_SND_HDA_POWER_SAVE
15002 spec->power_hook = alc_power_eapd;
15005 #ifdef CONFIG_SND_HDA_POWER_SAVE
15006 if (!spec->loopback.amplist)
15007 spec->loopback.amplist = alc861_loopbacks;
15014 * ALC861-VD support
15018 * In addition, an independent DAC
15020 #define ALC861VD_DIGOUT_NID 0x06
15022 static hda_nid_t alc861vd_dac_nids[4] = {
15023 /* front, surr, clfe, side surr */
15024 0x02, 0x03, 0x04, 0x05
15027 /* dac_nids for ALC660vd are in a different order - according to
15028 * Realtek's driver.
15029 * This should probably result in a different mixer for 6stack models
15030 * of ALC660vd codecs, but for now there is only 3stack mixer
15031 * - and it is the same as in 861vd.
15032 * adc_nids in ALC660vd are (is) the same as in 861vd
15034 static hda_nid_t alc660vd_dac_nids[3] = {
15035 /* front, rear, clfe, rear_surr */
15039 static hda_nid_t alc861vd_adc_nids[1] = {
15044 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
15047 /* FIXME: should be a matrix-type input source selection */
15048 static struct hda_input_mux alc861vd_capture_source = {
15052 { "Front Mic", 0x1 },
15058 static struct hda_input_mux alc861vd_dallas_capture_source = {
15061 { "Ext Mic", 0x0 },
15062 { "Int Mic", 0x1 },
15066 static struct hda_input_mux alc861vd_hp_capture_source = {
15069 { "Front Mic", 0x0 },
15070 { "ATAPI Mic", 0x1 },
15077 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
15084 static struct hda_verb alc861vd_6stack_ch6_init[] = {
15085 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15086 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15087 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15088 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15095 static struct hda_verb alc861vd_6stack_ch8_init[] = {
15096 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15097 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15098 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15099 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
15103 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
15104 { 6, alc861vd_6stack_ch6_init },
15105 { 8, alc861vd_6stack_ch8_init },
15108 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
15110 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15111 .name = "Channel Mode",
15112 .info = alc_ch_mode_info,
15113 .get = alc_ch_mode_get,
15114 .put = alc_ch_mode_put,
15119 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
15120 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
15122 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
15123 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15124 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15126 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15127 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
15129 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
15131 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
15133 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
15134 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
15136 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
15137 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
15139 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15141 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15142 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15143 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15145 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15146 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15147 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
15152 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15153 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15158 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
15159 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15160 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15162 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15164 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15168 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15169 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15170 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
15173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, 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 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
15182 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15183 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
15184 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
15186 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
15188 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
15189 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15192 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
15193 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15194 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
15197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
15202 /* Pin assignment: Speaker=0x14, HP = 0x15,
15203 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
15205 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
15206 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15207 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
15208 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15209 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15210 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
15211 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15212 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15213 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
15214 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15215 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15219 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
15220 * Front Mic=0x18, ATAPI Mic = 0x19,
15222 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
15223 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
15224 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
15225 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
15226 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
15227 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
15228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
15229 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
15230 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
15236 * generic initialization of ADC, input mixers and output mixers
15238 static struct hda_verb alc861vd_volume_init_verbs[] = {
15240 * Unmute ADC0 and set the default input to mic-in
15242 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15243 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15245 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
15246 * the analog-loopback mixer widget
15248 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
15249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15250 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15251 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15252 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15253 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15255 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
15256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
15262 * Set up output mixers (0x02 - 0x05)
15264 /* set vol=0 to output mixers */
15265 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15266 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15267 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15268 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15270 /* set up input amps for analog loopback */
15271 /* Amp Indices: DAC = 0, mixer = 1 */
15272 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15273 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15274 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15275 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15276 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15277 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15278 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15285 * 3-stack pin configuration:
15286 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
15288 static struct hda_verb alc861vd_3stack_init_verbs[] = {
15290 * Set pin mode and muting
15292 /* set front pin widgets 0x14 for output */
15293 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15294 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15295 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15297 /* Mic (rear) pin: input vref at 80% */
15298 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15299 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15300 /* Front Mic pin: input vref at 80% */
15301 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15302 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15303 /* Line In pin: input */
15304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15306 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15307 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15308 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15309 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15310 /* CD pin widget for input */
15311 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15317 * 6-stack pin configuration:
15319 static struct hda_verb alc861vd_6stack_init_verbs[] = {
15321 * Set pin mode and muting
15323 /* set front pin widgets 0x14 for output */
15324 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15325 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15326 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
15328 /* Rear Pin: output 1 (0x0d) */
15329 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15330 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15331 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
15332 /* CLFE Pin: output 2 (0x0e) */
15333 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15334 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15335 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
15336 /* Side Pin: output 3 (0x0f) */
15337 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15338 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15339 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
15341 /* Mic (rear) pin: input vref at 80% */
15342 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15343 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15344 /* Front Mic pin: input vref at 80% */
15345 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
15346 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15347 /* Line In pin: input */
15348 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15349 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15350 /* Line-2 In: Headphone output (output 0 - 0x0c) */
15351 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
15352 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15353 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
15354 /* CD pin widget for input */
15355 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15360 static struct hda_verb alc861vd_eapd_verbs[] = {
15361 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15365 static struct hda_verb alc660vd_eapd_verbs[] = {
15366 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
15367 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
15371 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
15372 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15373 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
15375 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
15380 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
15382 unsigned int present;
15383 unsigned char bits;
15385 present = snd_hda_jack_detect(codec, 0x18);
15386 bits = present ? HDA_AMP_MUTE : 0;
15388 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
15389 HDA_AMP_MUTE, bits);
15392 static void alc861vd_lenovo_setup(struct hda_codec *codec)
15394 struct alc_spec *spec = codec->spec;
15395 spec->autocfg.hp_pins[0] = 0x1b;
15396 spec->autocfg.speaker_pins[0] = 0x14;
15399 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
15401 alc_automute_amp(codec);
15402 alc861vd_lenovo_mic_automute(codec);
15405 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
15408 switch (res >> 26) {
15409 case ALC880_MIC_EVENT:
15410 alc861vd_lenovo_mic_automute(codec);
15413 alc_automute_amp_unsol_event(codec, res);
15418 static struct hda_verb alc861vd_dallas_verbs[] = {
15419 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15420 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15421 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15422 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
15424 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15425 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15426 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15427 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15428 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15429 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15430 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15431 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15433 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15434 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15435 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15436 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15438 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15439 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
15440 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15442 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15444 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
15445 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15447 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15448 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15449 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
15451 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15452 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15453 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15454 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
15456 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15457 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
15458 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15463 /* toggle speaker-output according to the hp-jack state */
15464 static void alc861vd_dallas_setup(struct hda_codec *codec)
15466 struct alc_spec *spec = codec->spec;
15468 spec->autocfg.hp_pins[0] = 0x15;
15469 spec->autocfg.speaker_pins[0] = 0x14;
15472 #ifdef CONFIG_SND_HDA_POWER_SAVE
15473 #define alc861vd_loopbacks alc880_loopbacks
15476 /* pcm configuration: identical with ALC880 */
15477 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
15478 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
15479 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
15480 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
15483 * configuration and preset
15485 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
15486 [ALC660VD_3ST] = "3stack-660",
15487 [ALC660VD_3ST_DIG] = "3stack-660-digout",
15488 [ALC660VD_ASUS_V1S] = "asus-v1s",
15489 [ALC861VD_3ST] = "3stack",
15490 [ALC861VD_3ST_DIG] = "3stack-digout",
15491 [ALC861VD_6ST_DIG] = "6stack-digout",
15492 [ALC861VD_LENOVO] = "lenovo",
15493 [ALC861VD_DALLAS] = "dallas",
15494 [ALC861VD_HP] = "hp",
15495 [ALC861VD_AUTO] = "auto",
15498 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15499 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15500 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15501 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15502 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15503 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15504 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15505 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
15506 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
15507 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
15508 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
15509 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
15510 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
15511 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
15512 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
15513 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
15517 static struct alc_config_preset alc861vd_presets[] = {
15519 .mixers = { alc861vd_3st_mixer },
15520 .init_verbs = { alc861vd_volume_init_verbs,
15521 alc861vd_3stack_init_verbs },
15522 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15523 .dac_nids = alc660vd_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 [ALC660VD_3ST_DIG] = {
15529 .mixers = { alc861vd_3st_mixer },
15530 .init_verbs = { alc861vd_volume_init_verbs,
15531 alc861vd_3stack_init_verbs },
15532 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15533 .dac_nids = alc660vd_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,
15540 .mixers = { alc861vd_3st_mixer },
15541 .init_verbs = { alc861vd_volume_init_verbs,
15542 alc861vd_3stack_init_verbs },
15543 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15544 .dac_nids = alc861vd_dac_nids,
15545 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15546 .channel_mode = alc861vd_3stack_2ch_modes,
15547 .input_mux = &alc861vd_capture_source,
15549 [ALC861VD_3ST_DIG] = {
15550 .mixers = { alc861vd_3st_mixer },
15551 .init_verbs = { alc861vd_volume_init_verbs,
15552 alc861vd_3stack_init_verbs },
15553 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15554 .dac_nids = alc861vd_dac_nids,
15555 .dig_out_nid = ALC861VD_DIGOUT_NID,
15556 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15557 .channel_mode = alc861vd_3stack_2ch_modes,
15558 .input_mux = &alc861vd_capture_source,
15560 [ALC861VD_6ST_DIG] = {
15561 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
15562 .init_verbs = { alc861vd_volume_init_verbs,
15563 alc861vd_6stack_init_verbs },
15564 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15565 .dac_nids = alc861vd_dac_nids,
15566 .dig_out_nid = ALC861VD_DIGOUT_NID,
15567 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
15568 .channel_mode = alc861vd_6stack_modes,
15569 .input_mux = &alc861vd_capture_source,
15571 [ALC861VD_LENOVO] = {
15572 .mixers = { alc861vd_lenovo_mixer },
15573 .init_verbs = { alc861vd_volume_init_verbs,
15574 alc861vd_3stack_init_verbs,
15575 alc861vd_eapd_verbs,
15576 alc861vd_lenovo_unsol_verbs },
15577 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15578 .dac_nids = alc660vd_dac_nids,
15579 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15580 .channel_mode = alc861vd_3stack_2ch_modes,
15581 .input_mux = &alc861vd_capture_source,
15582 .unsol_event = alc861vd_lenovo_unsol_event,
15583 .setup = alc861vd_lenovo_setup,
15584 .init_hook = alc861vd_lenovo_init_hook,
15586 [ALC861VD_DALLAS] = {
15587 .mixers = { alc861vd_dallas_mixer },
15588 .init_verbs = { alc861vd_dallas_verbs },
15589 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15590 .dac_nids = alc861vd_dac_nids,
15591 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15592 .channel_mode = alc861vd_3stack_2ch_modes,
15593 .input_mux = &alc861vd_dallas_capture_source,
15594 .unsol_event = alc_automute_amp_unsol_event,
15595 .setup = alc861vd_dallas_setup,
15596 .init_hook = alc_automute_amp,
15599 .mixers = { alc861vd_hp_mixer },
15600 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
15601 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
15602 .dac_nids = alc861vd_dac_nids,
15603 .dig_out_nid = ALC861VD_DIGOUT_NID,
15604 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15605 .channel_mode = alc861vd_3stack_2ch_modes,
15606 .input_mux = &alc861vd_hp_capture_source,
15607 .unsol_event = alc_automute_amp_unsol_event,
15608 .setup = alc861vd_dallas_setup,
15609 .init_hook = alc_automute_amp,
15611 [ALC660VD_ASUS_V1S] = {
15612 .mixers = { alc861vd_lenovo_mixer },
15613 .init_verbs = { alc861vd_volume_init_verbs,
15614 alc861vd_3stack_init_verbs,
15615 alc861vd_eapd_verbs,
15616 alc861vd_lenovo_unsol_verbs },
15617 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
15618 .dac_nids = alc660vd_dac_nids,
15619 .dig_out_nid = ALC861VD_DIGOUT_NID,
15620 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
15621 .channel_mode = alc861vd_3stack_2ch_modes,
15622 .input_mux = &alc861vd_capture_source,
15623 .unsol_event = alc861vd_lenovo_unsol_event,
15624 .setup = alc861vd_lenovo_setup,
15625 .init_hook = alc861vd_lenovo_init_hook,
15630 * BIOS auto configuration
15632 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15633 const struct auto_pin_cfg *cfg)
15635 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15639 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
15640 hda_nid_t nid, int pin_type, int dac_idx)
15642 alc_set_pin_output(codec, nid, pin_type);
15645 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
15647 struct alc_spec *spec = codec->spec;
15650 for (i = 0; i <= HDA_SIDE; i++) {
15651 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15652 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15654 alc861vd_auto_set_output_and_unmute(codec, nid,
15660 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
15662 struct alc_spec *spec = codec->spec;
15665 pin = spec->autocfg.hp_pins[0];
15666 if (pin) /* connect to front and use dac 0 */
15667 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
15668 pin = spec->autocfg.speaker_pins[0];
15670 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
15673 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
15675 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
15677 struct alc_spec *spec = codec->spec;
15680 for (i = 0; i < AUTO_PIN_LAST; i++) {
15681 hda_nid_t nid = spec->autocfg.input_pins[i];
15682 if (alc_is_input_pin(codec, nid)) {
15683 alc_set_input_pin(codec, nid, i);
15684 if (nid != ALC861VD_PIN_CD_NID &&
15685 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
15686 snd_hda_codec_write(codec, nid, 0,
15687 AC_VERB_SET_AMP_GAIN_MUTE,
15693 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
15695 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
15696 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
15698 /* add playback controls from the parsed DAC table */
15699 /* Based on ALC880 version. But ALC861VD has separate,
15700 * different NIDs for mute/unmute switch and volume control */
15701 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
15702 const struct auto_pin_cfg *cfg)
15704 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
15705 hda_nid_t nid_v, nid_s;
15708 for (i = 0; i < cfg->line_outs; i++) {
15709 if (!spec->multiout.dac_nids[i])
15711 nid_v = alc861vd_idx_to_mixer_vol(
15713 spec->multiout.dac_nids[i]));
15714 nid_s = alc861vd_idx_to_mixer_switch(
15716 spec->multiout.dac_nids[i]));
15720 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15722 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
15726 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
15728 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
15732 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15734 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
15738 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
15740 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
15746 if (cfg->line_outs == 1 &&
15747 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
15754 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15755 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
15759 if (cfg->line_outs == 1 &&
15760 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15762 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15763 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
15772 /* add playback controls for speaker and HP outputs */
15773 /* Based on ALC880 version. But ALC861VD has separate,
15774 * different NIDs for mute/unmute switch and volume control */
15775 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
15776 hda_nid_t pin, const char *pfx)
15778 hda_nid_t nid_v, nid_s;
15784 if (alc880_is_fixed_pin(pin)) {
15785 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
15786 /* specify the DAC as the extra output */
15787 if (!spec->multiout.hp_nid)
15788 spec->multiout.hp_nid = nid_v;
15790 spec->multiout.extra_out_nid[0] = nid_v;
15791 /* control HP volume/switch on the output mixer amp */
15792 nid_v = alc861vd_idx_to_mixer_vol(
15793 alc880_fixed_pin_idx(pin));
15794 nid_s = alc861vd_idx_to_mixer_switch(
15795 alc880_fixed_pin_idx(pin));
15797 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
15798 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
15801 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
15802 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
15805 } else if (alc880_is_multi_pin(pin)) {
15806 /* set manual connection */
15807 /* we have only a switch on HP-out PIN */
15808 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
15809 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
15816 /* parse the BIOS configuration and set up the alc_spec
15817 * return 1 if successful, 0 if the proper config is not found,
15818 * or a negative error code
15819 * Based on ALC880 version - had to change it to override
15820 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
15821 static int alc861vd_parse_auto_config(struct hda_codec *codec)
15823 struct alc_spec *spec = codec->spec;
15825 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
15827 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15831 if (!spec->autocfg.line_outs)
15832 return 0; /* can't find valid BIOS pin config */
15834 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
15837 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
15840 err = alc861vd_auto_create_extra_out(spec,
15841 spec->autocfg.speaker_pins[0],
15845 err = alc861vd_auto_create_extra_out(spec,
15846 spec->autocfg.hp_pins[0],
15850 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
15854 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15856 if (spec->autocfg.dig_outs)
15857 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
15859 if (spec->kctls.list)
15860 add_mixer(spec, spec->kctls.list);
15862 add_verb(spec, alc861vd_volume_init_verbs);
15864 spec->num_mux_defs = 1;
15865 spec->input_mux = &spec->private_imux[0];
15867 err = alc_auto_add_mic_boost(codec);
15871 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
15876 /* additional initialization for auto-configuration model */
15877 static void alc861vd_auto_init(struct hda_codec *codec)
15879 struct alc_spec *spec = codec->spec;
15880 alc861vd_auto_init_multi_out(codec);
15881 alc861vd_auto_init_hp_out(codec);
15882 alc861vd_auto_init_analog_input(codec);
15883 alc861vd_auto_init_input_src(codec);
15884 if (spec->unsol_event)
15885 alc_inithook(codec);
15889 ALC660VD_FIX_ASUS_GPIO1
15893 static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15894 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15895 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15896 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15900 static const struct alc_fixup alc861vd_fixups[] = {
15901 [ALC660VD_FIX_ASUS_GPIO1] = {
15902 .verbs = alc660vd_fix_asus_gpio1_verbs,
15906 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15907 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15911 static int patch_alc861vd(struct hda_codec *codec)
15913 struct alc_spec *spec;
15914 int err, board_config;
15916 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15920 codec->spec = spec;
15922 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
15926 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
15927 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15929 board_config = ALC861VD_AUTO;
15932 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15934 if (board_config == ALC861VD_AUTO) {
15935 /* automatic parse from the BIOS config */
15936 err = alc861vd_parse_auto_config(codec);
15942 "hda_codec: Cannot set up configuration "
15943 "from BIOS. Using base mode...\n");
15944 board_config = ALC861VD_3ST;
15948 err = snd_hda_attach_beep_device(codec, 0x23);
15954 if (board_config != ALC861VD_AUTO)
15955 setup_preset(codec, &alc861vd_presets[board_config]);
15957 if (codec->vendor_id == 0x10ec0660) {
15958 /* always turn on EAPD */
15959 add_verb(spec, alc660vd_eapd_verbs);
15962 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
15963 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
15965 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
15966 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
15968 if (!spec->adc_nids) {
15969 spec->adc_nids = alc861vd_adc_nids;
15970 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
15972 if (!spec->capsrc_nids)
15973 spec->capsrc_nids = alc861vd_capsrc_nids;
15975 set_capture_mixer(codec);
15976 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
15978 spec->vmaster_nid = 0x02;
15980 codec->patch_ops = alc_patch_ops;
15982 if (board_config == ALC861VD_AUTO)
15983 spec->init_hook = alc861vd_auto_init;
15984 #ifdef CONFIG_SND_HDA_POWER_SAVE
15985 if (!spec->loopback.amplist)
15986 spec->loopback.amplist = alc861vd_loopbacks;
15995 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
15996 * configuration. Each pin widget can choose any input DACs and a mixer.
15997 * Each ADC is connected from a mixer of all inputs. This makes possible
15998 * 6-channel independent captures.
16000 * In addition, an independent DAC for the multi-playback (not used in this
16003 #define ALC662_DIGOUT_NID 0x06
16004 #define ALC662_DIGIN_NID 0x0a
16006 static hda_nid_t alc662_dac_nids[4] = {
16007 /* front, rear, clfe, rear_surr */
16011 static hda_nid_t alc272_dac_nids[2] = {
16015 static hda_nid_t alc662_adc_nids[2] = {
16020 static hda_nid_t alc272_adc_nids[1] = {
16025 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
16026 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
16030 /* FIXME: should be a matrix-type input source selection */
16031 static struct hda_input_mux alc662_capture_source = {
16035 { "Front Mic", 0x1 },
16041 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
16049 static struct hda_input_mux alc663_capture_source = {
16053 { "Front Mic", 0x1 },
16058 #if 0 /* set to 1 for testing other input sources below */
16059 static struct hda_input_mux alc272_nc10_capture_source = {
16062 { "Autoselect Mic", 0x0 },
16063 { "Internal Mic", 0x1 },
16064 { "In-0x02", 0x2 },
16065 { "In-0x03", 0x3 },
16066 { "In-0x04", 0x4 },
16067 { "In-0x05", 0x5 },
16068 { "In-0x06", 0x6 },
16069 { "In-0x07", 0x7 },
16070 { "In-0x08", 0x8 },
16071 { "In-0x09", 0x9 },
16072 { "In-0x0a", 0x0a },
16073 { "In-0x0b", 0x0b },
16074 { "In-0x0c", 0x0c },
16075 { "In-0x0d", 0x0d },
16076 { "In-0x0e", 0x0e },
16077 { "In-0x0f", 0x0f },
16085 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
16092 static struct hda_verb alc662_3ST_ch2_init[] = {
16093 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
16094 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16095 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
16096 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
16103 static struct hda_verb alc662_3ST_ch6_init[] = {
16104 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16105 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16106 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
16107 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16108 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
16109 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
16113 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
16114 { 2, alc662_3ST_ch2_init },
16115 { 6, alc662_3ST_ch6_init },
16121 static struct hda_verb alc662_sixstack_ch6_init[] = {
16122 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16123 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16124 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16131 static struct hda_verb alc662_sixstack_ch8_init[] = {
16132 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16133 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16134 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16138 static struct hda_channel_mode alc662_5stack_modes[2] = {
16139 { 2, alc662_sixstack_ch6_init },
16140 { 6, alc662_sixstack_ch8_init },
16143 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16144 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16147 static struct snd_kcontrol_new alc662_base_mixer[] = {
16148 /* output mixer control */
16149 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
16150 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16151 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
16152 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16153 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16154 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16155 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16156 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16157 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16159 /*Input mixer control */
16160 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
16161 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
16162 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
16163 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
16164 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
16165 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
16166 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
16167 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
16171 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
16172 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16173 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16174 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16175 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16176 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16177 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16178 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16179 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16180 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16181 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16182 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16186 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
16187 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16188 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
16189 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16190 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
16191 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16192 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16193 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
16194 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
16195 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16196 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16197 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16198 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16199 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16200 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16201 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16202 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16203 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16207 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
16208 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16209 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
16210 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16211 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
16212 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16213 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16214 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16216 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16220 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
16221 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16222 ALC262_HIPPO_MASTER_SWITCH,
16224 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
16225 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16226 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16228 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
16229 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16230 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16234 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
16235 ALC262_HIPPO_MASTER_SWITCH,
16236 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16238 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
16239 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
16240 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
16241 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16242 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16243 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16244 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16248 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
16249 .ops = &snd_hda_bind_vol,
16251 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16252 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
16257 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
16258 .ops = &snd_hda_bind_sw,
16260 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16261 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16266 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
16267 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16268 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
16269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16274 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
16275 .ops = &snd_hda_bind_sw,
16277 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16278 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16279 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16284 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
16285 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16286 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
16287 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16288 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16289 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16290 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16295 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
16296 .ops = &snd_hda_bind_sw,
16298 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16299 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16300 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16305 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
16306 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16307 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
16308 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16309 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16310 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16311 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16315 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
16316 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16317 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16318 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16319 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16320 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16321 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16322 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16326 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
16327 .ops = &snd_hda_bind_vol,
16329 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
16330 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
16335 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
16336 .ops = &snd_hda_bind_sw,
16338 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16339 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
16344 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
16345 HDA_BIND_VOL("Master Playback Volume",
16346 &alc663_asus_two_bind_master_vol),
16347 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16348 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16349 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16350 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16351 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16355 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
16356 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
16357 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
16358 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16359 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16360 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16361 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16365 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
16366 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16367 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16368 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16369 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16370 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16372 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16373 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16374 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16375 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16379 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
16380 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16381 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16382 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16386 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16387 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16388 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16389 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16393 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
16394 .ops = &snd_hda_bind_sw,
16396 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16397 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
16398 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16399 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
16400 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
16405 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
16406 .ops = &snd_hda_bind_sw,
16408 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
16409 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
16414 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
16415 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16416 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16417 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16418 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16419 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16420 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16421 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16427 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
16428 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
16429 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
16430 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
16431 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
16432 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
16433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16439 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
16441 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16442 .name = "Channel Mode",
16443 .info = alc_ch_mode_info,
16444 .get = alc_ch_mode_get,
16445 .put = alc_ch_mode_put,
16450 static struct hda_verb alc662_init_verbs[] = {
16451 /* ADC: mute amp left and right */
16452 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16453 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16454 /* Front mixer: unmute input/output amp left and right (volume = 0) */
16456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16460 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16465 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16466 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16469 /* Front Pin: output 0 (0x0c) */
16470 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16471 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16473 /* Rear Pin: output 1 (0x0d) */
16474 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16475 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16477 /* CLFE Pin: output 2 (0x0e) */
16478 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16479 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16481 /* Mic (rear) pin: input vref at 80% */
16482 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16483 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16484 /* Front Mic pin: input vref at 80% */
16485 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16486 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16487 /* Line In pin: input */
16488 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16489 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16490 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16491 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16492 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16493 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16494 /* CD pin widget for input */
16495 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16497 /* FIXME: use matrix-type input source selection */
16498 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16500 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16503 /* always trun on EAPD */
16504 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16505 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16510 static struct hda_verb alc662_sue_init_verbs[] = {
16511 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16512 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16516 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
16517 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16518 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16522 /* Set Unsolicited Event*/
16523 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
16524 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16525 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16530 * generic initialization of ADC, input mixers and output mixers
16532 static struct hda_verb alc662_auto_init_verbs[] = {
16534 * Unmute ADC and set the default input to mic-in
16536 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16537 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16539 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
16541 * Note: PASD motherboards uses the Line In 2 as the input for front
16542 * panel mic (mic 2)
16544 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16545 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16546 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16547 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16548 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16549 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16552 * Set up output mixers (0x0c - 0x0f)
16554 /* set vol=0 to output mixers */
16555 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16556 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16557 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16559 /* set up input amps for analog loopback */
16560 /* Amp Indices: DAC = 0, mixer = 1 */
16561 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16562 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16563 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16564 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16565 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16566 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16569 /* FIXME: use matrix-type input source selection */
16570 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
16572 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16573 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16577 /* additional verbs for ALC663 */
16578 static struct hda_verb alc663_auto_init_verbs[] = {
16579 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16580 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16584 static struct hda_verb alc663_m51va_init_verbs[] = {
16585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16587 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16588 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16589 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16590 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16591 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16592 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16593 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16597 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
16598 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16599 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16600 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16601 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16602 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16603 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16604 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16608 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
16609 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16610 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16611 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16612 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16613 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16614 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16615 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16616 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16620 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
16621 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16622 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16623 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16624 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16625 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16626 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16627 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16631 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
16632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16633 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16634 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16635 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16636 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16638 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
16639 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16640 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16641 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16642 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16643 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16647 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
16648 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16649 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16650 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16651 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16652 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16653 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16654 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16655 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16656 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16657 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16658 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16659 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16663 static struct hda_verb alc663_g71v_init_verbs[] = {
16664 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16665 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
16666 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
16668 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16669 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16670 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16672 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
16673 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
16674 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
16678 static struct hda_verb alc663_g50v_init_verbs[] = {
16679 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16680 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16681 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
16683 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16684 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16688 static struct hda_verb alc662_ecs_init_verbs[] = {
16689 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
16690 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16691 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16692 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16696 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
16697 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16698 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16699 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16700 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16701 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16702 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16703 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16706 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16707 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16711 static struct hda_verb alc272_dell_init_verbs[] = {
16712 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16713 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16714 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16715 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16716 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16717 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16718 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16719 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16720 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16721 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16722 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16726 static struct hda_verb alc663_mode7_init_verbs[] = {
16727 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16728 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16729 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16730 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16731 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16732 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16733 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
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 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16740 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16741 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16745 static struct hda_verb alc663_mode8_init_verbs[] = {
16746 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16747 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16748 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16749 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16750 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16751 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16752 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16753 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16754 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16755 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16756 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
16757 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16758 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
16759 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16760 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16761 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16765 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
16766 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
16767 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
16771 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
16772 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
16773 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
16777 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
16779 unsigned int present;
16780 unsigned char bits;
16782 present = snd_hda_jack_detect(codec, 0x14);
16783 bits = present ? HDA_AMP_MUTE : 0;
16785 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16786 HDA_AMP_MUTE, bits);
16789 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
16791 unsigned int present;
16792 unsigned char bits;
16794 present = snd_hda_jack_detect(codec, 0x1b);
16795 bits = present ? HDA_AMP_MUTE : 0;
16797 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
16798 HDA_AMP_MUTE, bits);
16799 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
16800 HDA_AMP_MUTE, bits);
16803 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
16806 if ((res >> 26) == ALC880_HP_EVENT)
16807 alc662_lenovo_101e_all_automute(codec);
16808 if ((res >> 26) == ALC880_FRONT_EVENT)
16809 alc662_lenovo_101e_ispeaker_automute(codec);
16812 /* unsolicited event for HP jack sensing */
16813 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
16816 if ((res >> 26) == ALC880_MIC_EVENT)
16817 alc_mic_automute(codec);
16819 alc262_hippo_unsol_event(codec, res);
16822 static void alc662_eeepc_setup(struct hda_codec *codec)
16824 struct alc_spec *spec = codec->spec;
16826 alc262_hippo1_setup(codec);
16827 spec->ext_mic.pin = 0x18;
16828 spec->ext_mic.mux_idx = 0;
16829 spec->int_mic.pin = 0x19;
16830 spec->int_mic.mux_idx = 1;
16831 spec->auto_mic = 1;
16834 static void alc662_eeepc_inithook(struct hda_codec *codec)
16836 alc262_hippo_automute(codec);
16837 alc_mic_automute(codec);
16840 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
16842 struct alc_spec *spec = codec->spec;
16844 spec->autocfg.hp_pins[0] = 0x14;
16845 spec->autocfg.speaker_pins[0] = 0x1b;
16848 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
16850 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
16852 unsigned int present;
16853 unsigned char bits;
16855 present = snd_hda_jack_detect(codec, 0x21);
16856 bits = present ? HDA_AMP_MUTE : 0;
16857 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16858 AMP_IN_MUTE(0), bits);
16859 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16860 AMP_IN_MUTE(0), bits);
16863 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
16865 unsigned int present;
16866 unsigned char bits;
16868 present = snd_hda_jack_detect(codec, 0x21);
16869 bits = present ? HDA_AMP_MUTE : 0;
16870 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16871 AMP_IN_MUTE(0), bits);
16872 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16873 AMP_IN_MUTE(0), bits);
16874 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16875 AMP_IN_MUTE(0), bits);
16876 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16877 AMP_IN_MUTE(0), bits);
16880 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
16882 unsigned int present;
16883 unsigned char bits;
16885 present = snd_hda_jack_detect(codec, 0x15);
16886 bits = present ? HDA_AMP_MUTE : 0;
16887 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16888 AMP_IN_MUTE(0), bits);
16889 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16890 AMP_IN_MUTE(0), bits);
16891 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
16892 AMP_IN_MUTE(0), bits);
16893 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
16894 AMP_IN_MUTE(0), bits);
16897 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
16899 unsigned int present;
16900 unsigned char bits;
16902 present = snd_hda_jack_detect(codec, 0x1b);
16903 bits = present ? 0 : PIN_OUT;
16904 snd_hda_codec_write(codec, 0x14, 0,
16905 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
16908 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
16910 unsigned int present1, present2;
16912 present1 = snd_hda_jack_detect(codec, 0x21);
16913 present2 = snd_hda_jack_detect(codec, 0x15);
16915 if (present1 || present2) {
16916 snd_hda_codec_write_cache(codec, 0x14, 0,
16917 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16919 snd_hda_codec_write_cache(codec, 0x14, 0,
16920 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16924 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
16926 unsigned int present1, present2;
16928 present1 = snd_hda_jack_detect(codec, 0x1b);
16929 present2 = snd_hda_jack_detect(codec, 0x15);
16931 if (present1 || present2) {
16932 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16933 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16934 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16935 AMP_IN_MUTE(0), AMP_IN_MUTE(0));
16937 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
16938 AMP_IN_MUTE(0), 0);
16939 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
16940 AMP_IN_MUTE(0), 0);
16944 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
16946 unsigned int present1, present2;
16948 present1 = snd_hda_codec_read(codec, 0x1b, 0,
16949 AC_VERB_GET_PIN_SENSE, 0)
16950 & AC_PINSENSE_PRESENCE;
16951 present2 = snd_hda_codec_read(codec, 0x21, 0,
16952 AC_VERB_GET_PIN_SENSE, 0)
16953 & AC_PINSENSE_PRESENCE;
16955 if (present1 || present2) {
16956 snd_hda_codec_write_cache(codec, 0x14, 0,
16957 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16958 snd_hda_codec_write_cache(codec, 0x17, 0,
16959 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16961 snd_hda_codec_write_cache(codec, 0x14, 0,
16962 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16963 snd_hda_codec_write_cache(codec, 0x17, 0,
16964 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16968 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
16970 unsigned int present1, present2;
16972 present1 = snd_hda_codec_read(codec, 0x21, 0,
16973 AC_VERB_GET_PIN_SENSE, 0)
16974 & AC_PINSENSE_PRESENCE;
16975 present2 = snd_hda_codec_read(codec, 0x15, 0,
16976 AC_VERB_GET_PIN_SENSE, 0)
16977 & AC_PINSENSE_PRESENCE;
16979 if (present1 || present2) {
16980 snd_hda_codec_write_cache(codec, 0x14, 0,
16981 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16982 snd_hda_codec_write_cache(codec, 0x17, 0,
16983 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
16985 snd_hda_codec_write_cache(codec, 0x14, 0,
16986 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16987 snd_hda_codec_write_cache(codec, 0x17, 0,
16988 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
16992 static void alc663_m51va_unsol_event(struct hda_codec *codec,
16995 switch (res >> 26) {
16996 case ALC880_HP_EVENT:
16997 alc663_m51va_speaker_automute(codec);
16999 case ALC880_MIC_EVENT:
17000 alc_mic_automute(codec);
17005 static void alc663_m51va_setup(struct hda_codec *codec)
17007 struct alc_spec *spec = codec->spec;
17008 spec->ext_mic.pin = 0x18;
17009 spec->ext_mic.mux_idx = 0;
17010 spec->int_mic.pin = 0x12;
17011 spec->int_mic.mux_idx = 9;
17012 spec->auto_mic = 1;
17015 static void alc663_m51va_inithook(struct hda_codec *codec)
17017 alc663_m51va_speaker_automute(codec);
17018 alc_mic_automute(codec);
17021 /* ***************** Mode1 ******************************/
17022 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
17024 static void alc663_mode1_setup(struct hda_codec *codec)
17026 struct alc_spec *spec = codec->spec;
17027 spec->ext_mic.pin = 0x18;
17028 spec->ext_mic.mux_idx = 0;
17029 spec->int_mic.pin = 0x19;
17030 spec->int_mic.mux_idx = 1;
17031 spec->auto_mic = 1;
17034 #define alc663_mode1_inithook alc663_m51va_inithook
17036 /* ***************** Mode2 ******************************/
17037 static void alc662_mode2_unsol_event(struct hda_codec *codec,
17040 switch (res >> 26) {
17041 case ALC880_HP_EVENT:
17042 alc662_f5z_speaker_automute(codec);
17044 case ALC880_MIC_EVENT:
17045 alc_mic_automute(codec);
17050 #define alc662_mode2_setup alc663_mode1_setup
17052 static void alc662_mode2_inithook(struct hda_codec *codec)
17054 alc662_f5z_speaker_automute(codec);
17055 alc_mic_automute(codec);
17057 /* ***************** Mode3 ******************************/
17058 static void alc663_mode3_unsol_event(struct hda_codec *codec,
17061 switch (res >> 26) {
17062 case ALC880_HP_EVENT:
17063 alc663_two_hp_m1_speaker_automute(codec);
17065 case ALC880_MIC_EVENT:
17066 alc_mic_automute(codec);
17071 #define alc663_mode3_setup alc663_mode1_setup
17073 static void alc663_mode3_inithook(struct hda_codec *codec)
17075 alc663_two_hp_m1_speaker_automute(codec);
17076 alc_mic_automute(codec);
17078 /* ***************** Mode4 ******************************/
17079 static void alc663_mode4_unsol_event(struct hda_codec *codec,
17082 switch (res >> 26) {
17083 case ALC880_HP_EVENT:
17084 alc663_21jd_two_speaker_automute(codec);
17086 case ALC880_MIC_EVENT:
17087 alc_mic_automute(codec);
17092 #define alc663_mode4_setup alc663_mode1_setup
17094 static void alc663_mode4_inithook(struct hda_codec *codec)
17096 alc663_21jd_two_speaker_automute(codec);
17097 alc_mic_automute(codec);
17099 /* ***************** Mode5 ******************************/
17100 static void alc663_mode5_unsol_event(struct hda_codec *codec,
17103 switch (res >> 26) {
17104 case ALC880_HP_EVENT:
17105 alc663_15jd_two_speaker_automute(codec);
17107 case ALC880_MIC_EVENT:
17108 alc_mic_automute(codec);
17113 #define alc663_mode5_setup alc663_mode1_setup
17115 static void alc663_mode5_inithook(struct hda_codec *codec)
17117 alc663_15jd_two_speaker_automute(codec);
17118 alc_mic_automute(codec);
17120 /* ***************** Mode6 ******************************/
17121 static void alc663_mode6_unsol_event(struct hda_codec *codec,
17124 switch (res >> 26) {
17125 case ALC880_HP_EVENT:
17126 alc663_two_hp_m2_speaker_automute(codec);
17128 case ALC880_MIC_EVENT:
17129 alc_mic_automute(codec);
17134 #define alc663_mode6_setup alc663_mode1_setup
17136 static void alc663_mode6_inithook(struct hda_codec *codec)
17138 alc663_two_hp_m2_speaker_automute(codec);
17139 alc_mic_automute(codec);
17142 /* ***************** Mode7 ******************************/
17143 static void alc663_mode7_unsol_event(struct hda_codec *codec,
17146 switch (res >> 26) {
17147 case ALC880_HP_EVENT:
17148 alc663_two_hp_m7_speaker_automute(codec);
17150 case ALC880_MIC_EVENT:
17151 alc_mic_automute(codec);
17156 #define alc663_mode7_setup alc663_mode1_setup
17158 static void alc663_mode7_inithook(struct hda_codec *codec)
17160 alc663_two_hp_m7_speaker_automute(codec);
17161 alc_mic_automute(codec);
17164 /* ***************** Mode8 ******************************/
17165 static void alc663_mode8_unsol_event(struct hda_codec *codec,
17168 switch (res >> 26) {
17169 case ALC880_HP_EVENT:
17170 alc663_two_hp_m8_speaker_automute(codec);
17172 case ALC880_MIC_EVENT:
17173 alc_mic_automute(codec);
17178 #define alc663_mode8_setup alc663_m51va_setup
17180 static void alc663_mode8_inithook(struct hda_codec *codec)
17182 alc663_two_hp_m8_speaker_automute(codec);
17183 alc_mic_automute(codec);
17186 static void alc663_g71v_hp_automute(struct hda_codec *codec)
17188 unsigned int present;
17189 unsigned char bits;
17191 present = snd_hda_jack_detect(codec, 0x21);
17192 bits = present ? HDA_AMP_MUTE : 0;
17193 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
17194 HDA_AMP_MUTE, bits);
17195 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17196 HDA_AMP_MUTE, bits);
17199 static void alc663_g71v_front_automute(struct hda_codec *codec)
17201 unsigned int present;
17202 unsigned char bits;
17204 present = snd_hda_jack_detect(codec, 0x15);
17205 bits = present ? HDA_AMP_MUTE : 0;
17206 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
17207 HDA_AMP_MUTE, bits);
17210 static void alc663_g71v_unsol_event(struct hda_codec *codec,
17213 switch (res >> 26) {
17214 case ALC880_HP_EVENT:
17215 alc663_g71v_hp_automute(codec);
17217 case ALC880_FRONT_EVENT:
17218 alc663_g71v_front_automute(codec);
17220 case ALC880_MIC_EVENT:
17221 alc_mic_automute(codec);
17226 #define alc663_g71v_setup alc663_m51va_setup
17228 static void alc663_g71v_inithook(struct hda_codec *codec)
17230 alc663_g71v_front_automute(codec);
17231 alc663_g71v_hp_automute(codec);
17232 alc_mic_automute(codec);
17235 static void alc663_g50v_unsol_event(struct hda_codec *codec,
17238 switch (res >> 26) {
17239 case ALC880_HP_EVENT:
17240 alc663_m51va_speaker_automute(codec);
17242 case ALC880_MIC_EVENT:
17243 alc_mic_automute(codec);
17248 #define alc663_g50v_setup alc663_m51va_setup
17250 static void alc663_g50v_inithook(struct hda_codec *codec)
17252 alc663_m51va_speaker_automute(codec);
17253 alc_mic_automute(codec);
17256 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
17257 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17258 ALC262_HIPPO_MASTER_SWITCH,
17260 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
17261 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
17262 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
17264 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17265 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17266 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17270 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
17271 /* Master Playback automatically created from Speaker and Headphone */
17272 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17273 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17274 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17275 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17277 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17278 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17279 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
17281 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17282 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17283 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
17287 #ifdef CONFIG_SND_HDA_POWER_SAVE
17288 #define alc662_loopbacks alc880_loopbacks
17292 /* pcm configuration: identical with ALC880 */
17293 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
17294 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
17295 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
17296 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
17299 * configuration and preset
17301 static const char *alc662_models[ALC662_MODEL_LAST] = {
17302 [ALC662_3ST_2ch_DIG] = "3stack-dig",
17303 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
17304 [ALC662_3ST_6ch] = "3stack-6ch",
17305 [ALC662_5ST_DIG] = "6stack-dig",
17306 [ALC662_LENOVO_101E] = "lenovo-101e",
17307 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
17308 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
17309 [ALC662_ECS] = "ecs",
17310 [ALC663_ASUS_M51VA] = "m51va",
17311 [ALC663_ASUS_G71V] = "g71v",
17312 [ALC663_ASUS_H13] = "h13",
17313 [ALC663_ASUS_G50V] = "g50v",
17314 [ALC663_ASUS_MODE1] = "asus-mode1",
17315 [ALC662_ASUS_MODE2] = "asus-mode2",
17316 [ALC663_ASUS_MODE3] = "asus-mode3",
17317 [ALC663_ASUS_MODE4] = "asus-mode4",
17318 [ALC663_ASUS_MODE5] = "asus-mode5",
17319 [ALC663_ASUS_MODE6] = "asus-mode6",
17320 [ALC663_ASUS_MODE7] = "asus-mode7",
17321 [ALC663_ASUS_MODE8] = "asus-mode8",
17322 [ALC272_DELL] = "dell",
17323 [ALC272_DELL_ZM1] = "dell-zm1",
17324 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
17325 [ALC662_AUTO] = "auto",
17328 static struct snd_pci_quirk alc662_cfg_tbl[] = {
17329 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
17330 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
17331 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
17332 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
17333 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
17334 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
17335 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
17336 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
17337 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
17338 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
17339 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
17340 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
17341 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
17342 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
17343 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
17344 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
17345 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
17346 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
17347 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
17348 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
17349 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
17350 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
17351 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
17352 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
17353 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
17354 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
17355 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
17356 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
17357 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
17358 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
17359 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
17360 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
17361 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
17362 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
17363 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
17364 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
17365 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
17366 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
17367 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
17368 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
17369 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
17370 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
17371 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
17372 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
17373 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
17374 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
17375 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
17376 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
17377 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
17378 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
17379 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
17380 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
17381 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
17382 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
17383 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
17384 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
17385 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
17386 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
17387 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
17388 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
17389 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17390 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17391 ALC662_3ST_6ch_DIG),
17392 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17393 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17394 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17395 ALC662_3ST_6ch_DIG),
17396 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
17397 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
17398 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
17399 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
17400 ALC662_3ST_6ch_DIG),
17401 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
17403 SND_PCI_QUIRK(0x8086, 0xd604, "Intel mobo", ALC662_3ST_2ch_DIG),
17407 static struct alc_config_preset alc662_presets[] = {
17408 [ALC662_3ST_2ch_DIG] = {
17409 .mixers = { alc662_3ST_2ch_mixer },
17410 .init_verbs = { alc662_init_verbs },
17411 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17412 .dac_nids = alc662_dac_nids,
17413 .dig_out_nid = ALC662_DIGOUT_NID,
17414 .dig_in_nid = ALC662_DIGIN_NID,
17415 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17416 .channel_mode = alc662_3ST_2ch_modes,
17417 .input_mux = &alc662_capture_source,
17419 [ALC662_3ST_6ch_DIG] = {
17420 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17421 .init_verbs = { alc662_init_verbs },
17422 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17423 .dac_nids = alc662_dac_nids,
17424 .dig_out_nid = ALC662_DIGOUT_NID,
17425 .dig_in_nid = ALC662_DIGIN_NID,
17426 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17427 .channel_mode = alc662_3ST_6ch_modes,
17429 .input_mux = &alc662_capture_source,
17431 [ALC662_3ST_6ch] = {
17432 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
17433 .init_verbs = { alc662_init_verbs },
17434 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17435 .dac_nids = alc662_dac_nids,
17436 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17437 .channel_mode = alc662_3ST_6ch_modes,
17439 .input_mux = &alc662_capture_source,
17441 [ALC662_5ST_DIG] = {
17442 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
17443 .init_verbs = { alc662_init_verbs },
17444 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17445 .dac_nids = alc662_dac_nids,
17446 .dig_out_nid = ALC662_DIGOUT_NID,
17447 .dig_in_nid = ALC662_DIGIN_NID,
17448 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
17449 .channel_mode = alc662_5stack_modes,
17450 .input_mux = &alc662_capture_source,
17452 [ALC662_LENOVO_101E] = {
17453 .mixers = { alc662_lenovo_101e_mixer },
17454 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
17455 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17456 .dac_nids = alc662_dac_nids,
17457 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17458 .channel_mode = alc662_3ST_2ch_modes,
17459 .input_mux = &alc662_lenovo_101e_capture_source,
17460 .unsol_event = alc662_lenovo_101e_unsol_event,
17461 .init_hook = alc662_lenovo_101e_all_automute,
17463 [ALC662_ASUS_EEEPC_P701] = {
17464 .mixers = { alc662_eeepc_p701_mixer },
17465 .init_verbs = { alc662_init_verbs,
17466 alc662_eeepc_sue_init_verbs },
17467 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17468 .dac_nids = alc662_dac_nids,
17469 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17470 .channel_mode = alc662_3ST_2ch_modes,
17471 .unsol_event = alc662_eeepc_unsol_event,
17472 .setup = alc662_eeepc_setup,
17473 .init_hook = alc662_eeepc_inithook,
17475 [ALC662_ASUS_EEEPC_EP20] = {
17476 .mixers = { alc662_eeepc_ep20_mixer,
17477 alc662_chmode_mixer },
17478 .init_verbs = { alc662_init_verbs,
17479 alc662_eeepc_ep20_sue_init_verbs },
17480 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17481 .dac_nids = alc662_dac_nids,
17482 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17483 .channel_mode = alc662_3ST_6ch_modes,
17484 .input_mux = &alc662_lenovo_101e_capture_source,
17485 .unsol_event = alc662_eeepc_unsol_event,
17486 .setup = alc662_eeepc_ep20_setup,
17487 .init_hook = alc662_eeepc_ep20_inithook,
17490 .mixers = { alc662_ecs_mixer },
17491 .init_verbs = { alc662_init_verbs,
17492 alc662_ecs_init_verbs },
17493 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17494 .dac_nids = alc662_dac_nids,
17495 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17496 .channel_mode = alc662_3ST_2ch_modes,
17497 .unsol_event = alc662_eeepc_unsol_event,
17498 .setup = alc662_eeepc_setup,
17499 .init_hook = alc662_eeepc_inithook,
17501 [ALC663_ASUS_M51VA] = {
17502 .mixers = { alc663_m51va_mixer },
17503 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17504 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17505 .dac_nids = alc662_dac_nids,
17506 .dig_out_nid = ALC662_DIGOUT_NID,
17507 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17508 .channel_mode = alc662_3ST_2ch_modes,
17509 .unsol_event = alc663_m51va_unsol_event,
17510 .setup = alc663_m51va_setup,
17511 .init_hook = alc663_m51va_inithook,
17513 [ALC663_ASUS_G71V] = {
17514 .mixers = { alc663_g71v_mixer },
17515 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
17516 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17517 .dac_nids = alc662_dac_nids,
17518 .dig_out_nid = ALC662_DIGOUT_NID,
17519 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17520 .channel_mode = alc662_3ST_2ch_modes,
17521 .unsol_event = alc663_g71v_unsol_event,
17522 .setup = alc663_g71v_setup,
17523 .init_hook = alc663_g71v_inithook,
17525 [ALC663_ASUS_H13] = {
17526 .mixers = { alc663_m51va_mixer },
17527 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
17528 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17529 .dac_nids = alc662_dac_nids,
17530 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17531 .channel_mode = alc662_3ST_2ch_modes,
17532 .unsol_event = alc663_m51va_unsol_event,
17533 .init_hook = alc663_m51va_inithook,
17535 [ALC663_ASUS_G50V] = {
17536 .mixers = { alc663_g50v_mixer },
17537 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
17538 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17539 .dac_nids = alc662_dac_nids,
17540 .dig_out_nid = ALC662_DIGOUT_NID,
17541 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
17542 .channel_mode = alc662_3ST_6ch_modes,
17543 .input_mux = &alc663_capture_source,
17544 .unsol_event = alc663_g50v_unsol_event,
17545 .setup = alc663_g50v_setup,
17546 .init_hook = alc663_g50v_inithook,
17548 [ALC663_ASUS_MODE1] = {
17549 .mixers = { alc663_m51va_mixer },
17550 .cap_mixer = alc662_auto_capture_mixer,
17551 .init_verbs = { alc662_init_verbs,
17552 alc663_21jd_amic_init_verbs },
17553 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17555 .dac_nids = alc662_dac_nids,
17556 .dig_out_nid = ALC662_DIGOUT_NID,
17557 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17558 .channel_mode = alc662_3ST_2ch_modes,
17559 .unsol_event = alc663_mode1_unsol_event,
17560 .setup = alc663_mode1_setup,
17561 .init_hook = alc663_mode1_inithook,
17563 [ALC662_ASUS_MODE2] = {
17564 .mixers = { alc662_1bjd_mixer },
17565 .cap_mixer = alc662_auto_capture_mixer,
17566 .init_verbs = { alc662_init_verbs,
17567 alc662_1bjd_amic_init_verbs },
17568 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17569 .dac_nids = alc662_dac_nids,
17570 .dig_out_nid = ALC662_DIGOUT_NID,
17571 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17572 .channel_mode = alc662_3ST_2ch_modes,
17573 .unsol_event = alc662_mode2_unsol_event,
17574 .setup = alc662_mode2_setup,
17575 .init_hook = alc662_mode2_inithook,
17577 [ALC663_ASUS_MODE3] = {
17578 .mixers = { alc663_two_hp_m1_mixer },
17579 .cap_mixer = alc662_auto_capture_mixer,
17580 .init_verbs = { alc662_init_verbs,
17581 alc663_two_hp_amic_m1_init_verbs },
17582 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17584 .dac_nids = alc662_dac_nids,
17585 .dig_out_nid = ALC662_DIGOUT_NID,
17586 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17587 .channel_mode = alc662_3ST_2ch_modes,
17588 .unsol_event = alc663_mode3_unsol_event,
17589 .setup = alc663_mode3_setup,
17590 .init_hook = alc663_mode3_inithook,
17592 [ALC663_ASUS_MODE4] = {
17593 .mixers = { alc663_asus_21jd_clfe_mixer },
17594 .cap_mixer = alc662_auto_capture_mixer,
17595 .init_verbs = { alc662_init_verbs,
17596 alc663_21jd_amic_init_verbs},
17597 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17599 .dac_nids = alc662_dac_nids,
17600 .dig_out_nid = ALC662_DIGOUT_NID,
17601 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17602 .channel_mode = alc662_3ST_2ch_modes,
17603 .unsol_event = alc663_mode4_unsol_event,
17604 .setup = alc663_mode4_setup,
17605 .init_hook = alc663_mode4_inithook,
17607 [ALC663_ASUS_MODE5] = {
17608 .mixers = { alc663_asus_15jd_clfe_mixer },
17609 .cap_mixer = alc662_auto_capture_mixer,
17610 .init_verbs = { alc662_init_verbs,
17611 alc663_15jd_amic_init_verbs },
17612 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17614 .dac_nids = alc662_dac_nids,
17615 .dig_out_nid = ALC662_DIGOUT_NID,
17616 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17617 .channel_mode = alc662_3ST_2ch_modes,
17618 .unsol_event = alc663_mode5_unsol_event,
17619 .setup = alc663_mode5_setup,
17620 .init_hook = alc663_mode5_inithook,
17622 [ALC663_ASUS_MODE6] = {
17623 .mixers = { alc663_two_hp_m2_mixer },
17624 .cap_mixer = alc662_auto_capture_mixer,
17625 .init_verbs = { alc662_init_verbs,
17626 alc663_two_hp_amic_m2_init_verbs },
17627 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17629 .dac_nids = alc662_dac_nids,
17630 .dig_out_nid = ALC662_DIGOUT_NID,
17631 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17632 .channel_mode = alc662_3ST_2ch_modes,
17633 .unsol_event = alc663_mode6_unsol_event,
17634 .setup = alc663_mode6_setup,
17635 .init_hook = alc663_mode6_inithook,
17637 [ALC663_ASUS_MODE7] = {
17638 .mixers = { alc663_mode7_mixer },
17639 .cap_mixer = alc662_auto_capture_mixer,
17640 .init_verbs = { alc662_init_verbs,
17641 alc663_mode7_init_verbs },
17642 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17644 .dac_nids = alc662_dac_nids,
17645 .dig_out_nid = ALC662_DIGOUT_NID,
17646 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17647 .channel_mode = alc662_3ST_2ch_modes,
17648 .unsol_event = alc663_mode7_unsol_event,
17649 .setup = alc663_mode7_setup,
17650 .init_hook = alc663_mode7_inithook,
17652 [ALC663_ASUS_MODE8] = {
17653 .mixers = { alc663_mode8_mixer },
17654 .cap_mixer = alc662_auto_capture_mixer,
17655 .init_verbs = { alc662_init_verbs,
17656 alc663_mode8_init_verbs },
17657 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
17659 .dac_nids = alc662_dac_nids,
17660 .dig_out_nid = ALC662_DIGOUT_NID,
17661 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17662 .channel_mode = alc662_3ST_2ch_modes,
17663 .unsol_event = alc663_mode8_unsol_event,
17664 .setup = alc663_mode8_setup,
17665 .init_hook = alc663_mode8_inithook,
17668 .mixers = { alc663_m51va_mixer },
17669 .cap_mixer = alc272_auto_capture_mixer,
17670 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
17671 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17672 .dac_nids = alc662_dac_nids,
17673 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17674 .adc_nids = alc272_adc_nids,
17675 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
17676 .capsrc_nids = alc272_capsrc_nids,
17677 .channel_mode = alc662_3ST_2ch_modes,
17678 .unsol_event = alc663_m51va_unsol_event,
17679 .setup = alc663_m51va_setup,
17680 .init_hook = alc663_m51va_inithook,
17682 [ALC272_DELL_ZM1] = {
17683 .mixers = { alc663_m51va_mixer },
17684 .cap_mixer = alc662_auto_capture_mixer,
17685 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
17686 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17687 .dac_nids = alc662_dac_nids,
17688 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17689 .adc_nids = alc662_adc_nids,
17691 .capsrc_nids = alc662_capsrc_nids,
17692 .channel_mode = alc662_3ST_2ch_modes,
17693 .unsol_event = alc663_m51va_unsol_event,
17694 .setup = alc663_m51va_setup,
17695 .init_hook = alc663_m51va_inithook,
17697 [ALC272_SAMSUNG_NC10] = {
17698 .mixers = { alc272_nc10_mixer },
17699 .init_verbs = { alc662_init_verbs,
17700 alc663_21jd_amic_init_verbs },
17701 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
17702 .dac_nids = alc272_dac_nids,
17703 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
17704 .channel_mode = alc662_3ST_2ch_modes,
17705 /*.input_mux = &alc272_nc10_capture_source,*/
17706 .unsol_event = alc663_mode4_unsol_event,
17707 .setup = alc663_mode4_setup,
17708 .init_hook = alc663_mode4_inithook,
17714 * BIOS auto configuration
17717 /* convert from MIX nid to DAC */
17718 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
17722 else if (nid >= 0x0c && nid <= 0x0e)
17723 return nid - 0x0c + 0x02;
17728 /* get MIX nid connected to the given pin targeted to DAC */
17729 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
17735 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
17736 for (i = 0; i < num; i++) {
17737 if (alc662_mix_to_dac(mix[i]) == dac)
17743 /* look for an empty DAC slot */
17744 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
17746 struct alc_spec *spec = codec->spec;
17750 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
17753 for (i = 0; i < num; i++) {
17754 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
17757 for (j = 0; j < spec->multiout.num_dacs; j++)
17758 if (spec->multiout.dac_nids[j] == nid)
17760 if (j >= spec->multiout.num_dacs)
17766 /* fill in the dac_nids table from the parsed pin configuration */
17767 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
17768 const struct auto_pin_cfg *cfg)
17770 struct alc_spec *spec = codec->spec;
17774 spec->multiout.dac_nids = spec->private_dac_nids;
17775 for (i = 0; i < cfg->line_outs; i++) {
17776 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
17779 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
17784 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
17785 hda_nid_t nid, unsigned int chs)
17787 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17788 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
17791 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
17792 hda_nid_t nid, unsigned int chs)
17794 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17795 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
17798 #define alc662_add_stereo_vol(spec, pfx, nid) \
17799 alc662_add_vol_ctl(spec, pfx, nid, 3)
17800 #define alc662_add_stereo_sw(spec, pfx, nid) \
17801 alc662_add_sw_ctl(spec, pfx, nid, 3)
17803 /* add playback controls from the parsed DAC table */
17804 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
17805 const struct auto_pin_cfg *cfg)
17807 struct alc_spec *spec = codec->spec;
17808 static const char *chname[4] = {
17809 "Front", "Surround", NULL /*CLFE*/, "Side"
17811 hda_nid_t nid, mix;
17814 for (i = 0; i < cfg->line_outs; i++) {
17815 nid = spec->multiout.dac_nids[i];
17818 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
17823 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
17826 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
17829 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
17832 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
17837 if (cfg->line_outs == 1 &&
17838 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17845 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17848 if (cfg->line_outs == 1 &&
17849 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17851 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17859 /* add playback controls for speaker and HP outputs */
17860 /* return DAC nid if any new DAC is assigned */
17861 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17864 struct alc_spec *spec = codec->spec;
17865 hda_nid_t nid, mix;
17870 nid = alc662_look_for_dac(codec, pin);
17872 /* the corresponding DAC is already occupied */
17873 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
17874 return 0; /* no way */
17875 /* create a switch only */
17876 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17877 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17880 mix = alc662_dac_to_mix(codec, pin, nid);
17883 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
17886 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
17892 /* create playback/capture controls for input pins */
17893 #define alc662_auto_create_input_ctls \
17894 alc882_auto_create_input_ctls
17896 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17897 hda_nid_t nid, int pin_type,
17903 alc_set_pin_output(codec, nid, pin_type);
17904 /* need the manual connection? */
17905 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
17908 for (i = 0; i < num; i++) {
17909 if (alc662_mix_to_dac(srcs[i]) != dac)
17911 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
17916 static void alc662_auto_init_multi_out(struct hda_codec *codec)
17918 struct alc_spec *spec = codec->spec;
17919 int pin_type = get_pin_type(spec->autocfg.line_out_type);
17922 for (i = 0; i <= HDA_SIDE; i++) {
17923 hda_nid_t nid = spec->autocfg.line_out_pins[i];
17925 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
17926 spec->multiout.dac_nids[i]);
17930 static void alc662_auto_init_hp_out(struct hda_codec *codec)
17932 struct alc_spec *spec = codec->spec;
17935 pin = spec->autocfg.hp_pins[0];
17937 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
17938 spec->multiout.hp_nid);
17939 pin = spec->autocfg.speaker_pins[0];
17941 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
17942 spec->multiout.extra_out_nid[0]);
17945 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
17947 static void alc662_auto_init_analog_input(struct hda_codec *codec)
17949 struct alc_spec *spec = codec->spec;
17952 for (i = 0; i < AUTO_PIN_LAST; i++) {
17953 hda_nid_t nid = spec->autocfg.input_pins[i];
17954 if (alc_is_input_pin(codec, nid)) {
17955 alc_set_input_pin(codec, nid, i);
17956 if (nid != ALC662_PIN_CD_NID &&
17957 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17958 snd_hda_codec_write(codec, nid, 0,
17959 AC_VERB_SET_AMP_GAIN_MUTE,
17965 #define alc662_auto_init_input_src alc882_auto_init_input_src
17967 static int alc662_parse_auto_config(struct hda_codec *codec)
17969 struct alc_spec *spec = codec->spec;
17971 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
17973 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17977 if (!spec->autocfg.line_outs)
17978 return 0; /* can't find valid BIOS pin config */
17980 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
17983 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
17986 err = alc662_auto_create_extra_out(codec,
17987 spec->autocfg.speaker_pins[0],
17992 spec->multiout.extra_out_nid[0] = err;
17993 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
17998 spec->multiout.hp_nid = err;
17999 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
18003 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
18005 if (spec->autocfg.dig_outs)
18006 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
18008 if (spec->kctls.list)
18009 add_mixer(spec, spec->kctls.list);
18011 spec->num_mux_defs = 1;
18012 spec->input_mux = &spec->private_imux[0];
18014 add_verb(spec, alc662_auto_init_verbs);
18015 if (codec->vendor_id == 0x10ec0663)
18016 add_verb(spec, alc663_auto_init_verbs);
18018 err = alc_auto_add_mic_boost(codec);
18022 alc_ssid_check(codec, 0x15, 0x1b, 0x14);
18027 /* additional initialization for auto-configuration model */
18028 static void alc662_auto_init(struct hda_codec *codec)
18030 struct alc_spec *spec = codec->spec;
18031 alc662_auto_init_multi_out(codec);
18032 alc662_auto_init_hp_out(codec);
18033 alc662_auto_init_analog_input(codec);
18034 alc662_auto_init_input_src(codec);
18035 if (spec->unsol_event)
18036 alc_inithook(codec);
18039 static int patch_alc662(struct hda_codec *codec)
18041 struct alc_spec *spec;
18042 int err, board_config;
18044 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
18048 codec->spec = spec;
18050 alc_fix_pll_init(codec, 0x20, 0x04, 15);
18052 if (alc_read_coef_idx(codec, 0)==0x8020){
18053 kfree(codec->chip_name);
18054 codec->chip_name = kstrdup("ALC661", GFP_KERNEL);
18055 if (!codec->chip_name) {
18061 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
18064 if (board_config < 0) {
18065 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
18067 board_config = ALC662_AUTO;
18070 if (board_config == ALC662_AUTO) {
18071 /* automatic parse from the BIOS config */
18072 err = alc662_parse_auto_config(codec);
18078 "hda_codec: Cannot set up configuration "
18079 "from BIOS. Using base mode...\n");
18080 board_config = ALC662_3ST_2ch_DIG;
18084 err = snd_hda_attach_beep_device(codec, 0x1);
18090 if (board_config != ALC662_AUTO)
18091 setup_preset(codec, &alc662_presets[board_config]);
18093 spec->stream_analog_playback = &alc662_pcm_analog_playback;
18094 spec->stream_analog_capture = &alc662_pcm_analog_capture;
18096 spec->stream_digital_playback = &alc662_pcm_digital_playback;
18097 spec->stream_digital_capture = &alc662_pcm_digital_capture;
18099 if (!spec->adc_nids) {
18100 spec->adc_nids = alc662_adc_nids;
18101 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
18103 if (!spec->capsrc_nids)
18104 spec->capsrc_nids = alc662_capsrc_nids;
18106 if (!spec->cap_mixer)
18107 set_capture_mixer(codec);
18108 if (codec->vendor_id == 0x10ec0662)
18109 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
18111 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
18113 spec->vmaster_nid = 0x02;
18115 codec->patch_ops = alc_patch_ops;
18116 if (board_config == ALC662_AUTO)
18117 spec->init_hook = alc662_auto_init;
18118 #ifdef CONFIG_SND_HDA_POWER_SAVE
18119 if (!spec->loopback.amplist)
18120 spec->loopback.amplist = alc662_loopbacks;
18126 static int patch_alc888(struct hda_codec *codec)
18128 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
18129 kfree(codec->chip_name);
18130 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
18131 if (!codec->chip_name) {
18135 return patch_alc662(codec);
18137 return patch_alc882(codec);
18143 static struct hda_codec_preset snd_hda_preset_realtek[] = {
18144 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
18145 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
18146 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
18147 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
18148 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
18149 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
18150 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
18151 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
18152 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
18153 .patch = patch_alc861 },
18154 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
18155 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
18156 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
18157 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
18158 .patch = patch_alc882 },
18159 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
18160 .patch = patch_alc662 },
18161 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
18162 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
18163 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
18164 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
18165 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
18166 .patch = patch_alc882 },
18167 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
18168 .patch = patch_alc882 },
18169 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
18170 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
18171 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
18172 .patch = patch_alc882 },
18173 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
18174 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
18175 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
18176 {} /* terminator */
18179 MODULE_ALIAS("snd-hda-codec-id:10ec*");
18181 MODULE_LICENSE("GPL");
18182 MODULE_DESCRIPTION("Realtek HD-audio codec");
18184 static struct hda_codec_preset_list realtek_list = {
18185 .preset = snd_hda_preset_realtek,
18186 .owner = THIS_MODULE,
18189 static int __init patch_realtek_init(void)
18191 return snd_hda_add_codec_preset(&realtek_list);
18194 static void __exit patch_realtek_exit(void)
18196 snd_hda_delete_codec_preset(&realtek_list);
18199 module_init(patch_realtek_init)
18200 module_exit(patch_realtek_exit)