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 <sound/jack.h>
32 #include "hda_codec.h"
33 #include "hda_local.h"
36 #define ALC880_FRONT_EVENT 0x01
37 #define ALC880_DCVOL_EVENT 0x02
38 #define ALC880_HP_EVENT 0x04
39 #define ALC880_MIC_EVENT 0x08
41 /* ALC880 board config type */
65 #ifdef CONFIG_SND_DEBUG
69 ALC880_MODEL_LAST /* last tag */
83 #ifdef CONFIG_SND_DEBUG
87 ALC260_MODEL_LAST /* last tag */
97 ALC262_HP_BPC_D7000_WL,
98 ALC262_HP_BPC_D7000_WF,
111 ALC262_MODEL_LAST /* last tag */
121 ALC268_ACER_ASPIRE_ONE,
124 #ifdef CONFIG_SND_DEBUG
128 ALC268_MODEL_LAST /* last tag */
143 ALC269_MODEL_LAST /* last tag */
160 /* ALC861-VD models */
182 ALC662_ASUS_EEEPC_P701,
183 ALC662_ASUS_EEEPC_EP20,
225 ALC883_TARGA_2ch_DIG,
226 ALC883_TARGA_8ch_DIG,
229 ALC888_ACER_ASPIRE_4930G,
230 ALC888_ACER_ASPIRE_6530G,
231 ALC888_ACER_ASPIRE_8930G,
232 ALC888_ACER_ASPIRE_7730G,
235 ALC883_MEDION_WIM2160,
237 ALC883_LENOVO_101E_2ch,
238 ALC883_LENOVO_NB0763,
239 ALC888_LENOVO_MS7195_DIG,
247 ALC883_FUJITSU_PI2515,
248 ALC888_FUJITSU_XA3530,
249 ALC883_3ST_6ch_INTEL,
269 #define GPIO_MASK 0x03
271 /* extra amp-initialization sequence types */
280 struct alc_mic_route {
282 unsigned char mux_idx;
283 unsigned char amix_idx;
289 struct snd_jack *jack;
292 #define MUX_IDX_UNDEF ((unsigned char)-1)
294 struct alc_customize_define {
295 unsigned int sku_cfg;
296 unsigned char port_connectivity;
297 unsigned char check_sum;
298 unsigned char customization;
299 unsigned char external_amp;
300 unsigned int enable_pcbeep:1;
301 unsigned int platform_type:1;
303 unsigned int override:1;
304 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
308 /* codec parameterization */
309 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
310 unsigned int num_mixers;
311 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
312 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
314 const struct hda_verb *init_verbs[10]; /* initialization verbs
318 unsigned int num_init_verbs;
320 char stream_name_analog[32]; /* analog PCM stream */
321 struct hda_pcm_stream *stream_analog_playback;
322 struct hda_pcm_stream *stream_analog_capture;
323 struct hda_pcm_stream *stream_analog_alt_playback;
324 struct hda_pcm_stream *stream_analog_alt_capture;
326 char stream_name_digital[32]; /* digital PCM stream */
327 struct hda_pcm_stream *stream_digital_playback;
328 struct hda_pcm_stream *stream_digital_capture;
331 struct hda_multi_out multiout; /* playback set-up
332 * max_channels, dacs must be set
333 * dig_out_nid and hp_nid are optional
335 hda_nid_t alt_dac_nid;
336 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */
340 unsigned int num_adc_nids;
342 hda_nid_t *capsrc_nids;
343 hda_nid_t dig_in_nid; /* digital-in NID; optional */
345 /* capture setup for dynamic dual-adc switch */
346 unsigned int cur_adc_idx;
348 unsigned int cur_adc_stream_tag;
349 unsigned int cur_adc_format;
352 unsigned int num_mux_defs;
353 const struct hda_input_mux *input_mux;
354 unsigned int cur_mux[3];
355 struct alc_mic_route ext_mic;
356 struct alc_mic_route int_mic;
359 const struct hda_channel_mode *channel_mode;
360 int num_channel_mode;
362 int const_channel_count;
363 int ext_channel_count;
365 /* PCM information */
366 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
369 struct snd_array jacks;
371 /* dynamic controls, init_verbs and input_mux */
372 struct auto_pin_cfg autocfg;
373 struct alc_customize_define cdefine;
374 struct snd_array kctls;
375 struct hda_input_mux private_imux[3];
376 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
377 hda_nid_t private_adc_nids[AUTO_CFG_MAX_OUTS];
378 hda_nid_t private_capsrc_nids[AUTO_CFG_MAX_OUTS];
381 void (*init_hook)(struct hda_codec *codec);
382 void (*unsol_event)(struct hda_codec *codec, unsigned int res);
383 #ifdef CONFIG_SND_HDA_POWER_SAVE
384 void (*power_hook)(struct hda_codec *codec);
387 /* for pin sensing */
388 unsigned int sense_updated: 1;
389 unsigned int jack_present: 1;
390 unsigned int master_sw: 1;
391 unsigned int auto_mic:1;
394 unsigned int no_analog :1; /* digital I/O only */
395 unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
397 int codec_variant; /* flag for other variants */
399 /* for virtual master */
400 hda_nid_t vmaster_nid;
401 #ifdef CONFIG_SND_HDA_POWER_SAVE
402 struct hda_loopback_check loopback;
407 unsigned int pll_coef_idx, pll_coef_bit;
411 * configuration template - to be copied to the spec instance
413 struct alc_config_preset {
414 struct snd_kcontrol_new *mixers[5]; /* should be identical size
417 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
418 const struct hda_verb *init_verbs[5];
419 unsigned int num_dacs;
421 hda_nid_t dig_out_nid; /* optional */
422 hda_nid_t hp_nid; /* optional */
423 hda_nid_t *slave_dig_outs;
424 unsigned int num_adc_nids;
426 hda_nid_t *capsrc_nids;
427 hda_nid_t dig_in_nid;
428 unsigned int num_channel_mode;
429 const struct hda_channel_mode *channel_mode;
431 int const_channel_count;
432 unsigned int num_mux_defs;
433 const struct hda_input_mux *input_mux;
434 void (*unsol_event)(struct hda_codec *, unsigned int);
435 void (*setup)(struct hda_codec *);
436 void (*init_hook)(struct hda_codec *);
437 #ifdef CONFIG_SND_HDA_POWER_SAVE
438 struct hda_amp_list *loopbacks;
439 void (*power_hook)(struct hda_codec *codec);
447 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol,
448 struct snd_ctl_elem_info *uinfo)
450 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
451 struct alc_spec *spec = codec->spec;
452 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id);
453 if (mux_idx >= spec->num_mux_defs)
455 if (!spec->input_mux[mux_idx].num_items && mux_idx > 0)
457 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo);
460 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol,
461 struct snd_ctl_elem_value *ucontrol)
463 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
464 struct alc_spec *spec = codec->spec;
465 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
467 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx];
471 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
472 struct snd_ctl_elem_value *ucontrol)
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
475 struct alc_spec *spec = codec->spec;
476 const struct hda_input_mux *imux;
477 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
478 unsigned int mux_idx;
479 hda_nid_t nid = spec->capsrc_nids ?
480 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
483 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
484 imux = &spec->input_mux[mux_idx];
485 if (!imux->num_items && mux_idx > 0)
486 imux = &spec->input_mux[0];
488 type = get_wcaps_type(get_wcaps(codec, nid));
489 if (type == AC_WID_AUD_MIX) {
490 /* Matrix-mixer style (e.g. ALC882) */
491 unsigned int *cur_val = &spec->cur_mux[adc_idx];
494 idx = ucontrol->value.enumerated.item[0];
495 if (idx >= imux->num_items)
496 idx = imux->num_items - 1;
499 for (i = 0; i < imux->num_items; i++) {
500 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
501 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
502 imux->items[i].index,
508 /* MUX style (e.g. ALC880) */
509 return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
510 &spec->cur_mux[adc_idx]);
515 * channel mode setting
517 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol,
518 struct snd_ctl_elem_info *uinfo)
520 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
521 struct alc_spec *spec = codec->spec;
522 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode,
523 spec->num_channel_mode);
526 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol,
527 struct snd_ctl_elem_value *ucontrol)
529 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
530 struct alc_spec *spec = codec->spec;
531 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode,
532 spec->num_channel_mode,
533 spec->ext_channel_count);
536 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
537 struct snd_ctl_elem_value *ucontrol)
539 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
540 struct alc_spec *spec = codec->spec;
541 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
542 spec->num_channel_mode,
543 &spec->ext_channel_count);
544 if (err >= 0 && !spec->const_channel_count) {
545 spec->multiout.max_channels = spec->ext_channel_count;
546 if (spec->need_dac_fix)
547 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
553 * Control the mode of pin widget settings via the mixer. "pc" is used
554 * instead of "%" to avoid consequences of accidently treating the % as
555 * being part of a format specifier. Maximum allowed length of a value is
556 * 63 characters plus NULL terminator.
558 * Note: some retasking pin complexes seem to ignore requests for input
559 * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these
560 * are requested. Therefore order this list so that this behaviour will not
561 * cause problems when mixer clients move through the enum sequentially.
562 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of
565 static char *alc_pin_mode_names[] = {
566 "Mic 50pc bias", "Mic 80pc bias",
567 "Line in", "Line out", "Headphone out",
569 static unsigned char alc_pin_mode_values[] = {
570 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP,
572 /* The control can present all 5 options, or it can limit the options based
573 * in the pin being assumed to be exclusively an input or an output pin. In
574 * addition, "input" pins may or may not process the mic bias option
575 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to
576 * accept requests for bias as of chip versions up to March 2006) and/or
577 * wiring in the computer.
579 #define ALC_PIN_DIR_IN 0x00
580 #define ALC_PIN_DIR_OUT 0x01
581 #define ALC_PIN_DIR_INOUT 0x02
582 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03
583 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04
585 /* Info about the pin modes supported by the different pin direction modes.
586 * For each direction the minimum and maximum values are given.
588 static signed char alc_pin_mode_dir_info[5][2] = {
589 { 0, 2 }, /* ALC_PIN_DIR_IN */
590 { 3, 4 }, /* ALC_PIN_DIR_OUT */
591 { 0, 4 }, /* ALC_PIN_DIR_INOUT */
592 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */
593 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */
595 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0])
596 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1])
597 #define alc_pin_mode_n_items(_dir) \
598 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1)
600 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_info *uinfo)
603 unsigned int item_num = uinfo->value.enumerated.item;
604 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
606 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
608 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir);
610 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir))
611 item_num = alc_pin_mode_min(dir);
612 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]);
616 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol,
617 struct snd_ctl_elem_value *ucontrol)
620 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
621 hda_nid_t nid = kcontrol->private_value & 0xffff;
622 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
623 long *valp = ucontrol->value.integer.value;
624 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
625 AC_VERB_GET_PIN_WIDGET_CONTROL,
628 /* Find enumerated value for current pinctl setting */
629 i = alc_pin_mode_min(dir);
630 while (i <= alc_pin_mode_max(dir) && alc_pin_mode_values[i] != pinctl)
632 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir);
636 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
637 struct snd_ctl_elem_value *ucontrol)
640 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
641 hda_nid_t nid = kcontrol->private_value & 0xffff;
642 unsigned char dir = (kcontrol->private_value >> 16) & 0xff;
643 long val = *ucontrol->value.integer.value;
644 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0,
645 AC_VERB_GET_PIN_WIDGET_CONTROL,
648 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir))
649 val = alc_pin_mode_min(dir);
651 change = pinctl != alc_pin_mode_values[val];
653 /* Set pin mode to that requested */
654 snd_hda_codec_write_cache(codec, nid, 0,
655 AC_VERB_SET_PIN_WIDGET_CONTROL,
656 alc_pin_mode_values[val]);
658 /* Also enable the retasking pin's input/output as required
659 * for the requested pin mode. Enum values of 2 or less are
662 * Dynamically switching the input/output buffers probably
663 * reduces noise slightly (particularly on input) so we'll
664 * do it. However, having both input and output buffers
665 * enabled simultaneously doesn't seem to be problematic if
666 * this turns out to be necessary in the future.
669 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
670 HDA_AMP_MUTE, HDA_AMP_MUTE);
671 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
674 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
675 HDA_AMP_MUTE, HDA_AMP_MUTE);
676 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
683 #define ALC_PIN_MODE(xname, nid, dir) \
684 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
685 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
686 .info = alc_pin_mode_info, \
687 .get = alc_pin_mode_get, \
688 .put = alc_pin_mode_put, \
689 .private_value = nid | (dir<<16) }
691 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged
692 * together using a mask with more than one bit set. This control is
693 * currently used only by the ALC260 test model. At this stage they are not
694 * needed for any "production" models.
696 #ifdef CONFIG_SND_DEBUG
697 #define alc_gpio_data_info snd_ctl_boolean_mono_info
699 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol)
702 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
703 hda_nid_t nid = kcontrol->private_value & 0xffff;
704 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
705 long *valp = ucontrol->value.integer.value;
706 unsigned int val = snd_hda_codec_read(codec, nid, 0,
707 AC_VERB_GET_GPIO_DATA, 0x00);
709 *valp = (val & mask) != 0;
712 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,
713 struct snd_ctl_elem_value *ucontrol)
716 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
717 hda_nid_t nid = kcontrol->private_value & 0xffff;
718 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
719 long val = *ucontrol->value.integer.value;
720 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0,
721 AC_VERB_GET_GPIO_DATA,
724 /* Set/unset the masked GPIO bit(s) as needed */
725 change = (val == 0 ? 0 : mask) != (gpio_data & mask);
730 snd_hda_codec_write_cache(codec, nid, 0,
731 AC_VERB_SET_GPIO_DATA, gpio_data);
735 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \
736 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
737 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
738 .info = alc_gpio_data_info, \
739 .get = alc_gpio_data_get, \
740 .put = alc_gpio_data_put, \
741 .private_value = nid | (mask<<16) }
742 #endif /* CONFIG_SND_DEBUG */
744 /* A switch control to allow the enabling of the digital IO pins on the
745 * ALC260. This is incredibly simplistic; the intention of this control is
746 * to provide something in the test model allowing digital outputs to be
747 * identified if present. If models are found which can utilise these
748 * outputs a more complete mixer control can be devised for those models if
751 #ifdef CONFIG_SND_DEBUG
752 #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info
754 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol,
755 struct snd_ctl_elem_value *ucontrol)
757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
758 hda_nid_t nid = kcontrol->private_value & 0xffff;
759 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
760 long *valp = ucontrol->value.integer.value;
761 unsigned int val = snd_hda_codec_read(codec, nid, 0,
762 AC_VERB_GET_DIGI_CONVERT_1, 0x00);
764 *valp = (val & mask) != 0;
767 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,
768 struct snd_ctl_elem_value *ucontrol)
771 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
772 hda_nid_t nid = kcontrol->private_value & 0xffff;
773 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
774 long val = *ucontrol->value.integer.value;
775 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
776 AC_VERB_GET_DIGI_CONVERT_1,
779 /* Set/unset the masked control bit(s) as needed */
780 change = (val == 0 ? 0 : mask) != (ctrl_data & mask);
785 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1,
790 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \
791 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
792 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
793 .info = alc_spdif_ctrl_info, \
794 .get = alc_spdif_ctrl_get, \
795 .put = alc_spdif_ctrl_put, \
796 .private_value = nid | (mask<<16) }
797 #endif /* CONFIG_SND_DEBUG */
799 /* A switch control to allow the enabling EAPD digital outputs on the ALC26x.
800 * Again, this is only used in the ALC26x test models to help identify when
801 * the EAPD line must be asserted for features to work.
803 #ifdef CONFIG_SND_DEBUG
804 #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info
806 static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol,
807 struct snd_ctl_elem_value *ucontrol)
809 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
810 hda_nid_t nid = kcontrol->private_value & 0xffff;
811 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
812 long *valp = ucontrol->value.integer.value;
813 unsigned int val = snd_hda_codec_read(codec, nid, 0,
814 AC_VERB_GET_EAPD_BTLENABLE, 0x00);
816 *valp = (val & mask) != 0;
820 static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,
821 struct snd_ctl_elem_value *ucontrol)
824 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
825 hda_nid_t nid = kcontrol->private_value & 0xffff;
826 unsigned char mask = (kcontrol->private_value >> 16) & 0xff;
827 long val = *ucontrol->value.integer.value;
828 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0,
829 AC_VERB_GET_EAPD_BTLENABLE,
832 /* Set/unset the masked control bit(s) as needed */
833 change = (!val ? 0 : mask) != (ctrl_data & mask);
838 snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
844 #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \
845 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
846 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
847 .info = alc_eapd_ctrl_info, \
848 .get = alc_eapd_ctrl_get, \
849 .put = alc_eapd_ctrl_put, \
850 .private_value = nid | (mask<<16) }
851 #endif /* CONFIG_SND_DEBUG */
854 * set up the input pin config (depending on the given auto-pin type)
856 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
859 unsigned int val = PIN_IN;
861 if (auto_pin_type == AUTO_PIN_MIC) {
864 oldval = snd_hda_codec_read(codec, nid, 0,
865 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
866 pincap = snd_hda_query_pin_caps(codec, nid);
867 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
868 /* if the default pin setup is vref50, we give it priority */
869 if ((pincap & AC_PINCAP_VREF_80) && oldval != PIN_VREF50)
871 else if (pincap & AC_PINCAP_VREF_50)
873 else if (pincap & AC_PINCAP_VREF_100)
875 else if (pincap & AC_PINCAP_VREF_GRD)
878 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val);
881 static void alc_fixup_autocfg_pin_nums(struct hda_codec *codec)
883 struct alc_spec *spec = codec->spec;
884 struct auto_pin_cfg *cfg = &spec->autocfg;
886 if (!cfg->line_outs) {
887 while (cfg->line_outs < AUTO_CFG_MAX_OUTS &&
888 cfg->line_out_pins[cfg->line_outs])
891 if (!cfg->speaker_outs) {
892 while (cfg->speaker_outs < AUTO_CFG_MAX_OUTS &&
893 cfg->speaker_pins[cfg->speaker_outs])
897 while (cfg->hp_outs < AUTO_CFG_MAX_OUTS &&
898 cfg->hp_pins[cfg->hp_outs])
905 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix)
907 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
909 spec->mixers[spec->num_mixers++] = mix;
912 static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)
914 if (snd_BUG_ON(spec->num_init_verbs >= ARRAY_SIZE(spec->init_verbs)))
916 spec->init_verbs[spec->num_init_verbs++] = verb;
920 * set up from the preset table
922 static void setup_preset(struct hda_codec *codec,
923 const struct alc_config_preset *preset)
925 struct alc_spec *spec = codec->spec;
928 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++)
929 add_mixer(spec, preset->mixers[i]);
930 spec->cap_mixer = preset->cap_mixer;
931 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i];
933 add_verb(spec, preset->init_verbs[i]);
935 spec->channel_mode = preset->channel_mode;
936 spec->num_channel_mode = preset->num_channel_mode;
937 spec->need_dac_fix = preset->need_dac_fix;
938 spec->const_channel_count = preset->const_channel_count;
940 if (preset->const_channel_count)
941 spec->multiout.max_channels = preset->const_channel_count;
943 spec->multiout.max_channels = spec->channel_mode[0].channels;
944 spec->ext_channel_count = spec->channel_mode[0].channels;
946 spec->multiout.num_dacs = preset->num_dacs;
947 spec->multiout.dac_nids = preset->dac_nids;
948 spec->multiout.dig_out_nid = preset->dig_out_nid;
949 spec->multiout.slave_dig_outs = preset->slave_dig_outs;
950 spec->multiout.hp_nid = preset->hp_nid;
952 spec->num_mux_defs = preset->num_mux_defs;
953 if (!spec->num_mux_defs)
954 spec->num_mux_defs = 1;
955 spec->input_mux = preset->input_mux;
957 spec->num_adc_nids = preset->num_adc_nids;
958 spec->adc_nids = preset->adc_nids;
959 spec->capsrc_nids = preset->capsrc_nids;
960 spec->dig_in_nid = preset->dig_in_nid;
962 spec->unsol_event = preset->unsol_event;
963 spec->init_hook = preset->init_hook;
964 #ifdef CONFIG_SND_HDA_POWER_SAVE
965 spec->power_hook = preset->power_hook;
966 spec->loopback.amplist = preset->loopbacks;
970 preset->setup(codec);
972 alc_fixup_autocfg_pin_nums(codec);
975 /* Enable GPIO mask and set output */
976 static struct hda_verb alc_gpio1_init_verbs[] = {
977 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
978 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
979 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
983 static struct hda_verb alc_gpio2_init_verbs[] = {
984 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
985 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
986 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
990 static struct hda_verb alc_gpio3_init_verbs[] = {
991 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
992 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
993 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
998 * Fix hardware PLL issue
999 * On some codecs, the analog PLL gating control must be off while
1000 * the default value is 1.
1002 static void alc_fix_pll(struct hda_codec *codec)
1004 struct alc_spec *spec = codec->spec;
1009 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1010 spec->pll_coef_idx);
1011 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
1012 AC_VERB_GET_PROC_COEF, 0);
1013 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
1014 spec->pll_coef_idx);
1015 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
1016 val & ~(1 << spec->pll_coef_bit));
1019 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
1020 unsigned int coef_idx, unsigned int coef_bit)
1022 struct alc_spec *spec = codec->spec;
1023 spec->pll_nid = nid;
1024 spec->pll_coef_idx = coef_idx;
1025 spec->pll_coef_bit = coef_bit;
1029 #ifdef CONFIG_SND_HDA_INPUT_JACK
1030 static void alc_free_jack_priv(struct snd_jack *jack)
1032 struct alc_jack *jacks = jack->private_data;
1037 static int alc_add_jack(struct hda_codec *codec,
1038 hda_nid_t nid, int type)
1040 struct alc_spec *spec;
1041 struct alc_jack *jack;
1046 snd_array_init(&spec->jacks, sizeof(*jack), 32);
1047 jack = snd_array_new(&spec->jacks);
1053 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
1055 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
1058 jack->jack->private_data = jack;
1059 jack->jack->private_free = alc_free_jack_priv;
1063 static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1065 struct alc_spec *spec = codec->spec;
1066 struct alc_jack *jacks = spec->jacks.list;
1070 for (i = 0; i < spec->jacks.used; i++) {
1071 if (jacks->nid == nid) {
1072 unsigned int present;
1073 present = snd_hda_jack_detect(codec, nid);
1075 present = (present) ? jacks->type : 0;
1077 snd_jack_report(jacks->jack, present);
1084 static int alc_init_jacks(struct hda_codec *codec)
1086 struct alc_spec *spec = codec->spec;
1088 unsigned int hp_nid = spec->autocfg.hp_pins[0];
1089 unsigned int mic_nid = spec->ext_mic.pin;
1092 err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE);
1095 alc_report_jack(codec, hp_nid);
1099 err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE);
1102 alc_report_jack(codec, mic_nid);
1108 static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid)
1112 static inline int alc_init_jacks(struct hda_codec *codec)
1118 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1120 struct alc_spec *spec = codec->spec;
1125 spec->jack_present = 0;
1126 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1127 nid = spec->autocfg.hp_pins[i];
1130 if (snd_hda_jack_detect(codec, nid)) {
1131 spec->jack_present = 1;
1134 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1137 mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1138 /* Toggle internal speakers muting */
1139 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1140 nid = spec->autocfg.speaker_pins[i];
1144 snd_hda_codec_write(codec, nid, 0,
1145 AC_VERB_SET_PIN_WIDGET_CONTROL,
1146 spec->jack_present ? 0 : PIN_OUT);
1148 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1149 HDA_AMP_MUTE, mute);
1154 static void alc_automute_pin(struct hda_codec *codec)
1156 alc_automute_speaker(codec, 1);
1159 static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1162 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
1165 nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn));
1166 for (i = 0; i < nums; i++)
1172 /* switch the current ADC according to the jack state */
1173 static void alc_dual_mic_adc_auto_switch(struct hda_codec *codec)
1175 struct alc_spec *spec = codec->spec;
1176 unsigned int present;
1179 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1181 spec->cur_adc_idx = 1;
1183 spec->cur_adc_idx = 0;
1184 new_adc = spec->adc_nids[spec->cur_adc_idx];
1185 if (spec->cur_adc && spec->cur_adc != new_adc) {
1186 /* stream is running, let's swap the current ADC */
1187 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
1188 spec->cur_adc = new_adc;
1189 snd_hda_codec_setup_stream(codec, new_adc,
1190 spec->cur_adc_stream_tag, 0,
1191 spec->cur_adc_format);
1195 static void alc_mic_automute(struct hda_codec *codec)
1197 struct alc_spec *spec = codec->spec;
1198 struct alc_mic_route *dead, *alive;
1199 unsigned int present, type;
1202 if (!spec->auto_mic)
1204 if (!spec->int_mic.pin || !spec->ext_mic.pin)
1206 if (snd_BUG_ON(!spec->adc_nids))
1209 if (spec->dual_adc_switch) {
1210 alc_dual_mic_adc_auto_switch(codec);
1214 cap_nid = spec->capsrc_nids ? spec->capsrc_nids[0] : spec->adc_nids[0];
1216 present = snd_hda_jack_detect(codec, spec->ext_mic.pin);
1218 alive = &spec->ext_mic;
1219 dead = &spec->int_mic;
1221 alive = &spec->int_mic;
1222 dead = &spec->ext_mic;
1225 type = get_wcaps_type(get_wcaps(codec, cap_nid));
1226 if (type == AC_WID_AUD_MIX) {
1227 /* Matrix-mixer style (e.g. ALC882) */
1228 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1231 snd_hda_codec_amp_stereo(codec, cap_nid, HDA_INPUT,
1233 HDA_AMP_MUTE, HDA_AMP_MUTE);
1235 /* MUX style (e.g. ALC880) */
1236 snd_hda_codec_write_cache(codec, cap_nid, 0,
1237 AC_VERB_SET_CONNECT_SEL,
1240 alc_report_jack(codec, spec->ext_mic.pin);
1242 /* FIXME: analog mixer */
1245 /* unsolicited event for HP jack sensing */
1246 static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
1248 if (codec->vendor_id == 0x10ec0880)
1253 case ALC880_HP_EVENT:
1254 alc_automute_pin(codec);
1256 case ALC880_MIC_EVENT:
1257 alc_mic_automute(codec);
1262 static void alc_inithook(struct hda_codec *codec)
1264 alc_automute_pin(codec);
1265 alc_mic_automute(codec);
1268 /* additional initialization for ALC888 variants */
1269 static void alc888_coef_init(struct hda_codec *codec)
1273 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0);
1274 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1275 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1276 if ((tmp & 0xf0) == 0x20)
1278 snd_hda_codec_read(codec, 0x20, 0,
1279 AC_VERB_SET_PROC_COEF, 0x830);
1282 snd_hda_codec_read(codec, 0x20, 0,
1283 AC_VERB_SET_PROC_COEF, 0x3030);
1286 static void alc889_coef_init(struct hda_codec *codec)
1290 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1291 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
1292 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7);
1293 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1296 /* turn on/off EAPD control (only if available) */
1297 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1299 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1301 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1302 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1306 static void alc_auto_init_amp(struct hda_codec *codec, int type)
1311 case ALC_INIT_GPIO1:
1312 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
1314 case ALC_INIT_GPIO2:
1315 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
1317 case ALC_INIT_GPIO3:
1318 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
1320 case ALC_INIT_DEFAULT:
1321 switch (codec->vendor_id) {
1323 set_eapd(codec, 0x0f, 1);
1324 set_eapd(codec, 0x10, 1);
1337 set_eapd(codec, 0x14, 1);
1338 set_eapd(codec, 0x15, 1);
1341 switch (codec->vendor_id) {
1343 snd_hda_codec_write(codec, 0x1a, 0,
1344 AC_VERB_SET_COEF_INDEX, 7);
1345 tmp = snd_hda_codec_read(codec, 0x1a, 0,
1346 AC_VERB_GET_PROC_COEF, 0);
1347 snd_hda_codec_write(codec, 0x1a, 0,
1348 AC_VERB_SET_COEF_INDEX, 7);
1349 snd_hda_codec_write(codec, 0x1a, 0,
1350 AC_VERB_SET_PROC_COEF,
1360 alc889_coef_init(codec);
1363 alc888_coef_init(codec);
1365 #if 0 /* XXX: This may cause the silent output on speaker on some machines */
1368 snd_hda_codec_write(codec, 0x20, 0,
1369 AC_VERB_SET_COEF_INDEX, 7);
1370 tmp = snd_hda_codec_read(codec, 0x20, 0,
1371 AC_VERB_GET_PROC_COEF, 0);
1372 snd_hda_codec_write(codec, 0x20, 0,
1373 AC_VERB_SET_COEF_INDEX, 7);
1374 snd_hda_codec_write(codec, 0x20, 0,
1375 AC_VERB_SET_PROC_COEF,
1384 static void alc_init_auto_hp(struct hda_codec *codec)
1386 struct alc_spec *spec = codec->spec;
1387 struct auto_pin_cfg *cfg = &spec->autocfg;
1390 if (!cfg->hp_pins[0]) {
1391 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1395 if (!cfg->speaker_pins[0]) {
1396 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1398 memcpy(cfg->speaker_pins, cfg->line_out_pins,
1399 sizeof(cfg->speaker_pins));
1400 cfg->speaker_outs = cfg->line_outs;
1403 if (!cfg->hp_pins[0]) {
1404 memcpy(cfg->hp_pins, cfg->line_out_pins,
1405 sizeof(cfg->hp_pins));
1406 cfg->hp_outs = cfg->line_outs;
1409 for (i = 0; i < cfg->hp_outs; i++) {
1410 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1412 snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1413 AC_VERB_SET_UNSOLICITED_ENABLE,
1414 AC_USRSP_EN | ALC880_HP_EVENT);
1416 spec->unsol_event = alc_sku_unsol_event;
1419 static void alc_init_auto_mic(struct hda_codec *codec)
1421 struct alc_spec *spec = codec->spec;
1422 struct auto_pin_cfg *cfg = &spec->autocfg;
1423 hda_nid_t fixed, ext;
1426 /* there must be only two mic inputs exclusively */
1427 for (i = 0; i < cfg->num_inputs; i++)
1428 if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1432 for (i = 0; i < cfg->num_inputs; i++) {
1433 hda_nid_t nid = cfg->inputs[i].pin;
1434 unsigned int defcfg;
1435 defcfg = snd_hda_codec_get_pincfg(codec, nid);
1436 switch (snd_hda_get_input_pin_attr(defcfg)) {
1437 case INPUT_PIN_ATTR_INT:
1439 return; /* already occupied */
1442 case INPUT_PIN_ATTR_UNUSED:
1443 return; /* invalid entry */
1446 return; /* already occupied */
1453 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1454 return; /* no unsol support */
1455 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
1457 spec->ext_mic.pin = ext;
1458 spec->int_mic.pin = fixed;
1459 spec->ext_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1460 spec->int_mic.mux_idx = MUX_IDX_UNDEF; /* set later */
1462 snd_hda_codec_write_cache(codec, spec->ext_mic.pin, 0,
1463 AC_VERB_SET_UNSOLICITED_ENABLE,
1464 AC_USRSP_EN | ALC880_MIC_EVENT);
1465 spec->unsol_event = alc_sku_unsol_event;
1468 /* Could be any non-zero and even value. When used as fixup, tells
1469 * the driver to ignore any present sku defines.
1471 #define ALC_FIXUP_SKU_IGNORE (2)
1473 static int alc_auto_parse_customize_define(struct hda_codec *codec)
1475 unsigned int ass, tmp, i;
1477 struct alc_spec *spec = codec->spec;
1479 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1481 if (spec->cdefine.fixup) {
1482 ass = spec->cdefine.sku_cfg;
1483 if (ass == ALC_FIXUP_SKU_IGNORE)
1488 ass = codec->subsystem_id & 0xffff;
1489 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1493 if (codec->vendor_id == 0x10ec0260)
1495 ass = snd_hda_codec_get_pincfg(codec, nid);
1498 printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n",
1499 codec->chip_name, ass);
1505 for (i = 1; i < 16; i++) {
1509 if (((ass >> 16) & 0xf) != tmp)
1512 spec->cdefine.port_connectivity = ass >> 30;
1513 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1514 spec->cdefine.check_sum = (ass >> 16) & 0xf;
1515 spec->cdefine.customization = ass >> 8;
1517 spec->cdefine.sku_cfg = ass;
1518 spec->cdefine.external_amp = (ass & 0x38) >> 3;
1519 spec->cdefine.platform_type = (ass & 0x4) >> 2;
1520 spec->cdefine.swap = (ass & 0x2) >> 1;
1521 spec->cdefine.override = ass & 0x1;
1523 snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n",
1524 nid, spec->cdefine.sku_cfg);
1525 snd_printd("SKU: port_connectivity=0x%x\n",
1526 spec->cdefine.port_connectivity);
1527 snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
1528 snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
1529 snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization);
1530 snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
1531 snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
1532 snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap);
1533 snd_printd("SKU: override=0x%x\n", spec->cdefine.override);
1538 /* check subsystem ID and set up device-specific initialization;
1539 * return 1 if initialized, 0 if invalid SSID
1541 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
1542 * 31 ~ 16 : Manufacture ID
1544 * 7 ~ 0 : Assembly ID
1545 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
1547 static int alc_subsystem_id(struct hda_codec *codec,
1548 hda_nid_t porta, hda_nid_t porte,
1549 hda_nid_t portd, hda_nid_t porti)
1551 unsigned int ass, tmp, i;
1553 struct alc_spec *spec = codec->spec;
1555 if (spec->cdefine.fixup) {
1556 ass = spec->cdefine.sku_cfg;
1557 if (ass == ALC_FIXUP_SKU_IGNORE)
1562 ass = codec->subsystem_id & 0xffff;
1563 if ((ass != codec->bus->pci->subsystem_device) && (ass & 1))
1566 /* invalid SSID, check the special NID pin defcfg instead */
1568 * 31~30 : port connectivity
1571 * 19~16 : Check sum (15:1)
1576 if (codec->vendor_id == 0x10ec0260)
1578 ass = snd_hda_codec_get_pincfg(codec, nid);
1579 snd_printd("realtek: No valid SSID, "
1580 "checking pincfg 0x%08x for NID 0x%x\n",
1584 if ((ass >> 30) != 1) /* no physical connection */
1589 for (i = 1; i < 16; i++) {
1593 if (((ass >> 16) & 0xf) != tmp)
1596 snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1597 ass & 0xffff, codec->vendor_id);
1601 * 2 : 0 --> Desktop, 1 --> Laptop
1602 * 3~5 : External Amplifier control
1605 tmp = (ass & 0x38) >> 3; /* external Amp control */
1608 spec->init_amp = ALC_INIT_GPIO1;
1611 spec->init_amp = ALC_INIT_GPIO2;
1614 spec->init_amp = ALC_INIT_GPIO3;
1618 spec->init_amp = ALC_INIT_DEFAULT;
1622 /* is laptop or Desktop and enable the function "Mute internal speaker
1623 * when the external headphone out jack is plugged"
1625 if (!(ass & 0x8000))
1628 * 10~8 : Jack location
1629 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1631 * 15 : 1 --> enable the function "Mute internal speaker
1632 * when the external headphone out jack is plugged"
1634 if (!spec->autocfg.hp_pins[0]) {
1636 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1647 for (i = 0; i < spec->autocfg.line_outs; i++)
1648 if (spec->autocfg.line_out_pins[i] == nid)
1650 spec->autocfg.hp_pins[0] = nid;
1653 alc_init_auto_hp(codec);
1654 alc_init_auto_mic(codec);
1658 static void alc_ssid_check(struct hda_codec *codec,
1659 hda_nid_t porta, hda_nid_t porte,
1660 hda_nid_t portd, hda_nid_t porti)
1662 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1663 struct alc_spec *spec = codec->spec;
1664 snd_printd("realtek: "
1665 "Enable default setup for auto mode as fallback\n");
1666 spec->init_amp = ALC_INIT_DEFAULT;
1667 alc_init_auto_hp(codec);
1668 alc_init_auto_mic(codec);
1673 * Fix-up pin default configurations and add default verbs
1683 const struct alc_pincfg *pins;
1684 const struct hda_verb *verbs;
1685 void (*func)(struct hda_codec *codec, const struct alc_fixup *fix,
1689 static void alc_pick_fixup(struct hda_codec *codec,
1690 const struct snd_pci_quirk *quirk,
1691 const struct alc_fixup *fix,
1694 const struct alc_pincfg *cfg;
1695 struct alc_spec *spec;
1697 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1700 fix += quirk->value;
1702 if (pre_init && fix->sku) {
1703 #ifdef CONFIG_SND_DEBUG_VERBOSE
1704 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n",
1705 codec->chip_name, quirk->name);
1708 spec->cdefine.sku_cfg = fix->sku;
1709 spec->cdefine.fixup = 1;
1711 if (pre_init && cfg) {
1712 #ifdef CONFIG_SND_DEBUG_VERBOSE
1713 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1714 codec->chip_name, quirk->name);
1716 for (; cfg->nid; cfg++)
1717 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1719 if (!pre_init && fix->verbs) {
1720 #ifdef CONFIG_SND_DEBUG_VERBOSE
1721 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1722 codec->chip_name, quirk->name);
1724 add_verb(codec->spec, fix->verbs);
1727 #ifdef CONFIG_SND_DEBUG_VERBOSE
1728 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n",
1729 codec->chip_name, quirk->name);
1731 fix->func(codec, fix, pre_init);
1735 static int alc_read_coef_idx(struct hda_codec *codec,
1736 unsigned int coef_idx)
1739 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1741 val = snd_hda_codec_read(codec, 0x20, 0,
1742 AC_VERB_GET_PROC_COEF, 0);
1746 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1747 unsigned int coef_val)
1749 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1751 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1755 /* set right pin controls for digital I/O */
1756 static void alc_auto_init_digital(struct hda_codec *codec)
1758 struct alc_spec *spec = codec->spec;
1762 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1763 pin = spec->autocfg.dig_out_pins[i];
1765 snd_hda_codec_write(codec, pin, 0,
1766 AC_VERB_SET_PIN_WIDGET_CONTROL,
1770 pin = spec->autocfg.dig_in_pin;
1772 snd_hda_codec_write(codec, pin, 0,
1773 AC_VERB_SET_PIN_WIDGET_CONTROL,
1777 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1778 static void alc_auto_parse_digital(struct hda_codec *codec)
1780 struct alc_spec *spec = codec->spec;
1784 /* support multiple SPDIFs; the secondary is set up as a slave */
1785 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1786 err = snd_hda_get_connections(codec,
1787 spec->autocfg.dig_out_pins[i],
1792 spec->multiout.dig_out_nid = dig_nid;
1793 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1795 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1796 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1798 spec->slave_dig_outs[i - 1] = dig_nid;
1802 if (spec->autocfg.dig_in_pin) {
1803 dig_nid = codec->start_nid;
1804 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1805 unsigned int wcaps = get_wcaps(codec, dig_nid);
1806 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1808 if (!(wcaps & AC_WCAP_DIGITAL))
1810 if (!(wcaps & AC_WCAP_CONN_LIST))
1812 err = get_connection_index(codec, dig_nid,
1813 spec->autocfg.dig_in_pin);
1815 spec->dig_in_nid = dig_nid;
1829 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1830 /* Mic-in jack as mic in */
1831 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1832 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1833 /* Line-in jack as Line in */
1834 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1835 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1836 /* Line-Out as Front */
1837 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1844 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1845 /* Mic-in jack as mic in */
1846 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1847 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1848 /* Line-in jack as Surround */
1849 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1850 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1851 /* Line-Out as Front */
1852 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1859 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1860 /* Mic-in jack as CLFE */
1861 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1862 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1863 /* Line-in jack as Surround */
1864 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1865 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1866 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1867 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1874 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1875 /* Mic-in jack as CLFE */
1876 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1877 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1878 /* Line-in jack as Surround */
1879 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1880 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1881 /* Line-Out as Side */
1882 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1886 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1887 { 2, alc888_4ST_ch2_intel_init },
1888 { 4, alc888_4ST_ch4_intel_init },
1889 { 6, alc888_4ST_ch6_intel_init },
1890 { 8, alc888_4ST_ch8_intel_init },
1894 * ALC888 Fujitsu Siemens Amillo xa3530
1897 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1898 /* Front Mic: set to PIN_IN (empty by default) */
1899 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1900 /* Connect Internal HP to Front */
1901 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1902 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1903 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1904 /* Connect Bass HP to Front */
1905 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1907 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1908 /* Connect Line-Out side jack (SPDIF) to Side */
1909 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1910 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1911 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1912 /* Connect Mic jack to CLFE */
1913 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1914 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1915 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1916 /* Connect Line-in jack to Surround */
1917 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1918 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1919 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1920 /* Connect HP out jack to Front */
1921 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1922 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1923 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1924 /* Enable unsolicited event for HP jack and Line-out jack */
1925 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1926 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1930 static void alc_automute_amp(struct hda_codec *codec)
1932 alc_automute_speaker(codec, 0);
1935 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1938 if (codec->vendor_id == 0x10ec0880)
1942 if (res == ALC880_HP_EVENT)
1943 alc_automute_amp(codec);
1946 static void alc889_automute_setup(struct hda_codec *codec)
1948 struct alc_spec *spec = codec->spec;
1950 spec->autocfg.hp_pins[0] = 0x15;
1951 spec->autocfg.speaker_pins[0] = 0x14;
1952 spec->autocfg.speaker_pins[1] = 0x16;
1953 spec->autocfg.speaker_pins[2] = 0x17;
1954 spec->autocfg.speaker_pins[3] = 0x19;
1955 spec->autocfg.speaker_pins[4] = 0x1a;
1958 static void alc889_intel_init_hook(struct hda_codec *codec)
1960 alc889_coef_init(codec);
1961 alc_automute_amp(codec);
1964 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1966 struct alc_spec *spec = codec->spec;
1968 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1969 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1970 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1971 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1975 * ALC888 Acer Aspire 4930G model
1978 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1979 /* Front Mic: set to PIN_IN (empty by default) */
1980 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1981 /* Unselect Front Mic by default in input mixer 3 */
1982 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1983 /* Enable unsolicited event for HP jack */
1984 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1985 /* Connect Internal HP to front */
1986 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1987 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1988 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1989 /* Connect HP out to front */
1990 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1991 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1992 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1997 * ALC888 Acer Aspire 6530G model
2000 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
2001 /* Route to built-in subwoofer as well as speakers */
2002 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2003 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2004 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2005 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2006 /* Bias voltage on for external mic port */
2007 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2008 /* Front Mic: set to PIN_IN (empty by default) */
2009 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2010 /* Unselect Front Mic by default in input mixer 3 */
2011 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2012 /* Enable unsolicited event for HP jack */
2013 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2014 /* Enable speaker output */
2015 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2016 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2017 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2018 /* Enable headphone output */
2019 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2020 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2022 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2027 *ALC888 Acer Aspire 7730G model
2030 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
2031 /* Bias voltage on for external mic port */
2032 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
2033 /* Front Mic: set to PIN_IN (empty by default) */
2034 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2035 /* Unselect Front Mic by default in input mixer 3 */
2036 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2037 /* Enable unsolicited event for HP jack */
2038 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2039 /* Enable speaker output */
2040 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2041 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2042 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2043 /* Enable headphone output */
2044 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2045 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2046 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2047 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2048 /*Enable internal subwoofer */
2049 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2050 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2051 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2052 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
2057 * ALC889 Acer Aspire 8930G model
2060 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2061 /* Front Mic: set to PIN_IN (empty by default) */
2062 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2063 /* Unselect Front Mic by default in input mixer 3 */
2064 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2065 /* Enable unsolicited event for HP jack */
2066 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2067 /* Connect Internal Front to Front */
2068 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2069 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2070 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2071 /* Connect Internal Rear to Rear */
2072 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2073 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2074 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2075 /* Connect Internal CLFE to CLFE */
2076 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2077 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2078 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2079 /* Connect HP out to Front */
2080 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2081 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2082 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2083 /* Enable all DACs */
2084 /* DAC DISABLE/MUTE 1? */
2085 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2086 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2087 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2088 /* DAC DISABLE/MUTE 2? */
2089 /* some bit here disables the other DACs. Init=0x4900 */
2090 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2091 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2093 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2094 * which makes the stereo useless. However, either the mic or the ALC889
2095 * makes the signal become a difference/sum signal instead of standard
2096 * stereo, which is annoying. So instead we flip this bit which makes the
2097 * codec replicate the sum signal to both channels, turning it into a
2100 /* DMIC_CONTROL? Init value = 0x0001 */
2101 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2102 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2106 static struct hda_input_mux alc888_2_capture_sources[2] = {
2107 /* Front mic only available on one ADC */
2114 { "Front Mic", 0xb },
2127 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2128 /* Interal mic only available on one ADC */
2135 { "Input Mix", 0xa },
2145 { "Input Mix", 0xa },
2150 static struct hda_input_mux alc889_capture_sources[3] = {
2151 /* Digital mic only available on first "ADC" */
2158 { "Front Mic", 0xb },
2159 { "Input Mix", 0xa },
2168 { "Input Mix", 0xa },
2177 { "Input Mix", 0xa },
2182 static struct snd_kcontrol_new alc888_base_mixer[] = {
2183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2185 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2186 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2187 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2189 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2190 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2191 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2192 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2193 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2194 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2195 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2196 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2197 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2198 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2199 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2200 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2204 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2205 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2206 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2207 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2208 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2209 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2211 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2212 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2213 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2214 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2215 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2216 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2218 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2223 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2225 struct alc_spec *spec = codec->spec;
2227 spec->autocfg.hp_pins[0] = 0x15;
2228 spec->autocfg.speaker_pins[0] = 0x14;
2229 spec->autocfg.speaker_pins[1] = 0x16;
2230 spec->autocfg.speaker_pins[2] = 0x17;
2233 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2235 struct alc_spec *spec = codec->spec;
2237 spec->autocfg.hp_pins[0] = 0x15;
2238 spec->autocfg.speaker_pins[0] = 0x14;
2239 spec->autocfg.speaker_pins[1] = 0x16;
2240 spec->autocfg.speaker_pins[2] = 0x17;
2243 static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
2245 struct alc_spec *spec = codec->spec;
2247 spec->autocfg.hp_pins[0] = 0x15;
2248 spec->autocfg.speaker_pins[0] = 0x14;
2249 spec->autocfg.speaker_pins[1] = 0x16;
2250 spec->autocfg.speaker_pins[2] = 0x17;
2253 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2255 struct alc_spec *spec = codec->spec;
2257 spec->autocfg.hp_pins[0] = 0x15;
2258 spec->autocfg.speaker_pins[0] = 0x14;
2259 spec->autocfg.speaker_pins[1] = 0x16;
2260 spec->autocfg.speaker_pins[2] = 0x1b;
2264 * ALC880 3-stack model
2266 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2267 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2268 * F-Mic = 0x1b, HP = 0x19
2271 static hda_nid_t alc880_dac_nids[4] = {
2272 /* front, rear, clfe, rear_surr */
2273 0x02, 0x05, 0x04, 0x03
2276 static hda_nid_t alc880_adc_nids[3] = {
2281 /* The datasheet says the node 0x07 is connected from inputs,
2282 * but it shows zero connection in the real implementation on some devices.
2283 * Note: this is a 915GAV bug, fixed on 915GLV
2285 static hda_nid_t alc880_adc_nids_alt[2] = {
2290 #define ALC880_DIGOUT_NID 0x06
2291 #define ALC880_DIGIN_NID 0x0a
2293 static struct hda_input_mux alc880_capture_source = {
2297 { "Front Mic", 0x3 },
2303 /* channel source setting (2/6 channel selection for 3-stack) */
2305 static struct hda_verb alc880_threestack_ch2_init[] = {
2306 /* set line-in to input, mute it */
2307 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2308 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2309 /* set mic-in to input vref 80%, mute it */
2310 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2311 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2316 static struct hda_verb alc880_threestack_ch6_init[] = {
2317 /* set line-in to output, unmute it */
2318 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2319 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2320 /* set mic-in to output, unmute it */
2321 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2322 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2326 static struct hda_channel_mode alc880_threestack_modes[2] = {
2327 { 2, alc880_threestack_ch2_init },
2328 { 6, alc880_threestack_ch6_init },
2331 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2332 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2333 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2334 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2335 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2336 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2337 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2338 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2339 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2340 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2341 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2342 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2343 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2344 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2345 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2346 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2347 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2348 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2350 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2351 .name = "Channel Mode",
2352 .info = alc_ch_mode_info,
2353 .get = alc_ch_mode_get,
2354 .put = alc_ch_mode_put,
2359 /* capture mixer elements */
2360 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2361 struct snd_ctl_elem_info *uinfo)
2363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2364 struct alc_spec *spec = codec->spec;
2367 mutex_lock(&codec->control_mutex);
2368 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2370 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2371 mutex_unlock(&codec->control_mutex);
2375 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2376 unsigned int size, unsigned int __user *tlv)
2378 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2379 struct alc_spec *spec = codec->spec;
2382 mutex_lock(&codec->control_mutex);
2383 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2385 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2386 mutex_unlock(&codec->control_mutex);
2390 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2391 struct snd_ctl_elem_value *ucontrol);
2393 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2394 struct snd_ctl_elem_value *ucontrol,
2397 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2398 struct alc_spec *spec = codec->spec;
2399 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2402 mutex_lock(&codec->control_mutex);
2403 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2405 err = func(kcontrol, ucontrol);
2406 mutex_unlock(&codec->control_mutex);
2410 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2411 struct snd_ctl_elem_value *ucontrol)
2413 return alc_cap_getput_caller(kcontrol, ucontrol,
2414 snd_hda_mixer_amp_volume_get);
2417 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2418 struct snd_ctl_elem_value *ucontrol)
2420 return alc_cap_getput_caller(kcontrol, ucontrol,
2421 snd_hda_mixer_amp_volume_put);
2424 /* capture mixer elements */
2425 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2427 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2428 struct snd_ctl_elem_value *ucontrol)
2430 return alc_cap_getput_caller(kcontrol, ucontrol,
2431 snd_hda_mixer_amp_switch_get);
2434 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2435 struct snd_ctl_elem_value *ucontrol)
2437 return alc_cap_getput_caller(kcontrol, ucontrol,
2438 snd_hda_mixer_amp_switch_put);
2441 #define _DEFINE_CAPMIX(num) \
2443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2444 .name = "Capture Switch", \
2445 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2447 .info = alc_cap_sw_info, \
2448 .get = alc_cap_sw_get, \
2449 .put = alc_cap_sw_put, \
2452 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2453 .name = "Capture Volume", \
2454 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2455 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2456 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2458 .info = alc_cap_vol_info, \
2459 .get = alc_cap_vol_get, \
2460 .put = alc_cap_vol_put, \
2461 .tlv = { .c = alc_cap_vol_tlv }, \
2464 #define _DEFINE_CAPSRC(num) \
2466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2467 /* .name = "Capture Source", */ \
2468 .name = "Input Source", \
2470 .info = alc_mux_enum_info, \
2471 .get = alc_mux_enum_get, \
2472 .put = alc_mux_enum_put, \
2475 #define DEFINE_CAPMIX(num) \
2476 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2477 _DEFINE_CAPMIX(num), \
2478 _DEFINE_CAPSRC(num), \
2482 #define DEFINE_CAPMIX_NOSRC(num) \
2483 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2484 _DEFINE_CAPMIX(num), \
2488 /* up to three ADCs */
2492 DEFINE_CAPMIX_NOSRC(1);
2493 DEFINE_CAPMIX_NOSRC(2);
2494 DEFINE_CAPMIX_NOSRC(3);
2497 * ALC880 5-stack model
2499 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2501 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2502 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2505 /* additional mixers to alc880_three_stack_mixer */
2506 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2507 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2508 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2512 /* channel source setting (6/8 channel selection for 5-stack) */
2514 static struct hda_verb alc880_fivestack_ch6_init[] = {
2515 /* set line-in to input, mute it */
2516 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2517 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2522 static struct hda_verb alc880_fivestack_ch8_init[] = {
2523 /* set line-in to output, unmute it */
2524 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2525 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2529 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2530 { 6, alc880_fivestack_ch6_init },
2531 { 8, alc880_fivestack_ch8_init },
2536 * ALC880 6-stack model
2538 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2539 * Side = 0x05 (0x0f)
2540 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2541 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2544 static hda_nid_t alc880_6st_dac_nids[4] = {
2545 /* front, rear, clfe, rear_surr */
2546 0x02, 0x03, 0x04, 0x05
2549 static struct hda_input_mux alc880_6stack_capture_source = {
2553 { "Front Mic", 0x1 },
2559 /* fixed 8-channels */
2560 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2564 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2565 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2566 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2567 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2568 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2569 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2570 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2571 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2572 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2573 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2574 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2575 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2576 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2577 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2578 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2579 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2580 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2581 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2582 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2585 .name = "Channel Mode",
2586 .info = alc_ch_mode_info,
2587 .get = alc_ch_mode_get,
2588 .put = alc_ch_mode_put,
2597 * W810 has rear IO for:
2600 * Center/LFE (DAC 04)
2603 * The system also has a pair of internal speakers, and a headphone jack.
2604 * These are both connected to Line2 on the codec, hence to DAC 02.
2606 * There is a variable resistor to control the speaker or headphone
2607 * volume. This is a hardware-only device without a software API.
2609 * Plugging headphones in will disable the internal speakers. This is
2610 * implemented in hardware, not via the driver using jack sense. In
2611 * a similar fashion, plugging into the rear socket marked "front" will
2612 * disable both the speakers and headphones.
2614 * For input, there's a microphone jack, and an "audio in" jack.
2615 * These may not do anything useful with this driver yet, because I
2616 * haven't setup any initialization verbs for these yet...
2619 static hda_nid_t alc880_w810_dac_nids[3] = {
2620 /* front, rear/surround, clfe */
2624 /* fixed 6 channels */
2625 static struct hda_channel_mode alc880_w810_modes[1] = {
2629 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2630 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2631 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2632 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2633 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2634 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2635 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2636 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2637 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2638 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2647 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2648 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2652 static hda_nid_t alc880_z71v_dac_nids[1] = {
2655 #define ALC880_Z71V_HP_DAC 0x03
2657 /* fixed 2 channels */
2658 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2662 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2665 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2666 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2667 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2668 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2669 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2670 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2676 * ALC880 F1734 model
2678 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2679 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2682 static hda_nid_t alc880_f1734_dac_nids[1] = {
2685 #define ALC880_F1734_HP_DAC 0x02
2687 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2688 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2689 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2690 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2691 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2692 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2693 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2694 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2695 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2699 static struct hda_input_mux alc880_f1734_capture_source = {
2711 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2712 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2713 * Mic = 0x18, Line = 0x1a
2716 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2717 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2719 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2720 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2721 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2722 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2723 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2724 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2725 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2726 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2727 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2728 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2729 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2730 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2731 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2732 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2733 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2736 .name = "Channel Mode",
2737 .info = alc_ch_mode_info,
2738 .get = alc_ch_mode_get,
2739 .put = alc_ch_mode_put,
2745 * ALC880 ASUS W1V model
2747 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2748 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2749 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2752 /* additional mixers to alc880_asus_mixer */
2753 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2754 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2755 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2760 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2762 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2765 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2766 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2767 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2768 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2769 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2774 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2775 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2776 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2777 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2778 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2779 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2780 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2781 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2782 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2783 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2784 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2785 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2786 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2788 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2789 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2790 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2792 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2793 .name = "Channel Mode",
2794 .info = alc_ch_mode_info,
2795 .get = alc_ch_mode_get,
2796 .put = alc_ch_mode_put,
2801 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2802 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2803 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2804 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2805 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2806 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2807 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2808 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2809 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2810 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2811 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2815 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2816 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2817 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2818 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2819 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2820 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2821 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2826 * virtual master controls
2830 * slave controls for virtual master
2832 static const char *alc_slave_vols[] = {
2833 "Front Playback Volume",
2834 "Surround Playback Volume",
2835 "Center Playback Volume",
2836 "LFE Playback Volume",
2837 "Side Playback Volume",
2838 "Headphone Playback Volume",
2839 "Speaker Playback Volume",
2840 "Mono Playback Volume",
2841 "Line-Out Playback Volume",
2842 "PCM Playback Volume",
2846 static const char *alc_slave_sws[] = {
2847 "Front Playback Switch",
2848 "Surround Playback Switch",
2849 "Center Playback Switch",
2850 "LFE Playback Switch",
2851 "Side Playback Switch",
2852 "Headphone Playback Switch",
2853 "Speaker Playback Switch",
2854 "Mono Playback Switch",
2855 "IEC958 Playback Switch",
2856 "Line-Out Playback Switch",
2857 "PCM Playback Switch",
2862 * build control elements
2865 #define NID_MAPPING (-1)
2867 #define SUBDEV_SPEAKER_ (0 << 6)
2868 #define SUBDEV_HP_ (1 << 6)
2869 #define SUBDEV_LINE_ (2 << 6)
2870 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2871 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2872 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2874 static void alc_free_kctls(struct hda_codec *codec);
2876 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2877 /* additional beep mixers; the actual parameters are overwritten at build */
2878 static struct snd_kcontrol_new alc_beep_mixer[] = {
2879 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2880 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2885 static int alc_build_controls(struct hda_codec *codec)
2887 struct alc_spec *spec = codec->spec;
2888 struct snd_kcontrol *kctl = NULL;
2889 struct snd_kcontrol_new *knew;
2894 for (i = 0; i < spec->num_mixers; i++) {
2895 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2899 if (spec->cap_mixer) {
2900 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2904 if (spec->multiout.dig_out_nid) {
2905 err = snd_hda_create_spdif_out_ctls(codec,
2906 spec->multiout.dig_out_nid);
2909 if (!spec->no_analog) {
2910 err = snd_hda_create_spdif_share_sw(codec,
2914 spec->multiout.share_spdif = 1;
2917 if (spec->dig_in_nid) {
2918 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2923 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2924 /* create beep controls if needed */
2925 if (spec->beep_amp) {
2926 struct snd_kcontrol_new *knew;
2927 for (knew = alc_beep_mixer; knew->name; knew++) {
2928 struct snd_kcontrol *kctl;
2929 kctl = snd_ctl_new1(knew, codec);
2932 kctl->private_value = spec->beep_amp;
2933 err = snd_hda_ctl_add(codec, 0, kctl);
2940 /* if we have no master control, let's create it */
2941 if (!spec->no_analog &&
2942 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2943 unsigned int vmaster_tlv[4];
2944 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2945 HDA_OUTPUT, vmaster_tlv);
2946 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2947 vmaster_tlv, alc_slave_vols);
2951 if (!spec->no_analog &&
2952 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2953 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2954 NULL, alc_slave_sws);
2959 /* assign Capture Source enums to NID */
2960 if (spec->capsrc_nids || spec->adc_nids) {
2961 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2963 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2964 for (i = 0; kctl && i < kctl->count; i++) {
2965 hda_nid_t *nids = spec->capsrc_nids;
2967 nids = spec->adc_nids;
2968 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2973 if (spec->cap_mixer) {
2974 const char *kname = kctl ? kctl->id.name : NULL;
2975 for (knew = spec->cap_mixer; knew->name; knew++) {
2976 if (kname && strcmp(knew->name, kname) == 0)
2978 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2979 for (i = 0; kctl && i < kctl->count; i++) {
2980 err = snd_hda_add_nid(codec, kctl, i,
2988 /* other nid->control mapping */
2989 for (i = 0; i < spec->num_mixers; i++) {
2990 for (knew = spec->mixers[i]; knew->name; knew++) {
2991 if (knew->iface != NID_MAPPING)
2993 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2996 u = knew->subdevice;
2997 for (j = 0; j < 4; j++, u >>= 8) {
3002 case SUBDEV_SPEAKER_:
3003 nid = spec->autocfg.speaker_pins[nid];
3006 nid = spec->autocfg.line_out_pins[nid];
3009 nid = spec->autocfg.hp_pins[nid];
3014 err = snd_hda_add_nid(codec, kctl, 0, nid);
3018 u = knew->private_value;
3019 for (j = 0; j < 4; j++, u >>= 8) {
3023 err = snd_hda_add_nid(codec, kctl, 0, nid);
3030 alc_free_kctls(codec); /* no longer needed */
3037 * initialize the codec volumes, etc
3041 * generic initialization of ADC, input mixers and output mixers
3043 static struct hda_verb alc880_volume_init_verbs[] = {
3045 * Unmute ADC0-2 and set the default input to mic-in
3047 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
3048 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3049 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3050 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3051 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3052 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3054 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3056 * Note: PASD motherboards uses the Line In 2 as the input for front
3059 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3060 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3061 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3062 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3063 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3064 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3065 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3066 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3069 * Set up output mixers (0x0c - 0x0f)
3071 /* set vol=0 to output mixers */
3072 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3073 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3074 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3075 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3076 /* set up input amps for analog loopback */
3077 /* Amp Indices: DAC = 0, mixer = 1 */
3078 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3079 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3080 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3081 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3082 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3083 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3084 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3085 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3091 * 3-stack pin configuration:
3092 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3094 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3096 * preset connection lists of input pins
3097 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3099 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3100 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3101 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3104 * Set pin mode and muting
3106 /* set front pin widgets 0x14 for output */
3107 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3108 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3109 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3110 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3111 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3112 /* Mic2 (as headphone out) for HP output */
3113 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3114 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3115 /* Line In pin widget for input */
3116 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3117 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3118 /* Line2 (as front mic) pin widget for input and vref at 80% */
3119 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3120 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3121 /* CD pin widget for input */
3122 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3128 * 5-stack pin configuration:
3129 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3130 * line-in/side = 0x1a, f-mic = 0x1b
3132 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3134 * preset connection lists of input pins
3135 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3137 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3138 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3141 * Set pin mode and muting
3143 /* set pin widgets 0x14-0x17 for output */
3144 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3145 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3146 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3147 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3148 /* unmute pins for output (no gain on this amp) */
3149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3151 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3152 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3154 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3156 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3157 /* Mic2 (as headphone out) for HP output */
3158 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3159 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3160 /* Line In pin widget for input */
3161 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3162 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3163 /* Line2 (as front mic) pin widget for input and vref at 80% */
3164 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3165 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3166 /* CD pin widget for input */
3167 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3173 * W810 pin configuration:
3174 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3176 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3177 /* hphone/speaker input selector: front DAC */
3178 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3180 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3182 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3183 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3184 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3185 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3187 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3188 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3194 * Z71V pin configuration:
3195 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3197 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3198 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3199 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3200 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3204 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3205 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3206 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3212 * 6-stack pin configuration:
3213 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3214 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3216 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3217 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3219 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3220 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3222 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3223 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3224 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3225 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3226 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3228 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3229 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3230 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3231 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3232 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3233 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3234 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3235 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3236 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3242 * Uniwill pin configuration:
3243 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3246 static struct hda_verb alc880_uniwill_init_verbs[] = {
3247 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3249 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3250 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3252 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3253 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3254 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3255 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3256 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3257 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3259 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3260 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3265 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3266 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3267 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3269 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3270 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3271 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3274 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3275 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3282 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3284 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3285 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3287 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3288 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3289 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3290 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3291 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3292 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3295 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3296 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3298 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3300 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3301 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3302 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3303 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3305 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3307 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3308 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3313 static struct hda_verb alc880_beep_init_verbs[] = {
3314 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3318 /* auto-toggle front mic */
3319 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3321 unsigned int present;
3324 present = snd_hda_jack_detect(codec, 0x18);
3325 bits = present ? HDA_AMP_MUTE : 0;
3326 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3329 static void alc880_uniwill_setup(struct hda_codec *codec)
3331 struct alc_spec *spec = codec->spec;
3333 spec->autocfg.hp_pins[0] = 0x14;
3334 spec->autocfg.speaker_pins[0] = 0x15;
3335 spec->autocfg.speaker_pins[0] = 0x16;
3338 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3340 alc_automute_amp(codec);
3341 alc880_uniwill_mic_automute(codec);
3344 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3347 /* Looks like the unsol event is incompatible with the standard
3348 * definition. 4bit tag is placed at 28 bit!
3350 switch (res >> 28) {
3351 case ALC880_MIC_EVENT:
3352 alc880_uniwill_mic_automute(codec);
3355 alc_automute_amp_unsol_event(codec, res);
3360 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3362 struct alc_spec *spec = codec->spec;
3364 spec->autocfg.hp_pins[0] = 0x14;
3365 spec->autocfg.speaker_pins[0] = 0x15;
3368 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3370 unsigned int present;
3372 present = snd_hda_codec_read(codec, 0x21, 0,
3373 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3374 present &= HDA_AMP_VOLMASK;
3375 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3376 HDA_AMP_VOLMASK, present);
3377 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3378 HDA_AMP_VOLMASK, present);
3381 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3384 /* Looks like the unsol event is incompatible with the standard
3385 * definition. 4bit tag is placed at 28 bit!
3387 if ((res >> 28) == ALC880_DCVOL_EVENT)
3388 alc880_uniwill_p53_dcvol_automute(codec);
3390 alc_automute_amp_unsol_event(codec, res);
3394 * F1734 pin configuration:
3395 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3397 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3398 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3399 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3400 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3401 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3402 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3404 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3405 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3406 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3407 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3409 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3410 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3411 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3412 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3413 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3414 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3415 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3417 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3420 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3426 * ASUS pin configuration:
3427 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3429 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3430 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3431 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3432 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3433 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3436 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3437 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3439 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3441 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3442 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3444 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3446 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3447 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3448 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3449 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3450 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3452 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3457 /* Enable GPIO mask and set output */
3458 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3459 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3460 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3462 /* Clevo m520g init */
3463 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3464 /* headphone output */
3465 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3468 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3470 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3471 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3473 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3474 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3475 /* Mic1 (rear panel) */
3476 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3477 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3478 /* Mic2 (front panel) */
3479 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3480 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3482 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3483 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3484 /* change to EAPD mode */
3485 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3486 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3491 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3492 /* change to EAPD mode */
3493 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3494 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3496 /* Headphone output */
3497 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3499 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3500 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3502 /* Line In pin widget for input */
3503 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3504 /* CD pin widget for input */
3505 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3506 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3507 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3509 /* change to EAPD mode */
3510 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3511 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3517 * LG m1 express dual
3520 * Rear Line-In/Out (blue): 0x14
3521 * Build-in Mic-In: 0x15
3523 * HP-Out (green): 0x1b
3524 * Mic-In/Out (red): 0x19
3528 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3529 static hda_nid_t alc880_lg_dac_nids[3] = {
3533 /* seems analog CD is not working */
3534 static struct hda_input_mux alc880_lg_capture_source = {
3539 { "Internal Mic", 0x6 },
3543 /* 2,4,6 channel modes */
3544 static struct hda_verb alc880_lg_ch2_init[] = {
3545 /* set line-in and mic-in to input */
3546 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3547 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3551 static struct hda_verb alc880_lg_ch4_init[] = {
3552 /* set line-in to out and mic-in to input */
3553 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3554 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3558 static struct hda_verb alc880_lg_ch6_init[] = {
3559 /* set line-in and mic-in to output */
3560 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3561 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3565 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3566 { 2, alc880_lg_ch2_init },
3567 { 4, alc880_lg_ch4_init },
3568 { 6, alc880_lg_ch6_init },
3571 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3572 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3573 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3574 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3575 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3576 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3577 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3578 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3579 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3580 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3581 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3582 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3583 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3584 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3585 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3588 .name = "Channel Mode",
3589 .info = alc_ch_mode_info,
3590 .get = alc_ch_mode_get,
3591 .put = alc_ch_mode_put,
3596 static struct hda_verb alc880_lg_init_verbs[] = {
3597 /* set capture source to mic-in */
3598 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3599 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3600 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3601 /* mute all amp mixer inputs */
3602 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3603 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3604 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3605 /* line-in to input */
3606 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3607 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3609 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3612 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3613 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3614 /* mic-in to input */
3615 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3616 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3617 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3619 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3620 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3621 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3623 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3627 /* toggle speaker-output according to the hp-jack state */
3628 static void alc880_lg_setup(struct hda_codec *codec)
3630 struct alc_spec *spec = codec->spec;
3632 spec->autocfg.hp_pins[0] = 0x1b;
3633 spec->autocfg.speaker_pins[0] = 0x17;
3642 * Built-in Mic-In: 0x19
3648 static struct hda_input_mux alc880_lg_lw_capture_source = {
3652 { "Internal Mic", 0x1 },
3657 #define alc880_lg_lw_modes alc880_threestack_modes
3659 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3660 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3661 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3662 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3663 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3664 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3665 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3666 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3667 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3668 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3669 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3670 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3671 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3672 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3673 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3675 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3676 .name = "Channel Mode",
3677 .info = alc_ch_mode_info,
3678 .get = alc_ch_mode_get,
3679 .put = alc_ch_mode_put,
3684 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3685 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3686 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3687 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3689 /* set capture source to mic-in */
3690 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3691 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3692 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3693 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3695 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3696 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3698 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3699 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3700 /* mic-in to input */
3701 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3702 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3704 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3705 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3707 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3711 /* toggle speaker-output according to the hp-jack state */
3712 static void alc880_lg_lw_setup(struct hda_codec *codec)
3714 struct alc_spec *spec = codec->spec;
3716 spec->autocfg.hp_pins[0] = 0x1b;
3717 spec->autocfg.speaker_pins[0] = 0x14;
3720 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3721 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3722 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3724 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3725 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3726 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3730 static struct hda_input_mux alc880_medion_rim_capture_source = {
3734 { "Internal Mic", 0x1 },
3738 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3739 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3741 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3742 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3744 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3745 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3746 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3747 /* Mic2 (as headphone out) for HP output */
3748 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3749 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3750 /* Internal Speaker */
3751 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3754 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3755 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3757 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3761 /* toggle speaker-output according to the hp-jack state */
3762 static void alc880_medion_rim_automute(struct hda_codec *codec)
3764 struct alc_spec *spec = codec->spec;
3765 alc_automute_amp(codec);
3767 if (spec->jack_present)
3768 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3770 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3773 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3776 /* Looks like the unsol event is incompatible with the standard
3777 * definition. 4bit tag is placed at 28 bit!
3779 if ((res >> 28) == ALC880_HP_EVENT)
3780 alc880_medion_rim_automute(codec);
3783 static void alc880_medion_rim_setup(struct hda_codec *codec)
3785 struct alc_spec *spec = codec->spec;
3787 spec->autocfg.hp_pins[0] = 0x14;
3788 spec->autocfg.speaker_pins[0] = 0x1b;
3791 #ifdef CONFIG_SND_HDA_POWER_SAVE
3792 static struct hda_amp_list alc880_loopbacks[] = {
3793 { 0x0b, HDA_INPUT, 0 },
3794 { 0x0b, HDA_INPUT, 1 },
3795 { 0x0b, HDA_INPUT, 2 },
3796 { 0x0b, HDA_INPUT, 3 },
3797 { 0x0b, HDA_INPUT, 4 },
3801 static struct hda_amp_list alc880_lg_loopbacks[] = {
3802 { 0x0b, HDA_INPUT, 1 },
3803 { 0x0b, HDA_INPUT, 6 },
3804 { 0x0b, HDA_INPUT, 7 },
3813 static int alc_init(struct hda_codec *codec)
3815 struct alc_spec *spec = codec->spec;
3819 alc_auto_init_amp(codec, spec->init_amp);
3821 for (i = 0; i < spec->num_init_verbs; i++)
3822 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3824 if (spec->init_hook)
3825 spec->init_hook(codec);
3827 hda_call_check_power_status(codec, 0x01);
3831 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3833 struct alc_spec *spec = codec->spec;
3835 if (spec->unsol_event)
3836 spec->unsol_event(codec, res);
3839 #ifdef CONFIG_SND_HDA_POWER_SAVE
3840 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3842 struct alc_spec *spec = codec->spec;
3843 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3848 * Analog playback callbacks
3850 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3851 struct hda_codec *codec,
3852 struct snd_pcm_substream *substream)
3854 struct alc_spec *spec = codec->spec;
3855 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3859 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3860 struct hda_codec *codec,
3861 unsigned int stream_tag,
3862 unsigned int format,
3863 struct snd_pcm_substream *substream)
3865 struct alc_spec *spec = codec->spec;
3866 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3867 stream_tag, format, substream);
3870 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3871 struct hda_codec *codec,
3872 struct snd_pcm_substream *substream)
3874 struct alc_spec *spec = codec->spec;
3875 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3881 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3882 struct hda_codec *codec,
3883 struct snd_pcm_substream *substream)
3885 struct alc_spec *spec = codec->spec;
3886 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3889 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3890 struct hda_codec *codec,
3891 unsigned int stream_tag,
3892 unsigned int format,
3893 struct snd_pcm_substream *substream)
3895 struct alc_spec *spec = codec->spec;
3896 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3897 stream_tag, format, substream);
3900 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3901 struct hda_codec *codec,
3902 struct snd_pcm_substream *substream)
3904 struct alc_spec *spec = codec->spec;
3905 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
3908 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3909 struct hda_codec *codec,
3910 struct snd_pcm_substream *substream)
3912 struct alc_spec *spec = codec->spec;
3913 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3919 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3920 struct hda_codec *codec,
3921 unsigned int stream_tag,
3922 unsigned int format,
3923 struct snd_pcm_substream *substream)
3925 struct alc_spec *spec = codec->spec;
3927 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3928 stream_tag, 0, format);
3932 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3933 struct hda_codec *codec,
3934 struct snd_pcm_substream *substream)
3936 struct alc_spec *spec = codec->spec;
3938 snd_hda_codec_cleanup_stream(codec,
3939 spec->adc_nids[substream->number + 1]);
3943 /* analog capture with dynamic dual-adc changes */
3944 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3945 struct hda_codec *codec,
3946 unsigned int stream_tag,
3947 unsigned int format,
3948 struct snd_pcm_substream *substream)
3950 struct alc_spec *spec = codec->spec;
3951 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3952 spec->cur_adc_stream_tag = stream_tag;
3953 spec->cur_adc_format = format;
3954 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3958 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3959 struct hda_codec *codec,
3960 struct snd_pcm_substream *substream)
3962 struct alc_spec *spec = codec->spec;
3963 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3968 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3972 .nid = 0, /* fill later */
3974 .prepare = dualmic_capture_pcm_prepare,
3975 .cleanup = dualmic_capture_pcm_cleanup
3981 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3985 /* NID is set in alc_build_pcms */
3987 .open = alc880_playback_pcm_open,
3988 .prepare = alc880_playback_pcm_prepare,
3989 .cleanup = alc880_playback_pcm_cleanup
3993 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3997 /* NID is set in alc_build_pcms */
4000 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
4004 /* NID is set in alc_build_pcms */
4007 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
4008 .substreams = 2, /* can be overridden */
4011 /* NID is set in alc_build_pcms */
4013 .prepare = alc880_alt_capture_pcm_prepare,
4014 .cleanup = alc880_alt_capture_pcm_cleanup
4018 static struct hda_pcm_stream alc880_pcm_digital_playback = {
4022 /* NID is set in alc_build_pcms */
4024 .open = alc880_dig_playback_pcm_open,
4025 .close = alc880_dig_playback_pcm_close,
4026 .prepare = alc880_dig_playback_pcm_prepare,
4027 .cleanup = alc880_dig_playback_pcm_cleanup
4031 static struct hda_pcm_stream alc880_pcm_digital_capture = {
4035 /* NID is set in alc_build_pcms */
4038 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
4039 static struct hda_pcm_stream alc_pcm_null_stream = {
4045 static int alc_build_pcms(struct hda_codec *codec)
4047 struct alc_spec *spec = codec->spec;
4048 struct hda_pcm *info = spec->pcm_rec;
4051 codec->num_pcms = 1;
4052 codec->pcm_info = info;
4054 if (spec->no_analog)
4057 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4058 "%s Analog", codec->chip_name);
4059 info->name = spec->stream_name_analog;
4061 if (spec->stream_analog_playback) {
4062 if (snd_BUG_ON(!spec->multiout.dac_nids))
4064 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4065 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4067 if (spec->stream_analog_capture) {
4068 if (snd_BUG_ON(!spec->adc_nids))
4070 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4071 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4074 if (spec->channel_mode) {
4075 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4076 for (i = 0; i < spec->num_channel_mode; i++) {
4077 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4078 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4084 /* SPDIF for stream index #1 */
4085 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4086 snprintf(spec->stream_name_digital,
4087 sizeof(spec->stream_name_digital),
4088 "%s Digital", codec->chip_name);
4089 codec->num_pcms = 2;
4090 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4091 info = spec->pcm_rec + 1;
4092 info->name = spec->stream_name_digital;
4093 if (spec->dig_out_type)
4094 info->pcm_type = spec->dig_out_type;
4096 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4097 if (spec->multiout.dig_out_nid &&
4098 spec->stream_digital_playback) {
4099 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4100 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4102 if (spec->dig_in_nid &&
4103 spec->stream_digital_capture) {
4104 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4105 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4107 /* FIXME: do we need this for all Realtek codec models? */
4108 codec->spdif_status_reset = 1;
4111 if (spec->no_analog)
4114 /* If the use of more than one ADC is requested for the current
4115 * model, configure a second analog capture-only PCM.
4117 /* Additional Analaog capture for index #2 */
4118 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4119 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4120 codec->num_pcms = 3;
4121 info = spec->pcm_rec + 2;
4122 info->name = spec->stream_name_analog;
4123 if (spec->alt_dac_nid) {
4124 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4125 *spec->stream_analog_alt_playback;
4126 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4129 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4130 alc_pcm_null_stream;
4131 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4133 if (spec->num_adc_nids > 1) {
4134 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4135 *spec->stream_analog_alt_capture;
4136 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4138 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4139 spec->num_adc_nids - 1;
4141 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4142 alc_pcm_null_stream;
4143 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4150 static inline void alc_shutup(struct hda_codec *codec)
4152 snd_hda_shutup_pins(codec);
4155 static void alc_free_kctls(struct hda_codec *codec)
4157 struct alc_spec *spec = codec->spec;
4159 if (spec->kctls.list) {
4160 struct snd_kcontrol_new *kctl = spec->kctls.list;
4162 for (i = 0; i < spec->kctls.used; i++)
4163 kfree(kctl[i].name);
4165 snd_array_free(&spec->kctls);
4168 static void alc_free(struct hda_codec *codec)
4170 struct alc_spec *spec = codec->spec;
4176 alc_free_kctls(codec);
4178 snd_hda_detach_beep_device(codec);
4181 #ifdef CONFIG_SND_HDA_POWER_SAVE
4182 static void alc_power_eapd(struct hda_codec *codec)
4184 /* We currently only handle front, HP */
4185 switch (codec->vendor_id) {
4187 set_eapd(codec, 0x0f, 0);
4188 set_eapd(codec, 0x10, 0);
4201 set_eapd(codec, 0x14, 0);
4202 set_eapd(codec, 0x15, 0);
4207 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4209 struct alc_spec *spec = codec->spec;
4211 if (spec && spec->power_hook)
4212 spec->power_hook(codec);
4217 #ifdef SND_HDA_NEEDS_RESUME
4218 static int alc_resume(struct hda_codec *codec)
4220 codec->patch_ops.init(codec);
4221 snd_hda_codec_resume_amp(codec);
4222 snd_hda_codec_resume_cache(codec);
4223 hda_call_check_power_status(codec, 0x01);
4230 static struct hda_codec_ops alc_patch_ops = {
4231 .build_controls = alc_build_controls,
4232 .build_pcms = alc_build_pcms,
4235 .unsol_event = alc_unsol_event,
4236 #ifdef SND_HDA_NEEDS_RESUME
4237 .resume = alc_resume,
4239 #ifdef CONFIG_SND_HDA_POWER_SAVE
4240 .suspend = alc_suspend,
4241 .check_power_status = alc_check_power_status,
4243 .reboot_notify = alc_shutup,
4246 /* replace the codec chip_name with the given string */
4247 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4249 kfree(codec->chip_name);
4250 codec->chip_name = kstrdup(name, GFP_KERNEL);
4251 if (!codec->chip_name) {
4259 * Test configuration for debugging
4261 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4264 #ifdef CONFIG_SND_DEBUG
4265 static hda_nid_t alc880_test_dac_nids[4] = {
4266 0x02, 0x03, 0x04, 0x05
4269 static struct hda_input_mux alc880_test_capture_source = {
4278 { "Surround", 0x6 },
4282 static struct hda_channel_mode alc880_test_modes[4] = {
4289 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4290 struct snd_ctl_elem_info *uinfo)
4292 static char *texts[] = {
4293 "N/A", "Line Out", "HP Out",
4294 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4296 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4298 uinfo->value.enumerated.items = 8;
4299 if (uinfo->value.enumerated.item >= 8)
4300 uinfo->value.enumerated.item = 7;
4301 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4305 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4306 struct snd_ctl_elem_value *ucontrol)
4308 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4309 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4310 unsigned int pin_ctl, item = 0;
4312 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4313 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4314 if (pin_ctl & AC_PINCTL_OUT_EN) {
4315 if (pin_ctl & AC_PINCTL_HP_EN)
4319 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4320 switch (pin_ctl & AC_PINCTL_VREFEN) {
4321 case AC_PINCTL_VREF_HIZ: item = 3; break;
4322 case AC_PINCTL_VREF_50: item = 4; break;
4323 case AC_PINCTL_VREF_GRD: item = 5; break;
4324 case AC_PINCTL_VREF_80: item = 6; break;
4325 case AC_PINCTL_VREF_100: item = 7; break;
4328 ucontrol->value.enumerated.item[0] = item;
4332 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4333 struct snd_ctl_elem_value *ucontrol)
4335 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4336 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4337 static unsigned int ctls[] = {
4338 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4339 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4340 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4341 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4342 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4343 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4345 unsigned int old_ctl, new_ctl;
4347 old_ctl = snd_hda_codec_read(codec, nid, 0,
4348 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4349 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4350 if (old_ctl != new_ctl) {
4352 snd_hda_codec_write_cache(codec, nid, 0,
4353 AC_VERB_SET_PIN_WIDGET_CONTROL,
4355 val = ucontrol->value.enumerated.item[0] >= 3 ?
4357 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4364 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4365 struct snd_ctl_elem_info *uinfo)
4367 static char *texts[] = {
4368 "Front", "Surround", "CLFE", "Side"
4370 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4372 uinfo->value.enumerated.items = 4;
4373 if (uinfo->value.enumerated.item >= 4)
4374 uinfo->value.enumerated.item = 3;
4375 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4379 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4380 struct snd_ctl_elem_value *ucontrol)
4382 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4383 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4386 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4387 ucontrol->value.enumerated.item[0] = sel & 3;
4391 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4392 struct snd_ctl_elem_value *ucontrol)
4394 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4395 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4398 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4399 if (ucontrol->value.enumerated.item[0] != sel) {
4400 sel = ucontrol->value.enumerated.item[0] & 3;
4401 snd_hda_codec_write_cache(codec, nid, 0,
4402 AC_VERB_SET_CONNECT_SEL, sel);
4408 #define PIN_CTL_TEST(xname,nid) { \
4409 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4411 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4412 .info = alc_test_pin_ctl_info, \
4413 .get = alc_test_pin_ctl_get, \
4414 .put = alc_test_pin_ctl_put, \
4415 .private_value = nid \
4418 #define PIN_SRC_TEST(xname,nid) { \
4419 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4421 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4422 .info = alc_test_pin_src_info, \
4423 .get = alc_test_pin_src_get, \
4424 .put = alc_test_pin_src_put, \
4425 .private_value = nid \
4428 static struct snd_kcontrol_new alc880_test_mixer[] = {
4429 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4431 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4432 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4433 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4434 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4435 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4436 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4437 PIN_CTL_TEST("Front Pin Mode", 0x14),
4438 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4439 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4440 PIN_CTL_TEST("Side Pin Mode", 0x17),
4441 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4442 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4443 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4444 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4445 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4446 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4447 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4448 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4449 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4450 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4451 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4452 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4453 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4454 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4455 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4456 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4457 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4458 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4461 .name = "Channel Mode",
4462 .info = alc_ch_mode_info,
4463 .get = alc_ch_mode_get,
4464 .put = alc_ch_mode_put,
4469 static struct hda_verb alc880_test_init_verbs[] = {
4470 /* Unmute inputs of 0x0c - 0x0f */
4471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4472 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4474 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4476 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4477 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4478 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4479 /* Vol output for 0x0c-0x0f */
4480 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4481 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4482 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4484 /* Set output pins 0x14-0x17 */
4485 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4486 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4487 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4488 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4489 /* Unmute output pins 0x14-0x17 */
4490 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4491 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4493 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4494 /* Set input pins 0x18-0x1c */
4495 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4496 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4497 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4498 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4499 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4500 /* Mute input pins 0x18-0x1b */
4501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4503 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4504 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4507 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4508 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4509 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4510 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4511 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4512 /* Analog input/passthru */
4513 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4514 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4515 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4516 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4517 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4525 static const char *alc880_models[ALC880_MODEL_LAST] = {
4526 [ALC880_3ST] = "3stack",
4527 [ALC880_TCL_S700] = "tcl",
4528 [ALC880_3ST_DIG] = "3stack-digout",
4529 [ALC880_CLEVO] = "clevo",
4530 [ALC880_5ST] = "5stack",
4531 [ALC880_5ST_DIG] = "5stack-digout",
4532 [ALC880_W810] = "w810",
4533 [ALC880_Z71V] = "z71v",
4534 [ALC880_6ST] = "6stack",
4535 [ALC880_6ST_DIG] = "6stack-digout",
4536 [ALC880_ASUS] = "asus",
4537 [ALC880_ASUS_W1V] = "asus-w1v",
4538 [ALC880_ASUS_DIG] = "asus-dig",
4539 [ALC880_ASUS_DIG2] = "asus-dig2",
4540 [ALC880_UNIWILL_DIG] = "uniwill",
4541 [ALC880_UNIWILL_P53] = "uniwill-p53",
4542 [ALC880_FUJITSU] = "fujitsu",
4543 [ALC880_F1734] = "F1734",
4545 [ALC880_LG_LW] = "lg-lw",
4546 [ALC880_MEDION_RIM] = "medion",
4547 #ifdef CONFIG_SND_DEBUG
4548 [ALC880_TEST] = "test",
4550 [ALC880_AUTO] = "auto",
4553 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4554 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4555 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4556 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4557 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4558 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4559 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4560 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4561 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4562 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4563 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4564 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4565 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4566 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4567 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4568 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4569 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4570 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4571 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4572 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4573 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4574 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4575 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4576 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4577 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4578 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4579 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4580 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4581 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4582 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4583 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4584 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4585 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4586 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4587 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4588 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4589 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4590 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4591 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4592 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4593 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4594 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4595 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4596 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4597 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4598 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4599 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4600 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4601 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4602 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4603 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4604 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4605 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4606 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4607 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4608 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4609 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4610 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4611 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4612 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4613 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4614 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4615 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4616 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4617 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4618 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4619 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4620 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4621 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4623 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4624 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4625 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4630 * ALC880 codec presets
4632 static struct alc_config_preset alc880_presets[] = {
4634 .mixers = { alc880_three_stack_mixer },
4635 .init_verbs = { alc880_volume_init_verbs,
4636 alc880_pin_3stack_init_verbs },
4637 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4638 .dac_nids = alc880_dac_nids,
4639 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4640 .channel_mode = alc880_threestack_modes,
4642 .input_mux = &alc880_capture_source,
4644 [ALC880_3ST_DIG] = {
4645 .mixers = { alc880_three_stack_mixer },
4646 .init_verbs = { alc880_volume_init_verbs,
4647 alc880_pin_3stack_init_verbs },
4648 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4649 .dac_nids = alc880_dac_nids,
4650 .dig_out_nid = ALC880_DIGOUT_NID,
4651 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4652 .channel_mode = alc880_threestack_modes,
4654 .input_mux = &alc880_capture_source,
4656 [ALC880_TCL_S700] = {
4657 .mixers = { alc880_tcl_s700_mixer },
4658 .init_verbs = { alc880_volume_init_verbs,
4659 alc880_pin_tcl_S700_init_verbs,
4660 alc880_gpio2_init_verbs },
4661 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4662 .dac_nids = alc880_dac_nids,
4663 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4664 .num_adc_nids = 1, /* single ADC */
4666 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4667 .channel_mode = alc880_2_jack_modes,
4668 .input_mux = &alc880_capture_source,
4671 .mixers = { alc880_three_stack_mixer,
4672 alc880_five_stack_mixer},
4673 .init_verbs = { alc880_volume_init_verbs,
4674 alc880_pin_5stack_init_verbs },
4675 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4676 .dac_nids = alc880_dac_nids,
4677 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4678 .channel_mode = alc880_fivestack_modes,
4679 .input_mux = &alc880_capture_source,
4681 [ALC880_5ST_DIG] = {
4682 .mixers = { alc880_three_stack_mixer,
4683 alc880_five_stack_mixer },
4684 .init_verbs = { alc880_volume_init_verbs,
4685 alc880_pin_5stack_init_verbs },
4686 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4687 .dac_nids = alc880_dac_nids,
4688 .dig_out_nid = ALC880_DIGOUT_NID,
4689 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4690 .channel_mode = alc880_fivestack_modes,
4691 .input_mux = &alc880_capture_source,
4694 .mixers = { alc880_six_stack_mixer },
4695 .init_verbs = { alc880_volume_init_verbs,
4696 alc880_pin_6stack_init_verbs },
4697 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4698 .dac_nids = alc880_6st_dac_nids,
4699 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4700 .channel_mode = alc880_sixstack_modes,
4701 .input_mux = &alc880_6stack_capture_source,
4703 [ALC880_6ST_DIG] = {
4704 .mixers = { alc880_six_stack_mixer },
4705 .init_verbs = { alc880_volume_init_verbs,
4706 alc880_pin_6stack_init_verbs },
4707 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4708 .dac_nids = alc880_6st_dac_nids,
4709 .dig_out_nid = ALC880_DIGOUT_NID,
4710 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4711 .channel_mode = alc880_sixstack_modes,
4712 .input_mux = &alc880_6stack_capture_source,
4715 .mixers = { alc880_w810_base_mixer },
4716 .init_verbs = { alc880_volume_init_verbs,
4717 alc880_pin_w810_init_verbs,
4718 alc880_gpio2_init_verbs },
4719 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4720 .dac_nids = alc880_w810_dac_nids,
4721 .dig_out_nid = ALC880_DIGOUT_NID,
4722 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4723 .channel_mode = alc880_w810_modes,
4724 .input_mux = &alc880_capture_source,
4727 .mixers = { alc880_z71v_mixer },
4728 .init_verbs = { alc880_volume_init_verbs,
4729 alc880_pin_z71v_init_verbs },
4730 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4731 .dac_nids = alc880_z71v_dac_nids,
4732 .dig_out_nid = ALC880_DIGOUT_NID,
4734 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4735 .channel_mode = alc880_2_jack_modes,
4736 .input_mux = &alc880_capture_source,
4739 .mixers = { alc880_f1734_mixer },
4740 .init_verbs = { alc880_volume_init_verbs,
4741 alc880_pin_f1734_init_verbs },
4742 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4743 .dac_nids = alc880_f1734_dac_nids,
4745 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4746 .channel_mode = alc880_2_jack_modes,
4747 .input_mux = &alc880_f1734_capture_source,
4748 .unsol_event = alc880_uniwill_p53_unsol_event,
4749 .setup = alc880_uniwill_p53_setup,
4750 .init_hook = alc_automute_amp,
4753 .mixers = { alc880_asus_mixer },
4754 .init_verbs = { alc880_volume_init_verbs,
4755 alc880_pin_asus_init_verbs,
4756 alc880_gpio1_init_verbs },
4757 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4758 .dac_nids = alc880_asus_dac_nids,
4759 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4760 .channel_mode = alc880_asus_modes,
4762 .input_mux = &alc880_capture_source,
4764 [ALC880_ASUS_DIG] = {
4765 .mixers = { alc880_asus_mixer },
4766 .init_verbs = { alc880_volume_init_verbs,
4767 alc880_pin_asus_init_verbs,
4768 alc880_gpio1_init_verbs },
4769 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4770 .dac_nids = alc880_asus_dac_nids,
4771 .dig_out_nid = ALC880_DIGOUT_NID,
4772 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4773 .channel_mode = alc880_asus_modes,
4775 .input_mux = &alc880_capture_source,
4777 [ALC880_ASUS_DIG2] = {
4778 .mixers = { alc880_asus_mixer },
4779 .init_verbs = { alc880_volume_init_verbs,
4780 alc880_pin_asus_init_verbs,
4781 alc880_gpio2_init_verbs }, /* use GPIO2 */
4782 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4783 .dac_nids = alc880_asus_dac_nids,
4784 .dig_out_nid = ALC880_DIGOUT_NID,
4785 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4786 .channel_mode = alc880_asus_modes,
4788 .input_mux = &alc880_capture_source,
4790 [ALC880_ASUS_W1V] = {
4791 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4792 .init_verbs = { alc880_volume_init_verbs,
4793 alc880_pin_asus_init_verbs,
4794 alc880_gpio1_init_verbs },
4795 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4796 .dac_nids = alc880_asus_dac_nids,
4797 .dig_out_nid = ALC880_DIGOUT_NID,
4798 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4799 .channel_mode = alc880_asus_modes,
4801 .input_mux = &alc880_capture_source,
4803 [ALC880_UNIWILL_DIG] = {
4804 .mixers = { alc880_asus_mixer },
4805 .init_verbs = { alc880_volume_init_verbs,
4806 alc880_pin_asus_init_verbs },
4807 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4808 .dac_nids = alc880_asus_dac_nids,
4809 .dig_out_nid = ALC880_DIGOUT_NID,
4810 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4811 .channel_mode = alc880_asus_modes,
4813 .input_mux = &alc880_capture_source,
4815 [ALC880_UNIWILL] = {
4816 .mixers = { alc880_uniwill_mixer },
4817 .init_verbs = { alc880_volume_init_verbs,
4818 alc880_uniwill_init_verbs },
4819 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4820 .dac_nids = alc880_asus_dac_nids,
4821 .dig_out_nid = ALC880_DIGOUT_NID,
4822 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4823 .channel_mode = alc880_threestack_modes,
4825 .input_mux = &alc880_capture_source,
4826 .unsol_event = alc880_uniwill_unsol_event,
4827 .setup = alc880_uniwill_setup,
4828 .init_hook = alc880_uniwill_init_hook,
4830 [ALC880_UNIWILL_P53] = {
4831 .mixers = { alc880_uniwill_p53_mixer },
4832 .init_verbs = { alc880_volume_init_verbs,
4833 alc880_uniwill_p53_init_verbs },
4834 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4835 .dac_nids = alc880_asus_dac_nids,
4836 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4837 .channel_mode = alc880_threestack_modes,
4838 .input_mux = &alc880_capture_source,
4839 .unsol_event = alc880_uniwill_p53_unsol_event,
4840 .setup = alc880_uniwill_p53_setup,
4841 .init_hook = alc_automute_amp,
4843 [ALC880_FUJITSU] = {
4844 .mixers = { alc880_fujitsu_mixer },
4845 .init_verbs = { alc880_volume_init_verbs,
4846 alc880_uniwill_p53_init_verbs,
4847 alc880_beep_init_verbs },
4848 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4849 .dac_nids = alc880_dac_nids,
4850 .dig_out_nid = ALC880_DIGOUT_NID,
4851 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4852 .channel_mode = alc880_2_jack_modes,
4853 .input_mux = &alc880_capture_source,
4854 .unsol_event = alc880_uniwill_p53_unsol_event,
4855 .setup = alc880_uniwill_p53_setup,
4856 .init_hook = alc_automute_amp,
4859 .mixers = { alc880_three_stack_mixer },
4860 .init_verbs = { alc880_volume_init_verbs,
4861 alc880_pin_clevo_init_verbs },
4862 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4863 .dac_nids = alc880_dac_nids,
4865 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4866 .channel_mode = alc880_threestack_modes,
4868 .input_mux = &alc880_capture_source,
4871 .mixers = { alc880_lg_mixer },
4872 .init_verbs = { alc880_volume_init_verbs,
4873 alc880_lg_init_verbs },
4874 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4875 .dac_nids = alc880_lg_dac_nids,
4876 .dig_out_nid = ALC880_DIGOUT_NID,
4877 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4878 .channel_mode = alc880_lg_ch_modes,
4880 .input_mux = &alc880_lg_capture_source,
4881 .unsol_event = alc_automute_amp_unsol_event,
4882 .setup = alc880_lg_setup,
4883 .init_hook = alc_automute_amp,
4884 #ifdef CONFIG_SND_HDA_POWER_SAVE
4885 .loopbacks = alc880_lg_loopbacks,
4889 .mixers = { alc880_lg_lw_mixer },
4890 .init_verbs = { alc880_volume_init_verbs,
4891 alc880_lg_lw_init_verbs },
4892 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4893 .dac_nids = alc880_dac_nids,
4894 .dig_out_nid = ALC880_DIGOUT_NID,
4895 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4896 .channel_mode = alc880_lg_lw_modes,
4897 .input_mux = &alc880_lg_lw_capture_source,
4898 .unsol_event = alc_automute_amp_unsol_event,
4899 .setup = alc880_lg_lw_setup,
4900 .init_hook = alc_automute_amp,
4902 [ALC880_MEDION_RIM] = {
4903 .mixers = { alc880_medion_rim_mixer },
4904 .init_verbs = { alc880_volume_init_verbs,
4905 alc880_medion_rim_init_verbs,
4906 alc_gpio2_init_verbs },
4907 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4908 .dac_nids = alc880_dac_nids,
4909 .dig_out_nid = ALC880_DIGOUT_NID,
4910 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4911 .channel_mode = alc880_2_jack_modes,
4912 .input_mux = &alc880_medion_rim_capture_source,
4913 .unsol_event = alc880_medion_rim_unsol_event,
4914 .setup = alc880_medion_rim_setup,
4915 .init_hook = alc880_medion_rim_automute,
4917 #ifdef CONFIG_SND_DEBUG
4919 .mixers = { alc880_test_mixer },
4920 .init_verbs = { alc880_test_init_verbs },
4921 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4922 .dac_nids = alc880_test_dac_nids,
4923 .dig_out_nid = ALC880_DIGOUT_NID,
4924 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4925 .channel_mode = alc880_test_modes,
4926 .input_mux = &alc880_test_capture_source,
4932 * Automatic parse of I/O pins from the BIOS configuration
4937 ALC_CTL_WIDGET_MUTE,
4940 static struct snd_kcontrol_new alc880_control_templates[] = {
4941 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4942 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4943 HDA_BIND_MUTE(NULL, 0, 0, 0),
4946 /* add dynamic controls */
4947 static int add_control(struct alc_spec *spec, int type, const char *name,
4948 int cidx, unsigned long val)
4950 struct snd_kcontrol_new *knew;
4952 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4953 knew = snd_array_new(&spec->kctls);
4956 *knew = alc880_control_templates[type];
4957 knew->name = kstrdup(name, GFP_KERNEL);
4961 if (get_amp_nid_(val))
4962 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4963 knew->private_value = val;
4967 static int add_control_with_pfx(struct alc_spec *spec, int type,
4968 const char *pfx, const char *dir,
4969 const char *sfx, int cidx, unsigned long val)
4972 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4973 return add_control(spec, type, name, cidx, val);
4976 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4977 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
4978 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4979 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
4980 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
4981 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
4982 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
4983 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
4985 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4986 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4987 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4988 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4989 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4990 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4991 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4992 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4993 #define ALC880_PIN_CD_NID 0x1c
4995 /* fill in the dac_nids table from the parsed pin configuration */
4996 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4997 const struct auto_pin_cfg *cfg)
5003 memset(assigned, 0, sizeof(assigned));
5004 spec->multiout.dac_nids = spec->private_dac_nids;
5006 /* check the pins hardwired to audio widget */
5007 for (i = 0; i < cfg->line_outs; i++) {
5008 nid = cfg->line_out_pins[i];
5009 if (alc880_is_fixed_pin(nid)) {
5010 int idx = alc880_fixed_pin_idx(nid);
5011 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
5015 /* left pins can be connect to any audio widget */
5016 for (i = 0; i < cfg->line_outs; i++) {
5017 nid = cfg->line_out_pins[i];
5018 if (alc880_is_fixed_pin(nid))
5020 /* search for an empty channel */
5021 for (j = 0; j < cfg->line_outs; j++) {
5023 spec->multiout.dac_nids[i] =
5024 alc880_idx_to_dac(j);
5030 spec->multiout.num_dacs = cfg->line_outs;
5034 /* add playback controls from the parsed DAC table */
5035 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
5036 const struct auto_pin_cfg *cfg)
5038 static const char *chname[4] = {
5039 "Front", "Surround", NULL /*CLFE*/, "Side"
5044 for (i = 0; i < cfg->line_outs; i++) {
5045 if (!spec->multiout.dac_nids[i])
5047 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5050 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5052 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5056 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5058 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5062 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5064 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5068 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5070 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5076 if (cfg->line_outs == 1 &&
5077 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
5081 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5082 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5086 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5087 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5096 /* add playback controls for speaker and HP outputs */
5097 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5106 if (alc880_is_fixed_pin(pin)) {
5107 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5108 /* specify the DAC as the extra output */
5109 if (!spec->multiout.hp_nid)
5110 spec->multiout.hp_nid = nid;
5112 spec->multiout.extra_out_nid[0] = nid;
5113 /* control HP volume/switch on the output mixer amp */
5114 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5115 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5116 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5119 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5120 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5123 } else if (alc880_is_multi_pin(pin)) {
5124 /* set manual connection */
5125 /* we have only a switch on HP-out PIN */
5126 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5127 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5134 /* create input playback/capture controls for the given pin */
5135 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5136 const char *ctlname, int ctlidx,
5137 int idx, hda_nid_t mix_nid)
5141 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5142 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5145 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5146 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5152 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5154 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5155 return (pincap & AC_PINCAP_IN) != 0;
5158 /* create playback/capture controls for input pins */
5159 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5160 const struct auto_pin_cfg *cfg,
5162 hda_nid_t cap1, hda_nid_t cap2)
5164 struct alc_spec *spec = codec->spec;
5165 struct hda_input_mux *imux = &spec->private_imux[0];
5166 int i, err, idx, type, type_idx = 0;
5168 for (i = 0; i < cfg->num_inputs; i++) {
5172 pin = cfg->inputs[i].pin;
5173 if (!alc_is_input_pin(codec, pin))
5176 type = cfg->inputs[i].type;
5177 if (i > 0 && type == cfg->inputs[i - 1].type)
5181 label = hda_get_autocfg_input_label(codec, cfg, i);
5183 idx = get_connection_index(codec, mixer, pin);
5185 err = new_analog_input(spec, pin,
5195 idx = get_connection_index(codec, cap1, pin);
5196 if (idx < 0 && cap2)
5197 idx = get_connection_index(codec, cap2, pin);
5199 snd_hda_add_imux_item(imux, label, idx, NULL);
5204 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5205 const struct auto_pin_cfg *cfg)
5207 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5210 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5211 unsigned int pin_type)
5213 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5216 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5220 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5221 hda_nid_t nid, int pin_type,
5224 alc_set_pin_output(codec, nid, pin_type);
5225 /* need the manual connection? */
5226 if (alc880_is_multi_pin(nid)) {
5227 struct alc_spec *spec = codec->spec;
5228 int idx = alc880_multi_pin_idx(nid);
5229 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5230 AC_VERB_SET_CONNECT_SEL,
5231 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5235 static int get_pin_type(int line_out_type)
5237 if (line_out_type == AUTO_PIN_HP_OUT)
5243 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5245 struct alc_spec *spec = codec->spec;
5248 for (i = 0; i < spec->autocfg.line_outs; i++) {
5249 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5250 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5251 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5255 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5257 struct alc_spec *spec = codec->spec;
5260 pin = spec->autocfg.speaker_pins[0];
5261 if (pin) /* connect to front */
5262 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5263 pin = spec->autocfg.hp_pins[0];
5264 if (pin) /* connect to front */
5265 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5268 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5270 struct alc_spec *spec = codec->spec;
5271 struct auto_pin_cfg *cfg = &spec->autocfg;
5274 for (i = 0; i < cfg->num_inputs; i++) {
5275 hda_nid_t nid = cfg->inputs[i].pin;
5276 if (alc_is_input_pin(codec, nid)) {
5277 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5278 if (nid != ALC880_PIN_CD_NID &&
5279 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5280 snd_hda_codec_write(codec, nid, 0,
5281 AC_VERB_SET_AMP_GAIN_MUTE,
5287 static void alc880_auto_init_input_src(struct hda_codec *codec)
5289 struct alc_spec *spec = codec->spec;
5292 for (c = 0; c < spec->num_adc_nids; c++) {
5293 unsigned int mux_idx;
5294 const struct hda_input_mux *imux;
5295 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5296 imux = &spec->input_mux[mux_idx];
5297 if (!imux->num_items && mux_idx > 0)
5298 imux = &spec->input_mux[0];
5300 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5301 AC_VERB_SET_CONNECT_SEL,
5302 imux->items[0].index);
5306 /* parse the BIOS configuration and set up the alc_spec */
5307 /* return 1 if successful, 0 if the proper config is not found,
5308 * or a negative error code
5310 static int alc880_parse_auto_config(struct hda_codec *codec)
5312 struct alc_spec *spec = codec->spec;
5314 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5316 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5320 if (!spec->autocfg.line_outs)
5321 return 0; /* can't find valid BIOS pin config */
5323 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5326 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5329 err = alc880_auto_create_extra_out(spec,
5330 spec->autocfg.speaker_pins[0],
5334 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5338 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5342 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5344 alc_auto_parse_digital(codec);
5346 if (spec->kctls.list)
5347 add_mixer(spec, spec->kctls.list);
5349 add_verb(spec, alc880_volume_init_verbs);
5351 spec->num_mux_defs = 1;
5352 spec->input_mux = &spec->private_imux[0];
5354 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5359 /* additional initialization for auto-configuration model */
5360 static void alc880_auto_init(struct hda_codec *codec)
5362 struct alc_spec *spec = codec->spec;
5363 alc880_auto_init_multi_out(codec);
5364 alc880_auto_init_extra_out(codec);
5365 alc880_auto_init_analog_input(codec);
5366 alc880_auto_init_input_src(codec);
5367 alc_auto_init_digital(codec);
5368 if (spec->unsol_event)
5369 alc_inithook(codec);
5372 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5373 * one of two digital mic pins, e.g. on ALC272
5375 static void fixup_automic_adc(struct hda_codec *codec)
5377 struct alc_spec *spec = codec->spec;
5380 for (i = 0; i < spec->num_adc_nids; i++) {
5381 hda_nid_t cap = spec->capsrc_nids ?
5382 spec->capsrc_nids[i] : spec->adc_nids[i];
5385 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5388 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5391 spec->int_mic.mux_idx = iidx;
5392 spec->ext_mic.mux_idx = eidx;
5393 if (spec->capsrc_nids)
5394 spec->capsrc_nids += i;
5395 spec->adc_nids += i;
5396 spec->num_adc_nids = 1;
5399 snd_printd(KERN_INFO "hda_codec: %s: "
5400 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5401 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5402 spec->auto_mic = 0; /* disable auto-mic to be sure */
5405 /* select or unmute the given capsrc route */
5406 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5409 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5410 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5413 snd_hda_codec_write_cache(codec, cap, 0,
5414 AC_VERB_SET_CONNECT_SEL, idx);
5418 /* set the default connection to that pin */
5419 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5421 struct alc_spec *spec = codec->spec;
5424 for (i = 0; i < spec->num_adc_nids; i++) {
5425 hda_nid_t cap = spec->capsrc_nids ?
5426 spec->capsrc_nids[i] : spec->adc_nids[i];
5429 idx = get_connection_index(codec, cap, pin);
5432 select_or_unmute_capsrc(codec, cap, idx);
5433 return i; /* return the found index */
5435 return -1; /* not found */
5438 /* choose the ADC/MUX containing the input pin and initialize the setup */
5439 static void fixup_single_adc(struct hda_codec *codec)
5441 struct alc_spec *spec = codec->spec;
5442 struct auto_pin_cfg *cfg = &spec->autocfg;
5445 /* search for the input pin; there must be only one */
5446 if (cfg->num_inputs != 1)
5448 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5450 /* use only this ADC */
5451 if (spec->capsrc_nids)
5452 spec->capsrc_nids += i;
5453 spec->adc_nids += i;
5454 spec->num_adc_nids = 1;
5458 /* initialize dual adcs */
5459 static void fixup_dual_adc_switch(struct hda_codec *codec)
5461 struct alc_spec *spec = codec->spec;
5462 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5463 init_capsrc_for_pin(codec, spec->int_mic.pin);
5466 static void set_capture_mixer(struct hda_codec *codec)
5468 struct alc_spec *spec = codec->spec;
5469 static struct snd_kcontrol_new *caps[2][3] = {
5470 { alc_capture_mixer_nosrc1,
5471 alc_capture_mixer_nosrc2,
5472 alc_capture_mixer_nosrc3 },
5473 { alc_capture_mixer1,
5475 alc_capture_mixer3 },
5477 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5479 int num_adcs = spec->num_adc_nids;
5480 if (spec->dual_adc_switch)
5481 fixup_dual_adc_switch(codec);
5482 else if (spec->auto_mic)
5483 fixup_automic_adc(codec);
5484 else if (spec->input_mux) {
5485 if (spec->input_mux->num_items > 1)
5487 else if (spec->input_mux->num_items == 1)
5488 fixup_single_adc(codec);
5490 if (spec->dual_adc_switch)
5492 spec->cap_mixer = caps[mux][num_adcs - 1];
5496 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5497 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5500 struct alc_spec *spec = codec->spec;
5501 struct auto_pin_cfg *cfg = &spec->autocfg;
5503 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5505 for (n = 0; n < num_nids; n++) {
5507 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5511 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5514 nconns = snd_hda_get_connections(codec, cap, conn,
5518 nconns = snd_hda_get_connections(codec, cap, conn,
5523 if (!fallback_adc) {
5527 for (i = 0; i < cfg->num_inputs; i++) {
5528 hda_nid_t nid = cfg->inputs[i].pin;
5529 for (j = 0; j < nconns; j++) {
5536 if (i >= cfg->num_inputs) {
5537 int num_adcs = spec->num_adc_nids;
5538 spec->private_adc_nids[num_adcs] = adc;
5539 spec->private_capsrc_nids[num_adcs] = cap;
5540 spec->num_adc_nids++;
5541 spec->adc_nids = spec->private_adc_nids;
5543 spec->capsrc_nids = spec->private_capsrc_nids;
5546 if (!spec->num_adc_nids) {
5547 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5548 " using fallback 0x%x\n",
5549 codec->chip_name, fallback_adc);
5550 spec->private_adc_nids[0] = fallback_adc;
5551 spec->adc_nids = spec->private_adc_nids;
5552 if (fallback_adc != fallback_cap) {
5553 spec->private_capsrc_nids[0] = fallback_cap;
5554 spec->capsrc_nids = spec->private_adc_nids;
5559 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5560 #define set_beep_amp(spec, nid, idx, dir) \
5561 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5563 static struct snd_pci_quirk beep_white_list[] = {
5564 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5565 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5566 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5570 static inline int has_cdefine_beep(struct hda_codec *codec)
5572 struct alc_spec *spec = codec->spec;
5573 const struct snd_pci_quirk *q;
5574 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5577 return spec->cdefine.enable_pcbeep;
5580 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5581 #define has_cdefine_beep(codec) 0
5585 * OK, here we have finally the patch for ALC880
5588 static int patch_alc880(struct hda_codec *codec)
5590 struct alc_spec *spec;
5594 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5600 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5603 if (board_config < 0) {
5604 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5606 board_config = ALC880_AUTO;
5609 if (board_config == ALC880_AUTO) {
5610 /* automatic parse from the BIOS config */
5611 err = alc880_parse_auto_config(codec);
5617 "hda_codec: Cannot set up configuration "
5618 "from BIOS. Using 3-stack mode...\n");
5619 board_config = ALC880_3ST;
5623 err = snd_hda_attach_beep_device(codec, 0x1);
5629 if (board_config != ALC880_AUTO)
5630 setup_preset(codec, &alc880_presets[board_config]);
5632 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5633 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5634 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5636 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5637 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5639 if (!spec->adc_nids && spec->input_mux) {
5640 /* check whether NID 0x07 is valid */
5641 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5643 wcap = get_wcaps_type(wcap);
5644 if (wcap != AC_WID_AUD_IN) {
5645 spec->adc_nids = alc880_adc_nids_alt;
5646 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5648 spec->adc_nids = alc880_adc_nids;
5649 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5652 set_capture_mixer(codec);
5653 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5655 spec->vmaster_nid = 0x0c;
5657 codec->patch_ops = alc_patch_ops;
5658 if (board_config == ALC880_AUTO)
5659 spec->init_hook = alc880_auto_init;
5660 #ifdef CONFIG_SND_HDA_POWER_SAVE
5661 if (!spec->loopback.amplist)
5662 spec->loopback.amplist = alc880_loopbacks;
5673 static hda_nid_t alc260_dac_nids[1] = {
5678 static hda_nid_t alc260_adc_nids[1] = {
5683 static hda_nid_t alc260_adc_nids_alt[1] = {
5688 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5689 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5691 static hda_nid_t alc260_dual_adc_nids[2] = {
5696 #define ALC260_DIGOUT_NID 0x03
5697 #define ALC260_DIGIN_NID 0x06
5699 static struct hda_input_mux alc260_capture_source = {
5703 { "Front Mic", 0x1 },
5709 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5710 * headphone jack and the internal CD lines since these are the only pins at
5711 * which audio can appear. For flexibility, also allow the option of
5712 * recording the mixer output on the second ADC (ADC0 doesn't have a
5713 * connection to the mixer output).
5715 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5719 { "Mic/Line", 0x0 },
5721 { "Headphone", 0x2 },
5727 { "Mic/Line", 0x0 },
5729 { "Headphone", 0x2 },
5736 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5737 * the Fujitsu S702x, but jacks are marked differently.
5739 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5746 { "Headphone", 0x5 },
5755 { "Headphone", 0x6 },
5761 /* Maxdata Favorit 100XS */
5762 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5766 { "Line/Mic", 0x0 },
5773 { "Line/Mic", 0x0 },
5781 * This is just place-holder, so there's something for alc_build_pcms to look
5782 * at when it calculates the maximum number of channels. ALC260 has no mixer
5783 * element which allows changing the channel mode, so the verb list is
5786 static struct hda_channel_mode alc260_modes[1] = {
5791 /* Mixer combinations
5793 * basic: base_output + input + pc_beep + capture
5794 * HP: base_output + input + capture_alt
5795 * HP_3013: hp_3013 + input + capture
5796 * fujitsu: fujitsu + capture
5797 * acer: acer + capture
5800 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5801 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5802 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5803 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5804 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5805 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5806 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5810 static struct snd_kcontrol_new alc260_input_mixer[] = {
5811 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5812 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5813 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5814 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5816 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5817 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5818 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5822 /* update HP, line and mono out pins according to the master switch */
5823 static void alc260_hp_master_update(struct hda_codec *codec,
5824 hda_nid_t hp, hda_nid_t line,
5827 struct alc_spec *spec = codec->spec;
5828 unsigned int val = spec->master_sw ? PIN_HP : 0;
5829 /* change HP and line-out pins */
5830 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5832 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5834 /* mono (speaker) depending on the HP jack sense */
5835 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5836 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5840 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5841 struct snd_ctl_elem_value *ucontrol)
5843 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5844 struct alc_spec *spec = codec->spec;
5845 *ucontrol->value.integer.value = spec->master_sw;
5849 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5850 struct snd_ctl_elem_value *ucontrol)
5852 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5853 struct alc_spec *spec = codec->spec;
5854 int val = !!*ucontrol->value.integer.value;
5855 hda_nid_t hp, line, mono;
5857 if (val == spec->master_sw)
5859 spec->master_sw = val;
5860 hp = (kcontrol->private_value >> 16) & 0xff;
5861 line = (kcontrol->private_value >> 8) & 0xff;
5862 mono = kcontrol->private_value & 0xff;
5863 alc260_hp_master_update(codec, hp, line, mono);
5867 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5870 .name = "Master Playback Switch",
5871 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5872 .info = snd_ctl_boolean_mono_info,
5873 .get = alc260_hp_master_sw_get,
5874 .put = alc260_hp_master_sw_put,
5875 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5877 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5878 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5879 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5880 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5881 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5883 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5887 static struct hda_verb alc260_hp_unsol_verbs[] = {
5888 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5892 static void alc260_hp_automute(struct hda_codec *codec)
5894 struct alc_spec *spec = codec->spec;
5896 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5897 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5900 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5902 if ((res >> 26) == ALC880_HP_EVENT)
5903 alc260_hp_automute(codec);
5906 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5908 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5909 .name = "Master Playback Switch",
5910 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5911 .info = snd_ctl_boolean_mono_info,
5912 .get = alc260_hp_master_sw_get,
5913 .put = alc260_hp_master_sw_put,
5914 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5916 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5917 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5918 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5919 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5920 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5921 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5922 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5923 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5927 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5928 .ops = &snd_hda_bind_vol,
5930 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5931 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5932 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5937 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5938 .ops = &snd_hda_bind_sw,
5940 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5941 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5946 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5947 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5948 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5949 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5954 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5959 static void alc260_hp_3013_automute(struct hda_codec *codec)
5961 struct alc_spec *spec = codec->spec;
5963 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5964 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5967 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5970 if ((res >> 26) == ALC880_HP_EVENT)
5971 alc260_hp_3013_automute(codec);
5974 static void alc260_hp_3012_automute(struct hda_codec *codec)
5976 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5978 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5980 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5982 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5986 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5989 if ((res >> 26) == ALC880_HP_EVENT)
5990 alc260_hp_3012_automute(codec);
5993 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5994 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5996 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5997 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5998 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5999 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6000 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6001 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6002 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
6003 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
6004 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
6005 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6006 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
6010 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
6011 * versions of the ALC260 don't act on requests to enable mic bias from NID
6012 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
6013 * datasheet doesn't mention this restriction. At this stage it's not clear
6014 * whether this behaviour is intentional or is a hardware bug in chip
6015 * revisions available in early 2006. Therefore for now allow the
6016 * "Headphone Jack Mode" control to span all choices, but if it turns out
6017 * that the lack of mic bias for this NID is intentional we could change the
6018 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6020 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
6021 * don't appear to make the mic bias available from the "line" jack, even
6022 * though the NID used for this jack (0x14) can supply it. The theory is
6023 * that perhaps Acer have included blocking capacitors between the ALC260
6024 * and the output jack. If this turns out to be the case for all such
6025 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
6026 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
6028 * The C20x Tablet series have a mono internal speaker which is controlled
6029 * via the chip's Mono sum widget and pin complex, so include the necessary
6030 * controls for such models. On models without a "mono speaker" the control
6031 * won't do anything.
6033 static struct snd_kcontrol_new alc260_acer_mixer[] = {
6034 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6035 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6036 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6037 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
6039 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
6041 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6042 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6044 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6045 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6046 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6047 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6048 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6052 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6054 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6055 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6056 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6057 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6058 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6059 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6060 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6064 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6065 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6067 static struct snd_kcontrol_new alc260_will_mixer[] = {
6068 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6069 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6070 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6071 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6072 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6073 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6074 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6075 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6076 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6077 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6081 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6082 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6084 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6085 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6086 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6087 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6088 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6089 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6090 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6091 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6092 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6093 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6094 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6099 * initialization verbs
6101 static struct hda_verb alc260_init_verbs[] = {
6102 /* Line In pin widget for input */
6103 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6104 /* CD pin widget for input */
6105 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6106 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6107 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6108 /* Mic2 (front panel) pin widget for input and vref at 80% */
6109 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6110 /* LINE-2 is used for line-out in rear */
6111 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6112 /* select line-out */
6113 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6115 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6117 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6119 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6120 /* mute capture amp left and right */
6121 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6122 /* set connection select to line in (default select for this ADC) */
6123 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6124 /* mute capture amp left and right */
6125 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6126 /* set connection select to line in (default select for this ADC) */
6127 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6128 /* set vol=0 Line-Out mixer amp left and right */
6129 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6130 /* unmute pin widget amp left and right (no gain on this amp) */
6131 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6132 /* set vol=0 HP mixer amp left and right */
6133 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6134 /* unmute pin widget amp left and right (no gain on this amp) */
6135 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6136 /* set vol=0 Mono mixer amp left and right */
6137 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6138 /* unmute pin widget amp left and right (no gain on this amp) */
6139 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6140 /* unmute LINE-2 out pin */
6141 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6142 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6145 /* mute analog inputs */
6146 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6147 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6148 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6149 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6150 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6151 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6152 /* mute Front out path */
6153 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6155 /* mute Headphone out path */
6156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6158 /* mute Mono out path */
6159 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6164 #if 0 /* should be identical with alc260_init_verbs? */
6165 static struct hda_verb alc260_hp_init_verbs[] = {
6166 /* Headphone and output */
6167 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6169 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6170 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6171 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6172 /* Mic2 (front panel) pin widget for input and vref at 80% */
6173 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6174 /* Line In pin widget for input */
6175 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6176 /* Line-2 pin widget for output */
6177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6178 /* CD pin widget for input */
6179 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6180 /* unmute amp left and right */
6181 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6182 /* set connection select to line in (default select for this ADC) */
6183 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6184 /* unmute Line-Out mixer amp left and right (volume = 0) */
6185 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6186 /* mute pin widget amp left and right (no gain on this amp) */
6187 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6188 /* unmute HP mixer amp left and right (volume = 0) */
6189 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6190 /* mute pin widget amp left and right (no gain on this amp) */
6191 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6192 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6195 /* mute analog inputs */
6196 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6197 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6198 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6199 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6200 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6201 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6202 /* Unmute Front out path */
6203 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6204 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6205 /* Unmute Headphone out path */
6206 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6207 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6208 /* Unmute Mono out path */
6209 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6210 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6215 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6216 /* Line out and output */
6217 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6219 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6220 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6221 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6222 /* Mic2 (front panel) pin widget for input and vref at 80% */
6223 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6224 /* Line In pin widget for input */
6225 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6226 /* Headphone pin widget for output */
6227 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6228 /* CD pin widget for input */
6229 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6230 /* unmute amp left and right */
6231 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6232 /* set connection select to line in (default select for this ADC) */
6233 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6234 /* unmute Line-Out mixer amp left and right (volume = 0) */
6235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6236 /* mute pin widget amp left and right (no gain on this amp) */
6237 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6238 /* unmute HP mixer amp left and right (volume = 0) */
6239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6240 /* mute pin widget amp left and right (no gain on this amp) */
6241 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6242 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6245 /* mute analog inputs */
6246 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6247 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6248 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6249 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6250 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6251 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6252 /* Unmute Front out path */
6253 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6254 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6255 /* Unmute Headphone out path */
6256 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6257 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6258 /* Unmute Mono out path */
6259 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6260 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6264 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6265 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6266 * audio = 0x16, internal speaker = 0x10.
6268 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6269 /* Disable all GPIOs */
6270 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6271 /* Internal speaker is connected to headphone pin */
6272 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6273 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6274 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6275 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6276 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6277 /* Ensure all other unused pins are disabled and muted. */
6278 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6280 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6281 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6283 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6287 /* Disable digital (SPDIF) pins */
6288 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6289 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6291 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6292 * when acting as an output.
6294 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6296 /* Start with output sum widgets muted and their output gains at min */
6297 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6298 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6299 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6300 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6301 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6303 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6304 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6305 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6307 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6308 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6309 /* Unmute Line1 pin widget output buffer since it starts as an output.
6310 * If the pin mode is changed by the user the pin mode control will
6311 * take care of enabling the pin's input/output buffers as needed.
6312 * Therefore there's no need to enable the input buffer at this
6315 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6316 /* Unmute input buffer of pin widget used for Line-in (no equiv
6319 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6321 /* Mute capture amp left and right */
6322 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6323 /* Set ADC connection select to match default mixer setting - line
6326 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6328 /* Do the same for the second ADC: mute capture input amp and
6329 * set ADC connection to line in (on mic1 pin)
6331 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6332 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6334 /* Mute all inputs to mixer widget (even unconnected ones) */
6335 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6336 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6337 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6338 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6339 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6340 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6341 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6342 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6347 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6348 * similar laptops (adapted from Fujitsu init verbs).
6350 static struct hda_verb alc260_acer_init_verbs[] = {
6351 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6352 * the headphone jack. Turn this on and rely on the standard mute
6353 * methods whenever the user wants to turn these outputs off.
6355 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6356 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6357 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6358 /* Internal speaker/Headphone jack is connected to Line-out pin */
6359 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6360 /* Internal microphone/Mic jack is connected to Mic1 pin */
6361 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6362 /* Line In jack is connected to Line1 pin */
6363 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6364 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6365 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6366 /* Ensure all other unused pins are disabled and muted. */
6367 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6368 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6369 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6370 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6371 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6372 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6373 /* Disable digital (SPDIF) pins */
6374 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6375 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6377 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6378 * bus when acting as outputs.
6380 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6381 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6383 /* Start with output sum widgets muted and their output gains at min */
6384 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6385 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6386 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6387 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6388 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6389 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6390 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6391 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6392 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6394 /* Unmute Line-out pin widget amp left and right
6395 * (no equiv mixer ctrl)
6397 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6398 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6399 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6400 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6401 * inputs. If the pin mode is changed by the user the pin mode control
6402 * will take care of enabling the pin's input/output buffers as needed.
6403 * Therefore there's no need to enable the input buffer at this
6406 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6407 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6409 /* Mute capture amp left and right */
6410 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6411 /* Set ADC connection select to match default mixer setting - mic
6414 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6416 /* Do similar with the second ADC: mute capture input amp and
6417 * set ADC connection to mic to match ALSA's default state.
6419 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6420 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6422 /* Mute all inputs to mixer widget (even unconnected ones) */
6423 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6424 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6425 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6426 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6427 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6428 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6429 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6430 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6435 /* Initialisation sequence for Maxdata Favorit 100XS
6436 * (adapted from Acer init verbs).
6438 static struct hda_verb alc260_favorit100_init_verbs[] = {
6439 /* GPIO 0 enables the output jack.
6440 * Turn this on and rely on the standard mute
6441 * methods whenever the user wants to turn these outputs off.
6443 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6444 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6445 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6446 /* Line/Mic input jack is connected to Mic1 pin */
6447 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6448 /* Ensure all other unused pins are disabled and muted. */
6449 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6450 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6451 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6452 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6453 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6454 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6455 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6456 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6457 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6458 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6459 /* Disable digital (SPDIF) pins */
6460 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6461 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6463 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6464 * bus when acting as outputs.
6466 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6467 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6469 /* Start with output sum widgets muted and their output gains at min */
6470 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6471 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6472 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6473 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6474 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6475 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6476 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6477 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6478 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6480 /* Unmute Line-out pin widget amp left and right
6481 * (no equiv mixer ctrl)
6483 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6484 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6485 * inputs. If the pin mode is changed by the user the pin mode control
6486 * will take care of enabling the pin's input/output buffers as needed.
6487 * Therefore there's no need to enable the input buffer at this
6490 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6492 /* Mute capture amp left and right */
6493 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6494 /* Set ADC connection select to match default mixer setting - mic
6497 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6499 /* Do similar with the second ADC: mute capture input amp and
6500 * set ADC connection to mic to match ALSA's default state.
6502 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6503 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6505 /* Mute all inputs to mixer widget (even unconnected ones) */
6506 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6507 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6508 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6509 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6510 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6511 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6512 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6513 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6518 static struct hda_verb alc260_will_verbs[] = {
6519 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6520 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6521 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6522 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6523 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6524 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6528 static struct hda_verb alc260_replacer_672v_verbs[] = {
6529 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6530 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6531 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6533 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6534 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6535 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6537 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6541 /* toggle speaker-output according to the hp-jack state */
6542 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6544 unsigned int present;
6546 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6547 present = snd_hda_jack_detect(codec, 0x0f);
6549 snd_hda_codec_write_cache(codec, 0x01, 0,
6550 AC_VERB_SET_GPIO_DATA, 1);
6551 snd_hda_codec_write_cache(codec, 0x0f, 0,
6552 AC_VERB_SET_PIN_WIDGET_CONTROL,
6555 snd_hda_codec_write_cache(codec, 0x01, 0,
6556 AC_VERB_SET_GPIO_DATA, 0);
6557 snd_hda_codec_write_cache(codec, 0x0f, 0,
6558 AC_VERB_SET_PIN_WIDGET_CONTROL,
6563 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6566 if ((res >> 26) == ALC880_HP_EVENT)
6567 alc260_replacer_672v_automute(codec);
6570 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6571 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6572 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6573 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6574 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6575 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6576 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6577 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6578 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6579 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6580 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6584 /* Test configuration for debugging, modelled after the ALC880 test
6587 #ifdef CONFIG_SND_DEBUG
6588 static hda_nid_t alc260_test_dac_nids[1] = {
6591 static hda_nid_t alc260_test_adc_nids[2] = {
6594 /* For testing the ALC260, each input MUX needs its own definition since
6595 * the signal assignments are different. This assumes that the first ADC
6598 static struct hda_input_mux alc260_test_capture_sources[2] = {
6602 { "MIC1 pin", 0x0 },
6603 { "MIC2 pin", 0x1 },
6604 { "LINE1 pin", 0x2 },
6605 { "LINE2 pin", 0x3 },
6607 { "LINE-OUT pin", 0x5 },
6608 { "HP-OUT pin", 0x6 },
6614 { "MIC1 pin", 0x0 },
6615 { "MIC2 pin", 0x1 },
6616 { "LINE1 pin", 0x2 },
6617 { "LINE2 pin", 0x3 },
6620 { "LINE-OUT pin", 0x6 },
6621 { "HP-OUT pin", 0x7 },
6625 static struct snd_kcontrol_new alc260_test_mixer[] = {
6626 /* Output driver widgets */
6627 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6628 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6629 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6630 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6631 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6632 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6634 /* Modes for retasking pin widgets
6635 * Note: the ALC260 doesn't seem to act on requests to enable mic
6636 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6637 * mention this restriction. At this stage it's not clear whether
6638 * this behaviour is intentional or is a hardware bug in chip
6639 * revisions available at least up until early 2006. Therefore for
6640 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6641 * choices, but if it turns out that the lack of mic bias for these
6642 * NIDs is intentional we could change their modes from
6643 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6645 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6646 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6647 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6648 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6649 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6650 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6652 /* Loopback mixer controls */
6653 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6654 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6655 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6656 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6657 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6658 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6659 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6660 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6661 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6662 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6663 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6664 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6665 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6666 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6668 /* Controls for GPIO pins, assuming they are configured as outputs */
6669 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6670 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6671 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6672 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6674 /* Switches to allow the digital IO pins to be enabled. The datasheet
6675 * is ambigious as to which NID is which; testing on laptops which
6676 * make this output available should provide clarification.
6678 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6679 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6681 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6682 * this output to turn on an external amplifier.
6684 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6685 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6689 static struct hda_verb alc260_test_init_verbs[] = {
6690 /* Enable all GPIOs as outputs with an initial value of 0 */
6691 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6692 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6693 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6695 /* Enable retasking pins as output, initially without power amp */
6696 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6697 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6698 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6699 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6700 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6701 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6703 /* Disable digital (SPDIF) pins initially, but users can enable
6704 * them via a mixer switch. In the case of SPDIF-out, this initverb
6705 * payload also sets the generation to 0, output to be in "consumer"
6706 * PCM format, copyright asserted, no pre-emphasis and no validity
6709 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6710 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6712 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6713 * OUT1 sum bus when acting as an output.
6715 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6716 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6717 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6718 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6720 /* Start with output sum widgets muted and their output gains at min */
6721 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6722 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6723 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6724 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6725 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6726 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6727 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6728 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6729 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6731 /* Unmute retasking pin widget output buffers since the default
6732 * state appears to be output. As the pin mode is changed by the
6733 * user the pin mode control will take care of enabling the pin's
6734 * input/output buffers as needed.
6736 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6738 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6739 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6740 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6741 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6742 /* Also unmute the mono-out pin widget */
6743 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6745 /* Mute capture amp left and right */
6746 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6747 /* Set ADC connection select to match default mixer setting (mic1
6750 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6752 /* Do the same for the second ADC: mute capture input amp and
6753 * set ADC connection to mic1 pin
6755 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6756 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6758 /* Mute all inputs to mixer widget (even unconnected ones) */
6759 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6760 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6761 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6762 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6763 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6764 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6765 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6766 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6772 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6773 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6775 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6776 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6779 * for BIOS auto-configuration
6782 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6783 const char *pfx, int *vol_bits)
6786 unsigned long vol_val, sw_val;
6789 if (nid >= 0x0f && nid < 0x11) {
6790 nid_vol = nid - 0x7;
6791 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6792 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6793 } else if (nid == 0x11) {
6794 nid_vol = nid - 0x7;
6795 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6796 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6797 } else if (nid >= 0x12 && nid <= 0x15) {
6799 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6800 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6804 if (!(*vol_bits & (1 << nid_vol))) {
6805 /* first control for the volume widget */
6806 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6809 *vol_bits |= (1 << nid_vol);
6811 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6817 /* add playback controls from the parsed DAC table */
6818 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6819 const struct auto_pin_cfg *cfg)
6825 spec->multiout.num_dacs = 1;
6826 spec->multiout.dac_nids = spec->private_dac_nids;
6827 spec->multiout.dac_nids[0] = 0x02;
6829 nid = cfg->line_out_pins[0];
6832 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6834 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6838 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6843 nid = cfg->speaker_pins[0];
6845 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6850 nid = cfg->hp_pins[0];
6852 err = alc260_add_playback_controls(spec, nid, "Headphone",
6860 /* create playback/capture controls for input pins */
6861 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6862 const struct auto_pin_cfg *cfg)
6864 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6867 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6868 hda_nid_t nid, int pin_type,
6871 alc_set_pin_output(codec, nid, pin_type);
6872 /* need the manual connection? */
6874 int idx = nid - 0x12;
6875 snd_hda_codec_write(codec, idx + 0x0b, 0,
6876 AC_VERB_SET_CONNECT_SEL, sel_idx);
6880 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6882 struct alc_spec *spec = codec->spec;
6885 nid = spec->autocfg.line_out_pins[0];
6887 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6888 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6891 nid = spec->autocfg.speaker_pins[0];
6893 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6895 nid = spec->autocfg.hp_pins[0];
6897 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6900 #define ALC260_PIN_CD_NID 0x16
6901 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6903 struct alc_spec *spec = codec->spec;
6904 struct auto_pin_cfg *cfg = &spec->autocfg;
6907 for (i = 0; i < cfg->num_inputs; i++) {
6908 hda_nid_t nid = cfg->inputs[i].pin;
6910 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6911 if (nid != ALC260_PIN_CD_NID &&
6912 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6913 snd_hda_codec_write(codec, nid, 0,
6914 AC_VERB_SET_AMP_GAIN_MUTE,
6920 #define alc260_auto_init_input_src alc880_auto_init_input_src
6923 * generic initialization of ADC, input mixers and output mixers
6925 static struct hda_verb alc260_volume_init_verbs[] = {
6927 * Unmute ADC0-1 and set the default input to mic-in
6929 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6930 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6931 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6932 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6934 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6936 * Note: PASD motherboards uses the Line In 2 as the input for
6937 * front panel mic (mic 2)
6939 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6940 /* mute analog inputs */
6941 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6942 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6943 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6944 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6945 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6948 * Set up output mixers (0x08 - 0x0a)
6950 /* set vol=0 to output mixers */
6951 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6952 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6953 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6954 /* set up input amps for analog loopback */
6955 /* Amp Indices: DAC = 0, mixer = 1 */
6956 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6957 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6958 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6959 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6960 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6961 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6966 static int alc260_parse_auto_config(struct hda_codec *codec)
6968 struct alc_spec *spec = codec->spec;
6970 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6972 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6976 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6979 if (!spec->kctls.list)
6980 return 0; /* can't find valid BIOS pin config */
6981 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6985 spec->multiout.max_channels = 2;
6987 if (spec->autocfg.dig_outs)
6988 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6989 if (spec->kctls.list)
6990 add_mixer(spec, spec->kctls.list);
6992 add_verb(spec, alc260_volume_init_verbs);
6994 spec->num_mux_defs = 1;
6995 spec->input_mux = &spec->private_imux[0];
6997 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
7002 /* additional initialization for auto-configuration model */
7003 static void alc260_auto_init(struct hda_codec *codec)
7005 struct alc_spec *spec = codec->spec;
7006 alc260_auto_init_multi_out(codec);
7007 alc260_auto_init_analog_input(codec);
7008 alc260_auto_init_input_src(codec);
7009 alc_auto_init_digital(codec);
7010 if (spec->unsol_event)
7011 alc_inithook(codec);
7014 #ifdef CONFIG_SND_HDA_POWER_SAVE
7015 static struct hda_amp_list alc260_loopbacks[] = {
7016 { 0x07, HDA_INPUT, 0 },
7017 { 0x07, HDA_INPUT, 1 },
7018 { 0x07, HDA_INPUT, 2 },
7019 { 0x07, HDA_INPUT, 3 },
7020 { 0x07, HDA_INPUT, 4 },
7032 static const struct alc_fixup alc260_fixups[] = {
7033 [PINFIX_HP_DC5750] = {
7034 .pins = (const struct alc_pincfg[]) {
7035 { 0x11, 0x90130110 }, /* speaker */
7041 static struct snd_pci_quirk alc260_fixup_tbl[] = {
7042 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
7047 * ALC260 configurations
7049 static const char *alc260_models[ALC260_MODEL_LAST] = {
7050 [ALC260_BASIC] = "basic",
7052 [ALC260_HP_3013] = "hp-3013",
7053 [ALC260_HP_DC7600] = "hp-dc7600",
7054 [ALC260_FUJITSU_S702X] = "fujitsu",
7055 [ALC260_ACER] = "acer",
7056 [ALC260_WILL] = "will",
7057 [ALC260_REPLACER_672V] = "replacer",
7058 [ALC260_FAVORIT100] = "favorit100",
7059 #ifdef CONFIG_SND_DEBUG
7060 [ALC260_TEST] = "test",
7062 [ALC260_AUTO] = "auto",
7065 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7066 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7067 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7068 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7069 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7070 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7071 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7072 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7073 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7074 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7075 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7076 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7077 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7078 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7079 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7080 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7081 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7082 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7083 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7084 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7085 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7089 static struct alc_config_preset alc260_presets[] = {
7091 .mixers = { alc260_base_output_mixer,
7092 alc260_input_mixer },
7093 .init_verbs = { alc260_init_verbs },
7094 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7095 .dac_nids = alc260_dac_nids,
7096 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7097 .adc_nids = alc260_dual_adc_nids,
7098 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7099 .channel_mode = alc260_modes,
7100 .input_mux = &alc260_capture_source,
7103 .mixers = { alc260_hp_output_mixer,
7104 alc260_input_mixer },
7105 .init_verbs = { alc260_init_verbs,
7106 alc260_hp_unsol_verbs },
7107 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7108 .dac_nids = alc260_dac_nids,
7109 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7110 .adc_nids = alc260_adc_nids_alt,
7111 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7112 .channel_mode = alc260_modes,
7113 .input_mux = &alc260_capture_source,
7114 .unsol_event = alc260_hp_unsol_event,
7115 .init_hook = alc260_hp_automute,
7117 [ALC260_HP_DC7600] = {
7118 .mixers = { alc260_hp_dc7600_mixer,
7119 alc260_input_mixer },
7120 .init_verbs = { alc260_init_verbs,
7121 alc260_hp_dc7600_verbs },
7122 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7123 .dac_nids = alc260_dac_nids,
7124 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7125 .adc_nids = alc260_adc_nids_alt,
7126 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7127 .channel_mode = alc260_modes,
7128 .input_mux = &alc260_capture_source,
7129 .unsol_event = alc260_hp_3012_unsol_event,
7130 .init_hook = alc260_hp_3012_automute,
7132 [ALC260_HP_3013] = {
7133 .mixers = { alc260_hp_3013_mixer,
7134 alc260_input_mixer },
7135 .init_verbs = { alc260_hp_3013_init_verbs,
7136 alc260_hp_3013_unsol_verbs },
7137 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7138 .dac_nids = alc260_dac_nids,
7139 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7140 .adc_nids = alc260_adc_nids_alt,
7141 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7142 .channel_mode = alc260_modes,
7143 .input_mux = &alc260_capture_source,
7144 .unsol_event = alc260_hp_3013_unsol_event,
7145 .init_hook = alc260_hp_3013_automute,
7147 [ALC260_FUJITSU_S702X] = {
7148 .mixers = { alc260_fujitsu_mixer },
7149 .init_verbs = { alc260_fujitsu_init_verbs },
7150 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7151 .dac_nids = alc260_dac_nids,
7152 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7153 .adc_nids = alc260_dual_adc_nids,
7154 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7155 .channel_mode = alc260_modes,
7156 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7157 .input_mux = alc260_fujitsu_capture_sources,
7160 .mixers = { alc260_acer_mixer },
7161 .init_verbs = { alc260_acer_init_verbs },
7162 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7163 .dac_nids = alc260_dac_nids,
7164 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7165 .adc_nids = alc260_dual_adc_nids,
7166 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7167 .channel_mode = alc260_modes,
7168 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7169 .input_mux = alc260_acer_capture_sources,
7171 [ALC260_FAVORIT100] = {
7172 .mixers = { alc260_favorit100_mixer },
7173 .init_verbs = { alc260_favorit100_init_verbs },
7174 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7175 .dac_nids = alc260_dac_nids,
7176 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7177 .adc_nids = alc260_dual_adc_nids,
7178 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7179 .channel_mode = alc260_modes,
7180 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7181 .input_mux = alc260_favorit100_capture_sources,
7184 .mixers = { alc260_will_mixer },
7185 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7186 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7187 .dac_nids = alc260_dac_nids,
7188 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7189 .adc_nids = alc260_adc_nids,
7190 .dig_out_nid = ALC260_DIGOUT_NID,
7191 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7192 .channel_mode = alc260_modes,
7193 .input_mux = &alc260_capture_source,
7195 [ALC260_REPLACER_672V] = {
7196 .mixers = { alc260_replacer_672v_mixer },
7197 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7198 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7199 .dac_nids = alc260_dac_nids,
7200 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7201 .adc_nids = alc260_adc_nids,
7202 .dig_out_nid = ALC260_DIGOUT_NID,
7203 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7204 .channel_mode = alc260_modes,
7205 .input_mux = &alc260_capture_source,
7206 .unsol_event = alc260_replacer_672v_unsol_event,
7207 .init_hook = alc260_replacer_672v_automute,
7209 #ifdef CONFIG_SND_DEBUG
7211 .mixers = { alc260_test_mixer },
7212 .init_verbs = { alc260_test_init_verbs },
7213 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7214 .dac_nids = alc260_test_dac_nids,
7215 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7216 .adc_nids = alc260_test_adc_nids,
7217 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7218 .channel_mode = alc260_modes,
7219 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7220 .input_mux = alc260_test_capture_sources,
7225 static int patch_alc260(struct hda_codec *codec)
7227 struct alc_spec *spec;
7228 int err, board_config;
7230 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7236 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7239 if (board_config < 0) {
7240 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7242 board_config = ALC260_AUTO;
7245 if (board_config == ALC260_AUTO)
7246 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7248 if (board_config == ALC260_AUTO) {
7249 /* automatic parse from the BIOS config */
7250 err = alc260_parse_auto_config(codec);
7256 "hda_codec: Cannot set up configuration "
7257 "from BIOS. Using base mode...\n");
7258 board_config = ALC260_BASIC;
7262 err = snd_hda_attach_beep_device(codec, 0x1);
7268 if (board_config != ALC260_AUTO)
7269 setup_preset(codec, &alc260_presets[board_config]);
7271 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7272 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7273 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7275 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7276 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7278 if (!spec->adc_nids && spec->input_mux) {
7279 /* check whether NID 0x04 is valid */
7280 unsigned int wcap = get_wcaps(codec, 0x04);
7281 wcap = get_wcaps_type(wcap);
7283 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7284 spec->adc_nids = alc260_adc_nids_alt;
7285 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7287 spec->adc_nids = alc260_adc_nids;
7288 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7291 set_capture_mixer(codec);
7292 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7294 if (board_config == ALC260_AUTO)
7295 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7297 spec->vmaster_nid = 0x08;
7299 codec->patch_ops = alc_patch_ops;
7300 if (board_config == ALC260_AUTO)
7301 spec->init_hook = alc260_auto_init;
7302 #ifdef CONFIG_SND_HDA_POWER_SAVE
7303 if (!spec->loopback.amplist)
7304 spec->loopback.amplist = alc260_loopbacks;
7312 * ALC882/883/885/888/889 support
7314 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7315 * configuration. Each pin widget can choose any input DACs and a mixer.
7316 * Each ADC is connected from a mixer of all inputs. This makes possible
7317 * 6-channel independent captures.
7319 * In addition, an independent DAC for the multi-playback (not used in this
7322 #define ALC882_DIGOUT_NID 0x06
7323 #define ALC882_DIGIN_NID 0x0a
7324 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7325 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7326 #define ALC1200_DIGOUT_NID 0x10
7329 static struct hda_channel_mode alc882_ch_modes[1] = {
7334 static hda_nid_t alc882_dac_nids[4] = {
7335 /* front, rear, clfe, rear_surr */
7336 0x02, 0x03, 0x04, 0x05
7338 #define alc883_dac_nids alc882_dac_nids
7341 #define alc882_adc_nids alc880_adc_nids
7342 #define alc882_adc_nids_alt alc880_adc_nids_alt
7343 #define alc883_adc_nids alc882_adc_nids_alt
7344 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7345 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7346 #define alc889_adc_nids alc880_adc_nids
7348 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7349 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7350 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7351 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7352 #define alc889_capsrc_nids alc882_capsrc_nids
7355 /* FIXME: should be a matrix-type input source selection */
7357 static struct hda_input_mux alc882_capture_source = {
7361 { "Front Mic", 0x1 },
7367 #define alc883_capture_source alc882_capture_source
7369 static struct hda_input_mux alc889_capture_source = {
7372 { "Front Mic", 0x0 },
7378 static struct hda_input_mux mb5_capture_source = {
7387 static struct hda_input_mux macmini3_capture_source = {
7395 static struct hda_input_mux alc883_3stack_6ch_intel = {
7399 { "Front Mic", 0x0 },
7405 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7413 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7423 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7431 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7435 { "Front Mic", 0x1 },
7440 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7448 static struct hda_input_mux alc889A_mb31_capture_source = {
7452 /* Front Mic (0x01) unused */
7454 /* Line 2 (0x03) unused */
7455 /* CD (0x04) unused? */
7459 static struct hda_input_mux alc889A_imac91_capture_source = {
7463 { "Line", 0x2 }, /* Not sure! */
7470 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7477 static struct hda_verb alc882_3ST_ch2_init[] = {
7478 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7479 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7480 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7481 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7488 static struct hda_verb alc882_3ST_ch4_init[] = {
7489 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7490 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7491 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7492 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7493 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7500 static struct hda_verb alc882_3ST_ch6_init[] = {
7501 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7502 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7503 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7504 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7505 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7506 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7510 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7511 { 2, alc882_3ST_ch2_init },
7512 { 4, alc882_3ST_ch4_init },
7513 { 6, alc882_3ST_ch6_init },
7516 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7521 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7522 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7523 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7524 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7525 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7526 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7533 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7534 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7535 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7536 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7537 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7538 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7539 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7546 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7547 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7548 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7549 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7550 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7551 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7552 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7553 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7557 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7558 { 2, alc883_3ST_ch2_clevo_init },
7559 { 4, alc883_3ST_ch4_clevo_init },
7560 { 6, alc883_3ST_ch6_clevo_init },
7567 static struct hda_verb alc882_sixstack_ch6_init[] = {
7568 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7569 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7570 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7571 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7578 static struct hda_verb alc882_sixstack_ch8_init[] = {
7579 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7580 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7581 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7582 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7586 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7587 { 6, alc882_sixstack_ch6_init },
7588 { 8, alc882_sixstack_ch8_init },
7592 /* Macbook Air 2,1 */
7594 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7599 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7605 static struct hda_verb alc885_mbp_ch2_init[] = {
7606 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7607 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7608 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7615 static struct hda_verb alc885_mbp_ch4_init[] = {
7616 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7617 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7618 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7619 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7620 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7624 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7625 { 2, alc885_mbp_ch2_init },
7626 { 4, alc885_mbp_ch4_init },
7631 * Speakers/Woofer/HP = Front
7634 static struct hda_verb alc885_mb5_ch2_init[] = {
7635 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7636 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7642 * Speakers/HP = Front
7646 static struct hda_verb alc885_mb5_ch6_init[] = {
7647 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7648 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7649 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7653 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7654 { 2, alc885_mb5_ch2_init },
7655 { 6, alc885_mb5_ch6_init },
7658 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7663 static struct hda_verb alc883_4ST_ch2_init[] = {
7664 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7665 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7666 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7667 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7668 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7669 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7676 static struct hda_verb alc883_4ST_ch4_init[] = {
7677 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7678 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7679 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7680 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7681 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7682 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7683 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7690 static struct hda_verb alc883_4ST_ch6_init[] = {
7691 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7692 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7693 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7694 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7695 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7696 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7697 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7698 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7705 static struct hda_verb alc883_4ST_ch8_init[] = {
7706 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7707 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7708 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7709 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7710 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7711 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7712 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7713 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7714 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7718 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7719 { 2, alc883_4ST_ch2_init },
7720 { 4, alc883_4ST_ch4_init },
7721 { 6, alc883_4ST_ch6_init },
7722 { 8, alc883_4ST_ch8_init },
7729 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7730 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7731 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7732 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7733 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7740 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7741 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7742 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7743 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7744 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7745 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7752 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7753 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7754 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7755 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
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, 0x01 },
7762 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7763 { 2, alc883_3ST_ch2_intel_init },
7764 { 4, alc883_3ST_ch4_intel_init },
7765 { 6, alc883_3ST_ch6_intel_init },
7771 static struct hda_verb alc889_ch2_intel_init[] = {
7772 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7773 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7774 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7775 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7776 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7777 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7784 static struct hda_verb alc889_ch6_intel_init[] = {
7785 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7786 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7787 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7788 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7789 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7790 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7797 static struct hda_verb alc889_ch8_intel_init[] = {
7798 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7799 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7800 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7801 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7802 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7803 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7804 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7808 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7809 { 2, alc889_ch2_intel_init },
7810 { 6, alc889_ch6_intel_init },
7811 { 8, alc889_ch8_intel_init },
7817 static struct hda_verb alc883_sixstack_ch6_init[] = {
7818 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7819 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7820 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7821 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7828 static struct hda_verb alc883_sixstack_ch8_init[] = {
7829 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7830 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7831 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7832 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7836 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7837 { 6, alc883_sixstack_ch6_init },
7838 { 8, alc883_sixstack_ch8_init },
7842 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7843 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7845 static struct snd_kcontrol_new alc882_base_mixer[] = {
7846 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7847 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7848 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7849 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7850 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7851 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7852 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7853 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7854 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7855 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7856 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7857 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7858 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7859 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7860 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7861 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7862 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7863 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7864 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7866 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7870 /* Macbook Air 2,1 same control for HP and internal Speaker */
7872 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7873 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7874 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7879 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7880 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7881 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7882 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7883 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7884 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7885 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7886 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7887 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7888 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7890 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7894 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7895 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7896 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7897 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7898 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7899 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7900 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7901 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7902 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7904 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7906 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7907 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7912 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7913 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7914 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7915 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7916 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7917 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7918 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7919 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7920 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7921 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7922 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7923 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7927 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7928 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7929 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7934 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7935 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7936 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7937 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7938 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7939 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7940 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7943 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7947 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7948 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7949 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7950 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7951 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7952 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7953 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7954 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7955 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7957 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7958 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7959 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7960 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7964 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7965 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7967 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7968 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7969 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7970 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7971 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7972 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7973 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7974 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7975 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7976 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7977 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7978 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7979 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7980 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7984 static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
7985 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7986 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7987 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7988 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7989 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7990 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7991 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7992 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7993 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7994 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7998 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
8000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8001 .name = "Channel Mode",
8002 .info = alc_ch_mode_info,
8003 .get = alc_ch_mode_get,
8004 .put = alc_ch_mode_put,
8009 static struct hda_verb alc882_base_init_verbs[] = {
8010 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8011 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8012 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8014 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8015 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8017 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8018 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8020 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8021 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8023 /* Front Pin: output 0 (0x0c) */
8024 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8025 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8026 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8027 /* Rear Pin: output 1 (0x0d) */
8028 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8029 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8030 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
8031 /* CLFE Pin: output 2 (0x0e) */
8032 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8033 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8034 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8035 /* Side Pin: output 3 (0x0f) */
8036 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8037 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8038 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8039 /* Mic (rear) pin: input vref at 80% */
8040 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8041 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8042 /* Front Mic pin: input vref at 80% */
8043 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8044 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8045 /* Line In pin: input */
8046 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8047 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8048 /* Line-2 In: Headphone output (output 0 - 0x0c) */
8049 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8050 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8051 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8052 /* CD pin widget for input */
8053 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8055 /* FIXME: use matrix-type input source selection */
8056 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8058 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8060 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8061 /* ADC2: mute amp left and right */
8062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8063 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8064 /* ADC3: mute amp left and right */
8065 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8066 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8071 static struct hda_verb alc882_adc1_init_verbs[] = {
8072 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8073 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8074 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8075 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8076 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8077 /* ADC1: mute amp left and right */
8078 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8079 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8083 static struct hda_verb alc882_eapd_verbs[] = {
8084 /* change to EAPD mode */
8085 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8086 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8090 static struct hda_verb alc889_eapd_verbs[] = {
8091 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8092 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8096 static struct hda_verb alc_hp15_unsol_verbs[] = {
8097 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8098 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8102 static struct hda_verb alc885_init_verbs[] = {
8103 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8104 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8105 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8107 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8108 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8110 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8111 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8113 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8114 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8116 /* Front HP Pin: output 0 (0x0c) */
8117 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8118 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8119 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8120 /* Front Pin: output 0 (0x0c) */
8121 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8122 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8123 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8124 /* Rear Pin: output 1 (0x0d) */
8125 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8126 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8127 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8128 /* CLFE Pin: output 2 (0x0e) */
8129 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8130 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8131 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8132 /* Side Pin: output 3 (0x0f) */
8133 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8134 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8135 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8136 /* Mic (rear) pin: input vref at 80% */
8137 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8138 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8139 /* Front Mic pin: input vref at 80% */
8140 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8141 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8142 /* Line In pin: input */
8143 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8144 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8146 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8148 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8150 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8152 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8153 /* ADC2: mute amp left and right */
8154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8155 /* ADC3: mute amp left and right */
8156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8161 static struct hda_verb alc885_init_input_verbs[] = {
8162 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8163 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8164 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8169 /* Unmute Selector 24h and set the default input to front mic */
8170 static struct hda_verb alc889_init_input_verbs[] = {
8171 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8172 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8177 #define alc883_init_verbs alc882_base_init_verbs
8180 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8181 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8182 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8183 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8184 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8185 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8186 /* FIXME: this looks suspicious...
8187 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8188 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8193 static struct hda_verb alc882_macpro_init_verbs[] = {
8194 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8195 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8196 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8197 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8198 /* Front Pin: output 0 (0x0c) */
8199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8201 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8202 /* Front Mic pin: input vref at 80% */
8203 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8204 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8205 /* Speaker: output */
8206 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8207 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8209 /* Headphone output (output 0 - 0x0c) */
8210 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8211 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8212 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8214 /* FIXME: use matrix-type input source selection */
8215 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8216 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8217 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8218 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8219 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8220 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8222 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8223 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8224 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8225 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8227 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8228 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8229 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8230 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8231 /* ADC1: mute amp left and right */
8232 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8233 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8234 /* ADC2: mute amp left and right */
8235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8236 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8237 /* ADC3: mute amp left and right */
8238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8239 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8245 static struct hda_verb alc885_mb5_init_verbs[] = {
8247 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8248 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8249 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8250 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8254 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8255 /* Surround mixer */
8256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8257 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8258 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8262 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8266 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8267 /* Front Pin (0x0c) */
8268 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8269 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8270 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8271 /* LFE Pin (0x0e) */
8272 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8273 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8274 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8276 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8277 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8278 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8279 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8280 /* Front Mic pin: input vref at 80% */
8281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8282 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8284 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8285 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8294 static struct hda_verb alc885_macmini3_init_verbs[] = {
8296 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8297 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8298 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8299 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8301 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8302 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8304 /* Surround mixer */
8305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8307 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8309 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8310 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8311 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8313 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8314 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8315 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8316 /* Front Pin (0x0c) */
8317 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8318 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8319 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8320 /* LFE Pin (0x0e) */
8321 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8322 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8323 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8325 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8326 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8327 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8328 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8333 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8334 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8341 static struct hda_verb alc885_mba21_init_verbs[] = {
8342 /*Internal and HP Speaker Mixer*/
8343 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8344 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8345 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8346 /*Internal Speaker Pin (0x0c)*/
8347 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8348 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8349 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8350 /* HP Pin: output 0 (0x0e) */
8351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8353 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8354 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8355 /* Line in (is hp when jack connected)*/
8356 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8357 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8363 /* Macbook Pro rev3 */
8364 static struct hda_verb alc885_mbp3_init_verbs[] = {
8365 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8366 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8367 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8368 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8370 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8371 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8372 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8374 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8375 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8376 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8377 /* Front Pin: output 0 (0x0c) */
8378 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8379 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8380 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8381 /* HP Pin: output 0 (0x0e) */
8382 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8383 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8384 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8385 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8386 /* Mic (rear) pin: input vref at 80% */
8387 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8388 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8389 /* Front Mic pin: input vref at 80% */
8390 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8391 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8392 /* Line In pin: use output 1 when in LineOut mode */
8393 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8394 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8395 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8397 /* FIXME: use matrix-type input source selection */
8398 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8399 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8400 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8401 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8402 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8403 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8405 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8406 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8407 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8408 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8410 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8411 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8412 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8413 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8414 /* ADC1: mute amp left and right */
8415 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8416 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8417 /* ADC2: mute amp left and right */
8418 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8419 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8420 /* ADC3: mute amp left and right */
8421 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8422 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8428 static struct hda_verb alc885_imac91_init_verbs[] = {
8429 /* Internal Speaker Pin (0x0c) */
8430 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8431 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8432 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8433 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8434 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8435 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8437 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8438 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8439 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8440 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8442 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8443 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8444 /* Front Mic pin: input vref at 80% */
8445 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8446 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8448 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8449 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8451 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8452 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8453 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8454 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8455 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8456 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8457 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8458 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8459 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8460 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8461 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8465 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8466 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8467 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8470 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8471 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8472 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8473 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8474 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8475 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8476 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8477 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8478 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8482 /* iMac 24 mixer. */
8483 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8484 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8485 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8489 /* iMac 24 init verbs. */
8490 static struct hda_verb alc885_imac24_init_verbs[] = {
8491 /* Internal speakers: output 0 (0x0c) */
8492 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8493 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8494 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8495 /* Internal speakers: output 0 (0x0c) */
8496 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8497 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8498 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8499 /* Headphone: output 0 (0x0c) */
8500 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8501 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8502 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8503 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8504 /* Front Mic: input vref at 80% */
8505 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8506 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8510 /* Toggle speaker-output according to the hp-jack state */
8511 static void alc885_imac24_setup(struct hda_codec *codec)
8513 struct alc_spec *spec = codec->spec;
8515 spec->autocfg.hp_pins[0] = 0x14;
8516 spec->autocfg.speaker_pins[0] = 0x18;
8517 spec->autocfg.speaker_pins[1] = 0x1a;
8520 #define alc885_mb5_setup alc885_imac24_setup
8521 #define alc885_macmini3_setup alc885_imac24_setup
8523 /* Macbook Air 2,1 */
8524 static void alc885_mba21_setup(struct hda_codec *codec)
8526 struct alc_spec *spec = codec->spec;
8528 spec->autocfg.hp_pins[0] = 0x14;
8529 spec->autocfg.speaker_pins[0] = 0x18;
8534 static void alc885_mbp3_setup(struct hda_codec *codec)
8536 struct alc_spec *spec = codec->spec;
8538 spec->autocfg.hp_pins[0] = 0x15;
8539 spec->autocfg.speaker_pins[0] = 0x14;
8542 static void alc885_imac91_setup(struct hda_codec *codec)
8544 struct alc_spec *spec = codec->spec;
8546 spec->autocfg.hp_pins[0] = 0x14;
8547 spec->autocfg.speaker_pins[0] = 0x18;
8548 spec->autocfg.speaker_pins[1] = 0x1a;
8551 static struct hda_verb alc882_targa_verbs[] = {
8552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8555 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8556 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8558 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8559 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8560 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8562 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8566 /* toggle speaker-output according to the hp-jack state */
8567 static void alc882_targa_automute(struct hda_codec *codec)
8569 struct alc_spec *spec = codec->spec;
8570 alc_automute_amp(codec);
8571 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8572 spec->jack_present ? 1 : 3);
8575 static void alc882_targa_setup(struct hda_codec *codec)
8577 struct alc_spec *spec = codec->spec;
8579 spec->autocfg.hp_pins[0] = 0x14;
8580 spec->autocfg.speaker_pins[0] = 0x1b;
8583 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8585 if ((res >> 26) == ALC880_HP_EVENT)
8586 alc882_targa_automute(codec);
8589 static struct hda_verb alc882_asus_a7j_verbs[] = {
8590 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8591 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8593 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8594 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8595 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8597 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8598 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8599 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8601 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8602 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8603 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8607 static struct hda_verb alc882_asus_a7m_verbs[] = {
8608 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8609 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8612 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8613 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8615 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8617 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8619 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8620 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8621 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8625 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8627 unsigned int gpiostate, gpiomask, gpiodir;
8629 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8630 AC_VERB_GET_GPIO_DATA, 0);
8633 gpiostate |= (1 << pin);
8635 gpiostate &= ~(1 << pin);
8637 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8638 AC_VERB_GET_GPIO_MASK, 0);
8639 gpiomask |= (1 << pin);
8641 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8642 AC_VERB_GET_GPIO_DIRECTION, 0);
8643 gpiodir |= (1 << pin);
8646 snd_hda_codec_write(codec, codec->afg, 0,
8647 AC_VERB_SET_GPIO_MASK, gpiomask);
8648 snd_hda_codec_write(codec, codec->afg, 0,
8649 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8653 snd_hda_codec_write(codec, codec->afg, 0,
8654 AC_VERB_SET_GPIO_DATA, gpiostate);
8657 /* set up GPIO at initialization */
8658 static void alc885_macpro_init_hook(struct hda_codec *codec)
8660 alc882_gpio_mute(codec, 0, 0);
8661 alc882_gpio_mute(codec, 1, 0);
8664 /* set up GPIO and update auto-muting at initialization */
8665 static void alc885_imac24_init_hook(struct hda_codec *codec)
8667 alc885_macpro_init_hook(codec);
8668 alc_automute_amp(codec);
8672 * generic initialization of ADC, input mixers and output mixers
8674 static struct hda_verb alc883_auto_init_verbs[] = {
8676 * Unmute ADC0-2 and set the default input to mic-in
8678 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8679 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8680 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8681 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8684 * Set up output mixers (0x0c - 0x0f)
8686 /* set vol=0 to output mixers */
8687 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8688 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8690 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8691 /* set up input amps for analog loopback */
8692 /* Amp Indices: DAC = 0, mixer = 1 */
8693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8694 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8695 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8696 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8697 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8698 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8699 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8700 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8701 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8702 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8704 /* FIXME: use matrix-type input source selection */
8705 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8707 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8709 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8713 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8714 static struct hda_verb alc889A_mb31_ch2_init[] = {
8715 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8716 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8717 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8718 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8722 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8723 static struct hda_verb alc889A_mb31_ch4_init[] = {
8724 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8725 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8731 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8732 static struct hda_verb alc889A_mb31_ch5_init[] = {
8733 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8734 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8735 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8736 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8740 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8741 static struct hda_verb alc889A_mb31_ch6_init[] = {
8742 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8743 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8744 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8749 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8750 { 2, alc889A_mb31_ch2_init },
8751 { 4, alc889A_mb31_ch4_init },
8752 { 5, alc889A_mb31_ch5_init },
8753 { 6, alc889A_mb31_ch6_init },
8756 static struct hda_verb alc883_medion_eapd_verbs[] = {
8757 /* eanable EAPD on medion laptop */
8758 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8759 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8763 #define alc883_base_mixer alc882_base_mixer
8765 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8766 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8767 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8768 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8769 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8770 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8771 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8772 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8773 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8774 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8775 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8776 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8777 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8778 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8782 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8783 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8784 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8785 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8786 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8787 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8788 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8789 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8790 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8791 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8792 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8796 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8797 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8798 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8799 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8800 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8801 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8802 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8803 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8804 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8805 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8806 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8810 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8811 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8812 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8813 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8814 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8815 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8816 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8817 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8818 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8819 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8820 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8821 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8822 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8823 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8827 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8828 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8829 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8830 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8831 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8832 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8833 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8834 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8835 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8838 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8840 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8841 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8842 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8844 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8845 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8846 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8850 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8851 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8852 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8853 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8854 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8855 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8857 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8858 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8859 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8860 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8861 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8862 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8864 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8866 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8867 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8868 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8869 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8870 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8874 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8875 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8876 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8877 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8878 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8879 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8881 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8882 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8883 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8885 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8886 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8887 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8888 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8890 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8891 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8892 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8893 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8894 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8898 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8899 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8900 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8901 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8902 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8903 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8904 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8905 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8906 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8907 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8908 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8909 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8910 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8911 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8912 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8913 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8914 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8915 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8916 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8917 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8921 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8922 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8923 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8924 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8925 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8926 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8927 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8928 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8929 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8930 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8931 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8932 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8933 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8934 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8935 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8936 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8937 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8938 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8942 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8944 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8945 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8946 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8947 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8948 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8949 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8951 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8952 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8953 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8954 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8958 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8959 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8960 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8961 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8962 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8963 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8967 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8968 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8969 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8970 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8971 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8972 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8973 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8974 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8975 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8979 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8980 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8981 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8982 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8983 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8984 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8985 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8986 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8987 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8988 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8992 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8993 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8995 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8996 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8997 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9000 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9001 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9005 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
9006 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9007 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9008 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9009 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
9010 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
9011 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
9015 static struct hda_verb alc883_medion_wim2160_verbs[] = {
9016 /* Unmute front mixer */
9017 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9018 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9020 /* Set speaker pin to front mixer */
9021 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9023 /* Init headphone pin */
9024 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9025 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9026 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9027 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9032 /* toggle speaker-output according to the hp-jack state */
9033 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
9035 struct alc_spec *spec = codec->spec;
9037 spec->autocfg.hp_pins[0] = 0x1a;
9038 spec->autocfg.speaker_pins[0] = 0x15;
9041 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
9042 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9043 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9044 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9045 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9046 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9047 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9048 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9053 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9054 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9055 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9056 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9057 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9058 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9059 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9061 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9062 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9066 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9067 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9068 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9069 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9070 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9071 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9072 0x0d, 1, 0x0, HDA_OUTPUT),
9073 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9074 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9075 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9076 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9077 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9078 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9079 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9080 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9081 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9082 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9083 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9084 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9085 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9086 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9087 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9091 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9094 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9095 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9096 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9097 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9099 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9100 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9101 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9102 /* Output switches */
9103 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9104 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9105 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9107 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
9108 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
9110 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9111 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9112 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9113 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9117 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9118 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9119 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9120 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9121 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9122 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9123 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9127 static struct hda_bind_ctls alc883_bind_cap_vol = {
9128 .ops = &snd_hda_bind_vol,
9130 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9131 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9136 static struct hda_bind_ctls alc883_bind_cap_switch = {
9137 .ops = &snd_hda_bind_sw,
9139 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9140 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9145 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9148 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9149 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9150 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9151 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9152 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9153 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9157 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9158 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9159 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9161 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9162 /* .name = "Capture Source", */
9163 .name = "Input Source",
9165 .info = alc_mux_enum_info,
9166 .get = alc_mux_enum_get,
9167 .put = alc_mux_enum_put,
9172 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9175 .name = "Channel Mode",
9176 .info = alc_ch_mode_info,
9177 .get = alc_ch_mode_get,
9178 .put = alc_ch_mode_put,
9183 /* toggle speaker-output according to the hp-jack state */
9184 static void alc883_mitac_setup(struct hda_codec *codec)
9186 struct alc_spec *spec = codec->spec;
9188 spec->autocfg.hp_pins[0] = 0x15;
9189 spec->autocfg.speaker_pins[0] = 0x14;
9190 spec->autocfg.speaker_pins[1] = 0x17;
9193 /* auto-toggle front mic */
9195 static void alc883_mitac_mic_automute(struct hda_codec *codec)
9197 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
9199 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
9203 static struct hda_verb alc883_mitac_verbs[] = {
9205 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9206 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9208 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9209 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9211 /* enable unsolicited event */
9212 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9213 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9218 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9220 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9221 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9223 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9225 /* enable unsolicited event */
9227 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9228 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9234 static struct hda_verb alc883_clevo_m720_verbs[] = {
9236 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9237 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9239 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9240 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9242 /* enable unsolicited event */
9243 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9244 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9249 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9251 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9254 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9257 /* enable unsolicited event */
9258 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9263 static struct hda_verb alc883_targa_verbs[] = {
9264 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9265 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9268 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9270 /* Connect Line-Out side jack (SPDIF) to Side */
9271 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9272 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9273 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9274 /* Connect Mic jack to CLFE */
9275 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9276 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9277 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9278 /* Connect Line-in jack to Surround */
9279 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9280 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9281 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9282 /* Connect HP out jack to Front */
9283 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9284 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9285 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9287 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9292 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9293 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9294 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9295 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9299 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9300 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9301 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9302 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9307 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9309 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9310 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9311 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9316 static struct hda_verb alc883_haier_w66_verbs[] = {
9317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9320 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9322 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9323 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9324 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9325 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9329 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9330 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9331 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9332 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9333 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9334 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9335 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9336 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9337 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9341 static struct hda_verb alc888_6st_dell_verbs[] = {
9342 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9346 static struct hda_verb alc883_vaiott_verbs[] = {
9348 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9349 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9351 /* enable unsolicited event */
9352 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9357 static void alc888_3st_hp_setup(struct hda_codec *codec)
9359 struct alc_spec *spec = codec->spec;
9361 spec->autocfg.hp_pins[0] = 0x1b;
9362 spec->autocfg.speaker_pins[0] = 0x14;
9363 spec->autocfg.speaker_pins[1] = 0x16;
9364 spec->autocfg.speaker_pins[2] = 0x18;
9367 static struct hda_verb alc888_3st_hp_verbs[] = {
9368 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9369 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9370 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9371 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9378 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9379 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9380 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9381 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9382 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9389 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9390 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9391 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9392 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9393 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9394 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9401 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9402 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9403 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9404 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9405 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9406 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9407 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9411 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9412 { 2, alc888_3st_hp_2ch_init },
9413 { 4, alc888_3st_hp_4ch_init },
9414 { 6, alc888_3st_hp_6ch_init },
9417 /* toggle front-jack and RCA according to the hp-jack state */
9418 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9420 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9422 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9423 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9424 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9425 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9428 /* toggle RCA according to the front-jack state */
9429 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9431 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9433 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9434 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9437 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9440 if ((res >> 26) == ALC880_HP_EVENT)
9441 alc888_lenovo_ms7195_front_automute(codec);
9442 if ((res >> 26) == ALC880_FRONT_EVENT)
9443 alc888_lenovo_ms7195_rca_automute(codec);
9446 static struct hda_verb alc883_medion_md2_verbs[] = {
9447 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9452 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9456 /* toggle speaker-output according to the hp-jack state */
9457 static void alc883_medion_md2_setup(struct hda_codec *codec)
9459 struct alc_spec *spec = codec->spec;
9461 spec->autocfg.hp_pins[0] = 0x14;
9462 spec->autocfg.speaker_pins[0] = 0x15;
9465 /* toggle speaker-output according to the hp-jack state */
9466 #define alc883_targa_init_hook alc882_targa_init_hook
9467 #define alc883_targa_unsol_event alc882_targa_unsol_event
9469 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9471 unsigned int present;
9473 present = snd_hda_jack_detect(codec, 0x18);
9474 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9475 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9478 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9480 struct alc_spec *spec = codec->spec;
9482 spec->autocfg.hp_pins[0] = 0x15;
9483 spec->autocfg.speaker_pins[0] = 0x14;
9486 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9488 alc_automute_amp(codec);
9489 alc883_clevo_m720_mic_automute(codec);
9492 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9495 switch (res >> 26) {
9496 case ALC880_MIC_EVENT:
9497 alc883_clevo_m720_mic_automute(codec);
9500 alc_automute_amp_unsol_event(codec, res);
9505 /* toggle speaker-output according to the hp-jack state */
9506 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9508 struct alc_spec *spec = codec->spec;
9510 spec->autocfg.hp_pins[0] = 0x14;
9511 spec->autocfg.speaker_pins[0] = 0x15;
9514 static void alc883_haier_w66_setup(struct hda_codec *codec)
9516 struct alc_spec *spec = codec->spec;
9518 spec->autocfg.hp_pins[0] = 0x1b;
9519 spec->autocfg.speaker_pins[0] = 0x14;
9522 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9524 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9526 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9527 HDA_AMP_MUTE, bits);
9530 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9532 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9534 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9535 HDA_AMP_MUTE, bits);
9536 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9537 HDA_AMP_MUTE, bits);
9540 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9543 if ((res >> 26) == ALC880_HP_EVENT)
9544 alc883_lenovo_101e_all_automute(codec);
9545 if ((res >> 26) == ALC880_FRONT_EVENT)
9546 alc883_lenovo_101e_ispeaker_automute(codec);
9549 /* toggle speaker-output according to the hp-jack state */
9550 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9552 struct alc_spec *spec = codec->spec;
9554 spec->autocfg.hp_pins[0] = 0x14;
9555 spec->autocfg.speaker_pins[0] = 0x15;
9556 spec->autocfg.speaker_pins[1] = 0x16;
9559 static struct hda_verb alc883_acer_eapd_verbs[] = {
9560 /* HP Pin: output 0 (0x0c) */
9561 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9562 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9563 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9564 /* Front Pin: output 0 (0x0c) */
9565 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9567 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9568 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9569 /* eanable EAPD on medion laptop */
9570 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9571 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9572 /* enable unsolicited event */
9573 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9577 static void alc888_6st_dell_setup(struct hda_codec *codec)
9579 struct alc_spec *spec = codec->spec;
9581 spec->autocfg.hp_pins[0] = 0x1b;
9582 spec->autocfg.speaker_pins[0] = 0x14;
9583 spec->autocfg.speaker_pins[1] = 0x15;
9584 spec->autocfg.speaker_pins[2] = 0x16;
9585 spec->autocfg.speaker_pins[3] = 0x17;
9588 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9590 struct alc_spec *spec = codec->spec;
9592 spec->autocfg.hp_pins[0] = 0x1b;
9593 spec->autocfg.speaker_pins[0] = 0x14;
9594 spec->autocfg.speaker_pins[1] = 0x15;
9595 spec->autocfg.speaker_pins[2] = 0x16;
9596 spec->autocfg.speaker_pins[3] = 0x17;
9597 spec->autocfg.speaker_pins[4] = 0x1a;
9600 static void alc883_vaiott_setup(struct hda_codec *codec)
9602 struct alc_spec *spec = codec->spec;
9604 spec->autocfg.hp_pins[0] = 0x15;
9605 spec->autocfg.speaker_pins[0] = 0x14;
9606 spec->autocfg.speaker_pins[1] = 0x17;
9609 static struct hda_verb alc888_asus_m90v_verbs[] = {
9610 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9611 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9612 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9613 /* enable unsolicited event */
9614 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9615 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9619 static void alc883_mode2_setup(struct hda_codec *codec)
9621 struct alc_spec *spec = codec->spec;
9623 spec->autocfg.hp_pins[0] = 0x1b;
9624 spec->autocfg.speaker_pins[0] = 0x14;
9625 spec->autocfg.speaker_pins[1] = 0x15;
9626 spec->autocfg.speaker_pins[2] = 0x16;
9627 spec->ext_mic.pin = 0x18;
9628 spec->int_mic.pin = 0x19;
9629 spec->ext_mic.mux_idx = 0;
9630 spec->int_mic.mux_idx = 1;
9634 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9635 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9636 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9637 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9638 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9639 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9640 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9641 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9642 /* enable unsolicited event */
9643 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9647 static void alc883_eee1601_inithook(struct hda_codec *codec)
9649 struct alc_spec *spec = codec->spec;
9651 spec->autocfg.hp_pins[0] = 0x14;
9652 spec->autocfg.speaker_pins[0] = 0x1b;
9653 alc_automute_pin(codec);
9656 static struct hda_verb alc889A_mb31_verbs[] = {
9657 /* Init rear pin (used as headphone output) */
9658 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9659 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9660 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9661 /* Init line pin (used as output in 4ch and 6ch mode) */
9662 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9663 /* Init line 2 pin (used as headphone out by default) */
9664 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9665 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9669 /* Mute speakers according to the headphone jack state */
9670 static void alc889A_mb31_automute(struct hda_codec *codec)
9672 unsigned int present;
9674 /* Mute only in 2ch or 4ch mode */
9675 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9677 present = snd_hda_jack_detect(codec, 0x15);
9678 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9679 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9680 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9681 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9685 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9687 if ((res >> 26) == ALC880_HP_EVENT)
9688 alc889A_mb31_automute(codec);
9692 #ifdef CONFIG_SND_HDA_POWER_SAVE
9693 #define alc882_loopbacks alc880_loopbacks
9696 /* pcm configuration: identical with ALC880 */
9697 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9698 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9699 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9700 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9702 static hda_nid_t alc883_slave_dig_outs[] = {
9703 ALC1200_DIGOUT_NID, 0,
9706 static hda_nid_t alc1200_slave_dig_outs[] = {
9707 ALC883_DIGOUT_NID, 0,
9711 * configuration and preset
9713 static const char *alc882_models[ALC882_MODEL_LAST] = {
9714 [ALC882_3ST_DIG] = "3stack-dig",
9715 [ALC882_6ST_DIG] = "6stack-dig",
9716 [ALC882_ARIMA] = "arima",
9717 [ALC882_W2JC] = "w2jc",
9718 [ALC882_TARGA] = "targa",
9719 [ALC882_ASUS_A7J] = "asus-a7j",
9720 [ALC882_ASUS_A7M] = "asus-a7m",
9721 [ALC885_MACPRO] = "macpro",
9722 [ALC885_MB5] = "mb5",
9723 [ALC885_MACMINI3] = "macmini3",
9724 [ALC885_MBA21] = "mba21",
9725 [ALC885_MBP3] = "mbp3",
9726 [ALC885_IMAC24] = "imac24",
9727 [ALC885_IMAC91] = "imac91",
9728 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9729 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9730 [ALC883_3ST_6ch] = "3stack-6ch",
9731 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9732 [ALC883_TARGA_DIG] = "targa-dig",
9733 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9734 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9735 [ALC883_ACER] = "acer",
9736 [ALC883_ACER_ASPIRE] = "acer-aspire",
9737 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9738 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9739 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9740 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9741 [ALC883_MEDION] = "medion",
9742 [ALC883_MEDION_MD2] = "medion-md2",
9743 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9744 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9745 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9746 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9747 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9748 [ALC888_LENOVO_SKY] = "lenovo-sky",
9749 [ALC883_HAIER_W66] = "haier-w66",
9750 [ALC888_3ST_HP] = "3stack-hp",
9751 [ALC888_6ST_DELL] = "6stack-dell",
9752 [ALC883_MITAC] = "mitac",
9753 [ALC883_CLEVO_M540R] = "clevo-m540r",
9754 [ALC883_CLEVO_M720] = "clevo-m720",
9755 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9756 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9757 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9758 [ALC889A_INTEL] = "intel-alc889a",
9759 [ALC889_INTEL] = "intel-x58",
9760 [ALC1200_ASUS_P5Q] = "asus-p5q",
9761 [ALC889A_MB31] = "mb31",
9762 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9763 [ALC882_AUTO] = "auto",
9766 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9767 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9769 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9770 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9771 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9772 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9773 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9774 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9775 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9776 ALC888_ACER_ASPIRE_4930G),
9777 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9778 ALC888_ACER_ASPIRE_4930G),
9779 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9780 ALC888_ACER_ASPIRE_8930G),
9781 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9782 ALC888_ACER_ASPIRE_8930G),
9783 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9784 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9785 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9786 ALC888_ACER_ASPIRE_6530G),
9787 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9788 ALC888_ACER_ASPIRE_6530G),
9789 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9790 ALC888_ACER_ASPIRE_7730G),
9791 /* default Acer -- disabled as it causes more problems.
9792 * model=auto should work fine now
9794 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9796 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9798 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9799 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9800 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9801 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9802 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9803 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9805 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9806 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9807 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9808 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9809 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9810 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9811 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9812 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9813 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9814 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9815 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9817 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9818 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9819 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9820 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9821 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9822 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9823 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9824 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9825 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9827 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9828 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9829 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9830 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9831 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9832 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9833 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9834 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9835 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9836 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9837 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9838 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9839 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9840 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9841 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9842 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9843 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9844 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9845 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9846 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9847 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9848 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9849 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9850 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9851 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9852 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9853 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9854 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9855 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9856 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9857 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9859 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9860 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9861 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9862 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9863 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9864 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9865 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9866 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9867 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9868 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9869 ALC883_FUJITSU_PI2515),
9870 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9871 ALC888_FUJITSU_XA3530),
9872 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9873 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9874 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9875 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9876 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9877 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9878 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9879 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9881 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9882 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9883 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9884 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9885 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9886 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9887 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9892 /* codec SSID table for Intel Mac */
9893 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9894 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9895 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9896 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9897 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9898 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9899 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9900 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9901 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9902 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9903 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9904 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9905 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9906 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9907 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9908 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9909 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9910 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9911 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9912 * so apparently no perfect solution yet
9914 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9915 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9916 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9920 static struct alc_config_preset alc882_presets[] = {
9921 [ALC882_3ST_DIG] = {
9922 .mixers = { alc882_base_mixer },
9923 .init_verbs = { alc882_base_init_verbs,
9924 alc882_adc1_init_verbs },
9925 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9926 .dac_nids = alc882_dac_nids,
9927 .dig_out_nid = ALC882_DIGOUT_NID,
9928 .dig_in_nid = ALC882_DIGIN_NID,
9929 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9930 .channel_mode = alc882_ch_modes,
9932 .input_mux = &alc882_capture_source,
9934 [ALC882_6ST_DIG] = {
9935 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9936 .init_verbs = { alc882_base_init_verbs,
9937 alc882_adc1_init_verbs },
9938 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9939 .dac_nids = alc882_dac_nids,
9940 .dig_out_nid = ALC882_DIGOUT_NID,
9941 .dig_in_nid = ALC882_DIGIN_NID,
9942 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9943 .channel_mode = alc882_sixstack_modes,
9944 .input_mux = &alc882_capture_source,
9947 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9948 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9949 alc882_eapd_verbs },
9950 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9951 .dac_nids = alc882_dac_nids,
9952 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9953 .channel_mode = alc882_sixstack_modes,
9954 .input_mux = &alc882_capture_source,
9957 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9958 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9959 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9960 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9961 .dac_nids = alc882_dac_nids,
9962 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9963 .channel_mode = alc880_threestack_modes,
9965 .input_mux = &alc882_capture_source,
9966 .dig_out_nid = ALC882_DIGOUT_NID,
9969 .mixers = { alc885_mba21_mixer },
9970 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9972 .dac_nids = alc882_dac_nids,
9973 .channel_mode = alc885_mba21_ch_modes,
9974 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9975 .input_mux = &alc882_capture_source,
9976 .unsol_event = alc_automute_amp_unsol_event,
9977 .setup = alc885_mba21_setup,
9978 .init_hook = alc_automute_amp,
9981 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9982 .init_verbs = { alc885_mbp3_init_verbs,
9983 alc880_gpio1_init_verbs },
9985 .dac_nids = alc882_dac_nids,
9987 .channel_mode = alc885_mbp_4ch_modes,
9988 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9989 .input_mux = &alc882_capture_source,
9990 .dig_out_nid = ALC882_DIGOUT_NID,
9991 .dig_in_nid = ALC882_DIGIN_NID,
9992 .unsol_event = alc_automute_amp_unsol_event,
9993 .setup = alc885_mbp3_setup,
9994 .init_hook = alc_automute_amp,
9997 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9998 .init_verbs = { alc885_mb5_init_verbs,
9999 alc880_gpio1_init_verbs },
10000 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10001 .dac_nids = alc882_dac_nids,
10002 .channel_mode = alc885_mb5_6ch_modes,
10003 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
10004 .input_mux = &mb5_capture_source,
10005 .dig_out_nid = ALC882_DIGOUT_NID,
10006 .dig_in_nid = ALC882_DIGIN_NID,
10007 .unsol_event = alc_automute_amp_unsol_event,
10008 .setup = alc885_mb5_setup,
10009 .init_hook = alc_automute_amp,
10011 [ALC885_MACMINI3] = {
10012 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
10013 .init_verbs = { alc885_macmini3_init_verbs,
10014 alc880_gpio1_init_verbs },
10015 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10016 .dac_nids = alc882_dac_nids,
10017 .channel_mode = alc885_macmini3_6ch_modes,
10018 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
10019 .input_mux = &macmini3_capture_source,
10020 .dig_out_nid = ALC882_DIGOUT_NID,
10021 .dig_in_nid = ALC882_DIGIN_NID,
10022 .unsol_event = alc_automute_amp_unsol_event,
10023 .setup = alc885_macmini3_setup,
10024 .init_hook = alc_automute_amp,
10026 [ALC885_MACPRO] = {
10027 .mixers = { alc882_macpro_mixer },
10028 .init_verbs = { alc882_macpro_init_verbs },
10029 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10030 .dac_nids = alc882_dac_nids,
10031 .dig_out_nid = ALC882_DIGOUT_NID,
10032 .dig_in_nid = ALC882_DIGIN_NID,
10033 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10034 .channel_mode = alc882_ch_modes,
10035 .input_mux = &alc882_capture_source,
10036 .init_hook = alc885_macpro_init_hook,
10038 [ALC885_IMAC24] = {
10039 .mixers = { alc885_imac24_mixer },
10040 .init_verbs = { alc885_imac24_init_verbs },
10041 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10042 .dac_nids = alc882_dac_nids,
10043 .dig_out_nid = ALC882_DIGOUT_NID,
10044 .dig_in_nid = ALC882_DIGIN_NID,
10045 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10046 .channel_mode = alc882_ch_modes,
10047 .input_mux = &alc882_capture_source,
10048 .unsol_event = alc_automute_amp_unsol_event,
10049 .setup = alc885_imac24_setup,
10050 .init_hook = alc885_imac24_init_hook,
10052 [ALC885_IMAC91] = {
10053 .mixers = {alc885_imac91_mixer},
10054 .init_verbs = { alc885_imac91_init_verbs,
10055 alc880_gpio1_init_verbs },
10056 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10057 .dac_nids = alc882_dac_nids,
10058 .channel_mode = alc885_mba21_ch_modes,
10059 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10060 .input_mux = &alc889A_imac91_capture_source,
10061 .dig_out_nid = ALC882_DIGOUT_NID,
10062 .dig_in_nid = ALC882_DIGIN_NID,
10063 .unsol_event = alc_automute_amp_unsol_event,
10064 .setup = alc885_imac91_setup,
10065 .init_hook = alc_automute_amp,
10068 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10069 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10070 alc880_gpio3_init_verbs, alc882_targa_verbs},
10071 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10072 .dac_nids = alc882_dac_nids,
10073 .dig_out_nid = ALC882_DIGOUT_NID,
10074 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10075 .adc_nids = alc882_adc_nids,
10076 .capsrc_nids = alc882_capsrc_nids,
10077 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10078 .channel_mode = alc882_3ST_6ch_modes,
10080 .input_mux = &alc882_capture_source,
10081 .unsol_event = alc882_targa_unsol_event,
10082 .setup = alc882_targa_setup,
10083 .init_hook = alc882_targa_automute,
10085 [ALC882_ASUS_A7J] = {
10086 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10087 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10088 alc882_asus_a7j_verbs},
10089 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10090 .dac_nids = alc882_dac_nids,
10091 .dig_out_nid = ALC882_DIGOUT_NID,
10092 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10093 .adc_nids = alc882_adc_nids,
10094 .capsrc_nids = alc882_capsrc_nids,
10095 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10096 .channel_mode = alc882_3ST_6ch_modes,
10098 .input_mux = &alc882_capture_source,
10100 [ALC882_ASUS_A7M] = {
10101 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10102 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10103 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10104 alc882_asus_a7m_verbs },
10105 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10106 .dac_nids = alc882_dac_nids,
10107 .dig_out_nid = ALC882_DIGOUT_NID,
10108 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10109 .channel_mode = alc880_threestack_modes,
10111 .input_mux = &alc882_capture_source,
10113 [ALC883_3ST_2ch_DIG] = {
10114 .mixers = { alc883_3ST_2ch_mixer },
10115 .init_verbs = { alc883_init_verbs },
10116 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10117 .dac_nids = alc883_dac_nids,
10118 .dig_out_nid = ALC883_DIGOUT_NID,
10119 .dig_in_nid = ALC883_DIGIN_NID,
10120 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10121 .channel_mode = alc883_3ST_2ch_modes,
10122 .input_mux = &alc883_capture_source,
10124 [ALC883_3ST_6ch_DIG] = {
10125 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10126 .init_verbs = { alc883_init_verbs },
10127 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10128 .dac_nids = alc883_dac_nids,
10129 .dig_out_nid = ALC883_DIGOUT_NID,
10130 .dig_in_nid = ALC883_DIGIN_NID,
10131 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10132 .channel_mode = alc883_3ST_6ch_modes,
10134 .input_mux = &alc883_capture_source,
10136 [ALC883_3ST_6ch] = {
10137 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10138 .init_verbs = { alc883_init_verbs },
10139 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10140 .dac_nids = alc883_dac_nids,
10141 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10142 .channel_mode = alc883_3ST_6ch_modes,
10144 .input_mux = &alc883_capture_source,
10146 [ALC883_3ST_6ch_INTEL] = {
10147 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10148 .init_verbs = { alc883_init_verbs },
10149 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10150 .dac_nids = alc883_dac_nids,
10151 .dig_out_nid = ALC883_DIGOUT_NID,
10152 .dig_in_nid = ALC883_DIGIN_NID,
10153 .slave_dig_outs = alc883_slave_dig_outs,
10154 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10155 .channel_mode = alc883_3ST_6ch_intel_modes,
10157 .input_mux = &alc883_3stack_6ch_intel,
10159 [ALC889A_INTEL] = {
10160 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10161 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10162 alc_hp15_unsol_verbs },
10163 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10164 .dac_nids = alc883_dac_nids,
10165 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10166 .adc_nids = alc889_adc_nids,
10167 .dig_out_nid = ALC883_DIGOUT_NID,
10168 .dig_in_nid = ALC883_DIGIN_NID,
10169 .slave_dig_outs = alc883_slave_dig_outs,
10170 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10171 .channel_mode = alc889_8ch_intel_modes,
10172 .capsrc_nids = alc889_capsrc_nids,
10173 .input_mux = &alc889_capture_source,
10174 .setup = alc889_automute_setup,
10175 .init_hook = alc_automute_amp,
10176 .unsol_event = alc_automute_amp_unsol_event,
10180 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10181 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10182 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10183 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10184 .dac_nids = alc883_dac_nids,
10185 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10186 .adc_nids = alc889_adc_nids,
10187 .dig_out_nid = ALC883_DIGOUT_NID,
10188 .dig_in_nid = ALC883_DIGIN_NID,
10189 .slave_dig_outs = alc883_slave_dig_outs,
10190 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10191 .channel_mode = alc889_8ch_intel_modes,
10192 .capsrc_nids = alc889_capsrc_nids,
10193 .input_mux = &alc889_capture_source,
10194 .setup = alc889_automute_setup,
10195 .init_hook = alc889_intel_init_hook,
10196 .unsol_event = alc_automute_amp_unsol_event,
10199 [ALC883_6ST_DIG] = {
10200 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10201 .init_verbs = { alc883_init_verbs },
10202 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10203 .dac_nids = alc883_dac_nids,
10204 .dig_out_nid = ALC883_DIGOUT_NID,
10205 .dig_in_nid = ALC883_DIGIN_NID,
10206 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10207 .channel_mode = alc883_sixstack_modes,
10208 .input_mux = &alc883_capture_source,
10210 [ALC883_TARGA_DIG] = {
10211 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10212 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10213 alc883_targa_verbs},
10214 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10215 .dac_nids = alc883_dac_nids,
10216 .dig_out_nid = ALC883_DIGOUT_NID,
10217 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10218 .channel_mode = alc883_3ST_6ch_modes,
10220 .input_mux = &alc883_capture_source,
10221 .unsol_event = alc883_targa_unsol_event,
10222 .setup = alc882_targa_setup,
10223 .init_hook = alc882_targa_automute,
10225 [ALC883_TARGA_2ch_DIG] = {
10226 .mixers = { alc883_targa_2ch_mixer},
10227 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10228 alc883_targa_verbs},
10229 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10230 .dac_nids = alc883_dac_nids,
10231 .adc_nids = alc883_adc_nids_alt,
10232 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10233 .capsrc_nids = alc883_capsrc_nids,
10234 .dig_out_nid = ALC883_DIGOUT_NID,
10235 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10236 .channel_mode = alc883_3ST_2ch_modes,
10237 .input_mux = &alc883_capture_source,
10238 .unsol_event = alc883_targa_unsol_event,
10239 .setup = alc882_targa_setup,
10240 .init_hook = alc882_targa_automute,
10242 [ALC883_TARGA_8ch_DIG] = {
10243 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10244 alc883_chmode_mixer },
10245 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10246 alc883_targa_verbs },
10247 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10248 .dac_nids = alc883_dac_nids,
10249 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10250 .adc_nids = alc883_adc_nids_rev,
10251 .capsrc_nids = alc883_capsrc_nids_rev,
10252 .dig_out_nid = ALC883_DIGOUT_NID,
10253 .dig_in_nid = ALC883_DIGIN_NID,
10254 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10255 .channel_mode = alc883_4ST_8ch_modes,
10257 .input_mux = &alc883_capture_source,
10258 .unsol_event = alc883_targa_unsol_event,
10259 .setup = alc882_targa_setup,
10260 .init_hook = alc882_targa_automute,
10263 .mixers = { alc883_base_mixer },
10264 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10265 * and the headphone jack. Turn this on and rely on the
10266 * standard mute methods whenever the user wants to turn
10267 * these outputs off.
10269 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10270 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10271 .dac_nids = alc883_dac_nids,
10272 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10273 .channel_mode = alc883_3ST_2ch_modes,
10274 .input_mux = &alc883_capture_source,
10276 [ALC883_ACER_ASPIRE] = {
10277 .mixers = { alc883_acer_aspire_mixer },
10278 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10279 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10280 .dac_nids = alc883_dac_nids,
10281 .dig_out_nid = ALC883_DIGOUT_NID,
10282 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10283 .channel_mode = alc883_3ST_2ch_modes,
10284 .input_mux = &alc883_capture_source,
10285 .unsol_event = alc_automute_amp_unsol_event,
10286 .setup = alc883_acer_aspire_setup,
10287 .init_hook = alc_automute_amp,
10289 [ALC888_ACER_ASPIRE_4930G] = {
10290 .mixers = { alc888_base_mixer,
10291 alc883_chmode_mixer },
10292 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10293 alc888_acer_aspire_4930g_verbs },
10294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10295 .dac_nids = alc883_dac_nids,
10296 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10297 .adc_nids = alc883_adc_nids_rev,
10298 .capsrc_nids = alc883_capsrc_nids_rev,
10299 .dig_out_nid = ALC883_DIGOUT_NID,
10300 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10301 .channel_mode = alc883_3ST_6ch_modes,
10303 .const_channel_count = 6,
10305 ARRAY_SIZE(alc888_2_capture_sources),
10306 .input_mux = alc888_2_capture_sources,
10307 .unsol_event = alc_automute_amp_unsol_event,
10308 .setup = alc888_acer_aspire_4930g_setup,
10309 .init_hook = alc_automute_amp,
10311 [ALC888_ACER_ASPIRE_6530G] = {
10312 .mixers = { alc888_acer_aspire_6530_mixer },
10313 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10314 alc888_acer_aspire_6530g_verbs },
10315 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10316 .dac_nids = alc883_dac_nids,
10317 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10318 .adc_nids = alc883_adc_nids_rev,
10319 .capsrc_nids = alc883_capsrc_nids_rev,
10320 .dig_out_nid = ALC883_DIGOUT_NID,
10321 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10322 .channel_mode = alc883_3ST_2ch_modes,
10324 ARRAY_SIZE(alc888_2_capture_sources),
10325 .input_mux = alc888_acer_aspire_6530_sources,
10326 .unsol_event = alc_automute_amp_unsol_event,
10327 .setup = alc888_acer_aspire_6530g_setup,
10328 .init_hook = alc_automute_amp,
10330 [ALC888_ACER_ASPIRE_8930G] = {
10331 .mixers = { alc889_acer_aspire_8930g_mixer,
10332 alc883_chmode_mixer },
10333 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10334 alc889_acer_aspire_8930g_verbs,
10335 alc889_eapd_verbs},
10336 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10337 .dac_nids = alc883_dac_nids,
10338 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10339 .adc_nids = alc889_adc_nids,
10340 .capsrc_nids = alc889_capsrc_nids,
10341 .dig_out_nid = ALC883_DIGOUT_NID,
10342 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10343 .channel_mode = alc883_3ST_6ch_modes,
10345 .const_channel_count = 6,
10347 ARRAY_SIZE(alc889_capture_sources),
10348 .input_mux = alc889_capture_sources,
10349 .unsol_event = alc_automute_amp_unsol_event,
10350 .setup = alc889_acer_aspire_8930g_setup,
10351 .init_hook = alc_automute_amp,
10352 #ifdef CONFIG_SND_HDA_POWER_SAVE
10353 .power_hook = alc_power_eapd,
10356 [ALC888_ACER_ASPIRE_7730G] = {
10357 .mixers = { alc883_3ST_6ch_mixer,
10358 alc883_chmode_mixer },
10359 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10360 alc888_acer_aspire_7730G_verbs },
10361 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10362 .dac_nids = alc883_dac_nids,
10363 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10364 .adc_nids = alc883_adc_nids_rev,
10365 .capsrc_nids = alc883_capsrc_nids_rev,
10366 .dig_out_nid = ALC883_DIGOUT_NID,
10367 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10368 .channel_mode = alc883_3ST_6ch_modes,
10370 .const_channel_count = 6,
10371 .input_mux = &alc883_capture_source,
10372 .unsol_event = alc_automute_amp_unsol_event,
10373 .setup = alc888_acer_aspire_7730g_setup,
10374 .init_hook = alc_automute_amp,
10376 [ALC883_MEDION] = {
10377 .mixers = { alc883_fivestack_mixer,
10378 alc883_chmode_mixer },
10379 .init_verbs = { alc883_init_verbs,
10380 alc883_medion_eapd_verbs },
10381 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10382 .dac_nids = alc883_dac_nids,
10383 .adc_nids = alc883_adc_nids_alt,
10384 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10385 .capsrc_nids = alc883_capsrc_nids,
10386 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10387 .channel_mode = alc883_sixstack_modes,
10388 .input_mux = &alc883_capture_source,
10390 [ALC883_MEDION_MD2] = {
10391 .mixers = { alc883_medion_md2_mixer},
10392 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10393 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10394 .dac_nids = alc883_dac_nids,
10395 .dig_out_nid = ALC883_DIGOUT_NID,
10396 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10397 .channel_mode = alc883_3ST_2ch_modes,
10398 .input_mux = &alc883_capture_source,
10399 .unsol_event = alc_automute_amp_unsol_event,
10400 .setup = alc883_medion_md2_setup,
10401 .init_hook = alc_automute_amp,
10403 [ALC883_MEDION_WIM2160] = {
10404 .mixers = { alc883_medion_wim2160_mixer },
10405 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10406 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10407 .dac_nids = alc883_dac_nids,
10408 .dig_out_nid = ALC883_DIGOUT_NID,
10409 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10410 .adc_nids = alc883_adc_nids,
10411 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10412 .channel_mode = alc883_3ST_2ch_modes,
10413 .input_mux = &alc883_capture_source,
10414 .unsol_event = alc_automute_amp_unsol_event,
10415 .setup = alc883_medion_wim2160_setup,
10416 .init_hook = alc_automute_amp,
10418 [ALC883_LAPTOP_EAPD] = {
10419 .mixers = { alc883_base_mixer },
10420 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10421 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10422 .dac_nids = alc883_dac_nids,
10423 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10424 .channel_mode = alc883_3ST_2ch_modes,
10425 .input_mux = &alc883_capture_source,
10427 [ALC883_CLEVO_M540R] = {
10428 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10429 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .dig_out_nid = ALC883_DIGOUT_NID,
10433 .dig_in_nid = ALC883_DIGIN_NID,
10434 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10435 .channel_mode = alc883_3ST_6ch_clevo_modes,
10437 .input_mux = &alc883_capture_source,
10438 /* This machine has the hardware HP auto-muting, thus
10439 * we need no software mute via unsol event
10442 [ALC883_CLEVO_M720] = {
10443 .mixers = { alc883_clevo_m720_mixer },
10444 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10445 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10446 .dac_nids = alc883_dac_nids,
10447 .dig_out_nid = ALC883_DIGOUT_NID,
10448 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10449 .channel_mode = alc883_3ST_2ch_modes,
10450 .input_mux = &alc883_capture_source,
10451 .unsol_event = alc883_clevo_m720_unsol_event,
10452 .setup = alc883_clevo_m720_setup,
10453 .init_hook = alc883_clevo_m720_init_hook,
10455 [ALC883_LENOVO_101E_2ch] = {
10456 .mixers = { alc883_lenovo_101e_2ch_mixer},
10457 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10458 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10459 .dac_nids = alc883_dac_nids,
10460 .adc_nids = alc883_adc_nids_alt,
10461 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10462 .capsrc_nids = alc883_capsrc_nids,
10463 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10464 .channel_mode = alc883_3ST_2ch_modes,
10465 .input_mux = &alc883_lenovo_101e_capture_source,
10466 .unsol_event = alc883_lenovo_101e_unsol_event,
10467 .init_hook = alc883_lenovo_101e_all_automute,
10469 [ALC883_LENOVO_NB0763] = {
10470 .mixers = { alc883_lenovo_nb0763_mixer },
10471 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10472 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10473 .dac_nids = alc883_dac_nids,
10474 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10475 .channel_mode = alc883_3ST_2ch_modes,
10477 .input_mux = &alc883_lenovo_nb0763_capture_source,
10478 .unsol_event = alc_automute_amp_unsol_event,
10479 .setup = alc883_medion_md2_setup,
10480 .init_hook = alc_automute_amp,
10482 [ALC888_LENOVO_MS7195_DIG] = {
10483 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10484 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10485 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10486 .dac_nids = alc883_dac_nids,
10487 .dig_out_nid = ALC883_DIGOUT_NID,
10488 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10489 .channel_mode = alc883_3ST_6ch_modes,
10491 .input_mux = &alc883_capture_source,
10492 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10493 .init_hook = alc888_lenovo_ms7195_front_automute,
10495 [ALC883_HAIER_W66] = {
10496 .mixers = { alc883_targa_2ch_mixer},
10497 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10498 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10499 .dac_nids = alc883_dac_nids,
10500 .dig_out_nid = ALC883_DIGOUT_NID,
10501 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10502 .channel_mode = alc883_3ST_2ch_modes,
10503 .input_mux = &alc883_capture_source,
10504 .unsol_event = alc_automute_amp_unsol_event,
10505 .setup = alc883_haier_w66_setup,
10506 .init_hook = alc_automute_amp,
10508 [ALC888_3ST_HP] = {
10509 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10510 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10511 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10512 .dac_nids = alc883_dac_nids,
10513 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10514 .channel_mode = alc888_3st_hp_modes,
10516 .input_mux = &alc883_capture_source,
10517 .unsol_event = alc_automute_amp_unsol_event,
10518 .setup = alc888_3st_hp_setup,
10519 .init_hook = alc_automute_amp,
10521 [ALC888_6ST_DELL] = {
10522 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10523 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10524 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10525 .dac_nids = alc883_dac_nids,
10526 .dig_out_nid = ALC883_DIGOUT_NID,
10527 .dig_in_nid = ALC883_DIGIN_NID,
10528 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10529 .channel_mode = alc883_sixstack_modes,
10530 .input_mux = &alc883_capture_source,
10531 .unsol_event = alc_automute_amp_unsol_event,
10532 .setup = alc888_6st_dell_setup,
10533 .init_hook = alc_automute_amp,
10536 .mixers = { alc883_mitac_mixer },
10537 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10538 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10539 .dac_nids = alc883_dac_nids,
10540 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10541 .channel_mode = alc883_3ST_2ch_modes,
10542 .input_mux = &alc883_capture_source,
10543 .unsol_event = alc_automute_amp_unsol_event,
10544 .setup = alc883_mitac_setup,
10545 .init_hook = alc_automute_amp,
10547 [ALC883_FUJITSU_PI2515] = {
10548 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10549 .init_verbs = { alc883_init_verbs,
10550 alc883_2ch_fujitsu_pi2515_verbs},
10551 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10552 .dac_nids = alc883_dac_nids,
10553 .dig_out_nid = ALC883_DIGOUT_NID,
10554 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10555 .channel_mode = alc883_3ST_2ch_modes,
10556 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10557 .unsol_event = alc_automute_amp_unsol_event,
10558 .setup = alc883_2ch_fujitsu_pi2515_setup,
10559 .init_hook = alc_automute_amp,
10561 [ALC888_FUJITSU_XA3530] = {
10562 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10563 .init_verbs = { alc883_init_verbs,
10564 alc888_fujitsu_xa3530_verbs },
10565 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10566 .dac_nids = alc883_dac_nids,
10567 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10568 .adc_nids = alc883_adc_nids_rev,
10569 .capsrc_nids = alc883_capsrc_nids_rev,
10570 .dig_out_nid = ALC883_DIGOUT_NID,
10571 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10572 .channel_mode = alc888_4ST_8ch_intel_modes,
10574 ARRAY_SIZE(alc888_2_capture_sources),
10575 .input_mux = alc888_2_capture_sources,
10576 .unsol_event = alc_automute_amp_unsol_event,
10577 .setup = alc888_fujitsu_xa3530_setup,
10578 .init_hook = alc_automute_amp,
10580 [ALC888_LENOVO_SKY] = {
10581 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10582 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10583 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10584 .dac_nids = alc883_dac_nids,
10585 .dig_out_nid = ALC883_DIGOUT_NID,
10586 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10587 .channel_mode = alc883_sixstack_modes,
10589 .input_mux = &alc883_lenovo_sky_capture_source,
10590 .unsol_event = alc_automute_amp_unsol_event,
10591 .setup = alc888_lenovo_sky_setup,
10592 .init_hook = alc_automute_amp,
10594 [ALC888_ASUS_M90V] = {
10595 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10596 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10597 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10598 .dac_nids = alc883_dac_nids,
10599 .dig_out_nid = ALC883_DIGOUT_NID,
10600 .dig_in_nid = ALC883_DIGIN_NID,
10601 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10602 .channel_mode = alc883_3ST_6ch_modes,
10604 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10605 .unsol_event = alc_sku_unsol_event,
10606 .setup = alc883_mode2_setup,
10607 .init_hook = alc_inithook,
10609 [ALC888_ASUS_EEE1601] = {
10610 .mixers = { alc883_asus_eee1601_mixer },
10611 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10612 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10614 .dac_nids = alc883_dac_nids,
10615 .dig_out_nid = ALC883_DIGOUT_NID,
10616 .dig_in_nid = ALC883_DIGIN_NID,
10617 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10618 .channel_mode = alc883_3ST_2ch_modes,
10620 .input_mux = &alc883_asus_eee1601_capture_source,
10621 .unsol_event = alc_sku_unsol_event,
10622 .init_hook = alc883_eee1601_inithook,
10624 [ALC1200_ASUS_P5Q] = {
10625 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10626 .init_verbs = { alc883_init_verbs },
10627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10628 .dac_nids = alc883_dac_nids,
10629 .dig_out_nid = ALC1200_DIGOUT_NID,
10630 .dig_in_nid = ALC883_DIGIN_NID,
10631 .slave_dig_outs = alc1200_slave_dig_outs,
10632 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10633 .channel_mode = alc883_sixstack_modes,
10634 .input_mux = &alc883_capture_source,
10637 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10638 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10639 alc880_gpio1_init_verbs },
10640 .adc_nids = alc883_adc_nids,
10641 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10642 .capsrc_nids = alc883_capsrc_nids,
10643 .dac_nids = alc883_dac_nids,
10644 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10645 .channel_mode = alc889A_mb31_6ch_modes,
10646 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10647 .input_mux = &alc889A_mb31_capture_source,
10648 .dig_out_nid = ALC883_DIGOUT_NID,
10649 .unsol_event = alc889A_mb31_unsol_event,
10650 .init_hook = alc889A_mb31_automute,
10652 [ALC883_SONY_VAIO_TT] = {
10653 .mixers = { alc883_vaiott_mixer },
10654 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10655 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10656 .dac_nids = alc883_dac_nids,
10657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10658 .channel_mode = alc883_3ST_2ch_modes,
10659 .input_mux = &alc883_capture_source,
10660 .unsol_event = alc_automute_amp_unsol_event,
10661 .setup = alc883_vaiott_setup,
10662 .init_hook = alc_automute_amp,
10671 PINFIX_ABIT_AW9D_MAX,
10673 PINFIX_ACER_ASPIRE_7736,
10676 static const struct alc_fixup alc882_fixups[] = {
10677 [PINFIX_ABIT_AW9D_MAX] = {
10678 .pins = (const struct alc_pincfg[]) {
10679 { 0x15, 0x01080104 }, /* side */
10680 { 0x16, 0x01011012 }, /* rear */
10681 { 0x17, 0x01016011 }, /* clfe */
10685 [PINFIX_PB_M5210] = {
10686 .verbs = (const struct hda_verb[]) {
10687 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10691 [PINFIX_ACER_ASPIRE_7736] = {
10692 .sku = ALC_FIXUP_SKU_IGNORE,
10696 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10697 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10698 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10699 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
10704 * BIOS auto configuration
10706 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10707 const struct auto_pin_cfg *cfg)
10709 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10712 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10713 hda_nid_t nid, int pin_type,
10718 /* set as output */
10719 alc_set_pin_output(codec, nid, pin_type);
10723 else if (dac >= 0x02 && dac <= 0x05)
10727 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10730 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10732 struct alc_spec *spec = codec->spec;
10735 for (i = 0; i <= HDA_SIDE; i++) {
10736 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10737 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10739 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10740 spec->multiout.dac_nids[i]);
10744 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10746 struct alc_spec *spec = codec->spec;
10747 hda_nid_t pin, dac;
10750 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10751 pin = spec->autocfg.hp_pins[i];
10754 dac = spec->multiout.hp_nid;
10756 dac = spec->multiout.dac_nids[0]; /* to front */
10757 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10759 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10760 pin = spec->autocfg.speaker_pins[i];
10763 dac = spec->multiout.extra_out_nid[0];
10765 dac = spec->multiout.dac_nids[0]; /* to front */
10766 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10770 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10772 struct alc_spec *spec = codec->spec;
10773 struct auto_pin_cfg *cfg = &spec->autocfg;
10776 for (i = 0; i < cfg->num_inputs; i++) {
10777 hda_nid_t nid = cfg->inputs[i].pin;
10778 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10779 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10780 snd_hda_codec_write(codec, nid, 0,
10781 AC_VERB_SET_AMP_GAIN_MUTE,
10786 static void alc882_auto_init_input_src(struct hda_codec *codec)
10788 struct alc_spec *spec = codec->spec;
10791 for (c = 0; c < spec->num_adc_nids; c++) {
10792 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10793 hda_nid_t nid = spec->capsrc_nids[c];
10794 unsigned int mux_idx;
10795 const struct hda_input_mux *imux;
10796 int conns, mute, idx, item;
10798 conns = snd_hda_get_connections(codec, nid, conn_list,
10799 ARRAY_SIZE(conn_list));
10802 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10803 imux = &spec->input_mux[mux_idx];
10804 if (!imux->num_items && mux_idx > 0)
10805 imux = &spec->input_mux[0];
10806 for (idx = 0; idx < conns; idx++) {
10807 /* if the current connection is the selected one,
10808 * unmute it as default - otherwise mute it
10810 mute = AMP_IN_MUTE(idx);
10811 for (item = 0; item < imux->num_items; item++) {
10812 if (imux->items[item].index == idx) {
10813 if (spec->cur_mux[c] == item)
10814 mute = AMP_IN_UNMUTE(idx);
10818 /* check if we have a selector or mixer
10819 * we could check for the widget type instead, but
10820 * just check for Amp-In presence (in case of mixer
10821 * without amp-in there is something wrong, this
10822 * function shouldn't be used or capsrc nid is wrong)
10824 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10825 snd_hda_codec_write(codec, nid, 0,
10826 AC_VERB_SET_AMP_GAIN_MUTE,
10828 else if (mute != AMP_IN_MUTE(idx))
10829 snd_hda_codec_write(codec, nid, 0,
10830 AC_VERB_SET_CONNECT_SEL,
10836 /* add mic boosts if needed */
10837 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10839 struct alc_spec *spec = codec->spec;
10840 struct auto_pin_cfg *cfg = &spec->autocfg;
10844 for (i = 0; i < cfg->num_inputs; i++) {
10845 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10847 nid = cfg->inputs[i].pin;
10848 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10850 snprintf(label, sizeof(label), "%s Boost",
10851 hda_get_autocfg_input_label(codec, cfg, i));
10852 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10853 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10861 /* almost identical with ALC880 parser... */
10862 static int alc882_parse_auto_config(struct hda_codec *codec)
10864 struct alc_spec *spec = codec->spec;
10865 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10868 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10872 if (!spec->autocfg.line_outs)
10873 return 0; /* can't find valid BIOS pin config */
10875 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10878 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10881 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10885 err = alc880_auto_create_extra_out(spec,
10886 spec->autocfg.speaker_pins[0],
10890 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10894 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10896 alc_auto_parse_digital(codec);
10898 if (spec->kctls.list)
10899 add_mixer(spec, spec->kctls.list);
10901 add_verb(spec, alc883_auto_init_verbs);
10902 /* if ADC 0x07 is available, initialize it, too */
10903 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10904 add_verb(spec, alc882_adc1_init_verbs);
10906 spec->num_mux_defs = 1;
10907 spec->input_mux = &spec->private_imux[0];
10909 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10911 err = alc_auto_add_mic_boost(codec);
10915 return 1; /* config found */
10918 /* additional initialization for auto-configuration model */
10919 static void alc882_auto_init(struct hda_codec *codec)
10921 struct alc_spec *spec = codec->spec;
10922 alc882_auto_init_multi_out(codec);
10923 alc882_auto_init_hp_out(codec);
10924 alc882_auto_init_analog_input(codec);
10925 alc882_auto_init_input_src(codec);
10926 alc_auto_init_digital(codec);
10927 if (spec->unsol_event)
10928 alc_inithook(codec);
10931 static int patch_alc882(struct hda_codec *codec)
10933 struct alc_spec *spec;
10934 int err, board_config;
10936 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10940 codec->spec = spec;
10942 switch (codec->vendor_id) {
10947 /* ALC883 and variants */
10948 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10952 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10956 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10957 board_config = snd_hda_check_board_codec_sid_config(codec,
10958 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10960 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10961 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10963 board_config = ALC882_AUTO;
10966 if (board_config == ALC882_AUTO)
10967 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10969 alc_auto_parse_customize_define(codec);
10971 if (board_config == ALC882_AUTO) {
10972 /* automatic parse from the BIOS config */
10973 err = alc882_parse_auto_config(codec);
10979 "hda_codec: Cannot set up configuration "
10980 "from BIOS. Using base mode...\n");
10981 board_config = ALC882_3ST_DIG;
10985 if (has_cdefine_beep(codec)) {
10986 err = snd_hda_attach_beep_device(codec, 0x1);
10993 if (board_config != ALC882_AUTO)
10994 setup_preset(codec, &alc882_presets[board_config]);
10996 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10997 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10998 /* FIXME: setup DAC5 */
10999 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
11000 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
11002 spec->stream_digital_playback = &alc882_pcm_digital_playback;
11003 spec->stream_digital_capture = &alc882_pcm_digital_capture;
11005 if (!spec->adc_nids && spec->input_mux) {
11007 spec->num_adc_nids = 0;
11008 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
11009 const struct hda_input_mux *imux = spec->input_mux;
11011 hda_nid_t items[16];
11012 hda_nid_t nid = alc882_adc_nids[i];
11013 unsigned int wcap = get_wcaps(codec, nid);
11015 wcap = get_wcaps_type(wcap);
11016 if (wcap != AC_WID_AUD_IN)
11018 spec->private_adc_nids[spec->num_adc_nids] = nid;
11019 err = snd_hda_get_connections(codec, nid, &cap, 1);
11022 err = snd_hda_get_connections(codec, cap, items,
11023 ARRAY_SIZE(items));
11026 for (j = 0; j < imux->num_items; j++)
11027 if (imux->items[j].index >= err)
11029 if (j < imux->num_items)
11031 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
11032 spec->num_adc_nids++;
11034 spec->adc_nids = spec->private_adc_nids;
11035 spec->capsrc_nids = spec->private_capsrc_nids;
11038 set_capture_mixer(codec);
11040 if (has_cdefine_beep(codec))
11041 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
11043 if (board_config == ALC882_AUTO)
11044 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
11046 spec->vmaster_nid = 0x0c;
11048 codec->patch_ops = alc_patch_ops;
11049 if (board_config == ALC882_AUTO)
11050 spec->init_hook = alc882_auto_init;
11052 alc_init_jacks(codec);
11053 #ifdef CONFIG_SND_HDA_POWER_SAVE
11054 if (!spec->loopback.amplist)
11055 spec->loopback.amplist = alc882_loopbacks;
11066 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11067 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11069 #define alc262_dac_nids alc260_dac_nids
11070 #define alc262_adc_nids alc882_adc_nids
11071 #define alc262_adc_nids_alt alc882_adc_nids_alt
11072 #define alc262_capsrc_nids alc882_capsrc_nids
11073 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11075 #define alc262_modes alc260_modes
11076 #define alc262_capture_source alc882_capture_source
11078 static hda_nid_t alc262_dmic_adc_nids[1] = {
11083 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11085 static struct snd_kcontrol_new alc262_base_mixer[] = {
11086 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11087 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11088 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11089 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11090 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11091 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11092 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11093 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11094 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11095 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11096 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11097 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11098 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11099 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11100 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11101 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11105 /* update HP, line and mono-out pins according to the master switch */
11106 static void alc262_hp_master_update(struct hda_codec *codec)
11108 struct alc_spec *spec = codec->spec;
11109 int val = spec->master_sw;
11111 /* HP & line-out */
11112 snd_hda_codec_write_cache(codec, 0x1b, 0,
11113 AC_VERB_SET_PIN_WIDGET_CONTROL,
11115 snd_hda_codec_write_cache(codec, 0x15, 0,
11116 AC_VERB_SET_PIN_WIDGET_CONTROL,
11118 /* mono (speaker) depending on the HP jack sense */
11119 val = val && !spec->jack_present;
11120 snd_hda_codec_write_cache(codec, 0x16, 0,
11121 AC_VERB_SET_PIN_WIDGET_CONTROL,
11122 val ? PIN_OUT : 0);
11125 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11127 struct alc_spec *spec = codec->spec;
11129 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11130 alc262_hp_master_update(codec);
11133 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11135 if ((res >> 26) != ALC880_HP_EVENT)
11137 alc262_hp_bpc_automute(codec);
11140 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11142 struct alc_spec *spec = codec->spec;
11144 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11145 alc262_hp_master_update(codec);
11148 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11151 if ((res >> 26) != ALC880_HP_EVENT)
11153 alc262_hp_wildwest_automute(codec);
11156 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11158 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11159 struct snd_ctl_elem_value *ucontrol)
11161 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11162 struct alc_spec *spec = codec->spec;
11163 int val = !!*ucontrol->value.integer.value;
11165 if (val == spec->master_sw)
11167 spec->master_sw = val;
11168 alc262_hp_master_update(codec);
11172 #define ALC262_HP_MASTER_SWITCH \
11174 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11175 .name = "Master Playback Switch", \
11176 .info = snd_ctl_boolean_mono_info, \
11177 .get = alc262_hp_master_sw_get, \
11178 .put = alc262_hp_master_sw_put, \
11181 .iface = NID_MAPPING, \
11182 .name = "Master Playback Switch", \
11183 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11187 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11188 ALC262_HP_MASTER_SWITCH,
11189 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11190 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11191 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11192 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11194 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11196 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11197 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11198 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11199 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11200 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11201 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11202 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11203 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11204 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11205 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11206 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11207 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11211 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11212 ALC262_HP_MASTER_SWITCH,
11213 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11214 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11215 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11216 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11217 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11219 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11221 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11222 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11223 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11224 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11225 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11226 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11227 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11231 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11232 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11233 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11234 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11238 /* mute/unmute internal speaker according to the hp jack and mute state */
11239 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11241 struct alc_spec *spec = codec->spec;
11243 spec->autocfg.hp_pins[0] = 0x15;
11244 spec->autocfg.speaker_pins[0] = 0x14;
11247 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11248 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11249 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11250 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11251 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11252 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11253 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11254 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11258 static struct hda_verb alc262_hp_t5735_verbs[] = {
11259 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11260 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11262 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11266 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11267 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11268 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11269 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11270 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11271 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11272 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11276 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11277 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11278 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11279 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11280 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11281 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11282 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11283 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11285 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11290 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11297 /* bind hp and internal speaker mute (with plug check) as master switch */
11298 static void alc262_hippo_master_update(struct hda_codec *codec)
11300 struct alc_spec *spec = codec->spec;
11301 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11302 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11303 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11307 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11308 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11309 HDA_AMP_MUTE, mute);
11310 /* mute internal speaker per jack sense */
11311 if (spec->jack_present)
11312 mute = HDA_AMP_MUTE;
11314 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11315 HDA_AMP_MUTE, mute);
11316 if (speaker_nid && speaker_nid != line_nid)
11317 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11318 HDA_AMP_MUTE, mute);
11321 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11323 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11324 struct snd_ctl_elem_value *ucontrol)
11326 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11327 struct alc_spec *spec = codec->spec;
11328 int val = !!*ucontrol->value.integer.value;
11330 if (val == spec->master_sw)
11332 spec->master_sw = val;
11333 alc262_hippo_master_update(codec);
11337 #define ALC262_HIPPO_MASTER_SWITCH \
11339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11340 .name = "Master Playback Switch", \
11341 .info = snd_ctl_boolean_mono_info, \
11342 .get = alc262_hippo_master_sw_get, \
11343 .put = alc262_hippo_master_sw_put, \
11346 .iface = NID_MAPPING, \
11347 .name = "Master Playback Switch", \
11348 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11349 (SUBDEV_SPEAKER(0) << 16), \
11352 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11353 ALC262_HIPPO_MASTER_SWITCH,
11354 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11355 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11356 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11357 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11358 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11359 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11360 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11361 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11362 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11363 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11364 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11365 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11369 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11370 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11371 ALC262_HIPPO_MASTER_SWITCH,
11372 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11373 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11376 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11377 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11378 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11379 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11380 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11381 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11385 /* mute/unmute internal speaker according to the hp jack and mute state */
11386 static void alc262_hippo_automute(struct hda_codec *codec)
11388 struct alc_spec *spec = codec->spec;
11389 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11391 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11392 alc262_hippo_master_update(codec);
11395 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11397 if ((res >> 26) != ALC880_HP_EVENT)
11399 alc262_hippo_automute(codec);
11402 static void alc262_hippo_setup(struct hda_codec *codec)
11404 struct alc_spec *spec = codec->spec;
11406 spec->autocfg.hp_pins[0] = 0x15;
11407 spec->autocfg.speaker_pins[0] = 0x14;
11410 static void alc262_hippo1_setup(struct hda_codec *codec)
11412 struct alc_spec *spec = codec->spec;
11414 spec->autocfg.hp_pins[0] = 0x1b;
11415 spec->autocfg.speaker_pins[0] = 0x14;
11419 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11420 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11421 ALC262_HIPPO_MASTER_SWITCH,
11422 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11424 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11425 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11429 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11430 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11431 ALC262_HIPPO_MASTER_SWITCH,
11432 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11433 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11434 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11435 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11436 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11440 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11441 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11442 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11443 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11444 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11445 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11446 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11447 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11448 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11449 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11450 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11451 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11452 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11456 static struct hda_verb alc262_tyan_verbs[] = {
11457 /* Headphone automute */
11458 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11459 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11460 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11462 /* P11 AUX_IN, white 4-pin connector */
11463 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11464 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11465 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11466 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11471 /* unsolicited event for HP jack sensing */
11472 static void alc262_tyan_setup(struct hda_codec *codec)
11474 struct alc_spec *spec = codec->spec;
11476 spec->autocfg.hp_pins[0] = 0x1b;
11477 spec->autocfg.speaker_pins[0] = 0x15;
11481 #define alc262_capture_mixer alc882_capture_mixer
11482 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11485 * generic initialization of ADC, input mixers and output mixers
11487 static struct hda_verb alc262_init_verbs[] = {
11489 * Unmute ADC0-2 and set the default input to mic-in
11491 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11492 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11493 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11495 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11498 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11500 * Note: PASD motherboards uses the Line In 2 as the input for
11501 * front panel mic (mic 2)
11503 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11507 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11508 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11511 * Set up output mixers (0x0c - 0x0e)
11513 /* set vol=0 to output mixers */
11514 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11515 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11516 {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)},
11526 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11527 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11528 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11529 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11530 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11531 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11533 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11534 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11535 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11536 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11537 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11539 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11540 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11542 /* FIXME: use matrix-type input source selection */
11543 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11544 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11545 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11546 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11547 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11548 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11550 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11551 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11552 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11553 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11555 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11556 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11557 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11558 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11563 static struct hda_verb alc262_eapd_verbs[] = {
11564 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11565 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11569 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11571 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11572 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11574 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11575 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11579 static struct hda_verb alc262_sony_unsol_verbs[] = {
11580 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11581 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11582 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11584 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11589 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11590 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11591 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11592 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11593 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11594 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11598 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11599 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11600 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11601 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11602 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11603 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11604 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11605 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11606 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11610 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11612 struct alc_spec *spec = codec->spec;
11614 spec->autocfg.hp_pins[0] = 0x15;
11615 spec->autocfg.speaker_pins[0] = 0x14;
11616 spec->ext_mic.pin = 0x18;
11617 spec->ext_mic.mux_idx = 0;
11618 spec->int_mic.pin = 0x12;
11619 spec->int_mic.mux_idx = 9;
11620 spec->auto_mic = 1;
11626 * 0x16 = internal speaker
11627 * 0x18 = external mic
11630 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11631 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11632 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11634 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11635 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11636 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11639 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11643 static struct hda_verb alc262_nec_verbs[] = {
11644 /* Unmute Speaker */
11645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11648 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11651 /* External mic to headphone */
11652 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11653 /* External mic to speaker */
11654 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11660 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11661 * 0x1b = port replicator headphone out
11664 #define ALC_HP_EVENT 0x37
11666 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11667 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11668 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11669 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11670 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11674 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11675 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11676 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11680 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11681 /* Front Mic pin: input vref at 50% */
11682 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11683 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11687 static struct hda_input_mux alc262_fujitsu_capture_source = {
11691 { "Int Mic", 0x1 },
11696 static struct hda_input_mux alc262_HP_capture_source = {
11700 { "Front Mic", 0x1 },
11707 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11711 { "Front Mic", 0x2 },
11717 /* mute/unmute internal speaker according to the hp jacks and mute state */
11718 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11720 struct alc_spec *spec = codec->spec;
11723 if (force || !spec->sense_updated) {
11724 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11725 snd_hda_jack_detect(codec, 0x1b);
11726 spec->sense_updated = 1;
11728 /* unmute internal speaker only if both HPs are unplugged and
11729 * master switch is on
11731 if (spec->jack_present)
11732 mute = HDA_AMP_MUTE;
11734 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11735 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11736 HDA_AMP_MUTE, mute);
11739 /* unsolicited event for HP jack sensing */
11740 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11743 if ((res >> 26) != ALC_HP_EVENT)
11745 alc262_fujitsu_automute(codec, 1);
11748 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11750 alc262_fujitsu_automute(codec, 1);
11753 /* bind volumes of both NID 0x0c and 0x0d */
11754 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11755 .ops = &snd_hda_bind_vol,
11757 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11758 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11763 /* mute/unmute internal speaker according to the hp jack and mute state */
11764 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11766 struct alc_spec *spec = codec->spec;
11769 if (force || !spec->sense_updated) {
11770 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11771 spec->sense_updated = 1;
11773 if (spec->jack_present) {
11774 /* mute internal speaker */
11775 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11776 HDA_AMP_MUTE, HDA_AMP_MUTE);
11777 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11778 HDA_AMP_MUTE, HDA_AMP_MUTE);
11780 /* unmute internal speaker if necessary */
11781 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11782 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11783 HDA_AMP_MUTE, mute);
11784 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11785 HDA_AMP_MUTE, mute);
11789 /* unsolicited event for HP jack sensing */
11790 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11793 if ((res >> 26) != ALC_HP_EVENT)
11795 alc262_lenovo_3000_automute(codec, 1);
11798 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11799 int dir, int idx, long *valp)
11803 for (i = 0; i < 2; i++, valp++)
11804 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11806 *valp ? 0 : HDA_AMP_MUTE);
11810 /* bind hp and internal speaker mute (with plug check) */
11811 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11812 struct snd_ctl_elem_value *ucontrol)
11814 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11815 long *valp = ucontrol->value.integer.value;
11818 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11819 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11821 alc262_fujitsu_automute(codec, 0);
11825 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11826 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11828 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11829 .name = "Master Playback Switch",
11830 .subdevice = HDA_SUBDEV_AMP_FLAG,
11831 .info = snd_hda_mixer_amp_switch_info,
11832 .get = snd_hda_mixer_amp_switch_get,
11833 .put = alc262_fujitsu_master_sw_put,
11834 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11837 .iface = NID_MAPPING,
11838 .name = "Master Playback Switch",
11839 .private_value = 0x1b,
11841 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11842 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11843 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11844 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11845 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11846 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11847 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11848 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11852 /* bind hp and internal speaker mute (with plug check) */
11853 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11854 struct snd_ctl_elem_value *ucontrol)
11856 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11857 long *valp = ucontrol->value.integer.value;
11860 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11862 alc262_lenovo_3000_automute(codec, 0);
11866 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11867 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11869 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11870 .name = "Master Playback Switch",
11871 .subdevice = HDA_SUBDEV_AMP_FLAG,
11872 .info = snd_hda_mixer_amp_switch_info,
11873 .get = snd_hda_mixer_amp_switch_get,
11874 .put = alc262_lenovo_3000_master_sw_put,
11875 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11877 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11878 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11879 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11880 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11881 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11882 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11883 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11884 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11888 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11889 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11890 ALC262_HIPPO_MASTER_SWITCH,
11891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11892 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11893 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11894 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11895 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11896 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11900 /* additional init verbs for Benq laptops */
11901 static struct hda_verb alc262_EAPD_verbs[] = {
11902 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11903 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11907 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11908 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11909 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11911 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11912 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11916 /* Samsung Q1 Ultra Vista model setup */
11917 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11918 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11919 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11920 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11921 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11922 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11923 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11927 static struct hda_verb alc262_ultra_verbs[] = {
11929 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11930 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11931 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11933 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11934 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11935 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11936 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11938 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11939 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11940 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11941 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11944 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11945 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11946 /* ADC, choose mic */
11947 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11948 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11949 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11950 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11951 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11952 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11953 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11954 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11955 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11956 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11960 /* mute/unmute internal speaker according to the hp jack and mute state */
11961 static void alc262_ultra_automute(struct hda_codec *codec)
11963 struct alc_spec *spec = codec->spec;
11967 /* auto-mute only when HP is used as HP */
11968 if (!spec->cur_mux[0]) {
11969 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11970 if (spec->jack_present)
11971 mute = HDA_AMP_MUTE;
11973 /* mute/unmute internal speaker */
11974 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11975 HDA_AMP_MUTE, mute);
11976 /* mute/unmute HP */
11977 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11978 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11981 /* unsolicited event for HP jack sensing */
11982 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11985 if ((res >> 26) != ALC880_HP_EVENT)
11987 alc262_ultra_automute(codec);
11990 static struct hda_input_mux alc262_ultra_capture_source = {
11994 { "Headphone", 0x7 },
11998 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11999 struct snd_ctl_elem_value *ucontrol)
12001 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
12002 struct alc_spec *spec = codec->spec;
12005 ret = alc_mux_enum_put(kcontrol, ucontrol);
12008 /* reprogram the HP pin as mic or HP according to the input source */
12009 snd_hda_codec_write_cache(codec, 0x15, 0,
12010 AC_VERB_SET_PIN_WIDGET_CONTROL,
12011 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
12012 alc262_ultra_automute(codec); /* mute/unmute HP */
12016 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
12017 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
12018 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
12020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
12021 .name = "Capture Source",
12022 .info = alc_mux_enum_info,
12023 .get = alc_mux_enum_get,
12024 .put = alc262_ultra_mux_enum_put,
12027 .iface = NID_MAPPING,
12028 .name = "Capture Source",
12029 .private_value = 0x15,
12034 /* We use two mixers depending on the output pin; 0x16 is a mono output
12035 * and thus it's bound with a different mixer.
12036 * This function returns which mixer amp should be used.
12038 static int alc262_check_volbit(hda_nid_t nid)
12042 else if (nid == 0x16)
12048 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12049 const char *pfx, int *vbits, int idx)
12054 vbit = alc262_check_volbit(nid);
12057 if (*vbits & vbit) /* a volume control for this mixer already there */
12061 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12063 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12064 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12067 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12068 const char *pfx, int idx)
12075 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12077 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12078 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12081 /* add playback controls from the parsed DAC table */
12082 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12083 const struct auto_pin_cfg *cfg)
12089 spec->multiout.num_dacs = 1; /* only use one dac */
12090 spec->multiout.dac_nids = spec->private_dac_nids;
12091 spec->multiout.dac_nids[0] = 2;
12093 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
12095 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12097 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
12101 for (i = 0; i < 2; i++) {
12102 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12105 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12106 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12111 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12112 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12119 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12120 alc262_check_volbit(cfg->speaker_pins[0]) |
12121 alc262_check_volbit(cfg->hp_pins[0]);
12122 if (vbits == 1 || vbits == 2)
12123 pfx = "Master"; /* only one mixer is used */
12125 for (i = 0; i < 2; i++) {
12126 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12130 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12131 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12132 "Speaker", &vbits, i);
12136 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12137 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12138 "Headphone", &vbits, i);
12146 #define alc262_auto_create_input_ctls \
12147 alc882_auto_create_input_ctls
12150 * generic initialization of ADC, input mixers and output mixers
12152 static struct hda_verb alc262_volume_init_verbs[] = {
12154 * Unmute ADC0-2 and set the default input to mic-in
12156 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12157 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12158 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12159 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12160 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12161 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12163 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12165 * Note: PASD motherboards uses the Line In 2 as the input for
12166 * front panel mic (mic 2)
12168 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12169 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12170 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12171 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12172 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12173 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12176 * Set up output mixers (0x0c - 0x0f)
12178 /* set vol=0 to output mixers */
12179 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12180 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12181 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12183 /* set up input amps for analog loopback */
12184 /* Amp Indices: DAC = 0, mixer = 1 */
12185 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12186 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12187 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12188 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12189 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12190 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12192 /* FIXME: use matrix-type input source selection */
12193 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12194 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12197 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12198 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12202 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12203 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12207 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12208 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12213 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12215 * Unmute ADC0-2 and set the default input to mic-in
12217 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12218 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12219 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12220 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12221 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12222 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12224 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12226 * Note: PASD motherboards uses the Line In 2 as the input for
12227 * front panel mic (mic 2)
12229 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12230 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12231 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12232 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12233 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12234 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12235 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12236 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12239 * Set up output mixers (0x0c - 0x0e)
12241 /* set vol=0 to output mixers */
12242 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12243 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12244 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12246 /* set up input amps for analog loopback */
12247 /* Amp Indices: DAC = 0, mixer = 1 */
12248 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12249 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12250 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12251 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12252 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12253 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12255 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12256 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12257 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12259 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12260 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12262 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12263 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12265 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12266 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12267 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12268 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12269 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12271 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12272 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12273 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12274 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12275 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12276 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12279 /* FIXME: use matrix-type input source selection */
12280 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12281 /* Input mixer1: only unmute Mic */
12282 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12290 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12295 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12296 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12297 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12298 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12299 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12300 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12302 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12303 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12304 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12305 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12306 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12307 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12308 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12309 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12310 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12312 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12317 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12319 * Unmute ADC0-2 and set the default input to mic-in
12321 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12322 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12323 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12324 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12325 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12326 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12328 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12330 * Note: PASD motherboards uses the Line In 2 as the input for front
12331 * panel mic (mic 2)
12333 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12334 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12335 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12336 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12337 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12338 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12339 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12340 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12341 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12343 * Set up output mixers (0x0c - 0x0e)
12345 /* set vol=0 to output mixers */
12346 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12347 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12348 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12350 /* set up input amps for analog loopback */
12351 /* Amp Indices: DAC = 0, mixer = 1 */
12352 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12353 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12354 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12355 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12356 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12357 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12360 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12361 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12362 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12363 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12364 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12366 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12368 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12369 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12371 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12372 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12374 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12375 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12376 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12377 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12378 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12379 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12381 /* FIXME: use matrix-type input source selection */
12382 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12383 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12384 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12385 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12386 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12387 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12388 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12389 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12390 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12392 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12393 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12394 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12395 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12396 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12397 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12398 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12400 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12401 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12402 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12403 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12404 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12405 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12406 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12408 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12413 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12415 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12416 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12417 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12419 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12421 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12422 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12424 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12426 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12437 static const struct alc_fixup alc262_fixups[] = {
12438 [PINFIX_FSC_H270] = {
12439 .pins = (const struct alc_pincfg[]) {
12440 { 0x14, 0x99130110 }, /* speaker */
12441 { 0x15, 0x0221142f }, /* front HP */
12442 { 0x1b, 0x0121141f }, /* rear HP */
12446 [PINFIX_PB_M5210] = {
12447 .verbs = (const struct hda_verb[]) {
12448 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12454 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12455 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12460 #ifdef CONFIG_SND_HDA_POWER_SAVE
12461 #define alc262_loopbacks alc880_loopbacks
12464 /* pcm configuration: identical with ALC880 */
12465 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12466 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12467 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12468 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12471 * BIOS auto configuration
12473 static int alc262_parse_auto_config(struct hda_codec *codec)
12475 struct alc_spec *spec = codec->spec;
12477 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12479 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12483 if (!spec->autocfg.line_outs) {
12484 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12485 spec->multiout.max_channels = 2;
12486 spec->no_analog = 1;
12489 return 0; /* can't find valid BIOS pin config */
12491 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12494 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12498 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12501 alc_auto_parse_digital(codec);
12503 if (spec->kctls.list)
12504 add_mixer(spec, spec->kctls.list);
12506 add_verb(spec, alc262_volume_init_verbs);
12507 spec->num_mux_defs = 1;
12508 spec->input_mux = &spec->private_imux[0];
12510 err = alc_auto_add_mic_boost(codec);
12514 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12519 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12520 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12521 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12522 #define alc262_auto_init_input_src alc882_auto_init_input_src
12525 /* init callback for auto-configuration model -- overriding the default init */
12526 static void alc262_auto_init(struct hda_codec *codec)
12528 struct alc_spec *spec = codec->spec;
12529 alc262_auto_init_multi_out(codec);
12530 alc262_auto_init_hp_out(codec);
12531 alc262_auto_init_analog_input(codec);
12532 alc262_auto_init_input_src(codec);
12533 alc_auto_init_digital(codec);
12534 if (spec->unsol_event)
12535 alc_inithook(codec);
12539 * configuration and preset
12541 static const char *alc262_models[ALC262_MODEL_LAST] = {
12542 [ALC262_BASIC] = "basic",
12543 [ALC262_HIPPO] = "hippo",
12544 [ALC262_HIPPO_1] = "hippo_1",
12545 [ALC262_FUJITSU] = "fujitsu",
12546 [ALC262_HP_BPC] = "hp-bpc",
12547 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12548 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12549 [ALC262_HP_RP5700] = "hp-rp5700",
12550 [ALC262_BENQ_ED8] = "benq",
12551 [ALC262_BENQ_T31] = "benq-t31",
12552 [ALC262_SONY_ASSAMD] = "sony-assamd",
12553 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12554 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12555 [ALC262_ULTRA] = "ultra",
12556 [ALC262_LENOVO_3000] = "lenovo-3000",
12557 [ALC262_NEC] = "nec",
12558 [ALC262_TYAN] = "tyan",
12559 [ALC262_AUTO] = "auto",
12562 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12563 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12564 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12565 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12567 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12569 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12571 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12572 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12573 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12574 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12575 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12576 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12577 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12578 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12579 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12580 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12581 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12582 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12583 ALC262_HP_TC_T5735),
12584 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12585 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12586 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12587 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12588 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12589 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12590 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12591 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12592 #if 0 /* disable the quirk since model=auto works better in recent versions */
12593 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12594 ALC262_SONY_ASSAMD),
12596 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12597 ALC262_TOSHIBA_RX1),
12598 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12599 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12600 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12601 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12602 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12604 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12605 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12606 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12607 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12608 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12612 static struct alc_config_preset alc262_presets[] = {
12614 .mixers = { alc262_base_mixer },
12615 .init_verbs = { alc262_init_verbs },
12616 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12617 .dac_nids = alc262_dac_nids,
12619 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12620 .channel_mode = alc262_modes,
12621 .input_mux = &alc262_capture_source,
12624 .mixers = { alc262_hippo_mixer },
12625 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12626 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12627 .dac_nids = alc262_dac_nids,
12629 .dig_out_nid = ALC262_DIGOUT_NID,
12630 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12631 .channel_mode = alc262_modes,
12632 .input_mux = &alc262_capture_source,
12633 .unsol_event = alc262_hippo_unsol_event,
12634 .setup = alc262_hippo_setup,
12635 .init_hook = alc262_hippo_automute,
12637 [ALC262_HIPPO_1] = {
12638 .mixers = { alc262_hippo1_mixer },
12639 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12640 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12641 .dac_nids = alc262_dac_nids,
12643 .dig_out_nid = ALC262_DIGOUT_NID,
12644 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12645 .channel_mode = alc262_modes,
12646 .input_mux = &alc262_capture_source,
12647 .unsol_event = alc262_hippo_unsol_event,
12648 .setup = alc262_hippo1_setup,
12649 .init_hook = alc262_hippo_automute,
12651 [ALC262_FUJITSU] = {
12652 .mixers = { alc262_fujitsu_mixer },
12653 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12654 alc262_fujitsu_unsol_verbs },
12655 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12656 .dac_nids = alc262_dac_nids,
12658 .dig_out_nid = ALC262_DIGOUT_NID,
12659 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12660 .channel_mode = alc262_modes,
12661 .input_mux = &alc262_fujitsu_capture_source,
12662 .unsol_event = alc262_fujitsu_unsol_event,
12663 .init_hook = alc262_fujitsu_init_hook,
12665 [ALC262_HP_BPC] = {
12666 .mixers = { alc262_HP_BPC_mixer },
12667 .init_verbs = { alc262_HP_BPC_init_verbs },
12668 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12669 .dac_nids = alc262_dac_nids,
12671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12672 .channel_mode = alc262_modes,
12673 .input_mux = &alc262_HP_capture_source,
12674 .unsol_event = alc262_hp_bpc_unsol_event,
12675 .init_hook = alc262_hp_bpc_automute,
12677 [ALC262_HP_BPC_D7000_WF] = {
12678 .mixers = { alc262_HP_BPC_WildWest_mixer },
12679 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12680 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12681 .dac_nids = alc262_dac_nids,
12683 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12684 .channel_mode = alc262_modes,
12685 .input_mux = &alc262_HP_D7000_capture_source,
12686 .unsol_event = alc262_hp_wildwest_unsol_event,
12687 .init_hook = alc262_hp_wildwest_automute,
12689 [ALC262_HP_BPC_D7000_WL] = {
12690 .mixers = { alc262_HP_BPC_WildWest_mixer,
12691 alc262_HP_BPC_WildWest_option_mixer },
12692 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12693 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12694 .dac_nids = alc262_dac_nids,
12696 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12697 .channel_mode = alc262_modes,
12698 .input_mux = &alc262_HP_D7000_capture_source,
12699 .unsol_event = alc262_hp_wildwest_unsol_event,
12700 .init_hook = alc262_hp_wildwest_automute,
12702 [ALC262_HP_TC_T5735] = {
12703 .mixers = { alc262_hp_t5735_mixer },
12704 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12705 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12706 .dac_nids = alc262_dac_nids,
12708 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12709 .channel_mode = alc262_modes,
12710 .input_mux = &alc262_capture_source,
12711 .unsol_event = alc_sku_unsol_event,
12712 .setup = alc262_hp_t5735_setup,
12713 .init_hook = alc_inithook,
12715 [ALC262_HP_RP5700] = {
12716 .mixers = { alc262_hp_rp5700_mixer },
12717 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12718 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12719 .dac_nids = alc262_dac_nids,
12720 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12721 .channel_mode = alc262_modes,
12722 .input_mux = &alc262_hp_rp5700_capture_source,
12724 [ALC262_BENQ_ED8] = {
12725 .mixers = { alc262_base_mixer },
12726 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12727 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12728 .dac_nids = alc262_dac_nids,
12730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12731 .channel_mode = alc262_modes,
12732 .input_mux = &alc262_capture_source,
12734 [ALC262_SONY_ASSAMD] = {
12735 .mixers = { alc262_sony_mixer },
12736 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12737 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12738 .dac_nids = alc262_dac_nids,
12740 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12741 .channel_mode = alc262_modes,
12742 .input_mux = &alc262_capture_source,
12743 .unsol_event = alc262_hippo_unsol_event,
12744 .setup = alc262_hippo_setup,
12745 .init_hook = alc262_hippo_automute,
12747 [ALC262_BENQ_T31] = {
12748 .mixers = { alc262_benq_t31_mixer },
12749 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12750 alc_hp15_unsol_verbs },
12751 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12752 .dac_nids = alc262_dac_nids,
12754 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12755 .channel_mode = alc262_modes,
12756 .input_mux = &alc262_capture_source,
12757 .unsol_event = alc262_hippo_unsol_event,
12758 .setup = alc262_hippo_setup,
12759 .init_hook = alc262_hippo_automute,
12762 .mixers = { alc262_ultra_mixer },
12763 .cap_mixer = alc262_ultra_capture_mixer,
12764 .init_verbs = { alc262_ultra_verbs },
12765 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12766 .dac_nids = alc262_dac_nids,
12767 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12768 .channel_mode = alc262_modes,
12769 .input_mux = &alc262_ultra_capture_source,
12770 .adc_nids = alc262_adc_nids, /* ADC0 */
12771 .capsrc_nids = alc262_capsrc_nids,
12772 .num_adc_nids = 1, /* single ADC */
12773 .unsol_event = alc262_ultra_unsol_event,
12774 .init_hook = alc262_ultra_automute,
12776 [ALC262_LENOVO_3000] = {
12777 .mixers = { alc262_lenovo_3000_mixer },
12778 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12779 alc262_lenovo_3000_unsol_verbs,
12780 alc262_lenovo_3000_init_verbs },
12781 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12782 .dac_nids = alc262_dac_nids,
12784 .dig_out_nid = ALC262_DIGOUT_NID,
12785 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12786 .channel_mode = alc262_modes,
12787 .input_mux = &alc262_fujitsu_capture_source,
12788 .unsol_event = alc262_lenovo_3000_unsol_event,
12791 .mixers = { alc262_nec_mixer },
12792 .init_verbs = { alc262_nec_verbs },
12793 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12794 .dac_nids = alc262_dac_nids,
12796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12797 .channel_mode = alc262_modes,
12798 .input_mux = &alc262_capture_source,
12800 [ALC262_TOSHIBA_S06] = {
12801 .mixers = { alc262_toshiba_s06_mixer },
12802 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12803 alc262_eapd_verbs },
12804 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12805 .capsrc_nids = alc262_dmic_capsrc_nids,
12806 .dac_nids = alc262_dac_nids,
12807 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12808 .num_adc_nids = 1, /* single ADC */
12809 .dig_out_nid = ALC262_DIGOUT_NID,
12810 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12811 .channel_mode = alc262_modes,
12812 .unsol_event = alc_sku_unsol_event,
12813 .setup = alc262_toshiba_s06_setup,
12814 .init_hook = alc_inithook,
12816 [ALC262_TOSHIBA_RX1] = {
12817 .mixers = { alc262_toshiba_rx1_mixer },
12818 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12819 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12820 .dac_nids = alc262_dac_nids,
12822 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12823 .channel_mode = alc262_modes,
12824 .input_mux = &alc262_capture_source,
12825 .unsol_event = alc262_hippo_unsol_event,
12826 .setup = alc262_hippo_setup,
12827 .init_hook = alc262_hippo_automute,
12830 .mixers = { alc262_tyan_mixer },
12831 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12832 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12833 .dac_nids = alc262_dac_nids,
12835 .dig_out_nid = ALC262_DIGOUT_NID,
12836 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12837 .channel_mode = alc262_modes,
12838 .input_mux = &alc262_capture_source,
12839 .unsol_event = alc_automute_amp_unsol_event,
12840 .setup = alc262_tyan_setup,
12841 .init_hook = alc_automute_amp,
12845 static int patch_alc262(struct hda_codec *codec)
12847 struct alc_spec *spec;
12851 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12855 codec->spec = spec;
12857 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12862 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12863 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12864 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12865 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12868 alc_auto_parse_customize_define(codec);
12870 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12872 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12876 if (board_config < 0) {
12877 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12879 board_config = ALC262_AUTO;
12882 if (board_config == ALC262_AUTO)
12883 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12885 if (board_config == ALC262_AUTO) {
12886 /* automatic parse from the BIOS config */
12887 err = alc262_parse_auto_config(codec);
12893 "hda_codec: Cannot set up configuration "
12894 "from BIOS. Using base mode...\n");
12895 board_config = ALC262_BASIC;
12899 if (!spec->no_analog && has_cdefine_beep(codec)) {
12900 err = snd_hda_attach_beep_device(codec, 0x1);
12907 if (board_config != ALC262_AUTO)
12908 setup_preset(codec, &alc262_presets[board_config]);
12910 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12911 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12913 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12914 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12916 if (!spec->adc_nids && spec->input_mux) {
12918 /* check whether the digital-mic has to be supported */
12919 for (i = 0; i < spec->input_mux->num_items; i++) {
12920 if (spec->input_mux->items[i].index >= 9)
12923 if (i < spec->input_mux->num_items) {
12924 /* use only ADC0 */
12925 spec->adc_nids = alc262_dmic_adc_nids;
12926 spec->num_adc_nids = 1;
12927 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12929 /* all analog inputs */
12930 /* check whether NID 0x07 is valid */
12931 unsigned int wcap = get_wcaps(codec, 0x07);
12934 wcap = get_wcaps_type(wcap);
12935 if (wcap != AC_WID_AUD_IN) {
12936 spec->adc_nids = alc262_adc_nids_alt;
12937 spec->num_adc_nids =
12938 ARRAY_SIZE(alc262_adc_nids_alt);
12939 spec->capsrc_nids = alc262_capsrc_nids_alt;
12941 spec->adc_nids = alc262_adc_nids;
12942 spec->num_adc_nids =
12943 ARRAY_SIZE(alc262_adc_nids);
12944 spec->capsrc_nids = alc262_capsrc_nids;
12948 if (!spec->cap_mixer && !spec->no_analog)
12949 set_capture_mixer(codec);
12950 if (!spec->no_analog && has_cdefine_beep(codec))
12951 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12953 if (board_config == ALC262_AUTO)
12954 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12956 spec->vmaster_nid = 0x0c;
12958 codec->patch_ops = alc_patch_ops;
12959 if (board_config == ALC262_AUTO)
12960 spec->init_hook = alc262_auto_init;
12962 alc_init_jacks(codec);
12963 #ifdef CONFIG_SND_HDA_POWER_SAVE
12964 if (!spec->loopback.amplist)
12965 spec->loopback.amplist = alc262_loopbacks;
12972 * ALC268 channel source setting (2 channel)
12974 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12975 #define alc268_modes alc260_modes
12977 static hda_nid_t alc268_dac_nids[2] = {
12982 static hda_nid_t alc268_adc_nids[2] = {
12987 static hda_nid_t alc268_adc_nids_alt[1] = {
12992 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12994 static struct snd_kcontrol_new alc268_base_mixer[] = {
12995 /* output mixer control */
12996 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12997 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12998 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12999 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13000 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13001 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13002 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13006 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
13007 /* output mixer control */
13008 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13009 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13010 ALC262_HIPPO_MASTER_SWITCH,
13011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13012 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
13013 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13017 /* bind Beep switches of both NID 0x0f and 0x10 */
13018 static struct hda_bind_ctls alc268_bind_beep_sw = {
13019 .ops = &snd_hda_bind_sw,
13021 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
13022 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
13027 static struct snd_kcontrol_new alc268_beep_mixer[] = {
13028 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
13029 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
13033 static struct hda_verb alc268_eapd_verbs[] = {
13034 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
13035 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
13039 /* Toshiba specific */
13040 static struct hda_verb alc268_toshiba_verbs[] = {
13041 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13045 /* Acer specific */
13046 /* bind volumes of both NID 0x02 and 0x03 */
13047 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
13048 .ops = &snd_hda_bind_vol,
13050 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13051 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13056 /* mute/unmute internal speaker according to the hp jack and mute state */
13057 static void alc268_acer_automute(struct hda_codec *codec, int force)
13059 struct alc_spec *spec = codec->spec;
13062 if (force || !spec->sense_updated) {
13063 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13064 spec->sense_updated = 1;
13066 if (spec->jack_present)
13067 mute = HDA_AMP_MUTE; /* mute internal speaker */
13068 else /* unmute internal speaker if necessary */
13069 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13070 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13071 HDA_AMP_MUTE, mute);
13075 /* bind hp and internal speaker mute (with plug check) */
13076 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13077 struct snd_ctl_elem_value *ucontrol)
13079 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13080 long *valp = ucontrol->value.integer.value;
13083 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13085 alc268_acer_automute(codec, 0);
13089 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13090 /* output mixer control */
13091 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13093 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13094 .name = "Master Playback Switch",
13095 .subdevice = HDA_SUBDEV_AMP_FLAG,
13096 .info = snd_hda_mixer_amp_switch_info,
13097 .get = snd_hda_mixer_amp_switch_get,
13098 .put = alc268_acer_master_sw_put,
13099 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13101 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13105 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13106 /* output mixer control */
13107 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13109 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13110 .name = "Master Playback Switch",
13111 .subdevice = HDA_SUBDEV_AMP_FLAG,
13112 .info = snd_hda_mixer_amp_switch_info,
13113 .get = snd_hda_mixer_amp_switch_get,
13114 .put = alc268_acer_master_sw_put,
13115 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13117 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13118 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13119 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13123 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13124 /* output mixer control */
13125 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13128 .name = "Master Playback Switch",
13129 .subdevice = HDA_SUBDEV_AMP_FLAG,
13130 .info = snd_hda_mixer_amp_switch_info,
13131 .get = snd_hda_mixer_amp_switch_get,
13132 .put = alc268_acer_master_sw_put,
13133 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13135 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13136 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13140 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13141 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13142 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13143 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13144 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13145 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13146 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13150 static struct hda_verb alc268_acer_verbs[] = {
13151 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13152 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13153 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13154 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13155 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13157 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13161 /* unsolicited event for HP jack sensing */
13162 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13163 #define alc268_toshiba_setup alc262_hippo_setup
13164 #define alc268_toshiba_automute alc262_hippo_automute
13166 static void alc268_acer_unsol_event(struct hda_codec *codec,
13169 if ((res >> 26) != ALC880_HP_EVENT)
13171 alc268_acer_automute(codec, 1);
13174 static void alc268_acer_init_hook(struct hda_codec *codec)
13176 alc268_acer_automute(codec, 1);
13179 /* toggle speaker-output according to the hp-jack state */
13180 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13182 unsigned int present;
13183 unsigned char bits;
13185 present = snd_hda_jack_detect(codec, 0x15);
13186 bits = present ? HDA_AMP_MUTE : 0;
13187 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13188 HDA_AMP_MUTE, bits);
13189 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13190 HDA_AMP_MUTE, bits);
13193 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13196 switch (res >> 26) {
13197 case ALC880_HP_EVENT:
13198 alc268_aspire_one_speaker_automute(codec);
13200 case ALC880_MIC_EVENT:
13201 alc_mic_automute(codec);
13206 static void alc268_acer_lc_setup(struct hda_codec *codec)
13208 struct alc_spec *spec = codec->spec;
13209 spec->ext_mic.pin = 0x18;
13210 spec->ext_mic.mux_idx = 0;
13211 spec->int_mic.pin = 0x12;
13212 spec->int_mic.mux_idx = 6;
13213 spec->auto_mic = 1;
13216 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13218 alc268_aspire_one_speaker_automute(codec);
13219 alc_mic_automute(codec);
13222 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13223 /* output mixer control */
13224 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13225 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13226 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13227 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13228 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13229 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13233 static struct hda_verb alc268_dell_verbs[] = {
13234 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13235 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13237 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13241 /* mute/unmute internal speaker according to the hp jack and mute state */
13242 static void alc268_dell_setup(struct hda_codec *codec)
13244 struct alc_spec *spec = codec->spec;
13246 spec->autocfg.hp_pins[0] = 0x15;
13247 spec->autocfg.speaker_pins[0] = 0x14;
13248 spec->ext_mic.pin = 0x18;
13249 spec->ext_mic.mux_idx = 0;
13250 spec->int_mic.pin = 0x19;
13251 spec->int_mic.mux_idx = 1;
13252 spec->auto_mic = 1;
13255 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13256 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13257 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13258 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13259 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13260 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13261 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13262 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13263 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13267 static struct hda_verb alc267_quanta_il1_verbs[] = {
13268 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13269 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13273 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13275 struct alc_spec *spec = codec->spec;
13276 spec->autocfg.hp_pins[0] = 0x15;
13277 spec->autocfg.speaker_pins[0] = 0x14;
13278 spec->ext_mic.pin = 0x18;
13279 spec->ext_mic.mux_idx = 0;
13280 spec->int_mic.pin = 0x19;
13281 spec->int_mic.mux_idx = 1;
13282 spec->auto_mic = 1;
13286 * generic initialization of ADC, input mixers and output mixers
13288 static struct hda_verb alc268_base_init_verbs[] = {
13289 /* Unmute DAC0-1 and set vol = 0 */
13290 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13291 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13294 * Set up output mixers (0x0c - 0x0e)
13296 /* set vol=0 to output mixers */
13297 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13298 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13300 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13301 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13303 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13304 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13305 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13307 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13308 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13309 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13310 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13313 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13314 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13315 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13316 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13318 /* set PCBEEP vol = 0, mute connections */
13319 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13321 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13323 /* Unmute Selector 23h,24h and set the default input to mic-in */
13325 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13326 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13327 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13328 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13334 * generic initialization of ADC, input mixers and output mixers
13336 static struct hda_verb alc268_volume_init_verbs[] = {
13337 /* set output DAC */
13338 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13339 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13341 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13342 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13344 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13345 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13347 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13348 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13349 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13351 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13354 /* set PCBEEP vol = 0, mute connections */
13355 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13356 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13357 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13362 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13363 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13364 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13368 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13369 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13370 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13375 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13376 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13377 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13378 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13379 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13384 static struct hda_input_mux alc268_capture_source = {
13388 { "Front Mic", 0x1 },
13394 static struct hda_input_mux alc268_acer_capture_source = {
13398 { "Internal Mic", 0x1 },
13403 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13407 { "Internal Mic", 0x6 },
13412 #ifdef CONFIG_SND_DEBUG
13413 static struct snd_kcontrol_new alc268_test_mixer[] = {
13414 /* Volume widgets */
13415 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13416 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13417 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13418 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13419 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13420 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13421 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13422 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13423 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13424 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13425 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13426 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13427 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13428 /* The below appears problematic on some hardwares */
13429 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13430 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13431 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13432 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13433 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13435 /* Modes for retasking pin widgets */
13436 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13437 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13438 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13439 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13441 /* Controls for GPIO pins, assuming they are configured as outputs */
13442 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13443 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13444 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13445 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13447 /* Switches to allow the digital SPDIF output pin to be enabled.
13448 * The ALC268 does not have an SPDIF input.
13450 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13452 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13453 * this output to turn on an external amplifier.
13455 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13456 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13462 /* create input playback/capture controls for the given pin */
13463 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13464 const char *ctlname, int idx)
13475 case 0x1a: /* ALC259/269 only */
13476 case 0x1b: /* ALC259/269 only */
13477 case 0x21: /* ALC269vb has this pin, too */
13481 snd_printd(KERN_WARNING "hda_codec: "
13482 "ignoring pin 0x%x as unknown\n", nid);
13485 if (spec->multiout.dac_nids[0] != dac &&
13486 spec->multiout.dac_nids[1] != dac) {
13487 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13488 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13492 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13496 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13497 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13499 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13500 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13506 /* add playback controls from the parsed DAC table */
13507 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13508 const struct auto_pin_cfg *cfg)
13513 spec->multiout.dac_nids = spec->private_dac_nids;
13515 nid = cfg->line_out_pins[0];
13518 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13522 err = alc268_new_analog_output(spec, nid, name, 0);
13527 nid = cfg->speaker_pins[0];
13529 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13530 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13534 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13538 nid = cfg->hp_pins[0];
13540 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13545 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13547 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13548 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13555 /* create playback/capture controls for input pins */
13556 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13557 const struct auto_pin_cfg *cfg)
13559 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13562 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13563 hda_nid_t nid, int pin_type)
13567 alc_set_pin_output(codec, nid, pin_type);
13568 if (nid == 0x14 || nid == 0x16)
13572 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13575 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13577 struct alc_spec *spec = codec->spec;
13580 for (i = 0; i < spec->autocfg.line_outs; i++) {
13581 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13582 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13583 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13587 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13589 struct alc_spec *spec = codec->spec;
13593 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13594 pin = spec->autocfg.hp_pins[i];
13595 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13597 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13598 pin = spec->autocfg.speaker_pins[i];
13599 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13601 if (spec->autocfg.mono_out_pin)
13602 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13603 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13606 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13608 struct alc_spec *spec = codec->spec;
13609 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13610 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13611 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13612 unsigned int dac_vol1, dac_vol2;
13614 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13615 snd_hda_codec_write(codec, speaker_nid, 0,
13616 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13617 /* mute mixer inputs from 0x1d */
13618 snd_hda_codec_write(codec, 0x0f, 0,
13619 AC_VERB_SET_AMP_GAIN_MUTE,
13621 snd_hda_codec_write(codec, 0x10, 0,
13622 AC_VERB_SET_AMP_GAIN_MUTE,
13625 /* unmute mixer inputs from 0x1d */
13626 snd_hda_codec_write(codec, 0x0f, 0,
13627 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13628 snd_hda_codec_write(codec, 0x10, 0,
13629 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13632 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13633 if (line_nid == 0x14)
13634 dac_vol2 = AMP_OUT_ZERO;
13635 else if (line_nid == 0x15)
13636 dac_vol1 = AMP_OUT_ZERO;
13637 if (hp_nid == 0x14)
13638 dac_vol2 = AMP_OUT_ZERO;
13639 else if (hp_nid == 0x15)
13640 dac_vol1 = AMP_OUT_ZERO;
13641 if (line_nid != 0x16 || hp_nid != 0x16 ||
13642 spec->autocfg.line_out_pins[1] != 0x16 ||
13643 spec->autocfg.line_out_pins[2] != 0x16)
13644 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13646 snd_hda_codec_write(codec, 0x02, 0,
13647 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13648 snd_hda_codec_write(codec, 0x03, 0,
13649 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13652 /* pcm configuration: identical with ALC880 */
13653 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13654 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13655 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13656 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13659 * BIOS auto configuration
13661 static int alc268_parse_auto_config(struct hda_codec *codec)
13663 struct alc_spec *spec = codec->spec;
13665 static hda_nid_t alc268_ignore[] = { 0 };
13667 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13671 if (!spec->autocfg.line_outs) {
13672 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13673 spec->multiout.max_channels = 2;
13674 spec->no_analog = 1;
13677 return 0; /* can't find valid BIOS pin config */
13679 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13682 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13686 spec->multiout.max_channels = 2;
13689 /* digital only support output */
13690 alc_auto_parse_digital(codec);
13691 if (spec->kctls.list)
13692 add_mixer(spec, spec->kctls.list);
13694 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13695 add_mixer(spec, alc268_beep_mixer);
13697 add_verb(spec, alc268_volume_init_verbs);
13698 spec->num_mux_defs = 2;
13699 spec->input_mux = &spec->private_imux[0];
13701 err = alc_auto_add_mic_boost(codec);
13705 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13710 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13712 /* init callback for auto-configuration model -- overriding the default init */
13713 static void alc268_auto_init(struct hda_codec *codec)
13715 struct alc_spec *spec = codec->spec;
13716 alc268_auto_init_multi_out(codec);
13717 alc268_auto_init_hp_out(codec);
13718 alc268_auto_init_mono_speaker_out(codec);
13719 alc268_auto_init_analog_input(codec);
13720 alc_auto_init_digital(codec);
13721 if (spec->unsol_event)
13722 alc_inithook(codec);
13726 * configuration and preset
13728 static const char *alc268_models[ALC268_MODEL_LAST] = {
13729 [ALC267_QUANTA_IL1] = "quanta-il1",
13730 [ALC268_3ST] = "3stack",
13731 [ALC268_TOSHIBA] = "toshiba",
13732 [ALC268_ACER] = "acer",
13733 [ALC268_ACER_DMIC] = "acer-dmic",
13734 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13735 [ALC268_DELL] = "dell",
13736 [ALC268_ZEPTO] = "zepto",
13737 #ifdef CONFIG_SND_DEBUG
13738 [ALC268_TEST] = "test",
13740 [ALC268_AUTO] = "auto",
13743 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13744 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13745 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13746 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13747 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13748 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13749 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13750 ALC268_ACER_ASPIRE_ONE),
13751 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13752 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13753 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13754 /* almost compatible with toshiba but with optional digital outs;
13755 * auto-probing seems working fine
13757 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13759 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13760 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13761 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13762 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13763 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13767 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13768 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13769 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13770 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13771 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13776 static struct alc_config_preset alc268_presets[] = {
13777 [ALC267_QUANTA_IL1] = {
13778 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13779 alc268_capture_nosrc_mixer },
13780 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13781 alc267_quanta_il1_verbs },
13782 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13783 .dac_nids = alc268_dac_nids,
13784 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13785 .adc_nids = alc268_adc_nids_alt,
13787 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13788 .channel_mode = alc268_modes,
13789 .unsol_event = alc_sku_unsol_event,
13790 .setup = alc267_quanta_il1_setup,
13791 .init_hook = alc_inithook,
13794 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13795 alc268_beep_mixer },
13796 .init_verbs = { alc268_base_init_verbs },
13797 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13798 .dac_nids = alc268_dac_nids,
13799 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13800 .adc_nids = alc268_adc_nids_alt,
13801 .capsrc_nids = alc268_capsrc_nids,
13803 .dig_out_nid = ALC268_DIGOUT_NID,
13804 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13805 .channel_mode = alc268_modes,
13806 .input_mux = &alc268_capture_source,
13808 [ALC268_TOSHIBA] = {
13809 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13810 alc268_beep_mixer },
13811 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13812 alc268_toshiba_verbs },
13813 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13814 .dac_nids = alc268_dac_nids,
13815 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13816 .adc_nids = alc268_adc_nids_alt,
13817 .capsrc_nids = alc268_capsrc_nids,
13819 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13820 .channel_mode = alc268_modes,
13821 .input_mux = &alc268_capture_source,
13822 .unsol_event = alc268_toshiba_unsol_event,
13823 .setup = alc268_toshiba_setup,
13824 .init_hook = alc268_toshiba_automute,
13827 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13828 alc268_beep_mixer },
13829 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13830 alc268_acer_verbs },
13831 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13832 .dac_nids = alc268_dac_nids,
13833 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13834 .adc_nids = alc268_adc_nids_alt,
13835 .capsrc_nids = alc268_capsrc_nids,
13837 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13838 .channel_mode = alc268_modes,
13839 .input_mux = &alc268_acer_capture_source,
13840 .unsol_event = alc268_acer_unsol_event,
13841 .init_hook = alc268_acer_init_hook,
13843 [ALC268_ACER_DMIC] = {
13844 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13845 alc268_beep_mixer },
13846 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13847 alc268_acer_verbs },
13848 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13849 .dac_nids = alc268_dac_nids,
13850 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13851 .adc_nids = alc268_adc_nids_alt,
13852 .capsrc_nids = alc268_capsrc_nids,
13854 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13855 .channel_mode = alc268_modes,
13856 .input_mux = &alc268_acer_dmic_capture_source,
13857 .unsol_event = alc268_acer_unsol_event,
13858 .init_hook = alc268_acer_init_hook,
13860 [ALC268_ACER_ASPIRE_ONE] = {
13861 .mixers = { alc268_acer_aspire_one_mixer,
13863 alc268_capture_nosrc_mixer },
13864 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13865 alc268_acer_aspire_one_verbs },
13866 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13867 .dac_nids = alc268_dac_nids,
13868 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13869 .adc_nids = alc268_adc_nids_alt,
13870 .capsrc_nids = alc268_capsrc_nids,
13872 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13873 .channel_mode = alc268_modes,
13874 .unsol_event = alc268_acer_lc_unsol_event,
13875 .setup = alc268_acer_lc_setup,
13876 .init_hook = alc268_acer_lc_init_hook,
13879 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13880 alc268_capture_nosrc_mixer },
13881 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13882 alc268_dell_verbs },
13883 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13884 .dac_nids = alc268_dac_nids,
13885 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13886 .adc_nids = alc268_adc_nids_alt,
13887 .capsrc_nids = alc268_capsrc_nids,
13889 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13890 .channel_mode = alc268_modes,
13891 .unsol_event = alc_sku_unsol_event,
13892 .setup = alc268_dell_setup,
13893 .init_hook = alc_inithook,
13896 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13897 alc268_beep_mixer },
13898 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13899 alc268_toshiba_verbs },
13900 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13901 .dac_nids = alc268_dac_nids,
13902 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13903 .adc_nids = alc268_adc_nids_alt,
13904 .capsrc_nids = alc268_capsrc_nids,
13906 .dig_out_nid = ALC268_DIGOUT_NID,
13907 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13908 .channel_mode = alc268_modes,
13909 .input_mux = &alc268_capture_source,
13910 .setup = alc268_toshiba_setup,
13911 .init_hook = alc268_toshiba_automute,
13913 #ifdef CONFIG_SND_DEBUG
13915 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13916 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13917 alc268_volume_init_verbs },
13918 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13919 .dac_nids = alc268_dac_nids,
13920 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13921 .adc_nids = alc268_adc_nids_alt,
13922 .capsrc_nids = alc268_capsrc_nids,
13924 .dig_out_nid = ALC268_DIGOUT_NID,
13925 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13926 .channel_mode = alc268_modes,
13927 .input_mux = &alc268_capture_source,
13932 static int patch_alc268(struct hda_codec *codec)
13934 struct alc_spec *spec;
13936 int i, has_beep, err;
13938 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13942 codec->spec = spec;
13944 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13948 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13949 board_config = snd_hda_check_board_codec_sid_config(codec,
13950 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13952 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13953 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13955 board_config = ALC268_AUTO;
13958 if (board_config == ALC268_AUTO) {
13959 /* automatic parse from the BIOS config */
13960 err = alc268_parse_auto_config(codec);
13966 "hda_codec: Cannot set up configuration "
13967 "from BIOS. Using base mode...\n");
13968 board_config = ALC268_3ST;
13972 if (board_config != ALC268_AUTO)
13973 setup_preset(codec, &alc268_presets[board_config]);
13975 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13976 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13977 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13979 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13982 for (i = 0; i < spec->num_mixers; i++) {
13983 if (spec->mixers[i] == alc268_beep_mixer) {
13990 err = snd_hda_attach_beep_device(codec, 0x1);
13995 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13996 /* override the amp caps for beep generator */
13997 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13998 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13999 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
14000 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
14001 (0 << AC_AMPCAP_MUTE_SHIFT));
14004 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
14005 /* check whether NID 0x07 is valid */
14006 unsigned int wcap = get_wcaps(codec, 0x07);
14009 spec->capsrc_nids = alc268_capsrc_nids;
14011 wcap = get_wcaps_type(wcap);
14012 if (spec->auto_mic ||
14013 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
14014 spec->adc_nids = alc268_adc_nids_alt;
14015 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
14016 if (spec->auto_mic)
14017 fixup_automic_adc(codec);
14018 if (spec->auto_mic || spec->input_mux->num_items == 1)
14019 add_mixer(spec, alc268_capture_nosrc_mixer);
14021 add_mixer(spec, alc268_capture_alt_mixer);
14023 spec->adc_nids = alc268_adc_nids;
14024 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
14025 add_mixer(spec, alc268_capture_mixer);
14027 /* set default input source */
14028 for (i = 0; i < spec->num_adc_nids; i++)
14029 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
14030 0, AC_VERB_SET_CONNECT_SEL,
14031 i < spec->num_mux_defs ?
14032 spec->input_mux[i].items[0].index :
14033 spec->input_mux->items[0].index);
14036 spec->vmaster_nid = 0x02;
14038 codec->patch_ops = alc_patch_ops;
14039 if (board_config == ALC268_AUTO)
14040 spec->init_hook = alc268_auto_init;
14042 alc_init_jacks(codec);
14048 * ALC269 channel source setting (2 channel)
14050 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
14052 #define alc269_dac_nids alc260_dac_nids
14054 static hda_nid_t alc269_adc_nids[1] = {
14059 static hda_nid_t alc269_capsrc_nids[1] = {
14063 static hda_nid_t alc269vb_adc_nids[1] = {
14068 static hda_nid_t alc269vb_capsrc_nids[1] = {
14072 static hda_nid_t alc269_adc_candidates[] = {
14076 #define alc269_modes alc260_modes
14077 #define alc269_capture_source alc880_lg_lw_capture_source
14079 static struct snd_kcontrol_new alc269_base_mixer[] = {
14080 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14081 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14082 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14083 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14084 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14085 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14086 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14087 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14088 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14089 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14095 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14096 /* output mixer control */
14097 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14099 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14100 .name = "Master Playback Switch",
14101 .subdevice = HDA_SUBDEV_AMP_FLAG,
14102 .info = snd_hda_mixer_amp_switch_info,
14103 .get = snd_hda_mixer_amp_switch_get,
14104 .put = alc268_acer_master_sw_put,
14105 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14107 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14108 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14109 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14110 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14111 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14112 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14116 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14117 /* output mixer control */
14118 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14121 .name = "Master Playback Switch",
14122 .subdevice = HDA_SUBDEV_AMP_FLAG,
14123 .info = snd_hda_mixer_amp_switch_info,
14124 .get = snd_hda_mixer_amp_switch_get,
14125 .put = alc268_acer_master_sw_put,
14126 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14128 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14129 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14130 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14131 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14132 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14133 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14134 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14135 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14136 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
14140 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14141 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14142 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14143 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14144 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14148 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14149 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14150 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14151 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14152 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14156 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14157 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14158 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14162 /* capture mixer elements */
14163 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14164 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14165 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14166 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14167 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14171 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14172 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14173 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14174 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14178 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14179 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14180 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14181 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14182 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14186 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14187 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14188 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14189 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14194 #define alc269_fujitsu_mixer alc269_laptop_mixer
14196 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14197 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14198 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14199 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14200 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14201 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14202 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14206 static struct hda_verb alc269_lifebook_verbs[] = {
14207 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14208 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14209 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14210 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14211 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14213 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14214 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14215 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14216 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14220 /* toggle speaker-output according to the hp-jack state */
14221 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14223 unsigned int present;
14224 unsigned char bits;
14226 present = snd_hda_jack_detect(codec, 0x15);
14227 bits = present ? HDA_AMP_MUTE : 0;
14228 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14229 HDA_AMP_MUTE, bits);
14230 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14231 HDA_AMP_MUTE, bits);
14233 snd_hda_codec_write(codec, 0x20, 0,
14234 AC_VERB_SET_COEF_INDEX, 0x0c);
14235 snd_hda_codec_write(codec, 0x20, 0,
14236 AC_VERB_SET_PROC_COEF, 0x680);
14238 snd_hda_codec_write(codec, 0x20, 0,
14239 AC_VERB_SET_COEF_INDEX, 0x0c);
14240 snd_hda_codec_write(codec, 0x20, 0,
14241 AC_VERB_SET_PROC_COEF, 0x480);
14244 /* toggle speaker-output according to the hp-jacks state */
14245 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14247 unsigned int present;
14248 unsigned char bits;
14250 /* Check laptop headphone socket */
14251 present = snd_hda_jack_detect(codec, 0x15);
14253 /* Check port replicator headphone socket */
14254 present |= snd_hda_jack_detect(codec, 0x1a);
14256 bits = present ? HDA_AMP_MUTE : 0;
14257 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14258 HDA_AMP_MUTE, bits);
14259 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14260 HDA_AMP_MUTE, bits);
14262 snd_hda_codec_write(codec, 0x20, 0,
14263 AC_VERB_SET_COEF_INDEX, 0x0c);
14264 snd_hda_codec_write(codec, 0x20, 0,
14265 AC_VERB_SET_PROC_COEF, 0x680);
14267 snd_hda_codec_write(codec, 0x20, 0,
14268 AC_VERB_SET_COEF_INDEX, 0x0c);
14269 snd_hda_codec_write(codec, 0x20, 0,
14270 AC_VERB_SET_PROC_COEF, 0x480);
14273 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14275 unsigned int present_laptop;
14276 unsigned int present_dock;
14278 present_laptop = snd_hda_jack_detect(codec, 0x18);
14279 present_dock = snd_hda_jack_detect(codec, 0x1b);
14281 /* Laptop mic port overrides dock mic port, design decision */
14283 snd_hda_codec_write(codec, 0x23, 0,
14284 AC_VERB_SET_CONNECT_SEL, 0x3);
14285 if (present_laptop)
14286 snd_hda_codec_write(codec, 0x23, 0,
14287 AC_VERB_SET_CONNECT_SEL, 0x0);
14288 if (!present_dock && !present_laptop)
14289 snd_hda_codec_write(codec, 0x23, 0,
14290 AC_VERB_SET_CONNECT_SEL, 0x1);
14293 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14296 switch (res >> 26) {
14297 case ALC880_HP_EVENT:
14298 alc269_quanta_fl1_speaker_automute(codec);
14300 case ALC880_MIC_EVENT:
14301 alc_mic_automute(codec);
14306 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14309 if ((res >> 26) == ALC880_HP_EVENT)
14310 alc269_lifebook_speaker_automute(codec);
14311 if ((res >> 26) == ALC880_MIC_EVENT)
14312 alc269_lifebook_mic_autoswitch(codec);
14315 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14317 struct alc_spec *spec = codec->spec;
14318 spec->autocfg.hp_pins[0] = 0x15;
14319 spec->autocfg.speaker_pins[0] = 0x14;
14320 spec->ext_mic.pin = 0x18;
14321 spec->ext_mic.mux_idx = 0;
14322 spec->int_mic.pin = 0x19;
14323 spec->int_mic.mux_idx = 1;
14324 spec->auto_mic = 1;
14327 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14329 alc269_quanta_fl1_speaker_automute(codec);
14330 alc_mic_automute(codec);
14333 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14335 alc269_lifebook_speaker_automute(codec);
14336 alc269_lifebook_mic_autoswitch(codec);
14339 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14340 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14341 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14342 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14343 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14344 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14345 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14346 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14350 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14351 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14352 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14353 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14354 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14355 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14356 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14360 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14361 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14362 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14363 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14364 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14365 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14366 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14367 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14371 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14372 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14373 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14374 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14375 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14376 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14377 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14378 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14382 static struct hda_verb alc271_acer_dmic_verbs[] = {
14383 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14384 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14385 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14386 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14387 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14388 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14389 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14390 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14391 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14392 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14396 /* toggle speaker-output according to the hp-jack state */
14397 static void alc269_speaker_automute(struct hda_codec *codec)
14399 struct alc_spec *spec = codec->spec;
14400 unsigned int nid = spec->autocfg.hp_pins[0];
14401 unsigned int present;
14402 unsigned char bits;
14404 present = snd_hda_jack_detect(codec, nid);
14405 bits = present ? HDA_AMP_MUTE : 0;
14406 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14407 HDA_AMP_MUTE, bits);
14408 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14409 HDA_AMP_MUTE, bits);
14410 alc_report_jack(codec, nid);
14413 /* unsolicited event for HP jack sensing */
14414 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14417 switch (res >> 26) {
14418 case ALC880_HP_EVENT:
14419 alc269_speaker_automute(codec);
14421 case ALC880_MIC_EVENT:
14422 alc_mic_automute(codec);
14427 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14429 struct alc_spec *spec = codec->spec;
14430 spec->autocfg.hp_pins[0] = 0x15;
14431 spec->autocfg.speaker_pins[0] = 0x14;
14432 spec->ext_mic.pin = 0x18;
14433 spec->ext_mic.mux_idx = 0;
14434 spec->int_mic.pin = 0x19;
14435 spec->int_mic.mux_idx = 1;
14436 spec->auto_mic = 1;
14439 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14441 struct alc_spec *spec = codec->spec;
14442 spec->autocfg.hp_pins[0] = 0x15;
14443 spec->autocfg.speaker_pins[0] = 0x14;
14444 spec->ext_mic.pin = 0x18;
14445 spec->ext_mic.mux_idx = 0;
14446 spec->int_mic.pin = 0x12;
14447 spec->int_mic.mux_idx = 5;
14448 spec->auto_mic = 1;
14451 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14453 struct alc_spec *spec = codec->spec;
14454 spec->autocfg.hp_pins[0] = 0x21;
14455 spec->autocfg.speaker_pins[0] = 0x14;
14456 spec->ext_mic.pin = 0x18;
14457 spec->ext_mic.mux_idx = 0;
14458 spec->int_mic.pin = 0x19;
14459 spec->int_mic.mux_idx = 1;
14460 spec->auto_mic = 1;
14463 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14465 struct alc_spec *spec = codec->spec;
14466 spec->autocfg.hp_pins[0] = 0x21;
14467 spec->autocfg.speaker_pins[0] = 0x14;
14468 spec->ext_mic.pin = 0x18;
14469 spec->ext_mic.mux_idx = 0;
14470 spec->int_mic.pin = 0x12;
14471 spec->int_mic.mux_idx = 6;
14472 spec->auto_mic = 1;
14475 static void alc269_laptop_inithook(struct hda_codec *codec)
14477 alc269_speaker_automute(codec);
14478 alc_mic_automute(codec);
14482 * generic initialization of ADC, input mixers and output mixers
14484 static struct hda_verb alc269_init_verbs[] = {
14486 * Unmute ADC0 and set the default input to mic-in
14488 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14491 * Set up output mixers (0x02 - 0x03)
14493 /* set vol=0 to output mixers */
14494 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14495 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14497 /* set up input amps for analog loopback */
14498 /* Amp Indices: DAC = 0, mixer = 1 */
14499 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14500 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14501 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14502 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14503 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14504 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14506 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14507 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14508 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14509 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14510 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14511 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14512 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14514 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14515 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14517 /* FIXME: use Mux-type input source selection */
14518 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14519 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14520 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14523 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14527 static struct hda_verb alc269vb_init_verbs[] = {
14529 * Unmute ADC0 and set the default input to mic-in
14531 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14534 * Set up output mixers (0x02 - 0x03)
14536 /* set vol=0 to output mixers */
14537 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14538 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14540 /* set up input amps for analog loopback */
14541 /* Amp Indices: DAC = 0, mixer = 1 */
14542 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14543 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14544 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14545 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14546 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14547 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14549 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14550 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14551 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14552 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14553 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14554 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14555 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14558 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14560 /* FIXME: use Mux-type input source selection */
14561 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14562 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14563 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14566 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14570 #define alc269_auto_create_multi_out_ctls \
14571 alc268_auto_create_multi_out_ctls
14572 #define alc269_auto_create_input_ctls \
14573 alc268_auto_create_input_ctls
14575 #ifdef CONFIG_SND_HDA_POWER_SAVE
14576 #define alc269_loopbacks alc880_loopbacks
14579 /* pcm configuration: identical with ALC880 */
14580 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14581 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14582 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14583 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14585 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14589 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14590 /* NID is set in alc_build_pcms */
14592 .open = alc880_playback_pcm_open,
14593 .prepare = alc880_playback_pcm_prepare,
14594 .cleanup = alc880_playback_pcm_cleanup
14598 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14602 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14603 /* NID is set in alc_build_pcms */
14606 #ifdef CONFIG_SND_HDA_POWER_SAVE
14607 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14609 switch (codec->subsystem_id) {
14616 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14618 /* update mute-LED according to the speaker mute state */
14619 if (nid == 0x01 || nid == 0x14) {
14621 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14626 /* mic2 vref pin is used for mute LED control */
14627 snd_hda_codec_update_cache(codec, 0x19, 0,
14628 AC_VERB_SET_PIN_WIDGET_CONTROL,
14631 return alc_check_power_status(codec, nid);
14633 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14635 static int alc275_setup_dual_adc(struct hda_codec *codec)
14637 struct alc_spec *spec = codec->spec;
14639 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14641 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14642 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14643 if (spec->ext_mic.pin <= 0x12) {
14644 spec->private_adc_nids[0] = 0x08;
14645 spec->private_adc_nids[1] = 0x11;
14646 spec->private_capsrc_nids[0] = 0x23;
14647 spec->private_capsrc_nids[1] = 0x22;
14649 spec->private_adc_nids[0] = 0x11;
14650 spec->private_adc_nids[1] = 0x08;
14651 spec->private_capsrc_nids[0] = 0x22;
14652 spec->private_capsrc_nids[1] = 0x23;
14654 spec->adc_nids = spec->private_adc_nids;
14655 spec->capsrc_nids = spec->private_capsrc_nids;
14656 spec->num_adc_nids = 2;
14657 spec->dual_adc_switch = 1;
14658 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14659 spec->adc_nids[0], spec->adc_nids[1]);
14665 /* different alc269-variants */
14667 ALC269_TYPE_NORMAL,
14668 ALC269_TYPE_ALC258,
14669 ALC269_TYPE_ALC259,
14670 ALC269_TYPE_ALC269VB,
14671 ALC269_TYPE_ALC270,
14672 ALC269_TYPE_ALC271X,
14676 * BIOS auto configuration
14678 static int alc269_parse_auto_config(struct hda_codec *codec)
14680 struct alc_spec *spec = codec->spec;
14682 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14684 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14689 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14692 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14693 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14695 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14700 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14702 alc_auto_parse_digital(codec);
14704 if (spec->kctls.list)
14705 add_mixer(spec, spec->kctls.list);
14707 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14708 add_verb(spec, alc269vb_init_verbs);
14709 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14711 add_verb(spec, alc269_init_verbs);
14712 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14715 spec->num_mux_defs = 1;
14716 spec->input_mux = &spec->private_imux[0];
14718 if (!alc275_setup_dual_adc(codec))
14719 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14720 sizeof(alc269_adc_candidates));
14722 /* set default input source */
14723 if (!spec->dual_adc_switch)
14724 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14725 spec->input_mux->items[0].index);
14727 err = alc_auto_add_mic_boost(codec);
14731 if (!spec->cap_mixer && !spec->no_analog)
14732 set_capture_mixer(codec);
14737 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14738 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14739 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14742 /* init callback for auto-configuration model -- overriding the default init */
14743 static void alc269_auto_init(struct hda_codec *codec)
14745 struct alc_spec *spec = codec->spec;
14746 alc269_auto_init_multi_out(codec);
14747 alc269_auto_init_hp_out(codec);
14748 alc269_auto_init_analog_input(codec);
14749 alc_auto_init_digital(codec);
14750 if (spec->unsol_event)
14751 alc_inithook(codec);
14754 #ifdef SND_HDA_NEEDS_RESUME
14755 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14757 int val = alc_read_coef_idx(codec, 0x04);
14762 alc_write_coef_idx(codec, 0x04, val);
14765 #ifdef CONFIG_SND_HDA_POWER_SAVE
14766 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14768 struct alc_spec *spec = codec->spec;
14770 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14771 alc269_toggle_power_output(codec, 0);
14772 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14773 alc269_toggle_power_output(codec, 0);
14778 if (spec && spec->power_hook)
14779 spec->power_hook(codec);
14782 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14784 static int alc269_resume(struct hda_codec *codec)
14786 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14787 alc269_toggle_power_output(codec, 0);
14791 codec->patch_ops.init(codec);
14793 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14794 alc269_toggle_power_output(codec, 1);
14798 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14799 alc269_toggle_power_output(codec, 1);
14801 snd_hda_codec_resume_amp(codec);
14802 snd_hda_codec_resume_cache(codec);
14803 hda_call_check_power_status(codec, 0x01);
14806 #endif /* SND_HDA_NEEDS_RESUME */
14809 ALC269_FIXUP_SONY_VAIO,
14810 ALC269_FIXUP_DELL_M101Z,
14813 static const struct alc_fixup alc269_fixups[] = {
14814 [ALC269_FIXUP_SONY_VAIO] = {
14815 .verbs = (const struct hda_verb[]) {
14816 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14820 [ALC269_FIXUP_DELL_M101Z] = {
14821 .verbs = (const struct hda_verb[]) {
14822 /* Enables internal speaker */
14823 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14824 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14830 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14831 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14832 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14838 * configuration and preset
14840 static const char *alc269_models[ALC269_MODEL_LAST] = {
14841 [ALC269_BASIC] = "basic",
14842 [ALC269_QUANTA_FL1] = "quanta",
14843 [ALC269_AMIC] = "laptop-amic",
14844 [ALC269_DMIC] = "laptop-dmic",
14845 [ALC269_FUJITSU] = "fujitsu",
14846 [ALC269_LIFEBOOK] = "lifebook",
14847 [ALC269_AUTO] = "auto",
14850 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14851 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14852 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14853 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14855 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14856 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14857 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14858 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14859 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14860 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14861 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14862 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14863 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14864 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14865 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14866 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14867 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14868 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14869 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14870 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14871 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14872 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14873 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14874 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14875 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14876 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14877 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14878 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14879 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14880 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14881 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14882 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14883 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14884 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14885 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14886 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14887 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14888 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14889 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14890 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14891 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14893 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14895 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14896 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14897 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14898 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14899 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14900 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14901 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14902 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14903 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14904 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14908 static struct alc_config_preset alc269_presets[] = {
14910 .mixers = { alc269_base_mixer },
14911 .init_verbs = { alc269_init_verbs },
14912 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14913 .dac_nids = alc269_dac_nids,
14915 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14916 .channel_mode = alc269_modes,
14917 .input_mux = &alc269_capture_source,
14919 [ALC269_QUANTA_FL1] = {
14920 .mixers = { alc269_quanta_fl1_mixer },
14921 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14922 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14923 .dac_nids = alc269_dac_nids,
14925 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14926 .channel_mode = alc269_modes,
14927 .input_mux = &alc269_capture_source,
14928 .unsol_event = alc269_quanta_fl1_unsol_event,
14929 .setup = alc269_quanta_fl1_setup,
14930 .init_hook = alc269_quanta_fl1_init_hook,
14933 .mixers = { alc269_laptop_mixer },
14934 .cap_mixer = alc269_laptop_analog_capture_mixer,
14935 .init_verbs = { alc269_init_verbs,
14936 alc269_laptop_amic_init_verbs },
14937 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14938 .dac_nids = alc269_dac_nids,
14940 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14941 .channel_mode = alc269_modes,
14942 .unsol_event = alc269_laptop_unsol_event,
14943 .setup = alc269_laptop_amic_setup,
14944 .init_hook = alc269_laptop_inithook,
14947 .mixers = { alc269_laptop_mixer },
14948 .cap_mixer = alc269_laptop_digital_capture_mixer,
14949 .init_verbs = { alc269_init_verbs,
14950 alc269_laptop_dmic_init_verbs },
14951 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14952 .dac_nids = alc269_dac_nids,
14954 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14955 .channel_mode = alc269_modes,
14956 .unsol_event = alc269_laptop_unsol_event,
14957 .setup = alc269_laptop_dmic_setup,
14958 .init_hook = alc269_laptop_inithook,
14960 [ALC269VB_AMIC] = {
14961 .mixers = { alc269vb_laptop_mixer },
14962 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14963 .init_verbs = { alc269vb_init_verbs,
14964 alc269vb_laptop_amic_init_verbs },
14965 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14966 .dac_nids = alc269_dac_nids,
14968 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14969 .channel_mode = alc269_modes,
14970 .unsol_event = alc269_laptop_unsol_event,
14971 .setup = alc269vb_laptop_amic_setup,
14972 .init_hook = alc269_laptop_inithook,
14974 [ALC269VB_DMIC] = {
14975 .mixers = { alc269vb_laptop_mixer },
14976 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14977 .init_verbs = { alc269vb_init_verbs,
14978 alc269vb_laptop_dmic_init_verbs },
14979 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14980 .dac_nids = alc269_dac_nids,
14982 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14983 .channel_mode = alc269_modes,
14984 .unsol_event = alc269_laptop_unsol_event,
14985 .setup = alc269vb_laptop_dmic_setup,
14986 .init_hook = alc269_laptop_inithook,
14988 [ALC269_FUJITSU] = {
14989 .mixers = { alc269_fujitsu_mixer },
14990 .cap_mixer = alc269_laptop_digital_capture_mixer,
14991 .init_verbs = { alc269_init_verbs,
14992 alc269_laptop_dmic_init_verbs },
14993 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14994 .dac_nids = alc269_dac_nids,
14996 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14997 .channel_mode = alc269_modes,
14998 .unsol_event = alc269_laptop_unsol_event,
14999 .setup = alc269_laptop_dmic_setup,
15000 .init_hook = alc269_laptop_inithook,
15002 [ALC269_LIFEBOOK] = {
15003 .mixers = { alc269_lifebook_mixer },
15004 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
15005 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15006 .dac_nids = alc269_dac_nids,
15008 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15009 .channel_mode = alc269_modes,
15010 .input_mux = &alc269_capture_source,
15011 .unsol_event = alc269_lifebook_unsol_event,
15012 .init_hook = alc269_lifebook_init_hook,
15015 .mixers = { alc269_asus_mixer },
15016 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
15017 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
15018 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
15019 .dac_nids = alc269_dac_nids,
15020 .adc_nids = alc262_dmic_adc_nids,
15021 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
15022 .capsrc_nids = alc262_dmic_capsrc_nids,
15023 .num_channel_mode = ARRAY_SIZE(alc269_modes),
15024 .channel_mode = alc269_modes,
15025 .input_mux = &alc269_capture_source,
15026 .dig_out_nid = ALC880_DIGOUT_NID,
15027 .unsol_event = alc_sku_unsol_event,
15028 .setup = alc269vb_laptop_dmic_setup,
15029 .init_hook = alc_inithook,
15033 static int alc269_fill_coef(struct hda_codec *codec)
15037 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
15038 alc_write_coef_idx(codec, 0xf, 0x960b);
15039 alc_write_coef_idx(codec, 0xe, 0x8817);
15042 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
15043 alc_write_coef_idx(codec, 0xf, 0x960b);
15044 alc_write_coef_idx(codec, 0xe, 0x8814);
15047 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
15048 val = alc_read_coef_idx(codec, 0x04);
15049 /* Power up output pin */
15050 alc_write_coef_idx(codec, 0x04, val | (1<<11));
15053 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
15054 val = alc_read_coef_idx(codec, 0xd);
15055 if ((val & 0x0c00) >> 10 != 0x1) {
15056 /* Capless ramp up clock control */
15057 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15059 val = alc_read_coef_idx(codec, 0x17);
15060 if ((val & 0x01c0) >> 6 != 0x4) {
15061 /* Class D power on reset */
15062 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15068 static int patch_alc269(struct hda_codec *codec)
15070 struct alc_spec *spec;
15071 int board_config, coef;
15074 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15078 codec->spec = spec;
15080 alc_auto_parse_customize_define(codec);
15082 coef = alc_read_coef_idx(codec, 0);
15083 if ((coef & 0x00f0) == 0x0010) {
15084 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15085 spec->cdefine.platform_type == 1) {
15086 alc_codec_rename(codec, "ALC271X");
15087 spec->codec_variant = ALC269_TYPE_ALC271X;
15088 } else if ((coef & 0xf000) == 0x1000) {
15089 spec->codec_variant = ALC269_TYPE_ALC270;
15090 } else if ((coef & 0xf000) == 0x2000) {
15091 alc_codec_rename(codec, "ALC259");
15092 spec->codec_variant = ALC269_TYPE_ALC259;
15093 } else if ((coef & 0xf000) == 0x3000) {
15094 alc_codec_rename(codec, "ALC258");
15095 spec->codec_variant = ALC269_TYPE_ALC258;
15097 alc_codec_rename(codec, "ALC269VB");
15098 spec->codec_variant = ALC269_TYPE_ALC269VB;
15101 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15103 alc269_fill_coef(codec);
15105 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15109 if (board_config < 0) {
15110 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15112 board_config = ALC269_AUTO;
15115 if (board_config == ALC269_AUTO)
15116 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15118 if (board_config == ALC269_AUTO) {
15119 /* automatic parse from the BIOS config */
15120 err = alc269_parse_auto_config(codec);
15126 "hda_codec: Cannot set up configuration "
15127 "from BIOS. Using base mode...\n");
15128 board_config = ALC269_BASIC;
15132 if (has_cdefine_beep(codec)) {
15133 err = snd_hda_attach_beep_device(codec, 0x1);
15140 if (board_config != ALC269_AUTO)
15141 setup_preset(codec, &alc269_presets[board_config]);
15143 if (board_config == ALC269_QUANTA_FL1) {
15144 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15145 * fix the sample rate of analog I/O to 44.1kHz
15147 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15148 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15149 } else if (spec->dual_adc_switch) {
15150 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15151 /* switch ADC dynamically */
15152 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15154 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15155 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15157 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15158 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15160 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15161 if (spec->codec_variant == ALC269_TYPE_NORMAL) {
15162 spec->adc_nids = alc269_adc_nids;
15163 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15164 spec->capsrc_nids = alc269_capsrc_nids;
15166 spec->adc_nids = alc269vb_adc_nids;
15167 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15168 spec->capsrc_nids = alc269vb_capsrc_nids;
15172 if (!spec->cap_mixer)
15173 set_capture_mixer(codec);
15174 if (has_cdefine_beep(codec))
15175 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15177 if (board_config == ALC269_AUTO)
15178 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15180 spec->vmaster_nid = 0x02;
15182 codec->patch_ops = alc_patch_ops;
15183 #ifdef CONFIG_SND_HDA_POWER_SAVE
15184 codec->patch_ops.suspend = alc269_suspend;
15186 #ifdef SND_HDA_NEEDS_RESUME
15187 codec->patch_ops.resume = alc269_resume;
15189 if (board_config == ALC269_AUTO)
15190 spec->init_hook = alc269_auto_init;
15192 alc_init_jacks(codec);
15193 #ifdef CONFIG_SND_HDA_POWER_SAVE
15194 if (!spec->loopback.amplist)
15195 spec->loopback.amplist = alc269_loopbacks;
15196 if (alc269_mic2_for_mute_led(codec))
15197 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15204 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15208 * set the path ways for 2 channel output
15209 * need to set the codec line out and mic 1 pin widgets to inputs
15211 static struct hda_verb alc861_threestack_ch2_init[] = {
15212 /* set pin widget 1Ah (line in) for input */
15213 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15214 /* set pin widget 18h (mic1/2) for input, for mic also enable
15217 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15219 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15221 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15222 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15228 * need to set the codec line out and mic 1 pin widgets to outputs
15230 static struct hda_verb alc861_threestack_ch6_init[] = {
15231 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15232 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15233 /* set pin widget 18h (mic1) for output (CLFE)*/
15234 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15236 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15237 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15239 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15241 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15242 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15247 static struct hda_channel_mode alc861_threestack_modes[2] = {
15248 { 2, alc861_threestack_ch2_init },
15249 { 6, alc861_threestack_ch6_init },
15251 /* Set mic1 as input and unmute the mixer */
15252 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15253 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15254 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15257 /* Set mic1 as output and mute mixer */
15258 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15259 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15260 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15264 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15265 { 2, alc861_uniwill_m31_ch2_init },
15266 { 4, alc861_uniwill_m31_ch4_init },
15269 /* Set mic1 and line-in as input and unmute the mixer */
15270 static struct hda_verb alc861_asus_ch2_init[] = {
15271 /* set pin widget 1Ah (line in) for input */
15272 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15273 /* set pin widget 18h (mic1/2) for input, for mic also enable
15276 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15278 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15280 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15281 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15285 /* Set mic1 nad line-in as output and mute mixer */
15286 static struct hda_verb alc861_asus_ch6_init[] = {
15287 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15288 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15289 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15290 /* set pin widget 18h (mic1) for output (CLFE)*/
15291 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15292 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15293 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15294 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15296 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15298 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15299 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15304 static struct hda_channel_mode alc861_asus_modes[2] = {
15305 { 2, alc861_asus_ch2_init },
15306 { 6, alc861_asus_ch6_init },
15311 static struct snd_kcontrol_new alc861_base_mixer[] = {
15312 /* output mixer control */
15313 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15314 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15315 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15316 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15317 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15319 /*Input mixer control */
15320 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15321 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15322 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15323 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15324 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15325 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15326 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15327 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15328 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15329 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15334 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15335 /* output mixer control */
15336 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15337 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15338 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15339 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15340 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15342 /* Input mixer control */
15343 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15344 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15345 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15346 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15347 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15348 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15349 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15350 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15351 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15352 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15355 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15356 .name = "Channel Mode",
15357 .info = alc_ch_mode_info,
15358 .get = alc_ch_mode_get,
15359 .put = alc_ch_mode_put,
15360 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15365 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15366 /* output mixer control */
15367 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15368 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15369 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15374 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15375 /* output mixer control */
15376 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15377 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15378 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15379 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15380 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15382 /* Input mixer control */
15383 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15384 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15385 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15386 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15387 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15388 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15389 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15390 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15391 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15395 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15396 .name = "Channel Mode",
15397 .info = alc_ch_mode_info,
15398 .get = alc_ch_mode_get,
15399 .put = alc_ch_mode_put,
15400 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15405 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15406 /* output mixer control */
15407 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15408 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15409 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15410 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15411 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15413 /* Input mixer control */
15414 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15415 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15416 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15417 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15418 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15419 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15420 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15421 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15422 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15423 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15427 .name = "Channel Mode",
15428 .info = alc_ch_mode_info,
15429 .get = alc_ch_mode_get,
15430 .put = alc_ch_mode_put,
15431 .private_value = ARRAY_SIZE(alc861_asus_modes),
15436 /* additional mixer */
15437 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15438 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15439 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15444 * generic initialization of ADC, input mixers and output mixers
15446 static struct hda_verb alc861_base_init_verbs[] = {
15448 * Unmute ADC0 and set the default input to mic-in
15450 /* port-A for surround (rear panel) */
15451 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15452 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15453 /* port-B for mic-in (rear panel) with vref */
15454 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15455 /* port-C for line-in (rear panel) */
15456 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15457 /* port-D for Front */
15458 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15459 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15460 /* port-E for HP out (front panel) */
15461 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15462 /* route front PCM to HP */
15463 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15464 /* port-F for mic-in (front panel) with vref */
15465 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15466 /* port-G for CLFE (rear panel) */
15467 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15468 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15469 /* port-H for side (rear panel) */
15470 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15471 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15473 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15474 /* route front mic to ADC1*/
15475 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15476 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15478 /* Unmute DAC0~3 & spdif out*/
15479 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15480 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15481 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15482 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15483 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15485 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15486 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15487 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15488 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15489 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15491 /* Unmute Stereo Mixer 15 */
15492 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15493 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15494 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15495 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15497 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15498 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15499 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15500 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15501 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15502 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15503 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15504 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15505 /* hp used DAC 3 (Front) */
15506 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15507 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15512 static struct hda_verb alc861_threestack_init_verbs[] = {
15514 * Unmute ADC0 and set the default input to mic-in
15516 /* port-A for surround (rear panel) */
15517 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15518 /* port-B for mic-in (rear panel) with vref */
15519 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15520 /* port-C for line-in (rear panel) */
15521 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15522 /* port-D for Front */
15523 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15524 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15525 /* port-E for HP out (front panel) */
15526 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15527 /* route front PCM to HP */
15528 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15529 /* port-F for mic-in (front panel) with vref */
15530 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15531 /* port-G for CLFE (rear panel) */
15532 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15533 /* port-H for side (rear panel) */
15534 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15536 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15537 /* route front mic to ADC1*/
15538 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15540 /* Unmute DAC0~3 & spdif out*/
15541 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15542 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15543 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15544 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15545 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15547 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15548 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15549 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15550 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15551 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15553 /* Unmute Stereo Mixer 15 */
15554 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15555 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15556 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15557 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15559 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15560 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15561 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15562 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15563 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15564 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15565 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15566 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15567 /* hp used DAC 3 (Front) */
15568 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15569 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15573 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15575 * Unmute ADC0 and set the default input to mic-in
15577 /* port-A for surround (rear panel) */
15578 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15579 /* port-B for mic-in (rear panel) with vref */
15580 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15581 /* port-C for line-in (rear panel) */
15582 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15583 /* port-D for Front */
15584 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15585 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15586 /* port-E for HP out (front panel) */
15587 /* this has to be set to VREF80 */
15588 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15589 /* route front PCM to HP */
15590 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15591 /* port-F for mic-in (front panel) with vref */
15592 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15593 /* port-G for CLFE (rear panel) */
15594 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15595 /* port-H for side (rear panel) */
15596 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15598 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15599 /* route front mic to ADC1*/
15600 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15601 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15602 /* Unmute DAC0~3 & spdif out*/
15603 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15605 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15606 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15609 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15610 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15612 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15613 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15615 /* Unmute Stereo Mixer 15 */
15616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15618 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15619 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15621 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15623 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15624 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15625 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15627 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15628 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15629 /* hp used DAC 3 (Front) */
15630 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15631 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15635 static struct hda_verb alc861_asus_init_verbs[] = {
15637 * Unmute ADC0 and set the default input to mic-in
15639 /* port-A for surround (rear panel)
15640 * according to codec#0 this is the HP jack
15642 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15643 /* route front PCM to HP */
15644 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15645 /* port-B for mic-in (rear panel) with vref */
15646 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15647 /* port-C for line-in (rear panel) */
15648 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15649 /* port-D for Front */
15650 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15651 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15652 /* port-E for HP out (front panel) */
15653 /* this has to be set to VREF80 */
15654 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15655 /* route front PCM to HP */
15656 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15657 /* port-F for mic-in (front panel) with vref */
15658 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15659 /* port-G for CLFE (rear panel) */
15660 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15661 /* port-H for side (rear panel) */
15662 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15664 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15665 /* route front mic to ADC1*/
15666 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15667 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15668 /* Unmute DAC0~3 & spdif out*/
15669 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15670 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15671 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15672 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15673 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15674 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15675 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15676 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15677 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15678 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15680 /* Unmute Stereo Mixer 15 */
15681 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15682 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15683 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15686 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15687 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15688 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15689 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15690 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15691 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15692 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15693 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15694 /* hp used DAC 3 (Front) */
15695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15696 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15700 /* additional init verbs for ASUS laptops */
15701 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15702 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15703 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15708 * generic initialization of ADC, input mixers and output mixers
15710 static struct hda_verb alc861_auto_init_verbs[] = {
15712 * Unmute ADC0 and set the default input to mic-in
15714 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15715 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15717 /* Unmute DAC0~3 & spdif out*/
15718 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15719 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15720 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15721 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15722 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15724 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15725 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15726 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15727 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15728 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15730 /* Unmute Stereo Mixer 15 */
15731 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15732 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15733 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15734 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15736 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15737 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15738 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15739 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15740 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15741 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15742 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15743 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15745 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15746 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15747 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15748 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15749 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15750 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15751 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15752 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15754 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15759 static struct hda_verb alc861_toshiba_init_verbs[] = {
15760 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15765 /* toggle speaker-output according to the hp-jack state */
15766 static void alc861_toshiba_automute(struct hda_codec *codec)
15768 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15770 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15771 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15772 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15773 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15776 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15779 if ((res >> 26) == ALC880_HP_EVENT)
15780 alc861_toshiba_automute(codec);
15783 /* pcm configuration: identical with ALC880 */
15784 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15785 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15786 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15787 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15790 #define ALC861_DIGOUT_NID 0x07
15792 static struct hda_channel_mode alc861_8ch_modes[1] = {
15796 static hda_nid_t alc861_dac_nids[4] = {
15797 /* front, surround, clfe, side */
15798 0x03, 0x06, 0x05, 0x04
15801 static hda_nid_t alc660_dac_nids[3] = {
15802 /* front, clfe, surround */
15806 static hda_nid_t alc861_adc_nids[1] = {
15811 static struct hda_input_mux alc861_capture_source = {
15815 { "Front Mic", 0x3 },
15822 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15824 struct alc_spec *spec = codec->spec;
15825 hda_nid_t mix, srcs[5];
15828 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15830 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15833 for (i = 0; i < num; i++) {
15835 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15836 if (type != AC_WID_AUD_OUT)
15838 for (j = 0; j < spec->multiout.num_dacs; j++)
15839 if (spec->multiout.dac_nids[j] == srcs[i])
15841 if (j >= spec->multiout.num_dacs)
15847 /* fill in the dac_nids table from the parsed pin configuration */
15848 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15849 const struct auto_pin_cfg *cfg)
15851 struct alc_spec *spec = codec->spec;
15853 hda_nid_t nid, dac;
15855 spec->multiout.dac_nids = spec->private_dac_nids;
15856 for (i = 0; i < cfg->line_outs; i++) {
15857 nid = cfg->line_out_pins[i];
15858 dac = alc861_look_for_dac(codec, nid);
15861 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15866 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15867 hda_nid_t nid, unsigned int chs)
15869 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15870 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15873 /* add playback controls from the parsed DAC table */
15874 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15875 const struct auto_pin_cfg *cfg)
15877 struct alc_spec *spec = codec->spec;
15878 static const char *chname[4] = {
15879 "Front", "Surround", NULL /*CLFE*/, "Side"
15884 if (cfg->line_outs == 1) {
15885 const char *pfx = NULL;
15888 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15891 nid = spec->multiout.dac_nids[0];
15892 return alc861_create_out_sw(codec, pfx, nid, 3);
15896 for (i = 0; i < cfg->line_outs; i++) {
15897 nid = spec->multiout.dac_nids[i];
15902 err = alc861_create_out_sw(codec, "Center", nid, 1);
15905 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15909 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15917 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15919 struct alc_spec *spec = codec->spec;
15926 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15927 nid = alc861_look_for_dac(codec, pin);
15929 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15932 spec->multiout.hp_nid = nid;
15938 /* create playback/capture controls for input pins */
15939 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15940 const struct auto_pin_cfg *cfg)
15942 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15945 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15947 int pin_type, hda_nid_t dac)
15949 hda_nid_t mix, srcs[5];
15952 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15954 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15956 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15958 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15961 for (i = 0; i < num; i++) {
15963 if (srcs[i] == dac || srcs[i] == 0x15)
15964 mute = AMP_IN_UNMUTE(i);
15966 mute = AMP_IN_MUTE(i);
15967 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15972 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15974 struct alc_spec *spec = codec->spec;
15977 for (i = 0; i < spec->autocfg.line_outs; i++) {
15978 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15979 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15981 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15982 spec->multiout.dac_nids[i]);
15986 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15988 struct alc_spec *spec = codec->spec;
15990 if (spec->autocfg.hp_outs)
15991 alc861_auto_set_output_and_unmute(codec,
15992 spec->autocfg.hp_pins[0],
15994 spec->multiout.hp_nid);
15995 if (spec->autocfg.speaker_outs)
15996 alc861_auto_set_output_and_unmute(codec,
15997 spec->autocfg.speaker_pins[0],
15999 spec->multiout.dac_nids[0]);
16002 static void alc861_auto_init_analog_input(struct hda_codec *codec)
16004 struct alc_spec *spec = codec->spec;
16005 struct auto_pin_cfg *cfg = &spec->autocfg;
16008 for (i = 0; i < cfg->num_inputs; i++) {
16009 hda_nid_t nid = cfg->inputs[i].pin;
16010 if (nid >= 0x0c && nid <= 0x11)
16011 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16015 /* parse the BIOS configuration and set up the alc_spec */
16016 /* return 1 if successful, 0 if the proper config is not found,
16017 * or a negative error code
16019 static int alc861_parse_auto_config(struct hda_codec *codec)
16021 struct alc_spec *spec = codec->spec;
16023 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
16025 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
16029 if (!spec->autocfg.line_outs)
16030 return 0; /* can't find valid BIOS pin config */
16032 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
16035 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
16038 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
16041 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
16045 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
16047 alc_auto_parse_digital(codec);
16049 if (spec->kctls.list)
16050 add_mixer(spec, spec->kctls.list);
16052 add_verb(spec, alc861_auto_init_verbs);
16054 spec->num_mux_defs = 1;
16055 spec->input_mux = &spec->private_imux[0];
16057 spec->adc_nids = alc861_adc_nids;
16058 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
16059 set_capture_mixer(codec);
16061 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
16066 /* additional initialization for auto-configuration model */
16067 static void alc861_auto_init(struct hda_codec *codec)
16069 struct alc_spec *spec = codec->spec;
16070 alc861_auto_init_multi_out(codec);
16071 alc861_auto_init_hp_out(codec);
16072 alc861_auto_init_analog_input(codec);
16073 alc_auto_init_digital(codec);
16074 if (spec->unsol_event)
16075 alc_inithook(codec);
16078 #ifdef CONFIG_SND_HDA_POWER_SAVE
16079 static struct hda_amp_list alc861_loopbacks[] = {
16080 { 0x15, HDA_INPUT, 0 },
16081 { 0x15, HDA_INPUT, 1 },
16082 { 0x15, HDA_INPUT, 2 },
16083 { 0x15, HDA_INPUT, 3 },
16090 * configuration and preset
16092 static const char *alc861_models[ALC861_MODEL_LAST] = {
16093 [ALC861_3ST] = "3stack",
16094 [ALC660_3ST] = "3stack-660",
16095 [ALC861_3ST_DIG] = "3stack-dig",
16096 [ALC861_6ST_DIG] = "6stack-dig",
16097 [ALC861_UNIWILL_M31] = "uniwill-m31",
16098 [ALC861_TOSHIBA] = "toshiba",
16099 [ALC861_ASUS] = "asus",
16100 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16101 [ALC861_AUTO] = "auto",
16104 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16105 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16106 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16107 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16108 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16109 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16110 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16111 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16112 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16113 * Any other models that need this preset?
16115 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16116 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16117 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16118 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16119 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16120 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16121 /* FIXME: the below seems conflict */
16122 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16123 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16124 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16128 static struct alc_config_preset alc861_presets[] = {
16130 .mixers = { alc861_3ST_mixer },
16131 .init_verbs = { alc861_threestack_init_verbs },
16132 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16133 .dac_nids = alc861_dac_nids,
16134 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16135 .channel_mode = alc861_threestack_modes,
16137 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16138 .adc_nids = alc861_adc_nids,
16139 .input_mux = &alc861_capture_source,
16141 [ALC861_3ST_DIG] = {
16142 .mixers = { alc861_base_mixer },
16143 .init_verbs = { alc861_threestack_init_verbs },
16144 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16145 .dac_nids = alc861_dac_nids,
16146 .dig_out_nid = ALC861_DIGOUT_NID,
16147 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16148 .channel_mode = alc861_threestack_modes,
16150 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16151 .adc_nids = alc861_adc_nids,
16152 .input_mux = &alc861_capture_source,
16154 [ALC861_6ST_DIG] = {
16155 .mixers = { alc861_base_mixer },
16156 .init_verbs = { alc861_base_init_verbs },
16157 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16158 .dac_nids = alc861_dac_nids,
16159 .dig_out_nid = ALC861_DIGOUT_NID,
16160 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16161 .channel_mode = alc861_8ch_modes,
16162 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16163 .adc_nids = alc861_adc_nids,
16164 .input_mux = &alc861_capture_source,
16167 .mixers = { alc861_3ST_mixer },
16168 .init_verbs = { alc861_threestack_init_verbs },
16169 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16170 .dac_nids = alc660_dac_nids,
16171 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16172 .channel_mode = alc861_threestack_modes,
16174 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16175 .adc_nids = alc861_adc_nids,
16176 .input_mux = &alc861_capture_source,
16178 [ALC861_UNIWILL_M31] = {
16179 .mixers = { alc861_uniwill_m31_mixer },
16180 .init_verbs = { alc861_uniwill_m31_init_verbs },
16181 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16182 .dac_nids = alc861_dac_nids,
16183 .dig_out_nid = ALC861_DIGOUT_NID,
16184 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16185 .channel_mode = alc861_uniwill_m31_modes,
16187 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16188 .adc_nids = alc861_adc_nids,
16189 .input_mux = &alc861_capture_source,
16191 [ALC861_TOSHIBA] = {
16192 .mixers = { alc861_toshiba_mixer },
16193 .init_verbs = { alc861_base_init_verbs,
16194 alc861_toshiba_init_verbs },
16195 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16196 .dac_nids = alc861_dac_nids,
16197 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16198 .channel_mode = alc883_3ST_2ch_modes,
16199 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16200 .adc_nids = alc861_adc_nids,
16201 .input_mux = &alc861_capture_source,
16202 .unsol_event = alc861_toshiba_unsol_event,
16203 .init_hook = alc861_toshiba_automute,
16206 .mixers = { alc861_asus_mixer },
16207 .init_verbs = { alc861_asus_init_verbs },
16208 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16209 .dac_nids = alc861_dac_nids,
16210 .dig_out_nid = ALC861_DIGOUT_NID,
16211 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16212 .channel_mode = alc861_asus_modes,
16215 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16216 .adc_nids = alc861_adc_nids,
16217 .input_mux = &alc861_capture_source,
16219 [ALC861_ASUS_LAPTOP] = {
16220 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16221 .init_verbs = { alc861_asus_init_verbs,
16222 alc861_asus_laptop_init_verbs },
16223 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16224 .dac_nids = alc861_dac_nids,
16225 .dig_out_nid = ALC861_DIGOUT_NID,
16226 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16227 .channel_mode = alc883_3ST_2ch_modes,
16229 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16230 .adc_nids = alc861_adc_nids,
16231 .input_mux = &alc861_capture_source,
16235 /* Pin config fixes */
16237 PINFIX_FSC_AMILO_PI1505,
16240 static const struct alc_fixup alc861_fixups[] = {
16241 [PINFIX_FSC_AMILO_PI1505] = {
16242 .pins = (const struct alc_pincfg[]) {
16243 { 0x0b, 0x0221101f }, /* HP */
16244 { 0x0f, 0x90170310 }, /* speaker */
16250 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16251 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16255 static int patch_alc861(struct hda_codec *codec)
16257 struct alc_spec *spec;
16261 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16265 codec->spec = spec;
16267 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16271 if (board_config < 0) {
16272 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16274 board_config = ALC861_AUTO;
16277 if (board_config == ALC861_AUTO)
16278 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16280 if (board_config == ALC861_AUTO) {
16281 /* automatic parse from the BIOS config */
16282 err = alc861_parse_auto_config(codec);
16288 "hda_codec: Cannot set up configuration "
16289 "from BIOS. Using base mode...\n");
16290 board_config = ALC861_3ST_DIG;
16294 err = snd_hda_attach_beep_device(codec, 0x23);
16300 if (board_config != ALC861_AUTO)
16301 setup_preset(codec, &alc861_presets[board_config]);
16303 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16304 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16306 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16307 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16309 if (!spec->cap_mixer)
16310 set_capture_mixer(codec);
16311 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16313 spec->vmaster_nid = 0x03;
16315 if (board_config == ALC861_AUTO)
16316 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16318 codec->patch_ops = alc_patch_ops;
16319 if (board_config == ALC861_AUTO) {
16320 spec->init_hook = alc861_auto_init;
16321 #ifdef CONFIG_SND_HDA_POWER_SAVE
16322 spec->power_hook = alc_power_eapd;
16325 #ifdef CONFIG_SND_HDA_POWER_SAVE
16326 if (!spec->loopback.amplist)
16327 spec->loopback.amplist = alc861_loopbacks;
16334 * ALC861-VD support
16338 * In addition, an independent DAC
16340 #define ALC861VD_DIGOUT_NID 0x06
16342 static hda_nid_t alc861vd_dac_nids[4] = {
16343 /* front, surr, clfe, side surr */
16344 0x02, 0x03, 0x04, 0x05
16347 /* dac_nids for ALC660vd are in a different order - according to
16348 * Realtek's driver.
16349 * This should probably result in a different mixer for 6stack models
16350 * of ALC660vd codecs, but for now there is only 3stack mixer
16351 * - and it is the same as in 861vd.
16352 * adc_nids in ALC660vd are (is) the same as in 861vd
16354 static hda_nid_t alc660vd_dac_nids[3] = {
16355 /* front, rear, clfe, rear_surr */
16359 static hda_nid_t alc861vd_adc_nids[1] = {
16364 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16367 /* FIXME: should be a matrix-type input source selection */
16368 static struct hda_input_mux alc861vd_capture_source = {
16372 { "Front Mic", 0x1 },
16378 static struct hda_input_mux alc861vd_dallas_capture_source = {
16381 { "Ext Mic", 0x0 },
16382 { "Int Mic", 0x1 },
16386 static struct hda_input_mux alc861vd_hp_capture_source = {
16389 { "Front Mic", 0x0 },
16390 { "ATAPI Mic", 0x1 },
16397 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16404 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16405 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16406 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16407 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16408 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16415 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16416 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16417 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16418 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16419 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16423 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16424 { 6, alc861vd_6stack_ch6_init },
16425 { 8, alc861vd_6stack_ch8_init },
16428 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16431 .name = "Channel Mode",
16432 .info = alc_ch_mode_info,
16433 .get = alc_ch_mode_get,
16434 .put = alc_ch_mode_put,
16439 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16440 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16442 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16443 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16444 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16446 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16447 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16449 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16451 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16453 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16454 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16456 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16457 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16461 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16462 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16465 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16466 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16467 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16472 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16473 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16478 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16479 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16480 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16482 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16484 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16485 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16486 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16488 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16493 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16495 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16496 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16501 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16502 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16503 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16504 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16506 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16508 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16509 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16510 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16512 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16513 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16514 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16516 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16517 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16522 /* Pin assignment: Speaker=0x14, HP = 0x15,
16523 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16525 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16526 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16527 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16528 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16529 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16530 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16531 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16532 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16533 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16534 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16535 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16539 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16540 * Front Mic=0x18, ATAPI Mic = 0x19,
16542 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16543 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16544 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16545 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16546 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16547 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16548 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16549 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16550 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16556 * generic initialization of ADC, input mixers and output mixers
16558 static struct hda_verb alc861vd_volume_init_verbs[] = {
16560 * Unmute ADC0 and set the default input to mic-in
16562 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16563 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16565 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16566 * the analog-loopback mixer widget
16568 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16569 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16570 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16571 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16572 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16573 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16575 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16576 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16577 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16578 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16579 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16582 * Set up output mixers (0x02 - 0x05)
16584 /* set vol=0 to output mixers */
16585 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16586 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16587 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16588 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16590 /* set up input amps for analog loopback */
16591 /* Amp Indices: DAC = 0, mixer = 1 */
16592 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16593 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16594 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16595 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16596 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16597 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16598 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16599 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16605 * 3-stack pin configuration:
16606 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16608 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16610 * Set pin mode and muting
16612 /* set front pin widgets 0x14 for output */
16613 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16614 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16615 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16617 /* Mic (rear) pin: input vref at 80% */
16618 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16619 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16620 /* Front Mic pin: input vref at 80% */
16621 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16622 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16623 /* Line In pin: input */
16624 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16625 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16626 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16628 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16629 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16630 /* CD pin widget for input */
16631 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16637 * 6-stack pin configuration:
16639 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16641 * Set pin mode and muting
16643 /* set front pin widgets 0x14 for output */
16644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16648 /* Rear Pin: output 1 (0x0d) */
16649 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16650 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16651 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16652 /* CLFE Pin: output 2 (0x0e) */
16653 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16654 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16655 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16656 /* Side Pin: output 3 (0x0f) */
16657 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16658 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16659 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16661 /* Mic (rear) pin: input vref at 80% */
16662 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16663 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16664 /* Front Mic pin: input vref at 80% */
16665 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16667 /* Line In pin: input */
16668 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16669 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16670 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16671 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16672 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16673 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16674 /* CD pin widget for input */
16675 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16680 static struct hda_verb alc861vd_eapd_verbs[] = {
16681 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16685 static struct hda_verb alc660vd_eapd_verbs[] = {
16686 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16687 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16691 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16692 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16693 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16694 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16695 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16696 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16700 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16702 unsigned int present;
16703 unsigned char bits;
16705 present = snd_hda_jack_detect(codec, 0x18);
16706 bits = present ? HDA_AMP_MUTE : 0;
16708 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16709 HDA_AMP_MUTE, bits);
16712 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16714 struct alc_spec *spec = codec->spec;
16715 spec->autocfg.hp_pins[0] = 0x1b;
16716 spec->autocfg.speaker_pins[0] = 0x14;
16719 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16721 alc_automute_amp(codec);
16722 alc861vd_lenovo_mic_automute(codec);
16725 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16728 switch (res >> 26) {
16729 case ALC880_MIC_EVENT:
16730 alc861vd_lenovo_mic_automute(codec);
16733 alc_automute_amp_unsol_event(codec, res);
16738 static struct hda_verb alc861vd_dallas_verbs[] = {
16739 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16740 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16741 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16742 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16744 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16745 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16746 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16747 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16748 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16749 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16750 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16751 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16753 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16754 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16755 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16756 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16757 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16758 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16759 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16760 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16762 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16763 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16764 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16765 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16766 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16767 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16768 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16769 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16771 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16772 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16773 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16774 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16776 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16777 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16778 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16783 /* toggle speaker-output according to the hp-jack state */
16784 static void alc861vd_dallas_setup(struct hda_codec *codec)
16786 struct alc_spec *spec = codec->spec;
16788 spec->autocfg.hp_pins[0] = 0x15;
16789 spec->autocfg.speaker_pins[0] = 0x14;
16792 #ifdef CONFIG_SND_HDA_POWER_SAVE
16793 #define alc861vd_loopbacks alc880_loopbacks
16796 /* pcm configuration: identical with ALC880 */
16797 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16798 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16799 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16800 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16803 * configuration and preset
16805 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16806 [ALC660VD_3ST] = "3stack-660",
16807 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16808 [ALC660VD_ASUS_V1S] = "asus-v1s",
16809 [ALC861VD_3ST] = "3stack",
16810 [ALC861VD_3ST_DIG] = "3stack-digout",
16811 [ALC861VD_6ST_DIG] = "6stack-digout",
16812 [ALC861VD_LENOVO] = "lenovo",
16813 [ALC861VD_DALLAS] = "dallas",
16814 [ALC861VD_HP] = "hp",
16815 [ALC861VD_AUTO] = "auto",
16818 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16819 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16820 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16821 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16822 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16823 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16824 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16825 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16826 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16827 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16828 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16829 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16830 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16831 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16832 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16833 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16837 static struct alc_config_preset alc861vd_presets[] = {
16839 .mixers = { alc861vd_3st_mixer },
16840 .init_verbs = { alc861vd_volume_init_verbs,
16841 alc861vd_3stack_init_verbs },
16842 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16843 .dac_nids = alc660vd_dac_nids,
16844 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16845 .channel_mode = alc861vd_3stack_2ch_modes,
16846 .input_mux = &alc861vd_capture_source,
16848 [ALC660VD_3ST_DIG] = {
16849 .mixers = { alc861vd_3st_mixer },
16850 .init_verbs = { alc861vd_volume_init_verbs,
16851 alc861vd_3stack_init_verbs },
16852 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16853 .dac_nids = alc660vd_dac_nids,
16854 .dig_out_nid = ALC861VD_DIGOUT_NID,
16855 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16856 .channel_mode = alc861vd_3stack_2ch_modes,
16857 .input_mux = &alc861vd_capture_source,
16860 .mixers = { alc861vd_3st_mixer },
16861 .init_verbs = { alc861vd_volume_init_verbs,
16862 alc861vd_3stack_init_verbs },
16863 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16864 .dac_nids = alc861vd_dac_nids,
16865 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16866 .channel_mode = alc861vd_3stack_2ch_modes,
16867 .input_mux = &alc861vd_capture_source,
16869 [ALC861VD_3ST_DIG] = {
16870 .mixers = { alc861vd_3st_mixer },
16871 .init_verbs = { alc861vd_volume_init_verbs,
16872 alc861vd_3stack_init_verbs },
16873 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16874 .dac_nids = alc861vd_dac_nids,
16875 .dig_out_nid = ALC861VD_DIGOUT_NID,
16876 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16877 .channel_mode = alc861vd_3stack_2ch_modes,
16878 .input_mux = &alc861vd_capture_source,
16880 [ALC861VD_6ST_DIG] = {
16881 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16882 .init_verbs = { alc861vd_volume_init_verbs,
16883 alc861vd_6stack_init_verbs },
16884 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16885 .dac_nids = alc861vd_dac_nids,
16886 .dig_out_nid = ALC861VD_DIGOUT_NID,
16887 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16888 .channel_mode = alc861vd_6stack_modes,
16889 .input_mux = &alc861vd_capture_source,
16891 [ALC861VD_LENOVO] = {
16892 .mixers = { alc861vd_lenovo_mixer },
16893 .init_verbs = { alc861vd_volume_init_verbs,
16894 alc861vd_3stack_init_verbs,
16895 alc861vd_eapd_verbs,
16896 alc861vd_lenovo_unsol_verbs },
16897 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16898 .dac_nids = alc660vd_dac_nids,
16899 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16900 .channel_mode = alc861vd_3stack_2ch_modes,
16901 .input_mux = &alc861vd_capture_source,
16902 .unsol_event = alc861vd_lenovo_unsol_event,
16903 .setup = alc861vd_lenovo_setup,
16904 .init_hook = alc861vd_lenovo_init_hook,
16906 [ALC861VD_DALLAS] = {
16907 .mixers = { alc861vd_dallas_mixer },
16908 .init_verbs = { alc861vd_dallas_verbs },
16909 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16910 .dac_nids = alc861vd_dac_nids,
16911 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16912 .channel_mode = alc861vd_3stack_2ch_modes,
16913 .input_mux = &alc861vd_dallas_capture_source,
16914 .unsol_event = alc_automute_amp_unsol_event,
16915 .setup = alc861vd_dallas_setup,
16916 .init_hook = alc_automute_amp,
16919 .mixers = { alc861vd_hp_mixer },
16920 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16921 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16922 .dac_nids = alc861vd_dac_nids,
16923 .dig_out_nid = ALC861VD_DIGOUT_NID,
16924 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16925 .channel_mode = alc861vd_3stack_2ch_modes,
16926 .input_mux = &alc861vd_hp_capture_source,
16927 .unsol_event = alc_automute_amp_unsol_event,
16928 .setup = alc861vd_dallas_setup,
16929 .init_hook = alc_automute_amp,
16931 [ALC660VD_ASUS_V1S] = {
16932 .mixers = { alc861vd_lenovo_mixer },
16933 .init_verbs = { alc861vd_volume_init_verbs,
16934 alc861vd_3stack_init_verbs,
16935 alc861vd_eapd_verbs,
16936 alc861vd_lenovo_unsol_verbs },
16937 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16938 .dac_nids = alc660vd_dac_nids,
16939 .dig_out_nid = ALC861VD_DIGOUT_NID,
16940 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16941 .channel_mode = alc861vd_3stack_2ch_modes,
16942 .input_mux = &alc861vd_capture_source,
16943 .unsol_event = alc861vd_lenovo_unsol_event,
16944 .setup = alc861vd_lenovo_setup,
16945 .init_hook = alc861vd_lenovo_init_hook,
16950 * BIOS auto configuration
16952 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16953 const struct auto_pin_cfg *cfg)
16955 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0);
16959 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16960 hda_nid_t nid, int pin_type, int dac_idx)
16962 alc_set_pin_output(codec, nid, pin_type);
16965 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16967 struct alc_spec *spec = codec->spec;
16970 for (i = 0; i <= HDA_SIDE; i++) {
16971 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16972 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16974 alc861vd_auto_set_output_and_unmute(codec, nid,
16980 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16982 struct alc_spec *spec = codec->spec;
16985 pin = spec->autocfg.hp_pins[0];
16986 if (pin) /* connect to front and use dac 0 */
16987 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16988 pin = spec->autocfg.speaker_pins[0];
16990 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16993 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16995 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16997 struct alc_spec *spec = codec->spec;
16998 struct auto_pin_cfg *cfg = &spec->autocfg;
17001 for (i = 0; i < cfg->num_inputs; i++) {
17002 hda_nid_t nid = cfg->inputs[i].pin;
17003 if (alc_is_input_pin(codec, nid)) {
17004 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
17005 if (nid != ALC861VD_PIN_CD_NID &&
17006 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
17007 snd_hda_codec_write(codec, nid, 0,
17008 AC_VERB_SET_AMP_GAIN_MUTE,
17014 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
17016 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
17017 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
17019 /* add playback controls from the parsed DAC table */
17020 /* Based on ALC880 version. But ALC861VD has separate,
17021 * different NIDs for mute/unmute switch and volume control */
17022 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
17023 const struct auto_pin_cfg *cfg)
17025 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
17026 hda_nid_t nid_v, nid_s;
17029 for (i = 0; i < cfg->line_outs; i++) {
17030 if (!spec->multiout.dac_nids[i])
17032 nid_v = alc861vd_idx_to_mixer_vol(
17034 spec->multiout.dac_nids[i]));
17035 nid_s = alc861vd_idx_to_mixer_switch(
17037 spec->multiout.dac_nids[i]));
17041 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17043 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
17047 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
17049 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
17053 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17055 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
17059 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
17061 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17067 if (cfg->line_outs == 1 &&
17068 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17075 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17076 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17080 if (cfg->line_outs == 1 &&
17081 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17083 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17084 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17093 /* add playback controls for speaker and HP outputs */
17094 /* Based on ALC880 version. But ALC861VD has separate,
17095 * different NIDs for mute/unmute switch and volume control */
17096 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17097 hda_nid_t pin, const char *pfx)
17099 hda_nid_t nid_v, nid_s;
17105 if (alc880_is_fixed_pin(pin)) {
17106 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17107 /* specify the DAC as the extra output */
17108 if (!spec->multiout.hp_nid)
17109 spec->multiout.hp_nid = nid_v;
17111 spec->multiout.extra_out_nid[0] = nid_v;
17112 /* control HP volume/switch on the output mixer amp */
17113 nid_v = alc861vd_idx_to_mixer_vol(
17114 alc880_fixed_pin_idx(pin));
17115 nid_s = alc861vd_idx_to_mixer_switch(
17116 alc880_fixed_pin_idx(pin));
17118 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17119 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17122 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17123 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17126 } else if (alc880_is_multi_pin(pin)) {
17127 /* set manual connection */
17128 /* we have only a switch on HP-out PIN */
17129 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17130 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17137 /* parse the BIOS configuration and set up the alc_spec
17138 * return 1 if successful, 0 if the proper config is not found,
17139 * or a negative error code
17140 * Based on ALC880 version - had to change it to override
17141 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17142 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17144 struct alc_spec *spec = codec->spec;
17146 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17148 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17152 if (!spec->autocfg.line_outs)
17153 return 0; /* can't find valid BIOS pin config */
17155 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17158 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17161 err = alc861vd_auto_create_extra_out(spec,
17162 spec->autocfg.speaker_pins[0],
17166 err = alc861vd_auto_create_extra_out(spec,
17167 spec->autocfg.hp_pins[0],
17171 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17175 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17177 alc_auto_parse_digital(codec);
17179 if (spec->kctls.list)
17180 add_mixer(spec, spec->kctls.list);
17182 add_verb(spec, alc861vd_volume_init_verbs);
17184 spec->num_mux_defs = 1;
17185 spec->input_mux = &spec->private_imux[0];
17187 err = alc_auto_add_mic_boost(codec);
17191 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17196 /* additional initialization for auto-configuration model */
17197 static void alc861vd_auto_init(struct hda_codec *codec)
17199 struct alc_spec *spec = codec->spec;
17200 alc861vd_auto_init_multi_out(codec);
17201 alc861vd_auto_init_hp_out(codec);
17202 alc861vd_auto_init_analog_input(codec);
17203 alc861vd_auto_init_input_src(codec);
17204 alc_auto_init_digital(codec);
17205 if (spec->unsol_event)
17206 alc_inithook(codec);
17210 ALC660VD_FIX_ASUS_GPIO1
17214 static const struct alc_fixup alc861vd_fixups[] = {
17215 [ALC660VD_FIX_ASUS_GPIO1] = {
17216 .verbs = (const struct hda_verb[]) {
17217 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17218 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17219 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17225 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17226 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17230 static int patch_alc861vd(struct hda_codec *codec)
17232 struct alc_spec *spec;
17233 int err, board_config;
17235 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17239 codec->spec = spec;
17241 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17245 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17246 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17248 board_config = ALC861VD_AUTO;
17251 if (board_config == ALC861VD_AUTO)
17252 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17254 if (board_config == ALC861VD_AUTO) {
17255 /* automatic parse from the BIOS config */
17256 err = alc861vd_parse_auto_config(codec);
17262 "hda_codec: Cannot set up configuration "
17263 "from BIOS. Using base mode...\n");
17264 board_config = ALC861VD_3ST;
17268 err = snd_hda_attach_beep_device(codec, 0x23);
17274 if (board_config != ALC861VD_AUTO)
17275 setup_preset(codec, &alc861vd_presets[board_config]);
17277 if (codec->vendor_id == 0x10ec0660) {
17278 /* always turn on EAPD */
17279 add_verb(spec, alc660vd_eapd_verbs);
17282 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17283 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17285 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17286 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17288 if (!spec->adc_nids) {
17289 spec->adc_nids = alc861vd_adc_nids;
17290 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17292 if (!spec->capsrc_nids)
17293 spec->capsrc_nids = alc861vd_capsrc_nids;
17295 set_capture_mixer(codec);
17296 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17298 spec->vmaster_nid = 0x02;
17300 if (board_config == ALC861VD_AUTO)
17301 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17303 codec->patch_ops = alc_patch_ops;
17305 if (board_config == ALC861VD_AUTO)
17306 spec->init_hook = alc861vd_auto_init;
17307 #ifdef CONFIG_SND_HDA_POWER_SAVE
17308 if (!spec->loopback.amplist)
17309 spec->loopback.amplist = alc861vd_loopbacks;
17318 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17319 * configuration. Each pin widget can choose any input DACs and a mixer.
17320 * Each ADC is connected from a mixer of all inputs. This makes possible
17321 * 6-channel independent captures.
17323 * In addition, an independent DAC for the multi-playback (not used in this
17326 #define ALC662_DIGOUT_NID 0x06
17327 #define ALC662_DIGIN_NID 0x0a
17329 static hda_nid_t alc662_dac_nids[4] = {
17330 /* front, rear, clfe, rear_surr */
17334 static hda_nid_t alc272_dac_nids[2] = {
17338 static hda_nid_t alc662_adc_nids[2] = {
17343 static hda_nid_t alc272_adc_nids[1] = {
17348 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17349 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17353 /* FIXME: should be a matrix-type input source selection */
17354 static struct hda_input_mux alc662_capture_source = {
17358 { "Front Mic", 0x1 },
17364 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17372 static struct hda_input_mux alc663_capture_source = {
17376 { "Front Mic", 0x1 },
17381 #if 0 /* set to 1 for testing other input sources below */
17382 static struct hda_input_mux alc272_nc10_capture_source = {
17385 { "Autoselect Mic", 0x0 },
17386 { "Internal Mic", 0x1 },
17387 { "In-0x02", 0x2 },
17388 { "In-0x03", 0x3 },
17389 { "In-0x04", 0x4 },
17390 { "In-0x05", 0x5 },
17391 { "In-0x06", 0x6 },
17392 { "In-0x07", 0x7 },
17393 { "In-0x08", 0x8 },
17394 { "In-0x09", 0x9 },
17395 { "In-0x0a", 0x0a },
17396 { "In-0x0b", 0x0b },
17397 { "In-0x0c", 0x0c },
17398 { "In-0x0d", 0x0d },
17399 { "In-0x0e", 0x0e },
17400 { "In-0x0f", 0x0f },
17408 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17415 static struct hda_verb alc662_3ST_ch2_init[] = {
17416 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17417 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17418 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17419 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17426 static struct hda_verb alc662_3ST_ch6_init[] = {
17427 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17428 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17429 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17430 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17431 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17432 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17436 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17437 { 2, alc662_3ST_ch2_init },
17438 { 6, alc662_3ST_ch6_init },
17444 static struct hda_verb alc662_sixstack_ch6_init[] = {
17445 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17446 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17447 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17454 static struct hda_verb alc662_sixstack_ch8_init[] = {
17455 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17456 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17457 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17461 static struct hda_channel_mode alc662_5stack_modes[2] = {
17462 { 2, alc662_sixstack_ch6_init },
17463 { 6, alc662_sixstack_ch8_init },
17466 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17467 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17470 static struct snd_kcontrol_new alc662_base_mixer[] = {
17471 /* output mixer control */
17472 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17473 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17474 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17475 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17476 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17477 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17478 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17479 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17480 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17482 /*Input mixer control */
17483 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17484 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17485 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17486 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17487 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17488 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17489 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17490 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17494 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17495 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17496 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17497 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17498 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17499 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17500 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17501 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17502 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17503 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17504 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17505 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17509 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17510 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17511 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17512 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17513 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17514 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17515 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17516 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17517 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17518 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17519 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17520 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17521 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17522 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17523 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17524 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17525 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17526 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17530 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17531 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17532 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17533 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17534 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17535 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17536 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17537 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17538 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17539 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17543 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17544 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17545 ALC262_HIPPO_MASTER_SWITCH,
17547 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17548 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17549 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17551 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17552 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17553 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17557 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17558 ALC262_HIPPO_MASTER_SWITCH,
17559 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17560 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17561 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17562 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17563 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17564 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17565 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17566 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17567 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17571 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17572 .ops = &snd_hda_bind_vol,
17574 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17575 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17580 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17581 .ops = &snd_hda_bind_sw,
17583 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17584 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17589 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17590 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17591 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17592 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17593 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17597 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17598 .ops = &snd_hda_bind_sw,
17600 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17601 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17602 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17607 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17608 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17609 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17610 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17611 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17612 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17613 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17618 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17619 .ops = &snd_hda_bind_sw,
17621 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17622 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17623 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17628 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17629 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17630 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17631 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17632 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17633 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17634 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17638 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17639 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17640 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17641 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17642 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17643 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17644 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17645 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17649 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17650 .ops = &snd_hda_bind_vol,
17652 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17653 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17658 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17659 .ops = &snd_hda_bind_sw,
17661 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17662 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17667 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17668 HDA_BIND_VOL("Master Playback Volume",
17669 &alc663_asus_two_bind_master_vol),
17670 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17671 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17672 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17678 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17679 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17680 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17681 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17682 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17683 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17684 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17688 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17689 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17690 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17691 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17692 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17693 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17695 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17696 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17697 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17698 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17702 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17703 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17704 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17705 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17707 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17708 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17709 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17710 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17716 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17717 .ops = &snd_hda_bind_sw,
17719 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17720 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17721 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17722 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17723 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17728 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17729 .ops = &snd_hda_bind_sw,
17731 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17732 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17737 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17738 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17739 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17740 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17741 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17742 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17743 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17744 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17745 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17746 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17750 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17751 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17752 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17753 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17754 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17755 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17756 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17757 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17762 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17764 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17765 .name = "Channel Mode",
17766 .info = alc_ch_mode_info,
17767 .get = alc_ch_mode_get,
17768 .put = alc_ch_mode_put,
17773 static struct hda_verb alc662_init_verbs[] = {
17774 /* ADC: mute amp left and right */
17775 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17776 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17778 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17779 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17780 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17781 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17782 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17783 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17785 /* Front Pin: output 0 (0x0c) */
17786 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17787 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17789 /* Rear Pin: output 1 (0x0d) */
17790 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17791 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17793 /* CLFE Pin: output 2 (0x0e) */
17794 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17795 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17797 /* Mic (rear) pin: input vref at 80% */
17798 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17799 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17800 /* Front Mic pin: input vref at 80% */
17801 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17802 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17803 /* Line In pin: input */
17804 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17805 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17806 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17807 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17808 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17809 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17810 /* CD pin widget for input */
17811 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17813 /* FIXME: use matrix-type input source selection */
17814 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17816 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17817 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17819 /* always trun on EAPD */
17820 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17821 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17826 static struct hda_verb alc663_init_verbs[] = {
17827 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17828 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17829 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17830 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17831 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17832 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17836 static struct hda_verb alc272_init_verbs[] = {
17837 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17838 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17839 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17840 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17841 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17842 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17843 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17844 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17848 static struct hda_verb alc662_sue_init_verbs[] = {
17849 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17850 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17854 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17855 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17856 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17860 /* Set Unsolicited Event*/
17861 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17862 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17863 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17867 static struct hda_verb alc663_m51va_init_verbs[] = {
17868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17869 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17870 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17871 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17872 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17873 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17874 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17875 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17876 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17880 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17881 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17882 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17883 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17884 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17885 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17886 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17887 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17891 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17892 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17893 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17894 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17895 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17896 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17897 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17898 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17899 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17903 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17904 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17905 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17906 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17907 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17908 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17909 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17910 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17914 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17915 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17916 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17917 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17918 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17919 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17920 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17921 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17922 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17923 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17924 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17925 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17926 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17930 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17932 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17933 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17934 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17935 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17936 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17937 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17938 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17939 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17940 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17941 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17942 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17946 static struct hda_verb alc663_g71v_init_verbs[] = {
17947 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17948 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17949 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17951 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17952 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17955 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17956 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17957 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17961 static struct hda_verb alc663_g50v_init_verbs[] = {
17962 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17963 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17964 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17966 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17967 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17971 static struct hda_verb alc662_ecs_init_verbs[] = {
17972 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17974 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17975 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17979 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17980 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17981 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17982 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17983 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17984 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17985 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17986 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17989 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17990 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17994 static struct hda_verb alc272_dell_init_verbs[] = {
17995 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17996 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17997 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17998 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17999 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18000 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18001 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18002 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18003 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18004 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18005 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18009 static struct hda_verb alc663_mode7_init_verbs[] = {
18010 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18011 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18012 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18013 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18014 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18015 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18016 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
18017 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18018 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18019 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18020 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18021 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18022 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18023 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18024 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18028 static struct hda_verb alc663_mode8_init_verbs[] = {
18029 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18030 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18031 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18032 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
18033 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18034 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
18035 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18036 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
18037 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18038 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
18039 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
18040 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
18041 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
18042 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18043 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
18044 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
18048 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18049 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18050 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18054 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18055 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18056 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18060 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18062 unsigned int present;
18063 unsigned char bits;
18065 present = snd_hda_jack_detect(codec, 0x14);
18066 bits = present ? HDA_AMP_MUTE : 0;
18068 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18069 HDA_AMP_MUTE, bits);
18072 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18074 unsigned int present;
18075 unsigned char bits;
18077 present = snd_hda_jack_detect(codec, 0x1b);
18078 bits = present ? HDA_AMP_MUTE : 0;
18080 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18081 HDA_AMP_MUTE, bits);
18082 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18083 HDA_AMP_MUTE, bits);
18086 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18089 if ((res >> 26) == ALC880_HP_EVENT)
18090 alc662_lenovo_101e_all_automute(codec);
18091 if ((res >> 26) == ALC880_FRONT_EVENT)
18092 alc662_lenovo_101e_ispeaker_automute(codec);
18095 /* unsolicited event for HP jack sensing */
18096 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18099 if ((res >> 26) == ALC880_MIC_EVENT)
18100 alc_mic_automute(codec);
18102 alc262_hippo_unsol_event(codec, res);
18105 static void alc662_eeepc_setup(struct hda_codec *codec)
18107 struct alc_spec *spec = codec->spec;
18109 alc262_hippo1_setup(codec);
18110 spec->ext_mic.pin = 0x18;
18111 spec->ext_mic.mux_idx = 0;
18112 spec->int_mic.pin = 0x19;
18113 spec->int_mic.mux_idx = 1;
18114 spec->auto_mic = 1;
18117 static void alc662_eeepc_inithook(struct hda_codec *codec)
18119 alc262_hippo_automute(codec);
18120 alc_mic_automute(codec);
18123 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18125 struct alc_spec *spec = codec->spec;
18127 spec->autocfg.hp_pins[0] = 0x14;
18128 spec->autocfg.speaker_pins[0] = 0x1b;
18131 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18133 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18135 unsigned int present;
18136 unsigned char bits;
18138 present = snd_hda_jack_detect(codec, 0x21);
18139 bits = present ? HDA_AMP_MUTE : 0;
18140 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18141 HDA_AMP_MUTE, bits);
18142 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18143 HDA_AMP_MUTE, bits);
18146 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18148 unsigned int present;
18149 unsigned char bits;
18151 present = snd_hda_jack_detect(codec, 0x21);
18152 bits = present ? HDA_AMP_MUTE : 0;
18153 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18154 HDA_AMP_MUTE, bits);
18155 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18156 HDA_AMP_MUTE, bits);
18157 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18158 HDA_AMP_MUTE, bits);
18159 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18160 HDA_AMP_MUTE, bits);
18163 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18165 unsigned int present;
18166 unsigned char bits;
18168 present = snd_hda_jack_detect(codec, 0x15);
18169 bits = present ? HDA_AMP_MUTE : 0;
18170 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18171 HDA_AMP_MUTE, bits);
18172 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18173 HDA_AMP_MUTE, bits);
18174 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18175 HDA_AMP_MUTE, bits);
18176 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18177 HDA_AMP_MUTE, bits);
18180 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18182 unsigned int present;
18183 unsigned char bits;
18185 present = snd_hda_jack_detect(codec, 0x1b);
18186 bits = present ? 0 : PIN_OUT;
18187 snd_hda_codec_write(codec, 0x14, 0,
18188 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18191 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18193 unsigned int present1, present2;
18195 present1 = snd_hda_jack_detect(codec, 0x21);
18196 present2 = snd_hda_jack_detect(codec, 0x15);
18198 if (present1 || present2) {
18199 snd_hda_codec_write_cache(codec, 0x14, 0,
18200 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18202 snd_hda_codec_write_cache(codec, 0x14, 0,
18203 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18207 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18209 unsigned int present1, present2;
18211 present1 = snd_hda_jack_detect(codec, 0x1b);
18212 present2 = snd_hda_jack_detect(codec, 0x15);
18214 if (present1 || present2) {
18215 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18216 HDA_AMP_MUTE, HDA_AMP_MUTE);
18217 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18218 HDA_AMP_MUTE, HDA_AMP_MUTE);
18220 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18222 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18227 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18229 unsigned int present1, present2;
18231 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18232 AC_VERB_GET_PIN_SENSE, 0)
18233 & AC_PINSENSE_PRESENCE;
18234 present2 = snd_hda_codec_read(codec, 0x21, 0,
18235 AC_VERB_GET_PIN_SENSE, 0)
18236 & AC_PINSENSE_PRESENCE;
18238 if (present1 || present2) {
18239 snd_hda_codec_write_cache(codec, 0x14, 0,
18240 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18241 snd_hda_codec_write_cache(codec, 0x17, 0,
18242 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18244 snd_hda_codec_write_cache(codec, 0x14, 0,
18245 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18246 snd_hda_codec_write_cache(codec, 0x17, 0,
18247 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18251 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18253 unsigned int present1, present2;
18255 present1 = snd_hda_codec_read(codec, 0x21, 0,
18256 AC_VERB_GET_PIN_SENSE, 0)
18257 & AC_PINSENSE_PRESENCE;
18258 present2 = snd_hda_codec_read(codec, 0x15, 0,
18259 AC_VERB_GET_PIN_SENSE, 0)
18260 & AC_PINSENSE_PRESENCE;
18262 if (present1 || present2) {
18263 snd_hda_codec_write_cache(codec, 0x14, 0,
18264 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18265 snd_hda_codec_write_cache(codec, 0x17, 0,
18266 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18268 snd_hda_codec_write_cache(codec, 0x14, 0,
18269 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18270 snd_hda_codec_write_cache(codec, 0x17, 0,
18271 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18275 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18278 switch (res >> 26) {
18279 case ALC880_HP_EVENT:
18280 alc663_m51va_speaker_automute(codec);
18282 case ALC880_MIC_EVENT:
18283 alc_mic_automute(codec);
18288 static void alc663_m51va_setup(struct hda_codec *codec)
18290 struct alc_spec *spec = codec->spec;
18291 spec->ext_mic.pin = 0x18;
18292 spec->ext_mic.mux_idx = 0;
18293 spec->int_mic.pin = 0x12;
18294 spec->int_mic.mux_idx = 9;
18295 spec->auto_mic = 1;
18298 static void alc663_m51va_inithook(struct hda_codec *codec)
18300 alc663_m51va_speaker_automute(codec);
18301 alc_mic_automute(codec);
18304 /* ***************** Mode1 ******************************/
18305 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18307 static void alc663_mode1_setup(struct hda_codec *codec)
18309 struct alc_spec *spec = codec->spec;
18310 spec->ext_mic.pin = 0x18;
18311 spec->ext_mic.mux_idx = 0;
18312 spec->int_mic.pin = 0x19;
18313 spec->int_mic.mux_idx = 1;
18314 spec->auto_mic = 1;
18317 #define alc663_mode1_inithook alc663_m51va_inithook
18319 /* ***************** Mode2 ******************************/
18320 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18323 switch (res >> 26) {
18324 case ALC880_HP_EVENT:
18325 alc662_f5z_speaker_automute(codec);
18327 case ALC880_MIC_EVENT:
18328 alc_mic_automute(codec);
18333 #define alc662_mode2_setup alc663_mode1_setup
18335 static void alc662_mode2_inithook(struct hda_codec *codec)
18337 alc662_f5z_speaker_automute(codec);
18338 alc_mic_automute(codec);
18340 /* ***************** Mode3 ******************************/
18341 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18344 switch (res >> 26) {
18345 case ALC880_HP_EVENT:
18346 alc663_two_hp_m1_speaker_automute(codec);
18348 case ALC880_MIC_EVENT:
18349 alc_mic_automute(codec);
18354 #define alc663_mode3_setup alc663_mode1_setup
18356 static void alc663_mode3_inithook(struct hda_codec *codec)
18358 alc663_two_hp_m1_speaker_automute(codec);
18359 alc_mic_automute(codec);
18361 /* ***************** Mode4 ******************************/
18362 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18365 switch (res >> 26) {
18366 case ALC880_HP_EVENT:
18367 alc663_21jd_two_speaker_automute(codec);
18369 case ALC880_MIC_EVENT:
18370 alc_mic_automute(codec);
18375 #define alc663_mode4_setup alc663_mode1_setup
18377 static void alc663_mode4_inithook(struct hda_codec *codec)
18379 alc663_21jd_two_speaker_automute(codec);
18380 alc_mic_automute(codec);
18382 /* ***************** Mode5 ******************************/
18383 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18386 switch (res >> 26) {
18387 case ALC880_HP_EVENT:
18388 alc663_15jd_two_speaker_automute(codec);
18390 case ALC880_MIC_EVENT:
18391 alc_mic_automute(codec);
18396 #define alc663_mode5_setup alc663_mode1_setup
18398 static void alc663_mode5_inithook(struct hda_codec *codec)
18400 alc663_15jd_two_speaker_automute(codec);
18401 alc_mic_automute(codec);
18403 /* ***************** Mode6 ******************************/
18404 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18407 switch (res >> 26) {
18408 case ALC880_HP_EVENT:
18409 alc663_two_hp_m2_speaker_automute(codec);
18411 case ALC880_MIC_EVENT:
18412 alc_mic_automute(codec);
18417 #define alc663_mode6_setup alc663_mode1_setup
18419 static void alc663_mode6_inithook(struct hda_codec *codec)
18421 alc663_two_hp_m2_speaker_automute(codec);
18422 alc_mic_automute(codec);
18425 /* ***************** Mode7 ******************************/
18426 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18429 switch (res >> 26) {
18430 case ALC880_HP_EVENT:
18431 alc663_two_hp_m7_speaker_automute(codec);
18433 case ALC880_MIC_EVENT:
18434 alc_mic_automute(codec);
18439 #define alc663_mode7_setup alc663_mode1_setup
18441 static void alc663_mode7_inithook(struct hda_codec *codec)
18443 alc663_two_hp_m7_speaker_automute(codec);
18444 alc_mic_automute(codec);
18447 /* ***************** Mode8 ******************************/
18448 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18451 switch (res >> 26) {
18452 case ALC880_HP_EVENT:
18453 alc663_two_hp_m8_speaker_automute(codec);
18455 case ALC880_MIC_EVENT:
18456 alc_mic_automute(codec);
18461 #define alc663_mode8_setup alc663_m51va_setup
18463 static void alc663_mode8_inithook(struct hda_codec *codec)
18465 alc663_two_hp_m8_speaker_automute(codec);
18466 alc_mic_automute(codec);
18469 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18471 unsigned int present;
18472 unsigned char bits;
18474 present = snd_hda_jack_detect(codec, 0x21);
18475 bits = present ? HDA_AMP_MUTE : 0;
18476 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18477 HDA_AMP_MUTE, bits);
18478 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18479 HDA_AMP_MUTE, bits);
18482 static void alc663_g71v_front_automute(struct hda_codec *codec)
18484 unsigned int present;
18485 unsigned char bits;
18487 present = snd_hda_jack_detect(codec, 0x15);
18488 bits = present ? HDA_AMP_MUTE : 0;
18489 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18490 HDA_AMP_MUTE, bits);
18493 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18496 switch (res >> 26) {
18497 case ALC880_HP_EVENT:
18498 alc663_g71v_hp_automute(codec);
18500 case ALC880_FRONT_EVENT:
18501 alc663_g71v_front_automute(codec);
18503 case ALC880_MIC_EVENT:
18504 alc_mic_automute(codec);
18509 #define alc663_g71v_setup alc663_m51va_setup
18511 static void alc663_g71v_inithook(struct hda_codec *codec)
18513 alc663_g71v_front_automute(codec);
18514 alc663_g71v_hp_automute(codec);
18515 alc_mic_automute(codec);
18518 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18521 switch (res >> 26) {
18522 case ALC880_HP_EVENT:
18523 alc663_m51va_speaker_automute(codec);
18525 case ALC880_MIC_EVENT:
18526 alc_mic_automute(codec);
18531 #define alc663_g50v_setup alc663_m51va_setup
18533 static void alc663_g50v_inithook(struct hda_codec *codec)
18535 alc663_m51va_speaker_automute(codec);
18536 alc_mic_automute(codec);
18539 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18540 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18541 ALC262_HIPPO_MASTER_SWITCH,
18543 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18544 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18545 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18547 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18548 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18549 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18553 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18554 /* Master Playback automatically created from Speaker and Headphone */
18555 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18556 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18557 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18558 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18560 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18561 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18562 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18564 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18565 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18566 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18570 #ifdef CONFIG_SND_HDA_POWER_SAVE
18571 #define alc662_loopbacks alc880_loopbacks
18575 /* pcm configuration: identical with ALC880 */
18576 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18577 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18578 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18579 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18582 * configuration and preset
18584 static const char *alc662_models[ALC662_MODEL_LAST] = {
18585 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18586 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18587 [ALC662_3ST_6ch] = "3stack-6ch",
18588 [ALC662_5ST_DIG] = "6stack-dig",
18589 [ALC662_LENOVO_101E] = "lenovo-101e",
18590 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18591 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18592 [ALC662_ECS] = "ecs",
18593 [ALC663_ASUS_M51VA] = "m51va",
18594 [ALC663_ASUS_G71V] = "g71v",
18595 [ALC663_ASUS_H13] = "h13",
18596 [ALC663_ASUS_G50V] = "g50v",
18597 [ALC663_ASUS_MODE1] = "asus-mode1",
18598 [ALC662_ASUS_MODE2] = "asus-mode2",
18599 [ALC663_ASUS_MODE3] = "asus-mode3",
18600 [ALC663_ASUS_MODE4] = "asus-mode4",
18601 [ALC663_ASUS_MODE5] = "asus-mode5",
18602 [ALC663_ASUS_MODE6] = "asus-mode6",
18603 [ALC663_ASUS_MODE7] = "asus-mode7",
18604 [ALC663_ASUS_MODE8] = "asus-mode8",
18605 [ALC272_DELL] = "dell",
18606 [ALC272_DELL_ZM1] = "dell-zm1",
18607 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18608 [ALC662_AUTO] = "auto",
18611 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18612 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18613 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18614 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18615 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18616 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18617 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18618 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18619 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18620 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18621 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18622 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18623 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18624 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18625 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18626 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18627 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18628 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18629 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18630 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18631 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18632 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18633 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18634 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18635 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18636 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18637 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18638 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18639 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18640 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18641 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18642 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18643 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18644 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18645 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18646 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18647 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18648 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18649 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18650 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18651 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18652 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18653 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18654 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18655 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18656 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18657 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18658 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18659 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18660 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18661 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18662 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18663 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18664 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18665 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18666 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18667 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18668 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18669 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18670 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18671 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18672 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18673 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18674 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18675 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18676 ALC662_3ST_6ch_DIG),
18677 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18678 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18679 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18680 ALC662_3ST_6ch_DIG),
18681 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18682 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18683 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18684 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18685 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18686 ALC662_3ST_6ch_DIG),
18687 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18692 static struct alc_config_preset alc662_presets[] = {
18693 [ALC662_3ST_2ch_DIG] = {
18694 .mixers = { alc662_3ST_2ch_mixer },
18695 .init_verbs = { alc662_init_verbs },
18696 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18697 .dac_nids = alc662_dac_nids,
18698 .dig_out_nid = ALC662_DIGOUT_NID,
18699 .dig_in_nid = ALC662_DIGIN_NID,
18700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18701 .channel_mode = alc662_3ST_2ch_modes,
18702 .input_mux = &alc662_capture_source,
18704 [ALC662_3ST_6ch_DIG] = {
18705 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18706 .init_verbs = { alc662_init_verbs },
18707 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18708 .dac_nids = alc662_dac_nids,
18709 .dig_out_nid = ALC662_DIGOUT_NID,
18710 .dig_in_nid = ALC662_DIGIN_NID,
18711 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18712 .channel_mode = alc662_3ST_6ch_modes,
18714 .input_mux = &alc662_capture_source,
18716 [ALC662_3ST_6ch] = {
18717 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18718 .init_verbs = { alc662_init_verbs },
18719 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18720 .dac_nids = alc662_dac_nids,
18721 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18722 .channel_mode = alc662_3ST_6ch_modes,
18724 .input_mux = &alc662_capture_source,
18726 [ALC662_5ST_DIG] = {
18727 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18728 .init_verbs = { alc662_init_verbs },
18729 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18730 .dac_nids = alc662_dac_nids,
18731 .dig_out_nid = ALC662_DIGOUT_NID,
18732 .dig_in_nid = ALC662_DIGIN_NID,
18733 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18734 .channel_mode = alc662_5stack_modes,
18735 .input_mux = &alc662_capture_source,
18737 [ALC662_LENOVO_101E] = {
18738 .mixers = { alc662_lenovo_101e_mixer },
18739 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18740 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18741 .dac_nids = alc662_dac_nids,
18742 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18743 .channel_mode = alc662_3ST_2ch_modes,
18744 .input_mux = &alc662_lenovo_101e_capture_source,
18745 .unsol_event = alc662_lenovo_101e_unsol_event,
18746 .init_hook = alc662_lenovo_101e_all_automute,
18748 [ALC662_ASUS_EEEPC_P701] = {
18749 .mixers = { alc662_eeepc_p701_mixer },
18750 .init_verbs = { alc662_init_verbs,
18751 alc662_eeepc_sue_init_verbs },
18752 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18753 .dac_nids = alc662_dac_nids,
18754 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18755 .channel_mode = alc662_3ST_2ch_modes,
18756 .unsol_event = alc662_eeepc_unsol_event,
18757 .setup = alc662_eeepc_setup,
18758 .init_hook = alc662_eeepc_inithook,
18760 [ALC662_ASUS_EEEPC_EP20] = {
18761 .mixers = { alc662_eeepc_ep20_mixer,
18762 alc662_chmode_mixer },
18763 .init_verbs = { alc662_init_verbs,
18764 alc662_eeepc_ep20_sue_init_verbs },
18765 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18766 .dac_nids = alc662_dac_nids,
18767 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18768 .channel_mode = alc662_3ST_6ch_modes,
18769 .input_mux = &alc662_lenovo_101e_capture_source,
18770 .unsol_event = alc662_eeepc_unsol_event,
18771 .setup = alc662_eeepc_ep20_setup,
18772 .init_hook = alc662_eeepc_ep20_inithook,
18775 .mixers = { alc662_ecs_mixer },
18776 .init_verbs = { alc662_init_verbs,
18777 alc662_ecs_init_verbs },
18778 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18779 .dac_nids = alc662_dac_nids,
18780 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18781 .channel_mode = alc662_3ST_2ch_modes,
18782 .unsol_event = alc662_eeepc_unsol_event,
18783 .setup = alc662_eeepc_setup,
18784 .init_hook = alc662_eeepc_inithook,
18786 [ALC663_ASUS_M51VA] = {
18787 .mixers = { alc663_m51va_mixer },
18788 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18789 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18790 .dac_nids = alc662_dac_nids,
18791 .dig_out_nid = ALC662_DIGOUT_NID,
18792 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18793 .channel_mode = alc662_3ST_2ch_modes,
18794 .unsol_event = alc663_m51va_unsol_event,
18795 .setup = alc663_m51va_setup,
18796 .init_hook = alc663_m51va_inithook,
18798 [ALC663_ASUS_G71V] = {
18799 .mixers = { alc663_g71v_mixer },
18800 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18801 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18802 .dac_nids = alc662_dac_nids,
18803 .dig_out_nid = ALC662_DIGOUT_NID,
18804 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18805 .channel_mode = alc662_3ST_2ch_modes,
18806 .unsol_event = alc663_g71v_unsol_event,
18807 .setup = alc663_g71v_setup,
18808 .init_hook = alc663_g71v_inithook,
18810 [ALC663_ASUS_H13] = {
18811 .mixers = { alc663_m51va_mixer },
18812 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18813 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18814 .dac_nids = alc662_dac_nids,
18815 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18816 .channel_mode = alc662_3ST_2ch_modes,
18817 .unsol_event = alc663_m51va_unsol_event,
18818 .init_hook = alc663_m51va_inithook,
18820 [ALC663_ASUS_G50V] = {
18821 .mixers = { alc663_g50v_mixer },
18822 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18823 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18824 .dac_nids = alc662_dac_nids,
18825 .dig_out_nid = ALC662_DIGOUT_NID,
18826 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18827 .channel_mode = alc662_3ST_6ch_modes,
18828 .input_mux = &alc663_capture_source,
18829 .unsol_event = alc663_g50v_unsol_event,
18830 .setup = alc663_g50v_setup,
18831 .init_hook = alc663_g50v_inithook,
18833 [ALC663_ASUS_MODE1] = {
18834 .mixers = { alc663_m51va_mixer },
18835 .cap_mixer = alc662_auto_capture_mixer,
18836 .init_verbs = { alc662_init_verbs,
18837 alc663_21jd_amic_init_verbs },
18838 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18840 .dac_nids = alc662_dac_nids,
18841 .dig_out_nid = ALC662_DIGOUT_NID,
18842 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18843 .channel_mode = alc662_3ST_2ch_modes,
18844 .unsol_event = alc663_mode1_unsol_event,
18845 .setup = alc663_mode1_setup,
18846 .init_hook = alc663_mode1_inithook,
18848 [ALC662_ASUS_MODE2] = {
18849 .mixers = { alc662_1bjd_mixer },
18850 .cap_mixer = alc662_auto_capture_mixer,
18851 .init_verbs = { alc662_init_verbs,
18852 alc662_1bjd_amic_init_verbs },
18853 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18854 .dac_nids = alc662_dac_nids,
18855 .dig_out_nid = ALC662_DIGOUT_NID,
18856 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18857 .channel_mode = alc662_3ST_2ch_modes,
18858 .unsol_event = alc662_mode2_unsol_event,
18859 .setup = alc662_mode2_setup,
18860 .init_hook = alc662_mode2_inithook,
18862 [ALC663_ASUS_MODE3] = {
18863 .mixers = { alc663_two_hp_m1_mixer },
18864 .cap_mixer = alc662_auto_capture_mixer,
18865 .init_verbs = { alc662_init_verbs,
18866 alc663_two_hp_amic_m1_init_verbs },
18867 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18869 .dac_nids = alc662_dac_nids,
18870 .dig_out_nid = ALC662_DIGOUT_NID,
18871 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18872 .channel_mode = alc662_3ST_2ch_modes,
18873 .unsol_event = alc663_mode3_unsol_event,
18874 .setup = alc663_mode3_setup,
18875 .init_hook = alc663_mode3_inithook,
18877 [ALC663_ASUS_MODE4] = {
18878 .mixers = { alc663_asus_21jd_clfe_mixer },
18879 .cap_mixer = alc662_auto_capture_mixer,
18880 .init_verbs = { alc662_init_verbs,
18881 alc663_21jd_amic_init_verbs},
18882 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18884 .dac_nids = alc662_dac_nids,
18885 .dig_out_nid = ALC662_DIGOUT_NID,
18886 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18887 .channel_mode = alc662_3ST_2ch_modes,
18888 .unsol_event = alc663_mode4_unsol_event,
18889 .setup = alc663_mode4_setup,
18890 .init_hook = alc663_mode4_inithook,
18892 [ALC663_ASUS_MODE5] = {
18893 .mixers = { alc663_asus_15jd_clfe_mixer },
18894 .cap_mixer = alc662_auto_capture_mixer,
18895 .init_verbs = { alc662_init_verbs,
18896 alc663_15jd_amic_init_verbs },
18897 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18899 .dac_nids = alc662_dac_nids,
18900 .dig_out_nid = ALC662_DIGOUT_NID,
18901 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18902 .channel_mode = alc662_3ST_2ch_modes,
18903 .unsol_event = alc663_mode5_unsol_event,
18904 .setup = alc663_mode5_setup,
18905 .init_hook = alc663_mode5_inithook,
18907 [ALC663_ASUS_MODE6] = {
18908 .mixers = { alc663_two_hp_m2_mixer },
18909 .cap_mixer = alc662_auto_capture_mixer,
18910 .init_verbs = { alc662_init_verbs,
18911 alc663_two_hp_amic_m2_init_verbs },
18912 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18914 .dac_nids = alc662_dac_nids,
18915 .dig_out_nid = ALC662_DIGOUT_NID,
18916 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18917 .channel_mode = alc662_3ST_2ch_modes,
18918 .unsol_event = alc663_mode6_unsol_event,
18919 .setup = alc663_mode6_setup,
18920 .init_hook = alc663_mode6_inithook,
18922 [ALC663_ASUS_MODE7] = {
18923 .mixers = { alc663_mode7_mixer },
18924 .cap_mixer = alc662_auto_capture_mixer,
18925 .init_verbs = { alc662_init_verbs,
18926 alc663_mode7_init_verbs },
18927 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18929 .dac_nids = alc662_dac_nids,
18930 .dig_out_nid = ALC662_DIGOUT_NID,
18931 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18932 .channel_mode = alc662_3ST_2ch_modes,
18933 .unsol_event = alc663_mode7_unsol_event,
18934 .setup = alc663_mode7_setup,
18935 .init_hook = alc663_mode7_inithook,
18937 [ALC663_ASUS_MODE8] = {
18938 .mixers = { alc663_mode8_mixer },
18939 .cap_mixer = alc662_auto_capture_mixer,
18940 .init_verbs = { alc662_init_verbs,
18941 alc663_mode8_init_verbs },
18942 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18944 .dac_nids = alc662_dac_nids,
18945 .dig_out_nid = ALC662_DIGOUT_NID,
18946 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18947 .channel_mode = alc662_3ST_2ch_modes,
18948 .unsol_event = alc663_mode8_unsol_event,
18949 .setup = alc663_mode8_setup,
18950 .init_hook = alc663_mode8_inithook,
18953 .mixers = { alc663_m51va_mixer },
18954 .cap_mixer = alc272_auto_capture_mixer,
18955 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18956 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18957 .dac_nids = alc662_dac_nids,
18958 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18959 .adc_nids = alc272_adc_nids,
18960 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18961 .capsrc_nids = alc272_capsrc_nids,
18962 .channel_mode = alc662_3ST_2ch_modes,
18963 .unsol_event = alc663_m51va_unsol_event,
18964 .setup = alc663_m51va_setup,
18965 .init_hook = alc663_m51va_inithook,
18967 [ALC272_DELL_ZM1] = {
18968 .mixers = { alc663_m51va_mixer },
18969 .cap_mixer = alc662_auto_capture_mixer,
18970 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18971 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18972 .dac_nids = alc662_dac_nids,
18973 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18974 .adc_nids = alc662_adc_nids,
18976 .capsrc_nids = alc662_capsrc_nids,
18977 .channel_mode = alc662_3ST_2ch_modes,
18978 .unsol_event = alc663_m51va_unsol_event,
18979 .setup = alc663_m51va_setup,
18980 .init_hook = alc663_m51va_inithook,
18982 [ALC272_SAMSUNG_NC10] = {
18983 .mixers = { alc272_nc10_mixer },
18984 .init_verbs = { alc662_init_verbs,
18985 alc663_21jd_amic_init_verbs },
18986 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18987 .dac_nids = alc272_dac_nids,
18988 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18989 .channel_mode = alc662_3ST_2ch_modes,
18990 /*.input_mux = &alc272_nc10_capture_source,*/
18991 .unsol_event = alc663_mode4_unsol_event,
18992 .setup = alc663_mode4_setup,
18993 .init_hook = alc663_mode4_inithook,
18999 * BIOS auto configuration
19002 /* convert from MIX nid to DAC */
19003 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19007 else if (nid >= 0x0c && nid <= 0x0e)
19008 return nid - 0x0c + 0x02;
19009 else if (nid == 0x26) /* ALC887-VD has this DAC too */
19015 /* get MIX nid connected to the given pin targeted to DAC */
19016 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19022 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19023 for (i = 0; i < num; i++) {
19024 if (alc662_mix_to_dac(mix[i]) == dac)
19030 /* look for an empty DAC slot */
19031 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19033 struct alc_spec *spec = codec->spec;
19037 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19040 for (i = 0; i < num; i++) {
19041 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
19044 for (j = 0; j < spec->multiout.num_dacs; j++)
19045 if (spec->multiout.dac_nids[j] == nid)
19047 if (j >= spec->multiout.num_dacs)
19053 /* fill in the dac_nids table from the parsed pin configuration */
19054 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
19055 const struct auto_pin_cfg *cfg)
19057 struct alc_spec *spec = codec->spec;
19061 spec->multiout.dac_nids = spec->private_dac_nids;
19062 for (i = 0; i < cfg->line_outs; i++) {
19063 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
19066 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19071 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19072 hda_nid_t nid, unsigned int chs)
19074 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
19075 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19078 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19079 hda_nid_t nid, unsigned int chs)
19081 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19082 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19085 #define alc662_add_stereo_vol(spec, pfx, nid) \
19086 alc662_add_vol_ctl(spec, pfx, nid, 3)
19087 #define alc662_add_stereo_sw(spec, pfx, nid) \
19088 alc662_add_sw_ctl(spec, pfx, nid, 3)
19090 /* add playback controls from the parsed DAC table */
19091 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19092 const struct auto_pin_cfg *cfg)
19094 struct alc_spec *spec = codec->spec;
19095 static const char *chname[4] = {
19096 "Front", "Surround", NULL /*CLFE*/, "Side"
19098 hda_nid_t nid, mix;
19101 for (i = 0; i < cfg->line_outs; i++) {
19102 nid = spec->multiout.dac_nids[i];
19105 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19110 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19113 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19116 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19119 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19124 if (cfg->line_outs == 1 &&
19125 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
19132 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19135 if (cfg->line_outs == 1 &&
19136 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19138 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19146 /* add playback controls for speaker and HP outputs */
19147 /* return DAC nid if any new DAC is assigned */
19148 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19151 struct alc_spec *spec = codec->spec;
19152 hda_nid_t nid, mix;
19157 nid = alc662_look_for_dac(codec, pin);
19159 /* the corresponding DAC is already occupied */
19160 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19161 return 0; /* no way */
19162 /* create a switch only */
19163 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19164 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19167 mix = alc662_dac_to_mix(codec, pin, nid);
19170 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19173 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19179 /* create playback/capture controls for input pins */
19180 #define alc662_auto_create_input_ctls \
19181 alc882_auto_create_input_ctls
19183 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19184 hda_nid_t nid, int pin_type,
19188 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19190 alc_set_pin_output(codec, nid, pin_type);
19191 /* need the manual connection? */
19192 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19195 for (i = 0; i < num; i++) {
19196 if (alc662_mix_to_dac(srcs[i]) != dac)
19198 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19203 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19205 struct alc_spec *spec = codec->spec;
19206 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19209 for (i = 0; i <= HDA_SIDE; i++) {
19210 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19212 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19213 spec->multiout.dac_nids[i]);
19217 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19219 struct alc_spec *spec = codec->spec;
19222 pin = spec->autocfg.hp_pins[0];
19224 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19225 spec->multiout.hp_nid);
19226 pin = spec->autocfg.speaker_pins[0];
19228 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19229 spec->multiout.extra_out_nid[0]);
19232 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19234 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19236 struct alc_spec *spec = codec->spec;
19237 struct auto_pin_cfg *cfg = &spec->autocfg;
19240 for (i = 0; i < cfg->num_inputs; i++) {
19241 hda_nid_t nid = cfg->inputs[i].pin;
19242 if (alc_is_input_pin(codec, nid)) {
19243 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19244 if (nid != ALC662_PIN_CD_NID &&
19245 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19246 snd_hda_codec_write(codec, nid, 0,
19247 AC_VERB_SET_AMP_GAIN_MUTE,
19253 #define alc662_auto_init_input_src alc882_auto_init_input_src
19255 static int alc662_parse_auto_config(struct hda_codec *codec)
19257 struct alc_spec *spec = codec->spec;
19259 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19261 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19265 if (!spec->autocfg.line_outs)
19266 return 0; /* can't find valid BIOS pin config */
19268 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19271 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19274 err = alc662_auto_create_extra_out(codec,
19275 spec->autocfg.speaker_pins[0],
19280 spec->multiout.extra_out_nid[0] = err;
19281 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19286 spec->multiout.hp_nid = err;
19287 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19291 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19293 alc_auto_parse_digital(codec);
19295 if (spec->kctls.list)
19296 add_mixer(spec, spec->kctls.list);
19298 spec->num_mux_defs = 1;
19299 spec->input_mux = &spec->private_imux[0];
19301 add_verb(spec, alc662_init_verbs);
19302 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19303 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19304 add_verb(spec, alc663_init_verbs);
19306 if (codec->vendor_id == 0x10ec0272)
19307 add_verb(spec, alc272_init_verbs);
19309 err = alc_auto_add_mic_boost(codec);
19313 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19314 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19315 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19317 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19322 /* additional initialization for auto-configuration model */
19323 static void alc662_auto_init(struct hda_codec *codec)
19325 struct alc_spec *spec = codec->spec;
19326 alc662_auto_init_multi_out(codec);
19327 alc662_auto_init_hp_out(codec);
19328 alc662_auto_init_analog_input(codec);
19329 alc662_auto_init_input_src(codec);
19330 alc_auto_init_digital(codec);
19331 if (spec->unsol_event)
19332 alc_inithook(codec);
19336 ALC662_FIXUP_ASPIRE,
19337 ALC662_FIXUP_IDEAPAD,
19340 static const struct alc_fixup alc662_fixups[] = {
19341 [ALC662_FIXUP_ASPIRE] = {
19342 .pins = (const struct alc_pincfg[]) {
19343 { 0x15, 0x99130112 }, /* subwoofer */
19347 [ALC662_FIXUP_IDEAPAD] = {
19348 .pins = (const struct alc_pincfg[]) {
19349 { 0x17, 0x99130112 }, /* subwoofer */
19355 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19356 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19357 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
19358 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19359 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19365 static int patch_alc662(struct hda_codec *codec)
19367 struct alc_spec *spec;
19368 int err, board_config;
19371 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19375 codec->spec = spec;
19377 alc_auto_parse_customize_define(codec);
19379 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19381 coef = alc_read_coef_idx(codec, 0);
19382 if (coef == 0x8020 || coef == 0x8011)
19383 alc_codec_rename(codec, "ALC661");
19384 else if (coef & (1 << 14) &&
19385 codec->bus->pci->subsystem_vendor == 0x1025 &&
19386 spec->cdefine.platform_type == 1)
19387 alc_codec_rename(codec, "ALC272X");
19388 else if (coef == 0x4011)
19389 alc_codec_rename(codec, "ALC656");
19391 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19394 if (board_config < 0) {
19395 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19397 board_config = ALC662_AUTO;
19400 if (board_config == ALC662_AUTO) {
19401 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19402 /* automatic parse from the BIOS config */
19403 err = alc662_parse_auto_config(codec);
19409 "hda_codec: Cannot set up configuration "
19410 "from BIOS. Using base mode...\n");
19411 board_config = ALC662_3ST_2ch_DIG;
19415 if (has_cdefine_beep(codec)) {
19416 err = snd_hda_attach_beep_device(codec, 0x1);
19423 if (board_config != ALC662_AUTO)
19424 setup_preset(codec, &alc662_presets[board_config]);
19426 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19427 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19429 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19430 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19432 if (!spec->adc_nids) {
19433 spec->adc_nids = alc662_adc_nids;
19434 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19436 if (!spec->capsrc_nids)
19437 spec->capsrc_nids = alc662_capsrc_nids;
19439 if (!spec->cap_mixer)
19440 set_capture_mixer(codec);
19442 if (has_cdefine_beep(codec)) {
19443 switch (codec->vendor_id) {
19445 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19450 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19453 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19457 spec->vmaster_nid = 0x02;
19459 codec->patch_ops = alc_patch_ops;
19460 if (board_config == ALC662_AUTO) {
19461 spec->init_hook = alc662_auto_init;
19462 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0);
19465 alc_init_jacks(codec);
19467 #ifdef CONFIG_SND_HDA_POWER_SAVE
19468 if (!spec->loopback.amplist)
19469 spec->loopback.amplist = alc662_loopbacks;
19475 static int patch_alc888(struct hda_codec *codec)
19477 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19478 kfree(codec->chip_name);
19479 if (codec->vendor_id == 0x10ec0887)
19480 codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL);
19482 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19483 if (!codec->chip_name) {
19487 return patch_alc662(codec);
19489 return patch_alc882(codec);
19495 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19496 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19497 #define alc680_modes alc260_modes
19499 static hda_nid_t alc680_dac_nids[3] = {
19500 /* Lout1, Lout2, hp */
19504 static hda_nid_t alc680_adc_nids[3] = {
19506 /* DMIC, MIC, Line-in*/
19511 * Analog capture ADC cgange
19513 static void alc680_rec_autoswitch(struct hda_codec *codec)
19515 struct alc_spec *spec = codec->spec;
19516 struct auto_pin_cfg *cfg = &spec->autocfg;
19518 int type_found = AUTO_PIN_LAST;
19522 for (i = 0; i < cfg->num_inputs; i++) {
19523 nid = cfg->inputs[i].pin;
19524 if (!(snd_hda_query_pin_caps(codec, nid) &
19525 AC_PINCAP_PRES_DETECT))
19527 if (snd_hda_jack_detect(codec, nid)) {
19528 if (cfg->inputs[i].type < type_found) {
19529 type_found = cfg->inputs[i].type;
19537 snd_hda_get_connections(codec, pin_found, &nid, 1);
19539 if (nid != spec->cur_adc)
19540 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19541 spec->cur_adc = nid;
19542 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19543 spec->cur_adc_format);
19546 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19547 struct hda_codec *codec,
19548 unsigned int stream_tag,
19549 unsigned int format,
19550 struct snd_pcm_substream *substream)
19552 struct alc_spec *spec = codec->spec;
19554 spec->cur_adc = 0x07;
19555 spec->cur_adc_stream_tag = stream_tag;
19556 spec->cur_adc_format = format;
19558 alc680_rec_autoswitch(codec);
19562 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19563 struct hda_codec *codec,
19564 struct snd_pcm_substream *substream)
19566 snd_hda_codec_cleanup_stream(codec, 0x07);
19567 snd_hda_codec_cleanup_stream(codec, 0x08);
19568 snd_hda_codec_cleanup_stream(codec, 0x09);
19572 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19573 .substreams = 1, /* can be overridden */
19576 /* NID is set in alc_build_pcms */
19578 .prepare = alc680_capture_pcm_prepare,
19579 .cleanup = alc680_capture_pcm_cleanup
19583 static struct snd_kcontrol_new alc680_base_mixer[] = {
19584 /* output mixer control */
19585 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19586 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19587 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19588 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19589 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19590 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19591 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19595 static struct hda_bind_ctls alc680_bind_cap_vol = {
19596 .ops = &snd_hda_bind_vol,
19598 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19599 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19600 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19605 static struct hda_bind_ctls alc680_bind_cap_switch = {
19606 .ops = &snd_hda_bind_sw,
19608 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19609 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19610 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19615 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19616 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19617 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19622 * generic initialization of ADC, input mixers and output mixers
19624 static struct hda_verb alc680_init_verbs[] = {
19625 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19626 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19627 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19629 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19630 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19631 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19632 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19633 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19634 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19636 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19637 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19638 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19639 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19640 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19642 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19643 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19644 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19649 /* toggle speaker-output according to the hp-jack state */
19650 static void alc680_base_setup(struct hda_codec *codec)
19652 struct alc_spec *spec = codec->spec;
19654 spec->autocfg.hp_pins[0] = 0x16;
19655 spec->autocfg.speaker_pins[0] = 0x14;
19656 spec->autocfg.speaker_pins[1] = 0x15;
19657 spec->autocfg.num_inputs = 2;
19658 spec->autocfg.inputs[0].pin = 0x18;
19659 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19660 spec->autocfg.inputs[1].pin = 0x19;
19661 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19664 static void alc680_unsol_event(struct hda_codec *codec,
19667 if ((res >> 26) == ALC880_HP_EVENT)
19668 alc_automute_amp(codec);
19669 if ((res >> 26) == ALC880_MIC_EVENT)
19670 alc680_rec_autoswitch(codec);
19673 static void alc680_inithook(struct hda_codec *codec)
19675 alc_automute_amp(codec);
19676 alc680_rec_autoswitch(codec);
19679 /* create input playback/capture controls for the given pin */
19680 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19681 const char *ctlname, int idx)
19699 if (spec->multiout.dac_nids[0] != dac &&
19700 spec->multiout.dac_nids[1] != dac) {
19701 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19702 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19707 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19708 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19712 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19718 /* add playback controls from the parsed DAC table */
19719 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19720 const struct auto_pin_cfg *cfg)
19725 spec->multiout.dac_nids = spec->private_dac_nids;
19727 nid = cfg->line_out_pins[0];
19730 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19734 err = alc680_new_analog_output(spec, nid, name, 0);
19739 nid = cfg->speaker_pins[0];
19741 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19745 nid = cfg->hp_pins[0];
19747 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19755 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19756 hda_nid_t nid, int pin_type)
19758 alc_set_pin_output(codec, nid, pin_type);
19761 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19763 struct alc_spec *spec = codec->spec;
19764 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19766 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19767 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19771 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19773 struct alc_spec *spec = codec->spec;
19776 pin = spec->autocfg.hp_pins[0];
19778 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19779 pin = spec->autocfg.speaker_pins[0];
19781 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19784 /* pcm configuration: identical with ALC880 */
19785 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19786 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19787 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19788 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19789 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19792 * BIOS auto configuration
19794 static int alc680_parse_auto_config(struct hda_codec *codec)
19796 struct alc_spec *spec = codec->spec;
19798 static hda_nid_t alc680_ignore[] = { 0 };
19800 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19805 if (!spec->autocfg.line_outs) {
19806 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19807 spec->multiout.max_channels = 2;
19808 spec->no_analog = 1;
19811 return 0; /* can't find valid BIOS pin config */
19813 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19817 spec->multiout.max_channels = 2;
19820 /* digital only support output */
19821 alc_auto_parse_digital(codec);
19822 if (spec->kctls.list)
19823 add_mixer(spec, spec->kctls.list);
19825 add_verb(spec, alc680_init_verbs);
19827 err = alc_auto_add_mic_boost(codec);
19834 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19836 /* init callback for auto-configuration model -- overriding the default init */
19837 static void alc680_auto_init(struct hda_codec *codec)
19839 struct alc_spec *spec = codec->spec;
19840 alc680_auto_init_multi_out(codec);
19841 alc680_auto_init_hp_out(codec);
19842 alc680_auto_init_analog_input(codec);
19843 alc_auto_init_digital(codec);
19844 if (spec->unsol_event)
19845 alc_inithook(codec);
19849 * configuration and preset
19851 static const char *alc680_models[ALC680_MODEL_LAST] = {
19852 [ALC680_BASE] = "base",
19853 [ALC680_AUTO] = "auto",
19856 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19857 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19861 static struct alc_config_preset alc680_presets[] = {
19863 .mixers = { alc680_base_mixer },
19864 .cap_mixer = alc680_master_capture_mixer,
19865 .init_verbs = { alc680_init_verbs },
19866 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19867 .dac_nids = alc680_dac_nids,
19868 .dig_out_nid = ALC680_DIGOUT_NID,
19869 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19870 .channel_mode = alc680_modes,
19871 .unsol_event = alc680_unsol_event,
19872 .setup = alc680_base_setup,
19873 .init_hook = alc680_inithook,
19878 static int patch_alc680(struct hda_codec *codec)
19880 struct alc_spec *spec;
19884 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19888 codec->spec = spec;
19890 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19894 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19895 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19897 board_config = ALC680_AUTO;
19900 if (board_config == ALC680_AUTO) {
19901 /* automatic parse from the BIOS config */
19902 err = alc680_parse_auto_config(codec);
19908 "hda_codec: Cannot set up configuration "
19909 "from BIOS. Using base mode...\n");
19910 board_config = ALC680_BASE;
19914 if (board_config != ALC680_AUTO)
19915 setup_preset(codec, &alc680_presets[board_config]);
19917 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19918 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19919 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19920 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19922 if (!spec->adc_nids) {
19923 spec->adc_nids = alc680_adc_nids;
19924 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19927 if (!spec->cap_mixer)
19928 set_capture_mixer(codec);
19930 spec->vmaster_nid = 0x02;
19932 codec->patch_ops = alc_patch_ops;
19933 if (board_config == ALC680_AUTO)
19934 spec->init_hook = alc680_auto_init;
19942 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19943 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19944 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19945 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19946 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19947 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19948 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19949 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19950 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19951 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19952 .patch = patch_alc861 },
19953 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19954 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19955 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19956 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19957 .patch = patch_alc882 },
19958 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19959 .patch = patch_alc662 },
19960 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19961 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19962 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19963 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19964 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19965 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19966 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19967 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19968 .patch = patch_alc882 },
19969 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19970 .patch = patch_alc882 },
19971 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19972 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 },
19973 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19974 .patch = patch_alc882 },
19975 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19976 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19977 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19978 {} /* terminator */
19981 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19983 MODULE_LICENSE("GPL");
19984 MODULE_DESCRIPTION("Realtek HD-audio codec");
19986 static struct hda_codec_preset_list realtek_list = {
19987 .preset = snd_hda_preset_realtek,
19988 .owner = THIS_MODULE,
19991 static int __init patch_realtek_init(void)
19993 return snd_hda_add_codec_preset(&realtek_list);
19996 static void __exit patch_realtek_exit(void)
19998 snd_hda_delete_codec_preset(&realtek_list);
20001 module_init(patch_realtek_init)
20002 module_exit(patch_realtek_exit)