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;
1617 spec->init_amp = ALC_INIT_DEFAULT;
1621 /* is laptop or Desktop and enable the function "Mute internal speaker
1622 * when the external headphone out jack is plugged"
1624 if (!(ass & 0x8000))
1627 * 10~8 : Jack location
1628 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
1630 * 15 : 1 --> enable the function "Mute internal speaker
1631 * when the external headphone out jack is plugged"
1633 if (!spec->autocfg.hp_pins[0]) {
1635 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1646 for (i = 0; i < spec->autocfg.line_outs; i++)
1647 if (spec->autocfg.line_out_pins[i] == nid)
1649 spec->autocfg.hp_pins[0] = nid;
1652 alc_init_auto_hp(codec);
1653 alc_init_auto_mic(codec);
1657 static void alc_ssid_check(struct hda_codec *codec,
1658 hda_nid_t porta, hda_nid_t porte,
1659 hda_nid_t portd, hda_nid_t porti)
1661 if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {
1662 struct alc_spec *spec = codec->spec;
1663 snd_printd("realtek: "
1664 "Enable default setup for auto mode as fallback\n");
1665 spec->init_amp = ALC_INIT_DEFAULT;
1666 alc_init_auto_hp(codec);
1667 alc_init_auto_mic(codec);
1672 * Fix-up pin default configurations and add default verbs
1682 const struct alc_pincfg *pins;
1683 const struct hda_verb *verbs;
1686 static void alc_pick_fixup(struct hda_codec *codec,
1687 const struct snd_pci_quirk *quirk,
1688 const struct alc_fixup *fix,
1691 const struct alc_pincfg *cfg;
1692 struct alc_spec *spec;
1694 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1697 fix += quirk->value;
1699 if (pre_init && fix->sku) {
1700 #ifdef CONFIG_SND_DEBUG_VERBOSE
1701 snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n",
1702 codec->chip_name, quirk->name);
1705 spec->cdefine.sku_cfg = fix->sku;
1706 spec->cdefine.fixup = 1;
1708 if (pre_init && cfg) {
1709 #ifdef CONFIG_SND_DEBUG_VERBOSE
1710 snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
1711 codec->chip_name, quirk->name);
1713 for (; cfg->nid; cfg++)
1714 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1716 if (!pre_init && fix->verbs) {
1717 #ifdef CONFIG_SND_DEBUG_VERBOSE
1718 snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
1719 codec->chip_name, quirk->name);
1721 add_verb(codec->spec, fix->verbs);
1725 static int alc_read_coef_idx(struct hda_codec *codec,
1726 unsigned int coef_idx)
1729 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1731 val = snd_hda_codec_read(codec, 0x20, 0,
1732 AC_VERB_GET_PROC_COEF, 0);
1736 static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx,
1737 unsigned int coef_val)
1739 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX,
1741 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF,
1745 /* set right pin controls for digital I/O */
1746 static void alc_auto_init_digital(struct hda_codec *codec)
1748 struct alc_spec *spec = codec->spec;
1752 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1753 pin = spec->autocfg.dig_out_pins[i];
1755 snd_hda_codec_write(codec, pin, 0,
1756 AC_VERB_SET_PIN_WIDGET_CONTROL,
1760 pin = spec->autocfg.dig_in_pin;
1762 snd_hda_codec_write(codec, pin, 0,
1763 AC_VERB_SET_PIN_WIDGET_CONTROL,
1767 /* parse digital I/Os and set up NIDs in BIOS auto-parse mode */
1768 static void alc_auto_parse_digital(struct hda_codec *codec)
1770 struct alc_spec *spec = codec->spec;
1774 /* support multiple SPDIFs; the secondary is set up as a slave */
1775 for (i = 0; i < spec->autocfg.dig_outs; i++) {
1776 err = snd_hda_get_connections(codec,
1777 spec->autocfg.dig_out_pins[i],
1782 spec->multiout.dig_out_nid = dig_nid;
1783 spec->dig_out_type = spec->autocfg.dig_out_type[0];
1785 spec->multiout.slave_dig_outs = spec->slave_dig_outs;
1786 if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
1788 spec->slave_dig_outs[i - 1] = dig_nid;
1792 if (spec->autocfg.dig_in_pin) {
1793 dig_nid = codec->start_nid;
1794 for (i = 0; i < codec->num_nodes; i++, dig_nid++) {
1795 unsigned int wcaps = get_wcaps(codec, dig_nid);
1796 if (get_wcaps_type(wcaps) != AC_WID_AUD_IN)
1798 if (!(wcaps & AC_WCAP_DIGITAL))
1800 if (!(wcaps & AC_WCAP_CONN_LIST))
1802 err = get_connection_index(codec, dig_nid,
1803 spec->autocfg.dig_in_pin);
1805 spec->dig_in_nid = dig_nid;
1819 static struct hda_verb alc888_4ST_ch2_intel_init[] = {
1820 /* Mic-in jack as mic in */
1821 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1822 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1823 /* Line-in jack as Line in */
1824 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1825 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1826 /* Line-Out as Front */
1827 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1834 static struct hda_verb alc888_4ST_ch4_intel_init[] = {
1835 /* Mic-in jack as mic in */
1836 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
1837 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
1838 /* Line-in jack as Surround */
1839 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1840 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1841 /* Line-Out as Front */
1842 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
1849 static struct hda_verb alc888_4ST_ch6_intel_init[] = {
1850 /* Mic-in jack as CLFE */
1851 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1852 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1853 /* Line-in jack as Surround */
1854 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1855 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1856 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
1857 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1864 static struct hda_verb alc888_4ST_ch8_intel_init[] = {
1865 /* Mic-in jack as CLFE */
1866 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1867 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1868 /* Line-in jack as Surround */
1869 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1870 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
1871 /* Line-Out as Side */
1872 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1876 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
1877 { 2, alc888_4ST_ch2_intel_init },
1878 { 4, alc888_4ST_ch4_intel_init },
1879 { 6, alc888_4ST_ch6_intel_init },
1880 { 8, alc888_4ST_ch8_intel_init },
1884 * ALC888 Fujitsu Siemens Amillo xa3530
1887 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
1888 /* Front Mic: set to PIN_IN (empty by default) */
1889 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1890 /* Connect Internal HP to Front */
1891 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1892 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1893 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1894 /* Connect Bass HP to Front */
1895 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1896 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1897 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1898 /* Connect Line-Out side jack (SPDIF) to Side */
1899 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1900 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1901 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1902 /* Connect Mic jack to CLFE */
1903 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1904 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1905 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
1906 /* Connect Line-in jack to Surround */
1907 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1908 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1909 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
1910 /* Connect HP out jack to Front */
1911 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1912 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1913 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
1914 /* Enable unsolicited event for HP jack and Line-out jack */
1915 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1916 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1920 static void alc_automute_amp(struct hda_codec *codec)
1922 alc_automute_speaker(codec, 0);
1925 static void alc_automute_amp_unsol_event(struct hda_codec *codec,
1928 if (codec->vendor_id == 0x10ec0880)
1932 if (res == ALC880_HP_EVENT)
1933 alc_automute_amp(codec);
1936 static void alc889_automute_setup(struct hda_codec *codec)
1938 struct alc_spec *spec = codec->spec;
1940 spec->autocfg.hp_pins[0] = 0x15;
1941 spec->autocfg.speaker_pins[0] = 0x14;
1942 spec->autocfg.speaker_pins[1] = 0x16;
1943 spec->autocfg.speaker_pins[2] = 0x17;
1944 spec->autocfg.speaker_pins[3] = 0x19;
1945 spec->autocfg.speaker_pins[4] = 0x1a;
1948 static void alc889_intel_init_hook(struct hda_codec *codec)
1950 alc889_coef_init(codec);
1951 alc_automute_amp(codec);
1954 static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
1956 struct alc_spec *spec = codec->spec;
1958 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
1959 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
1960 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
1961 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
1965 * ALC888 Acer Aspire 4930G model
1968 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
1969 /* Front Mic: set to PIN_IN (empty by default) */
1970 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1971 /* Unselect Front Mic by default in input mixer 3 */
1972 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
1973 /* Enable unsolicited event for HP jack */
1974 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
1975 /* Connect Internal HP to front */
1976 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1977 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1978 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1979 /* Connect HP out to front */
1980 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1981 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1982 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1987 * ALC888 Acer Aspire 6530G model
1990 static struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
1991 /* Route to built-in subwoofer as well as speakers */
1992 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1993 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1994 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1995 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1996 /* Bias voltage on for external mic port */
1997 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
1998 /* Front Mic: set to PIN_IN (empty by default) */
1999 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2000 /* Unselect Front Mic by default in input mixer 3 */
2001 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2002 /* Enable unsolicited event for HP jack */
2003 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2004 /* Enable speaker output */
2005 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2006 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2007 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
2008 /* Enable headphone output */
2009 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2010 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2011 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2012 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
2017 * ALC889 Acer Aspire 8930G model
2020 static struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
2021 /* Front Mic: set to PIN_IN (empty by default) */
2022 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
2023 /* Unselect Front Mic by default in input mixer 3 */
2024 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
2025 /* Enable unsolicited event for HP jack */
2026 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
2027 /* Connect Internal Front to Front */
2028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2029 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2030 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2031 /* Connect Internal Rear to Rear */
2032 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2033 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2034 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
2035 /* Connect Internal CLFE to CLFE */
2036 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2037 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2038 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
2039 /* Connect HP out to Front */
2040 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
2041 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2042 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2043 /* Enable all DACs */
2044 /* DAC DISABLE/MUTE 1? */
2045 /* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
2046 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
2047 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2048 /* DAC DISABLE/MUTE 2? */
2049 /* some bit here disables the other DACs. Init=0x4900 */
2050 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
2051 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
2053 * This laptop has a stereo digital microphone. The mics are only 1cm apart
2054 * which makes the stereo useless. However, either the mic or the ALC889
2055 * makes the signal become a difference/sum signal instead of standard
2056 * stereo, which is annoying. So instead we flip this bit which makes the
2057 * codec replicate the sum signal to both channels, turning it into a
2060 /* DMIC_CONTROL? Init value = 0x0001 */
2061 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2062 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
2066 static struct hda_input_mux alc888_2_capture_sources[2] = {
2067 /* Front mic only available on one ADC */
2074 { "Front Mic", 0xb },
2087 static struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
2088 /* Interal mic only available on one ADC */
2095 { "Input Mix", 0xa },
2105 { "Input Mix", 0xa },
2110 static struct hda_input_mux alc889_capture_sources[3] = {
2111 /* Digital mic only available on first "ADC" */
2118 { "Front Mic", 0xb },
2119 { "Input Mix", 0xa },
2128 { "Input Mix", 0xa },
2137 { "Input Mix", 0xa },
2142 static struct snd_kcontrol_new alc888_base_mixer[] = {
2143 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2144 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2145 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2146 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2147 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2149 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2150 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2151 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2152 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2153 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2154 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2155 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2156 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2157 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2158 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2159 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2160 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2164 static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
2165 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2166 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2167 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2168 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2169 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2171 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2172 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2173 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2174 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2175 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2176 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2177 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
2178 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2183 static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
2185 struct alc_spec *spec = codec->spec;
2187 spec->autocfg.hp_pins[0] = 0x15;
2188 spec->autocfg.speaker_pins[0] = 0x14;
2189 spec->autocfg.speaker_pins[1] = 0x16;
2190 spec->autocfg.speaker_pins[2] = 0x17;
2193 static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
2195 struct alc_spec *spec = codec->spec;
2197 spec->autocfg.hp_pins[0] = 0x15;
2198 spec->autocfg.speaker_pins[0] = 0x14;
2199 spec->autocfg.speaker_pins[1] = 0x16;
2200 spec->autocfg.speaker_pins[2] = 0x17;
2203 static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
2205 struct alc_spec *spec = codec->spec;
2207 spec->autocfg.hp_pins[0] = 0x15;
2208 spec->autocfg.speaker_pins[0] = 0x14;
2209 spec->autocfg.speaker_pins[1] = 0x16;
2210 spec->autocfg.speaker_pins[2] = 0x1b;
2214 * ALC880 3-stack model
2216 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
2217 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18,
2218 * F-Mic = 0x1b, HP = 0x19
2221 static hda_nid_t alc880_dac_nids[4] = {
2222 /* front, rear, clfe, rear_surr */
2223 0x02, 0x05, 0x04, 0x03
2226 static hda_nid_t alc880_adc_nids[3] = {
2231 /* The datasheet says the node 0x07 is connected from inputs,
2232 * but it shows zero connection in the real implementation on some devices.
2233 * Note: this is a 915GAV bug, fixed on 915GLV
2235 static hda_nid_t alc880_adc_nids_alt[2] = {
2240 #define ALC880_DIGOUT_NID 0x06
2241 #define ALC880_DIGIN_NID 0x0a
2243 static struct hda_input_mux alc880_capture_source = {
2247 { "Front Mic", 0x3 },
2253 /* channel source setting (2/6 channel selection for 3-stack) */
2255 static struct hda_verb alc880_threestack_ch2_init[] = {
2256 /* set line-in to input, mute it */
2257 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2258 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2259 /* set mic-in to input vref 80%, mute it */
2260 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2261 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2266 static struct hda_verb alc880_threestack_ch6_init[] = {
2267 /* set line-in to output, unmute it */
2268 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2269 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2270 /* set mic-in to output, unmute it */
2271 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2272 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2276 static struct hda_channel_mode alc880_threestack_modes[2] = {
2277 { 2, alc880_threestack_ch2_init },
2278 { 6, alc880_threestack_ch6_init },
2281 static struct snd_kcontrol_new alc880_three_stack_mixer[] = {
2282 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2283 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2284 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2285 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
2286 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2287 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2288 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2289 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2290 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2291 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2292 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2293 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2294 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2295 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2296 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2297 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2298 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT),
2300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2301 .name = "Channel Mode",
2302 .info = alc_ch_mode_info,
2303 .get = alc_ch_mode_get,
2304 .put = alc_ch_mode_put,
2309 /* capture mixer elements */
2310 static int alc_cap_vol_info(struct snd_kcontrol *kcontrol,
2311 struct snd_ctl_elem_info *uinfo)
2313 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2314 struct alc_spec *spec = codec->spec;
2317 mutex_lock(&codec->control_mutex);
2318 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2320 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo);
2321 mutex_unlock(&codec->control_mutex);
2325 static int alc_cap_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
2326 unsigned int size, unsigned int __user *tlv)
2328 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2329 struct alc_spec *spec = codec->spec;
2332 mutex_lock(&codec->control_mutex);
2333 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0,
2335 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv);
2336 mutex_unlock(&codec->control_mutex);
2340 typedef int (*getput_call_t)(struct snd_kcontrol *kcontrol,
2341 struct snd_ctl_elem_value *ucontrol);
2343 static int alc_cap_getput_caller(struct snd_kcontrol *kcontrol,
2344 struct snd_ctl_elem_value *ucontrol,
2347 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2348 struct alc_spec *spec = codec->spec;
2349 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
2352 mutex_lock(&codec->control_mutex);
2353 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx],
2355 err = func(kcontrol, ucontrol);
2356 mutex_unlock(&codec->control_mutex);
2360 static int alc_cap_vol_get(struct snd_kcontrol *kcontrol,
2361 struct snd_ctl_elem_value *ucontrol)
2363 return alc_cap_getput_caller(kcontrol, ucontrol,
2364 snd_hda_mixer_amp_volume_get);
2367 static int alc_cap_vol_put(struct snd_kcontrol *kcontrol,
2368 struct snd_ctl_elem_value *ucontrol)
2370 return alc_cap_getput_caller(kcontrol, ucontrol,
2371 snd_hda_mixer_amp_volume_put);
2374 /* capture mixer elements */
2375 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
2377 static int alc_cap_sw_get(struct snd_kcontrol *kcontrol,
2378 struct snd_ctl_elem_value *ucontrol)
2380 return alc_cap_getput_caller(kcontrol, ucontrol,
2381 snd_hda_mixer_amp_switch_get);
2384 static int alc_cap_sw_put(struct snd_kcontrol *kcontrol,
2385 struct snd_ctl_elem_value *ucontrol)
2387 return alc_cap_getput_caller(kcontrol, ucontrol,
2388 snd_hda_mixer_amp_switch_put);
2391 #define _DEFINE_CAPMIX(num) \
2393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2394 .name = "Capture Switch", \
2395 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
2397 .info = alc_cap_sw_info, \
2398 .get = alc_cap_sw_get, \
2399 .put = alc_cap_sw_put, \
2402 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2403 .name = "Capture Volume", \
2404 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2405 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
2406 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
2408 .info = alc_cap_vol_info, \
2409 .get = alc_cap_vol_get, \
2410 .put = alc_cap_vol_put, \
2411 .tlv = { .c = alc_cap_vol_tlv }, \
2414 #define _DEFINE_CAPSRC(num) \
2416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2417 /* .name = "Capture Source", */ \
2418 .name = "Input Source", \
2420 .info = alc_mux_enum_info, \
2421 .get = alc_mux_enum_get, \
2422 .put = alc_mux_enum_put, \
2425 #define DEFINE_CAPMIX(num) \
2426 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
2427 _DEFINE_CAPMIX(num), \
2428 _DEFINE_CAPSRC(num), \
2432 #define DEFINE_CAPMIX_NOSRC(num) \
2433 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
2434 _DEFINE_CAPMIX(num), \
2438 /* up to three ADCs */
2442 DEFINE_CAPMIX_NOSRC(1);
2443 DEFINE_CAPMIX_NOSRC(2);
2444 DEFINE_CAPMIX_NOSRC(3);
2447 * ALC880 5-stack model
2449 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d),
2451 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16
2452 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19
2455 /* additional mixers to alc880_three_stack_mixer */
2456 static struct snd_kcontrol_new alc880_five_stack_mixer[] = {
2457 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2458 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT),
2462 /* channel source setting (6/8 channel selection for 5-stack) */
2464 static struct hda_verb alc880_fivestack_ch6_init[] = {
2465 /* set line-in to input, mute it */
2466 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2467 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2472 static struct hda_verb alc880_fivestack_ch8_init[] = {
2473 /* set line-in to output, unmute it */
2474 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2475 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2479 static struct hda_channel_mode alc880_fivestack_modes[2] = {
2480 { 6, alc880_fivestack_ch6_init },
2481 { 8, alc880_fivestack_ch8_init },
2486 * ALC880 6-stack model
2488 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e),
2489 * Side = 0x05 (0x0f)
2490 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17,
2491 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b
2494 static hda_nid_t alc880_6st_dac_nids[4] = {
2495 /* front, rear, clfe, rear_surr */
2496 0x02, 0x03, 0x04, 0x05
2499 static struct hda_input_mux alc880_6stack_capture_source = {
2503 { "Front Mic", 0x1 },
2509 /* fixed 8-channels */
2510 static struct hda_channel_mode alc880_sixstack_modes[1] = {
2514 static struct snd_kcontrol_new alc880_six_stack_mixer[] = {
2515 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2516 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2517 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2518 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2519 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2520 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2521 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2522 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2523 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2524 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2525 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2526 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2527 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2528 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2529 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2530 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2531 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2532 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2534 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2535 .name = "Channel Mode",
2536 .info = alc_ch_mode_info,
2537 .get = alc_ch_mode_get,
2538 .put = alc_ch_mode_put,
2547 * W810 has rear IO for:
2550 * Center/LFE (DAC 04)
2553 * The system also has a pair of internal speakers, and a headphone jack.
2554 * These are both connected to Line2 on the codec, hence to DAC 02.
2556 * There is a variable resistor to control the speaker or headphone
2557 * volume. This is a hardware-only device without a software API.
2559 * Plugging headphones in will disable the internal speakers. This is
2560 * implemented in hardware, not via the driver using jack sense. In
2561 * a similar fashion, plugging into the rear socket marked "front" will
2562 * disable both the speakers and headphones.
2564 * For input, there's a microphone jack, and an "audio in" jack.
2565 * These may not do anything useful with this driver yet, because I
2566 * haven't setup any initialization verbs for these yet...
2569 static hda_nid_t alc880_w810_dac_nids[3] = {
2570 /* front, rear/surround, clfe */
2574 /* fixed 6 channels */
2575 static struct hda_channel_mode alc880_w810_modes[1] = {
2579 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */
2580 static struct snd_kcontrol_new alc880_w810_base_mixer[] = {
2581 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2582 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2583 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2584 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2585 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2586 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2587 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2588 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2589 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2597 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d)
2598 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?),
2602 static hda_nid_t alc880_z71v_dac_nids[1] = {
2605 #define ALC880_Z71V_HP_DAC 0x03
2607 /* fixed 2 channels */
2608 static struct hda_channel_mode alc880_2_jack_modes[1] = {
2612 static struct snd_kcontrol_new alc880_z71v_mixer[] = {
2613 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2614 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2615 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2616 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
2617 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2618 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2619 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2620 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2626 * ALC880 F1734 model
2628 * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d)
2629 * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18
2632 static hda_nid_t alc880_f1734_dac_nids[1] = {
2635 #define ALC880_F1734_HP_DAC 0x02
2637 static struct snd_kcontrol_new alc880_f1734_mixer[] = {
2638 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2639 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2640 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2641 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2642 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2643 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2644 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2645 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2649 static struct hda_input_mux alc880_f1734_capture_source = {
2661 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2662 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2663 * Mic = 0x18, Line = 0x1a
2666 #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */
2667 #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */
2669 static struct snd_kcontrol_new alc880_asus_mixer[] = {
2670 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2671 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2672 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2673 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2674 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2675 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2676 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2677 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2678 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2679 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2680 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2681 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2682 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2683 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2685 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2686 .name = "Channel Mode",
2687 .info = alc_ch_mode_info,
2688 .get = alc_ch_mode_get,
2689 .put = alc_ch_mode_put,
2695 * ALC880 ASUS W1V model
2697 * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e)
2698 * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16,
2699 * Mic = 0x18, Line = 0x1a, Line2 = 0x1b
2702 /* additional mixers to alc880_asus_mixer */
2703 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = {
2704 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT),
2705 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT),
2710 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = {
2711 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2712 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2713 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2714 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT),
2715 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT),
2716 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT),
2717 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT),
2718 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
2719 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
2724 static struct snd_kcontrol_new alc880_uniwill_mixer[] = {
2725 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2726 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2727 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2728 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2729 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2730 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2731 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2732 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2733 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2734 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2735 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2736 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2738 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2739 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2740 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2742 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2743 .name = "Channel Mode",
2744 .info = alc_ch_mode_info,
2745 .get = alc_ch_mode_get,
2746 .put = alc_ch_mode_put,
2751 static struct snd_kcontrol_new alc880_fujitsu_mixer[] = {
2752 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2753 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2754 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2755 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2756 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2757 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2758 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2759 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2760 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2761 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2765 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = {
2766 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2767 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
2768 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2769 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2770 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2771 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2776 * virtual master controls
2780 * slave controls for virtual master
2782 static const char *alc_slave_vols[] = {
2783 "Front Playback Volume",
2784 "Surround Playback Volume",
2785 "Center Playback Volume",
2786 "LFE Playback Volume",
2787 "Side Playback Volume",
2788 "Headphone Playback Volume",
2789 "Speaker Playback Volume",
2790 "Mono Playback Volume",
2791 "Line-Out Playback Volume",
2792 "PCM Playback Volume",
2796 static const char *alc_slave_sws[] = {
2797 "Front Playback Switch",
2798 "Surround Playback Switch",
2799 "Center Playback Switch",
2800 "LFE Playback Switch",
2801 "Side Playback Switch",
2802 "Headphone Playback Switch",
2803 "Speaker Playback Switch",
2804 "Mono Playback Switch",
2805 "IEC958 Playback Switch",
2806 "Line-Out Playback Switch",
2807 "PCM Playback Switch",
2812 * build control elements
2815 #define NID_MAPPING (-1)
2817 #define SUBDEV_SPEAKER_ (0 << 6)
2818 #define SUBDEV_HP_ (1 << 6)
2819 #define SUBDEV_LINE_ (2 << 6)
2820 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
2821 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
2822 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
2824 static void alc_free_kctls(struct hda_codec *codec);
2826 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2827 /* additional beep mixers; the actual parameters are overwritten at build */
2828 static struct snd_kcontrol_new alc_beep_mixer[] = {
2829 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
2830 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
2835 static int alc_build_controls(struct hda_codec *codec)
2837 struct alc_spec *spec = codec->spec;
2838 struct snd_kcontrol *kctl = NULL;
2839 struct snd_kcontrol_new *knew;
2844 for (i = 0; i < spec->num_mixers; i++) {
2845 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
2849 if (spec->cap_mixer) {
2850 err = snd_hda_add_new_ctls(codec, spec->cap_mixer);
2854 if (spec->multiout.dig_out_nid) {
2855 err = snd_hda_create_spdif_out_ctls(codec,
2856 spec->multiout.dig_out_nid);
2859 if (!spec->no_analog) {
2860 err = snd_hda_create_spdif_share_sw(codec,
2864 spec->multiout.share_spdif = 1;
2867 if (spec->dig_in_nid) {
2868 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid);
2873 #ifdef CONFIG_SND_HDA_INPUT_BEEP
2874 /* create beep controls if needed */
2875 if (spec->beep_amp) {
2876 struct snd_kcontrol_new *knew;
2877 for (knew = alc_beep_mixer; knew->name; knew++) {
2878 struct snd_kcontrol *kctl;
2879 kctl = snd_ctl_new1(knew, codec);
2882 kctl->private_value = spec->beep_amp;
2883 err = snd_hda_ctl_add(codec, 0, kctl);
2890 /* if we have no master control, let's create it */
2891 if (!spec->no_analog &&
2892 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) {
2893 unsigned int vmaster_tlv[4];
2894 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid,
2895 HDA_OUTPUT, vmaster_tlv);
2896 err = snd_hda_add_vmaster(codec, "Master Playback Volume",
2897 vmaster_tlv, alc_slave_vols);
2901 if (!spec->no_analog &&
2902 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) {
2903 err = snd_hda_add_vmaster(codec, "Master Playback Switch",
2904 NULL, alc_slave_sws);
2909 /* assign Capture Source enums to NID */
2910 if (spec->capsrc_nids || spec->adc_nids) {
2911 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2913 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2914 for (i = 0; kctl && i < kctl->count; i++) {
2915 hda_nid_t *nids = spec->capsrc_nids;
2917 nids = spec->adc_nids;
2918 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2923 if (spec->cap_mixer) {
2924 const char *kname = kctl ? kctl->id.name : NULL;
2925 for (knew = spec->cap_mixer; knew->name; knew++) {
2926 if (kname && strcmp(knew->name, kname) == 0)
2928 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2929 for (i = 0; kctl && i < kctl->count; i++) {
2930 err = snd_hda_add_nid(codec, kctl, i,
2938 /* other nid->control mapping */
2939 for (i = 0; i < spec->num_mixers; i++) {
2940 for (knew = spec->mixers[i]; knew->name; knew++) {
2941 if (knew->iface != NID_MAPPING)
2943 kctl = snd_hda_find_mixer_ctl(codec, knew->name);
2946 u = knew->subdevice;
2947 for (j = 0; j < 4; j++, u >>= 8) {
2952 case SUBDEV_SPEAKER_:
2953 nid = spec->autocfg.speaker_pins[nid];
2956 nid = spec->autocfg.line_out_pins[nid];
2959 nid = spec->autocfg.hp_pins[nid];
2964 err = snd_hda_add_nid(codec, kctl, 0, nid);
2968 u = knew->private_value;
2969 for (j = 0; j < 4; j++, u >>= 8) {
2973 err = snd_hda_add_nid(codec, kctl, 0, nid);
2980 alc_free_kctls(codec); /* no longer needed */
2987 * initialize the codec volumes, etc
2991 * generic initialization of ADC, input mixers and output mixers
2993 static struct hda_verb alc880_volume_init_verbs[] = {
2995 * Unmute ADC0-2 and set the default input to mic-in
2997 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
2998 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2999 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
3000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3001 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
3002 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3004 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
3006 * Note: PASD motherboards uses the Line In 2 as the input for front
3009 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
3010 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3011 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3012 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
3013 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
3014 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
3015 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3016 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3019 * Set up output mixers (0x0c - 0x0f)
3021 /* set vol=0 to output mixers */
3022 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3023 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3024 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3025 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3026 /* set up input amps for analog loopback */
3027 /* Amp Indices: DAC = 0, mixer = 1 */
3028 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3029 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3030 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3031 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3032 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3033 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3034 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
3035 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3041 * 3-stack pin configuration:
3042 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
3044 static struct hda_verb alc880_pin_3stack_init_verbs[] = {
3046 * preset connection lists of input pins
3047 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3049 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3050 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3051 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3054 * Set pin mode and muting
3056 /* set front pin widgets 0x14 for output */
3057 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3058 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3059 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3060 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3061 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3062 /* Mic2 (as headphone out) for HP output */
3063 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3064 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3065 /* Line In pin widget for input */
3066 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3067 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3068 /* Line2 (as front mic) pin widget for input and vref at 80% */
3069 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3070 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3071 /* CD pin widget for input */
3072 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3078 * 5-stack pin configuration:
3079 * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19,
3080 * line-in/side = 0x1a, f-mic = 0x1b
3082 static struct hda_verb alc880_pin_5stack_init_verbs[] = {
3084 * preset connection lists of input pins
3085 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround
3087 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3088 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */
3091 * Set pin mode and muting
3093 /* set pin widgets 0x14-0x17 for output */
3094 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3095 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3096 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3097 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3098 /* unmute pins for output (no gain on this amp) */
3099 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3100 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3101 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3102 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3104 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3105 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3106 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3107 /* Mic2 (as headphone out) for HP output */
3108 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3109 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3110 /* Line In pin widget for input */
3111 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3112 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3113 /* Line2 (as front mic) pin widget for input and vref at 80% */
3114 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3115 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3116 /* CD pin widget for input */
3117 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3123 * W810 pin configuration:
3124 * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b
3126 static struct hda_verb alc880_pin_w810_init_verbs[] = {
3127 /* hphone/speaker input selector: front DAC */
3128 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0},
3130 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3131 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3132 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3133 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3134 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3135 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3137 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3138 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3144 * Z71V pin configuration:
3145 * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?)
3147 static struct hda_verb alc880_pin_z71v_init_verbs[] = {
3148 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3149 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3150 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3151 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3153 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3154 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3155 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3156 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3162 * 6-stack pin configuration:
3163 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18,
3164 * f-mic = 0x19, line = 0x1a, HP = 0x1b
3166 static struct hda_verb alc880_pin_6stack_init_verbs[] = {
3167 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3169 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3170 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3172 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3173 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3174 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3175 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3176 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3178 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3179 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3180 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3181 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3184 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3185 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3186 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3192 * Uniwill pin configuration:
3193 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19,
3196 static struct hda_verb alc880_uniwill_init_verbs[] = {
3197 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3199 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3200 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3201 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3202 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3203 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3204 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3205 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3206 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3207 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3208 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3209 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3210 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3214 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3215 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3216 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3217 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3218 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3219 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3220 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */
3221 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
3222 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3224 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3225 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
3232 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,
3234 static struct hda_verb alc880_uniwill_p53_init_verbs[] = {
3235 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3237 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3238 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3239 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3240 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3241 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3242 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3243 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3244 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3245 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3246 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3247 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
3248 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
3250 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3251 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3252 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3253 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3254 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3255 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3257 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3258 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},
3263 static struct hda_verb alc880_beep_init_verbs[] = {
3264 { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },
3268 /* auto-toggle front mic */
3269 static void alc880_uniwill_mic_automute(struct hda_codec *codec)
3271 unsigned int present;
3274 present = snd_hda_jack_detect(codec, 0x18);
3275 bits = present ? HDA_AMP_MUTE : 0;
3276 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
3279 static void alc880_uniwill_setup(struct hda_codec *codec)
3281 struct alc_spec *spec = codec->spec;
3283 spec->autocfg.hp_pins[0] = 0x14;
3284 spec->autocfg.speaker_pins[0] = 0x15;
3285 spec->autocfg.speaker_pins[0] = 0x16;
3288 static void alc880_uniwill_init_hook(struct hda_codec *codec)
3290 alc_automute_amp(codec);
3291 alc880_uniwill_mic_automute(codec);
3294 static void alc880_uniwill_unsol_event(struct hda_codec *codec,
3297 /* Looks like the unsol event is incompatible with the standard
3298 * definition. 4bit tag is placed at 28 bit!
3300 switch (res >> 28) {
3301 case ALC880_MIC_EVENT:
3302 alc880_uniwill_mic_automute(codec);
3305 alc_automute_amp_unsol_event(codec, res);
3310 static void alc880_uniwill_p53_setup(struct hda_codec *codec)
3312 struct alc_spec *spec = codec->spec;
3314 spec->autocfg.hp_pins[0] = 0x14;
3315 spec->autocfg.speaker_pins[0] = 0x15;
3318 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
3320 unsigned int present;
3322 present = snd_hda_codec_read(codec, 0x21, 0,
3323 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
3324 present &= HDA_AMP_VOLMASK;
3325 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
3326 HDA_AMP_VOLMASK, present);
3327 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
3328 HDA_AMP_VOLMASK, present);
3331 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
3334 /* Looks like the unsol event is incompatible with the standard
3335 * definition. 4bit tag is placed at 28 bit!
3337 if ((res >> 28) == ALC880_DCVOL_EVENT)
3338 alc880_uniwill_p53_dcvol_automute(codec);
3340 alc_automute_amp_unsol_event(codec, res);
3344 * F1734 pin configuration:
3345 * HP = 0x14, speaker-out = 0x15, mic = 0x18
3347 static struct hda_verb alc880_pin_f1734_init_verbs[] = {
3348 {0x07, AC_VERB_SET_CONNECT_SEL, 0x01},
3349 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3350 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3351 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3352 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3354 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3355 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3356 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3357 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3359 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3360 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3361 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
3362 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3363 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3364 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3365 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3366 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3367 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3369 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
3370 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT},
3376 * ASUS pin configuration:
3377 * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a
3379 static struct hda_verb alc880_pin_asus_init_verbs[] = {
3380 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02},
3381 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00},
3382 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01},
3383 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00},
3385 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3386 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3389 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3390 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3391 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3392 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3394 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3395 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3396 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3397 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3398 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3399 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3401 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3402 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3407 /* Enable GPIO mask and set output */
3408 #define alc880_gpio1_init_verbs alc_gpio1_init_verbs
3409 #define alc880_gpio2_init_verbs alc_gpio2_init_verbs
3410 #define alc880_gpio3_init_verbs alc_gpio3_init_verbs
3412 /* Clevo m520g init */
3413 static struct hda_verb alc880_pin_clevo_init_verbs[] = {
3414 /* headphone output */
3415 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3417 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3418 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3420 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3421 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3423 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3424 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3425 /* Mic1 (rear panel) */
3426 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3427 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3428 /* Mic2 (front panel) */
3429 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3430 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3432 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3433 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3434 /* change to EAPD mode */
3435 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3436 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3441 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {
3442 /* change to EAPD mode */
3443 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3444 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3446 /* Headphone output */
3447 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3449 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3450 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
3452 /* Line In pin widget for input */
3453 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3454 /* CD pin widget for input */
3455 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3456 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3457 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3459 /* change to EAPD mode */
3460 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3461 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
3467 * LG m1 express dual
3470 * Rear Line-In/Out (blue): 0x14
3471 * Build-in Mic-In: 0x15
3473 * HP-Out (green): 0x1b
3474 * Mic-In/Out (red): 0x19
3478 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */
3479 static hda_nid_t alc880_lg_dac_nids[3] = {
3483 /* seems analog CD is not working */
3484 static struct hda_input_mux alc880_lg_capture_source = {
3489 { "Internal Mic", 0x6 },
3493 /* 2,4,6 channel modes */
3494 static struct hda_verb alc880_lg_ch2_init[] = {
3495 /* set line-in and mic-in to input */
3496 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3497 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3501 static struct hda_verb alc880_lg_ch4_init[] = {
3502 /* set line-in to out and mic-in to input */
3503 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3504 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3508 static struct hda_verb alc880_lg_ch6_init[] = {
3509 /* set line-in and mic-in to output */
3510 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3511 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3515 static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3516 { 2, alc880_lg_ch2_init },
3517 { 4, alc880_lg_ch4_init },
3518 { 6, alc880_lg_ch6_init },
3521 static struct snd_kcontrol_new alc880_lg_mixer[] = {
3522 HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3523 HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3524 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3525 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),
3526 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),
3527 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
3528 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
3529 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
3530 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3531 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
3532 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),
3533 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),
3534 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),
3535 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),
3537 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3538 .name = "Channel Mode",
3539 .info = alc_ch_mode_info,
3540 .get = alc_ch_mode_get,
3541 .put = alc_ch_mode_put,
3546 static struct hda_verb alc880_lg_init_verbs[] = {
3547 /* set capture source to mic-in */
3548 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3549 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3550 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
3551 /* mute all amp mixer inputs */
3552 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},
3553 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
3554 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3555 /* line-in to input */
3556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
3557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3559 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3560 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3562 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3563 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3564 /* mic-in to input */
3565 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01},
3566 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3567 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3569 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03},
3570 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3571 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3573 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3577 /* toggle speaker-output according to the hp-jack state */
3578 static void alc880_lg_setup(struct hda_codec *codec)
3580 struct alc_spec *spec = codec->spec;
3582 spec->autocfg.hp_pins[0] = 0x1b;
3583 spec->autocfg.speaker_pins[0] = 0x17;
3592 * Built-in Mic-In: 0x19
3598 static struct hda_input_mux alc880_lg_lw_capture_source = {
3602 { "Internal Mic", 0x1 },
3607 #define alc880_lg_lw_modes alc880_threestack_modes
3609 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
3610 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3611 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
3612 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3613 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
3614 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
3615 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
3616 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
3617 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
3618 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
3619 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
3620 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3621 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3622 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
3623 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
3625 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3626 .name = "Channel Mode",
3627 .info = alc_ch_mode_info,
3628 .get = alc_ch_mode_get,
3629 .put = alc_ch_mode_put,
3634 static struct hda_verb alc880_lg_lw_init_verbs[] = {
3635 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3636 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
3637 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
3639 /* set capture source to mic-in */
3640 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3641 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3642 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
3643 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
3645 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3646 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3648 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3649 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3650 /* mic-in to input */
3651 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3652 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3654 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3655 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3657 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
3661 /* toggle speaker-output according to the hp-jack state */
3662 static void alc880_lg_lw_setup(struct hda_codec *codec)
3664 struct alc_spec *spec = codec->spec;
3666 spec->autocfg.hp_pins[0] = 0x1b;
3667 spec->autocfg.speaker_pins[0] = 0x14;
3670 static struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
3671 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
3672 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
3673 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
3674 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
3675 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
3676 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
3680 static struct hda_input_mux alc880_medion_rim_capture_source = {
3684 { "Internal Mic", 0x1 },
3688 static struct hda_verb alc880_medion_rim_init_verbs[] = {
3689 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
3691 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3692 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3694 /* Mic1 (rear panel) pin widget for input and vref at 80% */
3695 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3697 /* Mic2 (as headphone out) for HP output */
3698 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
3699 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3700 /* Internal Speaker */
3701 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
3702 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
3704 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
3705 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
3707 {0x14, 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_medion_rim_automute(struct hda_codec *codec)
3714 struct alc_spec *spec = codec->spec;
3715 alc_automute_amp(codec);
3717 if (spec->jack_present)
3718 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
3720 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
3723 static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
3726 /* Looks like the unsol event is incompatible with the standard
3727 * definition. 4bit tag is placed at 28 bit!
3729 if ((res >> 28) == ALC880_HP_EVENT)
3730 alc880_medion_rim_automute(codec);
3733 static void alc880_medion_rim_setup(struct hda_codec *codec)
3735 struct alc_spec *spec = codec->spec;
3737 spec->autocfg.hp_pins[0] = 0x14;
3738 spec->autocfg.speaker_pins[0] = 0x1b;
3741 #ifdef CONFIG_SND_HDA_POWER_SAVE
3742 static struct hda_amp_list alc880_loopbacks[] = {
3743 { 0x0b, HDA_INPUT, 0 },
3744 { 0x0b, HDA_INPUT, 1 },
3745 { 0x0b, HDA_INPUT, 2 },
3746 { 0x0b, HDA_INPUT, 3 },
3747 { 0x0b, HDA_INPUT, 4 },
3751 static struct hda_amp_list alc880_lg_loopbacks[] = {
3752 { 0x0b, HDA_INPUT, 1 },
3753 { 0x0b, HDA_INPUT, 6 },
3754 { 0x0b, HDA_INPUT, 7 },
3763 static int alc_init(struct hda_codec *codec)
3765 struct alc_spec *spec = codec->spec;
3769 alc_auto_init_amp(codec, spec->init_amp);
3771 for (i = 0; i < spec->num_init_verbs; i++)
3772 snd_hda_sequence_write(codec, spec->init_verbs[i]);
3774 if (spec->init_hook)
3775 spec->init_hook(codec);
3777 hda_call_check_power_status(codec, 0x01);
3781 static void alc_unsol_event(struct hda_codec *codec, unsigned int res)
3783 struct alc_spec *spec = codec->spec;
3785 if (spec->unsol_event)
3786 spec->unsol_event(codec, res);
3789 #ifdef CONFIG_SND_HDA_POWER_SAVE
3790 static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid)
3792 struct alc_spec *spec = codec->spec;
3793 return snd_hda_check_amp_list_power(codec, &spec->loopback, nid);
3798 * Analog playback callbacks
3800 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,
3801 struct hda_codec *codec,
3802 struct snd_pcm_substream *substream)
3804 struct alc_spec *spec = codec->spec;
3805 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
3809 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3810 struct hda_codec *codec,
3811 unsigned int stream_tag,
3812 unsigned int format,
3813 struct snd_pcm_substream *substream)
3815 struct alc_spec *spec = codec->spec;
3816 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
3817 stream_tag, format, substream);
3820 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
3821 struct hda_codec *codec,
3822 struct snd_pcm_substream *substream)
3824 struct alc_spec *spec = codec->spec;
3825 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
3831 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,
3832 struct hda_codec *codec,
3833 struct snd_pcm_substream *substream)
3835 struct alc_spec *spec = codec->spec;
3836 return snd_hda_multi_out_dig_open(codec, &spec->multiout);
3839 static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
3840 struct hda_codec *codec,
3841 unsigned int stream_tag,
3842 unsigned int format,
3843 struct snd_pcm_substream *substream)
3845 struct alc_spec *spec = codec->spec;
3846 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout,
3847 stream_tag, format, substream);
3850 static int alc880_dig_playback_pcm_cleanup(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_dig_cleanup(codec, &spec->multiout);
3858 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,
3859 struct hda_codec *codec,
3860 struct snd_pcm_substream *substream)
3862 struct alc_spec *spec = codec->spec;
3863 return snd_hda_multi_out_dig_close(codec, &spec->multiout);
3869 static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3870 struct hda_codec *codec,
3871 unsigned int stream_tag,
3872 unsigned int format,
3873 struct snd_pcm_substream *substream)
3875 struct alc_spec *spec = codec->spec;
3877 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1],
3878 stream_tag, 0, format);
3882 static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3883 struct hda_codec *codec,
3884 struct snd_pcm_substream *substream)
3886 struct alc_spec *spec = codec->spec;
3888 snd_hda_codec_cleanup_stream(codec,
3889 spec->adc_nids[substream->number + 1]);
3893 /* analog capture with dynamic dual-adc changes */
3894 static int dualmic_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
3895 struct hda_codec *codec,
3896 unsigned int stream_tag,
3897 unsigned int format,
3898 struct snd_pcm_substream *substream)
3900 struct alc_spec *spec = codec->spec;
3901 spec->cur_adc = spec->adc_nids[spec->cur_adc_idx];
3902 spec->cur_adc_stream_tag = stream_tag;
3903 spec->cur_adc_format = format;
3904 snd_hda_codec_setup_stream(codec, spec->cur_adc, stream_tag, 0, format);
3908 static int dualmic_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
3909 struct hda_codec *codec,
3910 struct snd_pcm_substream *substream)
3912 struct alc_spec *spec = codec->spec;
3913 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
3918 static struct hda_pcm_stream dualmic_pcm_analog_capture = {
3922 .nid = 0, /* fill later */
3924 .prepare = dualmic_capture_pcm_prepare,
3925 .cleanup = dualmic_capture_pcm_cleanup
3931 static struct hda_pcm_stream alc880_pcm_analog_playback = {
3935 /* NID is set in alc_build_pcms */
3937 .open = alc880_playback_pcm_open,
3938 .prepare = alc880_playback_pcm_prepare,
3939 .cleanup = alc880_playback_pcm_cleanup
3943 static struct hda_pcm_stream alc880_pcm_analog_capture = {
3947 /* NID is set in alc_build_pcms */
3950 static struct hda_pcm_stream alc880_pcm_analog_alt_playback = {
3954 /* NID is set in alc_build_pcms */
3957 static struct hda_pcm_stream alc880_pcm_analog_alt_capture = {
3958 .substreams = 2, /* can be overridden */
3961 /* NID is set in alc_build_pcms */
3963 .prepare = alc880_alt_capture_pcm_prepare,
3964 .cleanup = alc880_alt_capture_pcm_cleanup
3968 static struct hda_pcm_stream alc880_pcm_digital_playback = {
3972 /* NID is set in alc_build_pcms */
3974 .open = alc880_dig_playback_pcm_open,
3975 .close = alc880_dig_playback_pcm_close,
3976 .prepare = alc880_dig_playback_pcm_prepare,
3977 .cleanup = alc880_dig_playback_pcm_cleanup
3981 static struct hda_pcm_stream alc880_pcm_digital_capture = {
3985 /* NID is set in alc_build_pcms */
3988 /* Used by alc_build_pcms to flag that a PCM has no playback stream */
3989 static struct hda_pcm_stream alc_pcm_null_stream = {
3995 static int alc_build_pcms(struct hda_codec *codec)
3997 struct alc_spec *spec = codec->spec;
3998 struct hda_pcm *info = spec->pcm_rec;
4001 codec->num_pcms = 1;
4002 codec->pcm_info = info;
4004 if (spec->no_analog)
4007 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog),
4008 "%s Analog", codec->chip_name);
4009 info->name = spec->stream_name_analog;
4011 if (spec->stream_analog_playback) {
4012 if (snd_BUG_ON(!spec->multiout.dac_nids))
4014 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);
4015 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
4017 if (spec->stream_analog_capture) {
4018 if (snd_BUG_ON(!spec->adc_nids))
4020 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);
4021 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
4024 if (spec->channel_mode) {
4025 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0;
4026 for (i = 0; i < spec->num_channel_mode; i++) {
4027 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) {
4028 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels;
4034 /* SPDIF for stream index #1 */
4035 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
4036 snprintf(spec->stream_name_digital,
4037 sizeof(spec->stream_name_digital),
4038 "%s Digital", codec->chip_name);
4039 codec->num_pcms = 2;
4040 codec->slave_dig_outs = spec->multiout.slave_dig_outs;
4041 info = spec->pcm_rec + 1;
4042 info->name = spec->stream_name_digital;
4043 if (spec->dig_out_type)
4044 info->pcm_type = spec->dig_out_type;
4046 info->pcm_type = HDA_PCM_TYPE_SPDIF;
4047 if (spec->multiout.dig_out_nid &&
4048 spec->stream_digital_playback) {
4049 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback);
4050 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
4052 if (spec->dig_in_nid &&
4053 spec->stream_digital_capture) {
4054 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture);
4055 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid;
4057 /* FIXME: do we need this for all Realtek codec models? */
4058 codec->spdif_status_reset = 1;
4061 if (spec->no_analog)
4064 /* If the use of more than one ADC is requested for the current
4065 * model, configure a second analog capture-only PCM.
4067 /* Additional Analaog capture for index #2 */
4068 if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) ||
4069 (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) {
4070 codec->num_pcms = 3;
4071 info = spec->pcm_rec + 2;
4072 info->name = spec->stream_name_analog;
4073 if (spec->alt_dac_nid) {
4074 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4075 *spec->stream_analog_alt_playback;
4076 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
4079 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
4080 alc_pcm_null_stream;
4081 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0;
4083 if (spec->num_adc_nids > 1) {
4084 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4085 *spec->stream_analog_alt_capture;
4086 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
4088 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
4089 spec->num_adc_nids - 1;
4091 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
4092 alc_pcm_null_stream;
4093 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0;
4100 static inline void alc_shutup(struct hda_codec *codec)
4102 snd_hda_shutup_pins(codec);
4105 static void alc_free_kctls(struct hda_codec *codec)
4107 struct alc_spec *spec = codec->spec;
4109 if (spec->kctls.list) {
4110 struct snd_kcontrol_new *kctl = spec->kctls.list;
4112 for (i = 0; i < spec->kctls.used; i++)
4113 kfree(kctl[i].name);
4115 snd_array_free(&spec->kctls);
4118 static void alc_free(struct hda_codec *codec)
4120 struct alc_spec *spec = codec->spec;
4126 alc_free_kctls(codec);
4128 snd_hda_detach_beep_device(codec);
4131 #ifdef CONFIG_SND_HDA_POWER_SAVE
4132 static void alc_power_eapd(struct hda_codec *codec)
4134 /* We currently only handle front, HP */
4135 switch (codec->vendor_id) {
4137 set_eapd(codec, 0x0f, 0);
4138 set_eapd(codec, 0x10, 0);
4151 set_eapd(codec, 0x14, 0);
4152 set_eapd(codec, 0x15, 0);
4157 static int alc_suspend(struct hda_codec *codec, pm_message_t state)
4159 struct alc_spec *spec = codec->spec;
4161 if (spec && spec->power_hook)
4162 spec->power_hook(codec);
4167 #ifdef SND_HDA_NEEDS_RESUME
4168 static int alc_resume(struct hda_codec *codec)
4170 codec->patch_ops.init(codec);
4171 snd_hda_codec_resume_amp(codec);
4172 snd_hda_codec_resume_cache(codec);
4173 hda_call_check_power_status(codec, 0x01);
4180 static struct hda_codec_ops alc_patch_ops = {
4181 .build_controls = alc_build_controls,
4182 .build_pcms = alc_build_pcms,
4185 .unsol_event = alc_unsol_event,
4186 #ifdef SND_HDA_NEEDS_RESUME
4187 .resume = alc_resume,
4189 #ifdef CONFIG_SND_HDA_POWER_SAVE
4190 .suspend = alc_suspend,
4191 .check_power_status = alc_check_power_status,
4193 .reboot_notify = alc_shutup,
4196 /* replace the codec chip_name with the given string */
4197 static int alc_codec_rename(struct hda_codec *codec, const char *name)
4199 kfree(codec->chip_name);
4200 codec->chip_name = kstrdup(name, GFP_KERNEL);
4201 if (!codec->chip_name) {
4209 * Test configuration for debugging
4211 * Almost all inputs/outputs are enabled. I/O pins can be configured via
4214 #ifdef CONFIG_SND_DEBUG
4215 static hda_nid_t alc880_test_dac_nids[4] = {
4216 0x02, 0x03, 0x04, 0x05
4219 static struct hda_input_mux alc880_test_capture_source = {
4228 { "Surround", 0x6 },
4232 static struct hda_channel_mode alc880_test_modes[4] = {
4239 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol,
4240 struct snd_ctl_elem_info *uinfo)
4242 static char *texts[] = {
4243 "N/A", "Line Out", "HP Out",
4244 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%"
4246 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4248 uinfo->value.enumerated.items = 8;
4249 if (uinfo->value.enumerated.item >= 8)
4250 uinfo->value.enumerated.item = 7;
4251 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4255 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol,
4256 struct snd_ctl_elem_value *ucontrol)
4258 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4259 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4260 unsigned int pin_ctl, item = 0;
4262 pin_ctl = snd_hda_codec_read(codec, nid, 0,
4263 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4264 if (pin_ctl & AC_PINCTL_OUT_EN) {
4265 if (pin_ctl & AC_PINCTL_HP_EN)
4269 } else if (pin_ctl & AC_PINCTL_IN_EN) {
4270 switch (pin_ctl & AC_PINCTL_VREFEN) {
4271 case AC_PINCTL_VREF_HIZ: item = 3; break;
4272 case AC_PINCTL_VREF_50: item = 4; break;
4273 case AC_PINCTL_VREF_GRD: item = 5; break;
4274 case AC_PINCTL_VREF_80: item = 6; break;
4275 case AC_PINCTL_VREF_100: item = 7; break;
4278 ucontrol->value.enumerated.item[0] = item;
4282 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
4283 struct snd_ctl_elem_value *ucontrol)
4285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4286 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4287 static unsigned int ctls[] = {
4288 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN,
4289 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ,
4290 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50,
4291 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD,
4292 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80,
4293 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100,
4295 unsigned int old_ctl, new_ctl;
4297 old_ctl = snd_hda_codec_read(codec, nid, 0,
4298 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
4299 new_ctl = ctls[ucontrol->value.enumerated.item[0]];
4300 if (old_ctl != new_ctl) {
4302 snd_hda_codec_write_cache(codec, nid, 0,
4303 AC_VERB_SET_PIN_WIDGET_CONTROL,
4305 val = ucontrol->value.enumerated.item[0] >= 3 ?
4307 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
4314 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol,
4315 struct snd_ctl_elem_info *uinfo)
4317 static char *texts[] = {
4318 "Front", "Surround", "CLFE", "Side"
4320 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4322 uinfo->value.enumerated.items = 4;
4323 if (uinfo->value.enumerated.item >= 4)
4324 uinfo->value.enumerated.item = 3;
4325 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
4329 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol,
4330 struct snd_ctl_elem_value *ucontrol)
4332 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4333 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4336 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
4337 ucontrol->value.enumerated.item[0] = sel & 3;
4341 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,
4342 struct snd_ctl_elem_value *ucontrol)
4344 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
4345 hda_nid_t nid = (hda_nid_t)kcontrol->private_value;
4348 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3;
4349 if (ucontrol->value.enumerated.item[0] != sel) {
4350 sel = ucontrol->value.enumerated.item[0] & 3;
4351 snd_hda_codec_write_cache(codec, nid, 0,
4352 AC_VERB_SET_CONNECT_SEL, sel);
4358 #define PIN_CTL_TEST(xname,nid) { \
4359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4361 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4362 .info = alc_test_pin_ctl_info, \
4363 .get = alc_test_pin_ctl_get, \
4364 .put = alc_test_pin_ctl_put, \
4365 .private_value = nid \
4368 #define PIN_SRC_TEST(xname,nid) { \
4369 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
4371 .subdevice = HDA_SUBDEV_NID_FLAG | nid, \
4372 .info = alc_test_pin_src_info, \
4373 .get = alc_test_pin_src_get, \
4374 .put = alc_test_pin_src_put, \
4375 .private_value = nid \
4378 static struct snd_kcontrol_new alc880_test_mixer[] = {
4379 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
4380 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
4381 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
4382 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
4383 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
4384 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
4385 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT),
4386 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
4387 PIN_CTL_TEST("Front Pin Mode", 0x14),
4388 PIN_CTL_TEST("Surround Pin Mode", 0x15),
4389 PIN_CTL_TEST("CLFE Pin Mode", 0x16),
4390 PIN_CTL_TEST("Side Pin Mode", 0x17),
4391 PIN_CTL_TEST("In-1 Pin Mode", 0x18),
4392 PIN_CTL_TEST("In-2 Pin Mode", 0x19),
4393 PIN_CTL_TEST("In-3 Pin Mode", 0x1a),
4394 PIN_CTL_TEST("In-4 Pin Mode", 0x1b),
4395 PIN_SRC_TEST("In-1 Pin Source", 0x18),
4396 PIN_SRC_TEST("In-2 Pin Source", 0x19),
4397 PIN_SRC_TEST("In-3 Pin Source", 0x1a),
4398 PIN_SRC_TEST("In-4 Pin Source", 0x1b),
4399 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT),
4400 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT),
4401 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT),
4402 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT),
4403 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT),
4404 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT),
4405 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT),
4406 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT),
4407 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT),
4408 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT),
4410 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
4411 .name = "Channel Mode",
4412 .info = alc_ch_mode_info,
4413 .get = alc_ch_mode_get,
4414 .put = alc_ch_mode_put,
4419 static struct hda_verb alc880_test_init_verbs[] = {
4420 /* Unmute inputs of 0x0c - 0x0f */
4421 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4422 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4423 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4424 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4425 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4426 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4427 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4428 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4429 /* Vol output for 0x0c-0x0f */
4430 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4432 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4433 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4434 /* Set output pins 0x14-0x17 */
4435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4436 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4437 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4438 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4439 /* Unmute output pins 0x14-0x17 */
4440 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4441 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4442 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4443 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4444 /* Set input pins 0x18-0x1c */
4445 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4446 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
4447 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4448 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4449 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4450 /* Mute input pins 0x18-0x1b */
4451 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4452 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4453 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4454 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
4456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4457 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
4458 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4459 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
4460 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4461 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
4462 /* Analog input/passthru */
4463 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4464 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4465 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
4466 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
4467 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
4475 static const char *alc880_models[ALC880_MODEL_LAST] = {
4476 [ALC880_3ST] = "3stack",
4477 [ALC880_TCL_S700] = "tcl",
4478 [ALC880_3ST_DIG] = "3stack-digout",
4479 [ALC880_CLEVO] = "clevo",
4480 [ALC880_5ST] = "5stack",
4481 [ALC880_5ST_DIG] = "5stack-digout",
4482 [ALC880_W810] = "w810",
4483 [ALC880_Z71V] = "z71v",
4484 [ALC880_6ST] = "6stack",
4485 [ALC880_6ST_DIG] = "6stack-digout",
4486 [ALC880_ASUS] = "asus",
4487 [ALC880_ASUS_W1V] = "asus-w1v",
4488 [ALC880_ASUS_DIG] = "asus-dig",
4489 [ALC880_ASUS_DIG2] = "asus-dig2",
4490 [ALC880_UNIWILL_DIG] = "uniwill",
4491 [ALC880_UNIWILL_P53] = "uniwill-p53",
4492 [ALC880_FUJITSU] = "fujitsu",
4493 [ALC880_F1734] = "F1734",
4495 [ALC880_LG_LW] = "lg-lw",
4496 [ALC880_MEDION_RIM] = "medion",
4497 #ifdef CONFIG_SND_DEBUG
4498 [ALC880_TEST] = "test",
4500 [ALC880_AUTO] = "auto",
4503 static struct snd_pci_quirk alc880_cfg_tbl[] = {
4504 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810),
4505 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG),
4506 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST),
4507 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG),
4508 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG),
4509 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG),
4510 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG),
4511 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG),
4512 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST),
4513 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG),
4514 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST),
4515 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V),
4516 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG),
4517 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG),
4518 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG),
4519 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG),
4520 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG),
4521 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V),
4522 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */
4523 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG),
4524 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG),
4525 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG),
4526 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG),
4527 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST),
4528 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST),
4529 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */
4530 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST),
4531 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST),
4532 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST),
4533 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST),
4534 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST),
4535 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG),
4536 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG),
4537 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG),
4538 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG),
4539 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO),
4540 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO),
4541 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2),
4542 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG),
4543 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG),
4544 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734),
4545 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
4546 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
4547 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
4548 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
4549 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
4550 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
4551 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
4552 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
4553 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
4554 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
4555 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
4556 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
4557 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
4558 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
4559 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
4560 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
4561 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
4562 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG),
4563 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG),
4564 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG),
4565 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG),
4566 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG),
4567 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG),
4568 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG),
4569 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG),
4570 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG),
4571 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG),
4573 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST),
4574 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG),
4575 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG),
4580 * ALC880 codec presets
4582 static struct alc_config_preset alc880_presets[] = {
4584 .mixers = { alc880_three_stack_mixer },
4585 .init_verbs = { alc880_volume_init_verbs,
4586 alc880_pin_3stack_init_verbs },
4587 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4588 .dac_nids = alc880_dac_nids,
4589 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4590 .channel_mode = alc880_threestack_modes,
4592 .input_mux = &alc880_capture_source,
4594 [ALC880_3ST_DIG] = {
4595 .mixers = { alc880_three_stack_mixer },
4596 .init_verbs = { alc880_volume_init_verbs,
4597 alc880_pin_3stack_init_verbs },
4598 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4599 .dac_nids = alc880_dac_nids,
4600 .dig_out_nid = ALC880_DIGOUT_NID,
4601 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4602 .channel_mode = alc880_threestack_modes,
4604 .input_mux = &alc880_capture_source,
4606 [ALC880_TCL_S700] = {
4607 .mixers = { alc880_tcl_s700_mixer },
4608 .init_verbs = { alc880_volume_init_verbs,
4609 alc880_pin_tcl_S700_init_verbs,
4610 alc880_gpio2_init_verbs },
4611 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4612 .dac_nids = alc880_dac_nids,
4613 .adc_nids = alc880_adc_nids_alt, /* FIXME: correct? */
4614 .num_adc_nids = 1, /* single ADC */
4616 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4617 .channel_mode = alc880_2_jack_modes,
4618 .input_mux = &alc880_capture_source,
4621 .mixers = { alc880_three_stack_mixer,
4622 alc880_five_stack_mixer},
4623 .init_verbs = { alc880_volume_init_verbs,
4624 alc880_pin_5stack_init_verbs },
4625 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4626 .dac_nids = alc880_dac_nids,
4627 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4628 .channel_mode = alc880_fivestack_modes,
4629 .input_mux = &alc880_capture_source,
4631 [ALC880_5ST_DIG] = {
4632 .mixers = { alc880_three_stack_mixer,
4633 alc880_five_stack_mixer },
4634 .init_verbs = { alc880_volume_init_verbs,
4635 alc880_pin_5stack_init_verbs },
4636 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4637 .dac_nids = alc880_dac_nids,
4638 .dig_out_nid = ALC880_DIGOUT_NID,
4639 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes),
4640 .channel_mode = alc880_fivestack_modes,
4641 .input_mux = &alc880_capture_source,
4644 .mixers = { alc880_six_stack_mixer },
4645 .init_verbs = { alc880_volume_init_verbs,
4646 alc880_pin_6stack_init_verbs },
4647 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4648 .dac_nids = alc880_6st_dac_nids,
4649 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4650 .channel_mode = alc880_sixstack_modes,
4651 .input_mux = &alc880_6stack_capture_source,
4653 [ALC880_6ST_DIG] = {
4654 .mixers = { alc880_six_stack_mixer },
4655 .init_verbs = { alc880_volume_init_verbs,
4656 alc880_pin_6stack_init_verbs },
4657 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids),
4658 .dac_nids = alc880_6st_dac_nids,
4659 .dig_out_nid = ALC880_DIGOUT_NID,
4660 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes),
4661 .channel_mode = alc880_sixstack_modes,
4662 .input_mux = &alc880_6stack_capture_source,
4665 .mixers = { alc880_w810_base_mixer },
4666 .init_verbs = { alc880_volume_init_verbs,
4667 alc880_pin_w810_init_verbs,
4668 alc880_gpio2_init_verbs },
4669 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids),
4670 .dac_nids = alc880_w810_dac_nids,
4671 .dig_out_nid = ALC880_DIGOUT_NID,
4672 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4673 .channel_mode = alc880_w810_modes,
4674 .input_mux = &alc880_capture_source,
4677 .mixers = { alc880_z71v_mixer },
4678 .init_verbs = { alc880_volume_init_verbs,
4679 alc880_pin_z71v_init_verbs },
4680 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids),
4681 .dac_nids = alc880_z71v_dac_nids,
4682 .dig_out_nid = ALC880_DIGOUT_NID,
4684 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4685 .channel_mode = alc880_2_jack_modes,
4686 .input_mux = &alc880_capture_source,
4689 .mixers = { alc880_f1734_mixer },
4690 .init_verbs = { alc880_volume_init_verbs,
4691 alc880_pin_f1734_init_verbs },
4692 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids),
4693 .dac_nids = alc880_f1734_dac_nids,
4695 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4696 .channel_mode = alc880_2_jack_modes,
4697 .input_mux = &alc880_f1734_capture_source,
4698 .unsol_event = alc880_uniwill_p53_unsol_event,
4699 .setup = alc880_uniwill_p53_setup,
4700 .init_hook = alc_automute_amp,
4703 .mixers = { alc880_asus_mixer },
4704 .init_verbs = { alc880_volume_init_verbs,
4705 alc880_pin_asus_init_verbs,
4706 alc880_gpio1_init_verbs },
4707 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4708 .dac_nids = alc880_asus_dac_nids,
4709 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4710 .channel_mode = alc880_asus_modes,
4712 .input_mux = &alc880_capture_source,
4714 [ALC880_ASUS_DIG] = {
4715 .mixers = { alc880_asus_mixer },
4716 .init_verbs = { alc880_volume_init_verbs,
4717 alc880_pin_asus_init_verbs,
4718 alc880_gpio1_init_verbs },
4719 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4720 .dac_nids = alc880_asus_dac_nids,
4721 .dig_out_nid = ALC880_DIGOUT_NID,
4722 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4723 .channel_mode = alc880_asus_modes,
4725 .input_mux = &alc880_capture_source,
4727 [ALC880_ASUS_DIG2] = {
4728 .mixers = { alc880_asus_mixer },
4729 .init_verbs = { alc880_volume_init_verbs,
4730 alc880_pin_asus_init_verbs,
4731 alc880_gpio2_init_verbs }, /* use GPIO2 */
4732 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4733 .dac_nids = alc880_asus_dac_nids,
4734 .dig_out_nid = ALC880_DIGOUT_NID,
4735 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4736 .channel_mode = alc880_asus_modes,
4738 .input_mux = &alc880_capture_source,
4740 [ALC880_ASUS_W1V] = {
4741 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer },
4742 .init_verbs = { alc880_volume_init_verbs,
4743 alc880_pin_asus_init_verbs,
4744 alc880_gpio1_init_verbs },
4745 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4746 .dac_nids = alc880_asus_dac_nids,
4747 .dig_out_nid = ALC880_DIGOUT_NID,
4748 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4749 .channel_mode = alc880_asus_modes,
4751 .input_mux = &alc880_capture_source,
4753 [ALC880_UNIWILL_DIG] = {
4754 .mixers = { alc880_asus_mixer },
4755 .init_verbs = { alc880_volume_init_verbs,
4756 alc880_pin_asus_init_verbs },
4757 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4758 .dac_nids = alc880_asus_dac_nids,
4759 .dig_out_nid = ALC880_DIGOUT_NID,
4760 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes),
4761 .channel_mode = alc880_asus_modes,
4763 .input_mux = &alc880_capture_source,
4765 [ALC880_UNIWILL] = {
4766 .mixers = { alc880_uniwill_mixer },
4767 .init_verbs = { alc880_volume_init_verbs,
4768 alc880_uniwill_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_threestack_modes),
4773 .channel_mode = alc880_threestack_modes,
4775 .input_mux = &alc880_capture_source,
4776 .unsol_event = alc880_uniwill_unsol_event,
4777 .setup = alc880_uniwill_setup,
4778 .init_hook = alc880_uniwill_init_hook,
4780 [ALC880_UNIWILL_P53] = {
4781 .mixers = { alc880_uniwill_p53_mixer },
4782 .init_verbs = { alc880_volume_init_verbs,
4783 alc880_uniwill_p53_init_verbs },
4784 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
4785 .dac_nids = alc880_asus_dac_nids,
4786 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes),
4787 .channel_mode = alc880_threestack_modes,
4788 .input_mux = &alc880_capture_source,
4789 .unsol_event = alc880_uniwill_p53_unsol_event,
4790 .setup = alc880_uniwill_p53_setup,
4791 .init_hook = alc_automute_amp,
4793 [ALC880_FUJITSU] = {
4794 .mixers = { alc880_fujitsu_mixer },
4795 .init_verbs = { alc880_volume_init_verbs,
4796 alc880_uniwill_p53_init_verbs,
4797 alc880_beep_init_verbs },
4798 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4799 .dac_nids = alc880_dac_nids,
4800 .dig_out_nid = ALC880_DIGOUT_NID,
4801 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4802 .channel_mode = alc880_2_jack_modes,
4803 .input_mux = &alc880_capture_source,
4804 .unsol_event = alc880_uniwill_p53_unsol_event,
4805 .setup = alc880_uniwill_p53_setup,
4806 .init_hook = alc_automute_amp,
4809 .mixers = { alc880_three_stack_mixer },
4810 .init_verbs = { alc880_volume_init_verbs,
4811 alc880_pin_clevo_init_verbs },
4812 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4813 .dac_nids = alc880_dac_nids,
4815 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
4816 .channel_mode = alc880_threestack_modes,
4818 .input_mux = &alc880_capture_source,
4821 .mixers = { alc880_lg_mixer },
4822 .init_verbs = { alc880_volume_init_verbs,
4823 alc880_lg_init_verbs },
4824 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids),
4825 .dac_nids = alc880_lg_dac_nids,
4826 .dig_out_nid = ALC880_DIGOUT_NID,
4827 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes),
4828 .channel_mode = alc880_lg_ch_modes,
4830 .input_mux = &alc880_lg_capture_source,
4831 .unsol_event = alc_automute_amp_unsol_event,
4832 .setup = alc880_lg_setup,
4833 .init_hook = alc_automute_amp,
4834 #ifdef CONFIG_SND_HDA_POWER_SAVE
4835 .loopbacks = alc880_lg_loopbacks,
4839 .mixers = { alc880_lg_lw_mixer },
4840 .init_verbs = { alc880_volume_init_verbs,
4841 alc880_lg_lw_init_verbs },
4842 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4843 .dac_nids = alc880_dac_nids,
4844 .dig_out_nid = ALC880_DIGOUT_NID,
4845 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
4846 .channel_mode = alc880_lg_lw_modes,
4847 .input_mux = &alc880_lg_lw_capture_source,
4848 .unsol_event = alc_automute_amp_unsol_event,
4849 .setup = alc880_lg_lw_setup,
4850 .init_hook = alc_automute_amp,
4852 [ALC880_MEDION_RIM] = {
4853 .mixers = { alc880_medion_rim_mixer },
4854 .init_verbs = { alc880_volume_init_verbs,
4855 alc880_medion_rim_init_verbs,
4856 alc_gpio2_init_verbs },
4857 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
4858 .dac_nids = alc880_dac_nids,
4859 .dig_out_nid = ALC880_DIGOUT_NID,
4860 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
4861 .channel_mode = alc880_2_jack_modes,
4862 .input_mux = &alc880_medion_rim_capture_source,
4863 .unsol_event = alc880_medion_rim_unsol_event,
4864 .setup = alc880_medion_rim_setup,
4865 .init_hook = alc880_medion_rim_automute,
4867 #ifdef CONFIG_SND_DEBUG
4869 .mixers = { alc880_test_mixer },
4870 .init_verbs = { alc880_test_init_verbs },
4871 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids),
4872 .dac_nids = alc880_test_dac_nids,
4873 .dig_out_nid = ALC880_DIGOUT_NID,
4874 .num_channel_mode = ARRAY_SIZE(alc880_test_modes),
4875 .channel_mode = alc880_test_modes,
4876 .input_mux = &alc880_test_capture_source,
4882 * Automatic parse of I/O pins from the BIOS configuration
4887 ALC_CTL_WIDGET_MUTE,
4890 static struct snd_kcontrol_new alc880_control_templates[] = {
4891 HDA_CODEC_VOLUME(NULL, 0, 0, 0),
4892 HDA_CODEC_MUTE(NULL, 0, 0, 0),
4893 HDA_BIND_MUTE(NULL, 0, 0, 0),
4896 /* add dynamic controls */
4897 static int add_control(struct alc_spec *spec, int type, const char *name,
4898 int cidx, unsigned long val)
4900 struct snd_kcontrol_new *knew;
4902 snd_array_init(&spec->kctls, sizeof(*knew), 32);
4903 knew = snd_array_new(&spec->kctls);
4906 *knew = alc880_control_templates[type];
4907 knew->name = kstrdup(name, GFP_KERNEL);
4911 if (get_amp_nid_(val))
4912 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
4913 knew->private_value = val;
4917 static int add_control_with_pfx(struct alc_spec *spec, int type,
4918 const char *pfx, const char *dir,
4919 const char *sfx, int cidx, unsigned long val)
4922 snprintf(name, sizeof(name), "%s %s %s", pfx, dir, sfx);
4923 return add_control(spec, type, name, cidx, val);
4926 #define add_pb_vol_ctrl(spec, type, pfx, val) \
4927 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
4928 #define add_pb_sw_ctrl(spec, type, pfx, val) \
4929 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
4930 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
4931 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
4932 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
4933 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
4935 #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17)
4936 #define alc880_fixed_pin_idx(nid) ((nid) - 0x14)
4937 #define alc880_is_multi_pin(nid) ((nid) >= 0x18)
4938 #define alc880_multi_pin_idx(nid) ((nid) - 0x18)
4939 #define alc880_idx_to_dac(nid) ((nid) + 0x02)
4940 #define alc880_dac_to_idx(nid) ((nid) - 0x02)
4941 #define alc880_idx_to_mixer(nid) ((nid) + 0x0c)
4942 #define alc880_idx_to_selector(nid) ((nid) + 0x10)
4943 #define ALC880_PIN_CD_NID 0x1c
4945 /* fill in the dac_nids table from the parsed pin configuration */
4946 static int alc880_auto_fill_dac_nids(struct alc_spec *spec,
4947 const struct auto_pin_cfg *cfg)
4953 memset(assigned, 0, sizeof(assigned));
4954 spec->multiout.dac_nids = spec->private_dac_nids;
4956 /* check the pins hardwired to audio widget */
4957 for (i = 0; i < cfg->line_outs; i++) {
4958 nid = cfg->line_out_pins[i];
4959 if (alc880_is_fixed_pin(nid)) {
4960 int idx = alc880_fixed_pin_idx(nid);
4961 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx);
4965 /* left pins can be connect to any audio widget */
4966 for (i = 0; i < cfg->line_outs; i++) {
4967 nid = cfg->line_out_pins[i];
4968 if (alc880_is_fixed_pin(nid))
4970 /* search for an empty channel */
4971 for (j = 0; j < cfg->line_outs; j++) {
4973 spec->multiout.dac_nids[i] =
4974 alc880_idx_to_dac(j);
4980 spec->multiout.num_dacs = cfg->line_outs;
4984 /* add playback controls from the parsed DAC table */
4985 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec,
4986 const struct auto_pin_cfg *cfg)
4988 static const char *chname[4] = {
4989 "Front", "Surround", NULL /*CLFE*/, "Side"
4994 for (i = 0; i < cfg->line_outs; i++) {
4995 if (!spec->multiout.dac_nids[i])
4997 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i]));
5000 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5002 HDA_COMPOSE_AMP_VAL(nid, 1, 0,
5006 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
5008 HDA_COMPOSE_AMP_VAL(nid, 2, 0,
5012 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5014 HDA_COMPOSE_AMP_VAL(nid, 1, 2,
5018 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
5020 HDA_COMPOSE_AMP_VAL(nid, 2, 2,
5026 if (cfg->line_outs == 1 &&
5027 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
5031 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5032 HDA_COMPOSE_AMP_VAL(nid, 3, 0,
5036 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5037 HDA_COMPOSE_AMP_VAL(nid, 3, 2,
5046 /* add playback controls for speaker and HP outputs */
5047 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
5056 if (alc880_is_fixed_pin(pin)) {
5057 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
5058 /* specify the DAC as the extra output */
5059 if (!spec->multiout.hp_nid)
5060 spec->multiout.hp_nid = nid;
5062 spec->multiout.extra_out_nid[0] = nid;
5063 /* control HP volume/switch on the output mixer amp */
5064 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin));
5065 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
5066 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
5069 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
5070 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT));
5073 } else if (alc880_is_multi_pin(pin)) {
5074 /* set manual connection */
5075 /* we have only a switch on HP-out PIN */
5076 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
5077 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
5084 /* create input playback/capture controls for the given pin */
5085 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
5086 const char *ctlname, int ctlidx,
5087 int idx, hda_nid_t mix_nid)
5091 err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
5092 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5095 err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
5096 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
5102 static int alc_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
5104 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
5105 return (pincap & AC_PINCAP_IN) != 0;
5108 /* create playback/capture controls for input pins */
5109 static int alc_auto_create_input_ctls(struct hda_codec *codec,
5110 const struct auto_pin_cfg *cfg,
5112 hda_nid_t cap1, hda_nid_t cap2)
5114 struct alc_spec *spec = codec->spec;
5115 struct hda_input_mux *imux = &spec->private_imux[0];
5116 int i, err, idx, type, type_idx = 0;
5118 for (i = 0; i < cfg->num_inputs; i++) {
5122 pin = cfg->inputs[i].pin;
5123 if (!alc_is_input_pin(codec, pin))
5126 type = cfg->inputs[i].type;
5127 if (i > 0 && type == cfg->inputs[i - 1].type)
5131 label = hda_get_autocfg_input_label(codec, cfg, i);
5133 idx = get_connection_index(codec, mixer, pin);
5135 err = new_analog_input(spec, pin,
5145 idx = get_connection_index(codec, cap1, pin);
5146 if (idx < 0 && cap2)
5147 idx = get_connection_index(codec, cap2, pin);
5149 snd_hda_add_imux_item(imux, label, idx, NULL);
5154 static int alc880_auto_create_input_ctls(struct hda_codec *codec,
5155 const struct auto_pin_cfg *cfg)
5157 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x08, 0x09);
5160 static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
5161 unsigned int pin_type)
5163 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5166 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE,
5170 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec,
5171 hda_nid_t nid, int pin_type,
5174 alc_set_pin_output(codec, nid, pin_type);
5175 /* need the manual connection? */
5176 if (alc880_is_multi_pin(nid)) {
5177 struct alc_spec *spec = codec->spec;
5178 int idx = alc880_multi_pin_idx(nid);
5179 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0,
5180 AC_VERB_SET_CONNECT_SEL,
5181 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx]));
5185 static int get_pin_type(int line_out_type)
5187 if (line_out_type == AUTO_PIN_HP_OUT)
5193 static void alc880_auto_init_multi_out(struct hda_codec *codec)
5195 struct alc_spec *spec = codec->spec;
5198 for (i = 0; i < spec->autocfg.line_outs; i++) {
5199 hda_nid_t nid = spec->autocfg.line_out_pins[i];
5200 int pin_type = get_pin_type(spec->autocfg.line_out_type);
5201 alc880_auto_set_output_and_unmute(codec, nid, pin_type, i);
5205 static void alc880_auto_init_extra_out(struct hda_codec *codec)
5207 struct alc_spec *spec = codec->spec;
5210 pin = spec->autocfg.speaker_pins[0];
5211 if (pin) /* connect to front */
5212 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
5213 pin = spec->autocfg.hp_pins[0];
5214 if (pin) /* connect to front */
5215 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
5218 static void alc880_auto_init_analog_input(struct hda_codec *codec)
5220 struct alc_spec *spec = codec->spec;
5221 struct auto_pin_cfg *cfg = &spec->autocfg;
5224 for (i = 0; i < cfg->num_inputs; i++) {
5225 hda_nid_t nid = cfg->inputs[i].pin;
5226 if (alc_is_input_pin(codec, nid)) {
5227 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
5228 if (nid != ALC880_PIN_CD_NID &&
5229 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
5230 snd_hda_codec_write(codec, nid, 0,
5231 AC_VERB_SET_AMP_GAIN_MUTE,
5237 static void alc880_auto_init_input_src(struct hda_codec *codec)
5239 struct alc_spec *spec = codec->spec;
5242 for (c = 0; c < spec->num_adc_nids; c++) {
5243 unsigned int mux_idx;
5244 const struct hda_input_mux *imux;
5245 mux_idx = c >= spec->num_mux_defs ? 0 : c;
5246 imux = &spec->input_mux[mux_idx];
5247 if (!imux->num_items && mux_idx > 0)
5248 imux = &spec->input_mux[0];
5250 snd_hda_codec_write(codec, spec->adc_nids[c], 0,
5251 AC_VERB_SET_CONNECT_SEL,
5252 imux->items[0].index);
5256 /* parse the BIOS configuration and set up the alc_spec */
5257 /* return 1 if successful, 0 if the proper config is not found,
5258 * or a negative error code
5260 static int alc880_parse_auto_config(struct hda_codec *codec)
5262 struct alc_spec *spec = codec->spec;
5264 static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
5266 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
5270 if (!spec->autocfg.line_outs)
5271 return 0; /* can't find valid BIOS pin config */
5273 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
5276 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
5279 err = alc880_auto_create_extra_out(spec,
5280 spec->autocfg.speaker_pins[0],
5284 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
5288 err = alc880_auto_create_input_ctls(codec, &spec->autocfg);
5292 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
5294 alc_auto_parse_digital(codec);
5296 if (spec->kctls.list)
5297 add_mixer(spec, spec->kctls.list);
5299 add_verb(spec, alc880_volume_init_verbs);
5301 spec->num_mux_defs = 1;
5302 spec->input_mux = &spec->private_imux[0];
5304 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
5309 /* additional initialization for auto-configuration model */
5310 static void alc880_auto_init(struct hda_codec *codec)
5312 struct alc_spec *spec = codec->spec;
5313 alc880_auto_init_multi_out(codec);
5314 alc880_auto_init_extra_out(codec);
5315 alc880_auto_init_analog_input(codec);
5316 alc880_auto_init_input_src(codec);
5317 alc_auto_init_digital(codec);
5318 if (spec->unsol_event)
5319 alc_inithook(codec);
5322 /* check the ADC/MUX contains all input pins; some ADC/MUX contains only
5323 * one of two digital mic pins, e.g. on ALC272
5325 static void fixup_automic_adc(struct hda_codec *codec)
5327 struct alc_spec *spec = codec->spec;
5330 for (i = 0; i < spec->num_adc_nids; i++) {
5331 hda_nid_t cap = spec->capsrc_nids ?
5332 spec->capsrc_nids[i] : spec->adc_nids[i];
5335 iidx = get_connection_index(codec, cap, spec->int_mic.pin);
5338 eidx = get_connection_index(codec, cap, spec->ext_mic.pin);
5341 spec->int_mic.mux_idx = iidx;
5342 spec->ext_mic.mux_idx = eidx;
5343 if (spec->capsrc_nids)
5344 spec->capsrc_nids += i;
5345 spec->adc_nids += i;
5346 spec->num_adc_nids = 1;
5349 snd_printd(KERN_INFO "hda_codec: %s: "
5350 "No ADC/MUX containing both 0x%x and 0x%x pins\n",
5351 codec->chip_name, spec->int_mic.pin, spec->ext_mic.pin);
5352 spec->auto_mic = 0; /* disable auto-mic to be sure */
5355 /* select or unmute the given capsrc route */
5356 static void select_or_unmute_capsrc(struct hda_codec *codec, hda_nid_t cap,
5359 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
5360 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
5363 snd_hda_codec_write_cache(codec, cap, 0,
5364 AC_VERB_SET_CONNECT_SEL, idx);
5368 /* set the default connection to that pin */
5369 static int init_capsrc_for_pin(struct hda_codec *codec, hda_nid_t pin)
5371 struct alc_spec *spec = codec->spec;
5374 for (i = 0; i < spec->num_adc_nids; i++) {
5375 hda_nid_t cap = spec->capsrc_nids ?
5376 spec->capsrc_nids[i] : spec->adc_nids[i];
5379 idx = get_connection_index(codec, cap, pin);
5382 select_or_unmute_capsrc(codec, cap, idx);
5383 return i; /* return the found index */
5385 return -1; /* not found */
5388 /* choose the ADC/MUX containing the input pin and initialize the setup */
5389 static void fixup_single_adc(struct hda_codec *codec)
5391 struct alc_spec *spec = codec->spec;
5392 struct auto_pin_cfg *cfg = &spec->autocfg;
5395 /* search for the input pin; there must be only one */
5396 if (cfg->num_inputs != 1)
5398 i = init_capsrc_for_pin(codec, cfg->inputs[0].pin);
5400 /* use only this ADC */
5401 if (spec->capsrc_nids)
5402 spec->capsrc_nids += i;
5403 spec->adc_nids += i;
5404 spec->num_adc_nids = 1;
5408 /* initialize dual adcs */
5409 static void fixup_dual_adc_switch(struct hda_codec *codec)
5411 struct alc_spec *spec = codec->spec;
5412 init_capsrc_for_pin(codec, spec->ext_mic.pin);
5413 init_capsrc_for_pin(codec, spec->int_mic.pin);
5416 static void set_capture_mixer(struct hda_codec *codec)
5418 struct alc_spec *spec = codec->spec;
5419 static struct snd_kcontrol_new *caps[2][3] = {
5420 { alc_capture_mixer_nosrc1,
5421 alc_capture_mixer_nosrc2,
5422 alc_capture_mixer_nosrc3 },
5423 { alc_capture_mixer1,
5425 alc_capture_mixer3 },
5427 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
5429 int num_adcs = spec->num_adc_nids;
5430 if (spec->dual_adc_switch)
5431 fixup_dual_adc_switch(codec);
5432 else if (spec->auto_mic)
5433 fixup_automic_adc(codec);
5434 else if (spec->input_mux) {
5435 if (spec->input_mux->num_items > 1)
5437 else if (spec->input_mux->num_items == 1)
5438 fixup_single_adc(codec);
5440 if (spec->dual_adc_switch)
5442 spec->cap_mixer = caps[mux][num_adcs - 1];
5446 /* fill adc_nids (and capsrc_nids) containing all active input pins */
5447 static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5450 struct alc_spec *spec = codec->spec;
5451 struct auto_pin_cfg *cfg = &spec->autocfg;
5453 hda_nid_t fallback_adc = 0, fallback_cap = 0;
5455 for (n = 0; n < num_nids; n++) {
5457 hda_nid_t conn[HDA_MAX_NUM_INPUTS];
5461 if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN)
5464 nconns = snd_hda_get_connections(codec, cap, conn,
5468 nconns = snd_hda_get_connections(codec, cap, conn,
5473 if (!fallback_adc) {
5477 for (i = 0; i < cfg->num_inputs; i++) {
5478 hda_nid_t nid = cfg->inputs[i].pin;
5479 for (j = 0; j < nconns; j++) {
5486 if (i >= cfg->num_inputs) {
5487 int num_adcs = spec->num_adc_nids;
5488 spec->private_adc_nids[num_adcs] = adc;
5489 spec->private_capsrc_nids[num_adcs] = cap;
5490 spec->num_adc_nids++;
5491 spec->adc_nids = spec->private_adc_nids;
5493 spec->capsrc_nids = spec->private_capsrc_nids;
5496 if (!spec->num_adc_nids) {
5497 printk(KERN_WARNING "hda_codec: %s: no valid ADC found;"
5498 " using fallback 0x%x\n",
5499 codec->chip_name, fallback_adc);
5500 spec->private_adc_nids[0] = fallback_adc;
5501 spec->adc_nids = spec->private_adc_nids;
5502 if (fallback_adc != fallback_cap) {
5503 spec->private_capsrc_nids[0] = fallback_cap;
5504 spec->capsrc_nids = spec->private_adc_nids;
5509 #ifdef CONFIG_SND_HDA_INPUT_BEEP
5510 #define set_beep_amp(spec, nid, idx, dir) \
5511 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5513 static struct snd_pci_quirk beep_white_list[] = {
5514 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5515 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
5516 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
5520 static inline int has_cdefine_beep(struct hda_codec *codec)
5522 struct alc_spec *spec = codec->spec;
5523 const struct snd_pci_quirk *q;
5524 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5527 return spec->cdefine.enable_pcbeep;
5530 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
5531 #define has_cdefine_beep(codec) 0
5535 * OK, here we have finally the patch for ALC880
5538 static int patch_alc880(struct hda_codec *codec)
5540 struct alc_spec *spec;
5544 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5550 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST,
5553 if (board_config < 0) {
5554 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
5556 board_config = ALC880_AUTO;
5559 if (board_config == ALC880_AUTO) {
5560 /* automatic parse from the BIOS config */
5561 err = alc880_parse_auto_config(codec);
5567 "hda_codec: Cannot set up configuration "
5568 "from BIOS. Using 3-stack mode...\n");
5569 board_config = ALC880_3ST;
5573 err = snd_hda_attach_beep_device(codec, 0x1);
5579 if (board_config != ALC880_AUTO)
5580 setup_preset(codec, &alc880_presets[board_config]);
5582 spec->stream_analog_playback = &alc880_pcm_analog_playback;
5583 spec->stream_analog_capture = &alc880_pcm_analog_capture;
5584 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
5586 spec->stream_digital_playback = &alc880_pcm_digital_playback;
5587 spec->stream_digital_capture = &alc880_pcm_digital_capture;
5589 if (!spec->adc_nids && spec->input_mux) {
5590 /* check whether NID 0x07 is valid */
5591 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]);
5593 wcap = get_wcaps_type(wcap);
5594 if (wcap != AC_WID_AUD_IN) {
5595 spec->adc_nids = alc880_adc_nids_alt;
5596 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt);
5598 spec->adc_nids = alc880_adc_nids;
5599 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids);
5602 set_capture_mixer(codec);
5603 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5605 spec->vmaster_nid = 0x0c;
5607 codec->patch_ops = alc_patch_ops;
5608 if (board_config == ALC880_AUTO)
5609 spec->init_hook = alc880_auto_init;
5610 #ifdef CONFIG_SND_HDA_POWER_SAVE
5611 if (!spec->loopback.amplist)
5612 spec->loopback.amplist = alc880_loopbacks;
5623 static hda_nid_t alc260_dac_nids[1] = {
5628 static hda_nid_t alc260_adc_nids[1] = {
5633 static hda_nid_t alc260_adc_nids_alt[1] = {
5638 /* NIDs used when simultaneous access to both ADCs makes sense. Note that
5639 * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC.
5641 static hda_nid_t alc260_dual_adc_nids[2] = {
5646 #define ALC260_DIGOUT_NID 0x03
5647 #define ALC260_DIGIN_NID 0x06
5649 static struct hda_input_mux alc260_capture_source = {
5653 { "Front Mic", 0x1 },
5659 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack,
5660 * headphone jack and the internal CD lines since these are the only pins at
5661 * which audio can appear. For flexibility, also allow the option of
5662 * recording the mixer output on the second ADC (ADC0 doesn't have a
5663 * connection to the mixer output).
5665 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = {
5669 { "Mic/Line", 0x0 },
5671 { "Headphone", 0x2 },
5677 { "Mic/Line", 0x0 },
5679 { "Headphone", 0x2 },
5686 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to
5687 * the Fujitsu S702x, but jacks are marked differently.
5689 static struct hda_input_mux alc260_acer_capture_sources[2] = {
5696 { "Headphone", 0x5 },
5705 { "Headphone", 0x6 },
5711 /* Maxdata Favorit 100XS */
5712 static struct hda_input_mux alc260_favorit100_capture_sources[2] = {
5716 { "Line/Mic", 0x0 },
5723 { "Line/Mic", 0x0 },
5731 * This is just place-holder, so there's something for alc_build_pcms to look
5732 * at when it calculates the maximum number of channels. ALC260 has no mixer
5733 * element which allows changing the channel mode, so the verb list is
5736 static struct hda_channel_mode alc260_modes[1] = {
5741 /* Mixer combinations
5743 * basic: base_output + input + pc_beep + capture
5744 * HP: base_output + input + capture_alt
5745 * HP_3013: hp_3013 + input + capture
5746 * fujitsu: fujitsu + capture
5747 * acer: acer + capture
5750 static struct snd_kcontrol_new alc260_base_output_mixer[] = {
5751 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5752 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5753 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5754 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5755 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5756 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5760 static struct snd_kcontrol_new alc260_input_mixer[] = {
5761 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5762 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5763 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5764 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5765 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5766 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5767 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT),
5768 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT),
5772 /* update HP, line and mono out pins according to the master switch */
5773 static void alc260_hp_master_update(struct hda_codec *codec,
5774 hda_nid_t hp, hda_nid_t line,
5777 struct alc_spec *spec = codec->spec;
5778 unsigned int val = spec->master_sw ? PIN_HP : 0;
5779 /* change HP and line-out pins */
5780 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5782 snd_hda_codec_write(codec, line, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5784 /* mono (speaker) depending on the HP jack sense */
5785 val = (val && !spec->jack_present) ? PIN_OUT : 0;
5786 snd_hda_codec_write(codec, mono, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5790 static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol,
5791 struct snd_ctl_elem_value *ucontrol)
5793 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5794 struct alc_spec *spec = codec->spec;
5795 *ucontrol->value.integer.value = spec->master_sw;
5799 static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol,
5800 struct snd_ctl_elem_value *ucontrol)
5802 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5803 struct alc_spec *spec = codec->spec;
5804 int val = !!*ucontrol->value.integer.value;
5805 hda_nid_t hp, line, mono;
5807 if (val == spec->master_sw)
5809 spec->master_sw = val;
5810 hp = (kcontrol->private_value >> 16) & 0xff;
5811 line = (kcontrol->private_value >> 8) & 0xff;
5812 mono = kcontrol->private_value & 0xff;
5813 alc260_hp_master_update(codec, hp, line, mono);
5817 static struct snd_kcontrol_new alc260_hp_output_mixer[] = {
5819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5820 .name = "Master Playback Switch",
5821 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5822 .info = snd_ctl_boolean_mono_info,
5823 .get = alc260_hp_master_sw_get,
5824 .put = alc260_hp_master_sw_put,
5825 .private_value = (0x0f << 16) | (0x10 << 8) | 0x11
5827 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5828 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT),
5829 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5830 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT),
5831 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5833 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT),
5837 static struct hda_verb alc260_hp_unsol_verbs[] = {
5838 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5842 static void alc260_hp_automute(struct hda_codec *codec)
5844 struct alc_spec *spec = codec->spec;
5846 spec->jack_present = snd_hda_jack_detect(codec, 0x10);
5847 alc260_hp_master_update(codec, 0x0f, 0x10, 0x11);
5850 static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res)
5852 if ((res >> 26) == ALC880_HP_EVENT)
5853 alc260_hp_automute(codec);
5856 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {
5858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
5859 .name = "Master Playback Switch",
5860 .subdevice = HDA_SUBDEV_NID_FLAG | 0x11,
5861 .info = snd_ctl_boolean_mono_info,
5862 .get = alc260_hp_master_sw_get,
5863 .put = alc260_hp_master_sw_put,
5864 .private_value = (0x15 << 16) | (0x10 << 8) | 0x11
5866 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5867 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5868 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT),
5869 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT),
5870 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5871 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
5872 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
5873 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT),
5877 static struct hda_bind_ctls alc260_dc7600_bind_master_vol = {
5878 .ops = &snd_hda_bind_vol,
5880 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT),
5881 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT),
5882 HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT),
5887 static struct hda_bind_ctls alc260_dc7600_bind_switch = {
5888 .ops = &snd_hda_bind_sw,
5890 HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT),
5891 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
5896 static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = {
5897 HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol),
5898 HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch),
5899 HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT),
5900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT),
5904 static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
5905 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
5909 static void alc260_hp_3013_automute(struct hda_codec *codec)
5911 struct alc_spec *spec = codec->spec;
5913 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
5914 alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
5917 static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
5920 if ((res >> 26) == ALC880_HP_EVENT)
5921 alc260_hp_3013_automute(codec);
5924 static void alc260_hp_3012_automute(struct hda_codec *codec)
5926 unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
5928 snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5930 snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5932 snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5936 static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
5939 if ((res >> 26) == ALC880_HP_EVENT)
5940 alc260_hp_3012_automute(codec);
5943 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
5944 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
5946 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
5947 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5948 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
5949 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
5950 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5951 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5952 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT),
5953 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT),
5954 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN),
5955 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT),
5956 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT),
5960 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current
5961 * versions of the ALC260 don't act on requests to enable mic bias from NID
5962 * 0x0f (used to drive the headphone jack in these laptops). The ALC260
5963 * datasheet doesn't mention this restriction. At this stage it's not clear
5964 * whether this behaviour is intentional or is a hardware bug in chip
5965 * revisions available in early 2006. Therefore for now allow the
5966 * "Headphone Jack Mode" control to span all choices, but if it turns out
5967 * that the lack of mic bias for this NID is intentional we could change the
5968 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
5970 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006
5971 * don't appear to make the mic bias available from the "line" jack, even
5972 * though the NID used for this jack (0x14) can supply it. The theory is
5973 * that perhaps Acer have included blocking capacitors between the ALC260
5974 * and the output jack. If this turns out to be the case for all such
5975 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT
5976 * to ALC_PIN_DIR_INOUT_NOMICBIAS.
5978 * The C20x Tablet series have a mono internal speaker which is controlled
5979 * via the chip's Mono sum widget and pin complex, so include the necessary
5980 * controls for such models. On models without a "mono speaker" the control
5981 * won't do anything.
5983 static struct snd_kcontrol_new alc260_acer_mixer[] = {
5984 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
5985 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
5986 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
5987 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0,
5989 HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2,
5991 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
5992 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
5993 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
5994 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
5995 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
5996 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
5997 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
5998 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6002 /* Maxdata Favorit 100XS: one output and one input (0x12) jack
6004 static struct snd_kcontrol_new alc260_favorit100_mixer[] = {
6005 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6006 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT),
6007 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT),
6008 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6009 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6010 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6014 /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12,
6015 * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17.
6017 static struct snd_kcontrol_new alc260_will_mixer[] = {
6018 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6019 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6020 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6021 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6022 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6023 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6024 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6025 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6026 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6027 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6031 /* Replacer 672V ALC260 pin usage: Mic jack = 0x12,
6032 * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f.
6034 static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = {
6035 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6036 HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT),
6037 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT),
6038 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT),
6039 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN),
6040 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT),
6041 HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT),
6042 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT),
6043 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT),
6044 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
6049 * initialization verbs
6051 static struct hda_verb alc260_init_verbs[] = {
6052 /* Line In pin widget for input */
6053 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6054 /* CD pin widget for input */
6055 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6056 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6057 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6058 /* Mic2 (front panel) pin widget for input and vref at 80% */
6059 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6060 /* LINE-2 is used for line-out in rear */
6061 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6062 /* select line-out */
6063 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
6065 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6067 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6069 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6070 /* mute capture amp left and right */
6071 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6072 /* set connection select to line in (default select for this ADC) */
6073 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6074 /* mute capture amp left and right */
6075 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6076 /* set connection select to line in (default select for this ADC) */
6077 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02},
6078 /* set vol=0 Line-Out mixer amp left and right */
6079 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6080 /* unmute pin widget amp left and right (no gain on this amp) */
6081 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6082 /* set vol=0 HP mixer amp left and right */
6083 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6084 /* unmute pin widget amp left and right (no gain on this amp) */
6085 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6086 /* set vol=0 Mono mixer amp left and right */
6087 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6088 /* unmute pin widget amp left and right (no gain on this amp) */
6089 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6090 /* unmute LINE-2 out pin */
6091 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6092 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 &
6095 /* mute analog inputs */
6096 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6097 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6098 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6099 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6100 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6101 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */
6102 /* mute Front out path */
6103 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6105 /* mute Headphone out path */
6106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6107 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6108 /* mute Mono out path */
6109 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6110 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6114 #if 0 /* should be identical with alc260_init_verbs? */
6115 static struct hda_verb alc260_hp_init_verbs[] = {
6116 /* Headphone and output */
6117 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
6119 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6120 /* Mic1 (rear panel) pin widget for input and vref at 80% */
6121 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6122 /* Mic2 (front panel) pin widget for input and vref at 80% */
6123 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
6124 /* Line In pin widget for input */
6125 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6126 /* Line-2 pin widget for output */
6127 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
6128 /* CD pin widget for input */
6129 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
6130 /* unmute amp left and right */
6131 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000},
6132 /* set connection select to line in (default select for this ADC) */
6133 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02},
6134 /* unmute Line-Out mixer amp left and right (volume = 0) */
6135 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6136 /* mute pin widget amp left and right (no gain on this amp) */
6137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
6138 /* unmute HP mixer amp left and right (volume = 0) */
6139 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
6140 /* mute pin widget amp left and right (no gain on this amp) */
6141 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
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 /* Unmute Front out path */
6153 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6154 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6155 /* Unmute Headphone out path */
6156 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6157 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6158 /* Unmute Mono out path */
6159 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
6160 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
6165 static struct hda_verb alc260_hp_3013_init_verbs[] = {
6166 /* Line out and output */
6167 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
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 /* Headphone pin widget for output */
6177 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
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))},
6214 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x
6215 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD
6216 * audio = 0x16, internal speaker = 0x10.
6218 static struct hda_verb alc260_fujitsu_init_verbs[] = {
6219 /* Disable all GPIOs */
6220 {0x01, AC_VERB_SET_GPIO_MASK, 0},
6221 /* Internal speaker is connected to headphone pin */
6222 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6223 /* Headphone/Line-out jack connects to Line1 pin; make it an output */
6224 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6225 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */
6226 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6227 /* Ensure all other unused pins are disabled and muted. */
6228 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6229 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6230 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6231 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6232 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6233 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6237 /* Disable digital (SPDIF) pins */
6238 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6239 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6241 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus
6242 * when acting as an output.
6244 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6246 /* Start with output sum widgets muted and their output gains at min */
6247 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6248 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6249 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6250 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6252 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6253 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6254 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6255 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6257 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */
6258 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6259 /* Unmute Line1 pin widget output buffer since it starts as an output.
6260 * If the pin mode is changed by the user the pin mode control will
6261 * take care of enabling the pin's input/output buffers as needed.
6262 * Therefore there's no need to enable the input buffer at this
6265 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6266 /* Unmute input buffer of pin widget used for Line-in (no equiv
6269 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6271 /* Mute capture amp left and right */
6272 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6273 /* Set ADC connection select to match default mixer setting - line
6276 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6278 /* Do the same for the second ADC: mute capture input amp and
6279 * set ADC connection to line in (on mic1 pin)
6281 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6282 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6284 /* Mute all inputs to mixer widget (even unconnected ones) */
6285 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6286 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6287 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6288 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6289 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6290 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6291 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6292 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6297 /* Initialisation sequence for ALC260 as configured in Acer TravelMate and
6298 * similar laptops (adapted from Fujitsu init verbs).
6300 static struct hda_verb alc260_acer_init_verbs[] = {
6301 /* On TravelMate laptops, GPIO 0 enables the internal speaker and
6302 * the headphone jack. Turn this on and rely on the standard mute
6303 * methods whenever the user wants to turn these outputs off.
6305 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6306 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6307 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6308 /* Internal speaker/Headphone jack is connected to Line-out pin */
6309 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6310 /* Internal microphone/Mic jack is connected to Mic1 pin */
6311 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6312 /* Line In jack is connected to Line1 pin */
6313 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
6314 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */
6315 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6316 /* Ensure all other unused pins are disabled and muted. */
6317 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6318 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6319 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6320 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6321 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6322 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6323 /* Disable digital (SPDIF) pins */
6324 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6325 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6327 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6328 * bus when acting as outputs.
6330 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6331 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6333 /* Start with output sum widgets muted and their output gains at min */
6334 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6335 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6336 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6337 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6338 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6339 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6340 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6341 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6342 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6344 /* Unmute Line-out pin widget amp left and right
6345 * (no equiv mixer ctrl)
6347 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6348 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */
6349 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6350 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6351 * inputs. If the pin mode is changed by the user the pin mode control
6352 * will take care of enabling the pin's input/output buffers as needed.
6353 * Therefore there's no need to enable the input buffer at this
6356 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6357 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6359 /* Mute capture amp left and right */
6360 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6361 /* Set ADC connection select to match default mixer setting - mic
6364 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6366 /* Do similar with the second ADC: mute capture input amp and
6367 * set ADC connection to mic to match ALSA's default state.
6369 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6370 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6372 /* Mute all inputs to mixer widget (even unconnected ones) */
6373 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6374 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6375 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6376 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6377 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6378 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6379 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6380 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6385 /* Initialisation sequence for Maxdata Favorit 100XS
6386 * (adapted from Acer init verbs).
6388 static struct hda_verb alc260_favorit100_init_verbs[] = {
6389 /* GPIO 0 enables the output jack.
6390 * Turn this on and rely on the standard mute
6391 * methods whenever the user wants to turn these outputs off.
6393 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6394 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6395 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
6396 /* Line/Mic input jack is connected to Mic1 pin */
6397 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
6398 /* Ensure all other unused pins are disabled and muted. */
6399 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6400 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6401 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6402 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6403 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6404 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6405 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6406 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6407 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6408 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6409 /* Disable digital (SPDIF) pins */
6410 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6411 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6413 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum
6414 * bus when acting as outputs.
6416 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6417 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6419 /* Start with output sum widgets muted and their output gains at min */
6420 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6421 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6423 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6425 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6426 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6427 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6428 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6430 /* Unmute Line-out pin widget amp left and right
6431 * (no equiv mixer ctrl)
6433 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6434 /* Unmute Mic1 and Line1 pin widget input buffers since they start as
6435 * inputs. If the pin mode is changed by the user the pin mode control
6436 * will take care of enabling the pin's input/output buffers as needed.
6437 * Therefore there's no need to enable the input buffer at this
6440 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6442 /* Mute capture amp left and right */
6443 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6444 /* Set ADC connection select to match default mixer setting - mic
6447 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6449 /* Do similar with the second ADC: mute capture input amp and
6450 * set ADC connection to mic to match ALSA's default state.
6452 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6453 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6455 /* Mute all inputs to mixer widget (even unconnected ones) */
6456 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6457 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6458 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6459 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6460 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6461 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6462 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6463 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6468 static struct hda_verb alc260_will_verbs[] = {
6469 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6470 {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00},
6471 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},
6472 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6473 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6474 {0x1a, AC_VERB_SET_PROC_COEF, 0x3040},
6478 static struct hda_verb alc260_replacer_672v_verbs[] = {
6479 {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02},
6480 {0x1a, AC_VERB_SET_COEF_INDEX, 0x07},
6481 {0x1a, AC_VERB_SET_PROC_COEF, 0x3050},
6483 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
6484 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
6485 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6487 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6491 /* toggle speaker-output according to the hp-jack state */
6492 static void alc260_replacer_672v_automute(struct hda_codec *codec)
6494 unsigned int present;
6496 /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */
6497 present = snd_hda_jack_detect(codec, 0x0f);
6499 snd_hda_codec_write_cache(codec, 0x01, 0,
6500 AC_VERB_SET_GPIO_DATA, 1);
6501 snd_hda_codec_write_cache(codec, 0x0f, 0,
6502 AC_VERB_SET_PIN_WIDGET_CONTROL,
6505 snd_hda_codec_write_cache(codec, 0x01, 0,
6506 AC_VERB_SET_GPIO_DATA, 0);
6507 snd_hda_codec_write_cache(codec, 0x0f, 0,
6508 AC_VERB_SET_PIN_WIDGET_CONTROL,
6513 static void alc260_replacer_672v_unsol_event(struct hda_codec *codec,
6516 if ((res >> 26) == ALC880_HP_EVENT)
6517 alc260_replacer_672v_automute(codec);
6520 static struct hda_verb alc260_hp_dc7600_verbs[] = {
6521 {0x05, AC_VERB_SET_CONNECT_SEL, 0x01},
6522 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
6523 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6524 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
6525 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6526 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6527 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
6528 {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6529 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6530 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6534 /* Test configuration for debugging, modelled after the ALC880 test
6537 #ifdef CONFIG_SND_DEBUG
6538 static hda_nid_t alc260_test_dac_nids[1] = {
6541 static hda_nid_t alc260_test_adc_nids[2] = {
6544 /* For testing the ALC260, each input MUX needs its own definition since
6545 * the signal assignments are different. This assumes that the first ADC
6548 static struct hda_input_mux alc260_test_capture_sources[2] = {
6552 { "MIC1 pin", 0x0 },
6553 { "MIC2 pin", 0x1 },
6554 { "LINE1 pin", 0x2 },
6555 { "LINE2 pin", 0x3 },
6557 { "LINE-OUT pin", 0x5 },
6558 { "HP-OUT pin", 0x6 },
6564 { "MIC1 pin", 0x0 },
6565 { "MIC2 pin", 0x1 },
6566 { "LINE1 pin", 0x2 },
6567 { "LINE2 pin", 0x3 },
6570 { "LINE-OUT pin", 0x6 },
6571 { "HP-OUT pin", 0x7 },
6575 static struct snd_kcontrol_new alc260_test_mixer[] = {
6576 /* Output driver widgets */
6577 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
6578 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT),
6579 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT),
6580 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT),
6581 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6582 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT),
6584 /* Modes for retasking pin widgets
6585 * Note: the ALC260 doesn't seem to act on requests to enable mic
6586 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't
6587 * mention this restriction. At this stage it's not clear whether
6588 * this behaviour is intentional or is a hardware bug in chip
6589 * revisions available at least up until early 2006. Therefore for
6590 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all
6591 * choices, but if it turns out that the lack of mic bias for these
6592 * NIDs is intentional we could change their modes from
6593 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS.
6595 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT),
6596 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT),
6597 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT),
6598 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT),
6599 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT),
6600 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT),
6602 /* Loopback mixer controls */
6603 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT),
6604 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT),
6605 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT),
6606 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT),
6607 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT),
6608 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT),
6609 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT),
6610 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT),
6611 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT),
6612 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT),
6613 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT),
6614 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT),
6615 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT),
6616 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT),
6618 /* Controls for GPIO pins, assuming they are configured as outputs */
6619 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
6620 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
6621 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
6622 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
6624 /* Switches to allow the digital IO pins to be enabled. The datasheet
6625 * is ambigious as to which NID is which; testing on laptops which
6626 * make this output available should provide clarification.
6628 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01),
6629 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01),
6631 /* A switch allowing EAPD to be enabled. Some laptops seem to use
6632 * this output to turn on an external amplifier.
6634 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
6635 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
6639 static struct hda_verb alc260_test_init_verbs[] = {
6640 /* Enable all GPIOs as outputs with an initial value of 0 */
6641 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f},
6642 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6643 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f},
6645 /* Enable retasking pins as output, initially without power amp */
6646 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6647 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6649 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6650 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6651 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
6653 /* Disable digital (SPDIF) pins initially, but users can enable
6654 * them via a mixer switch. In the case of SPDIF-out, this initverb
6655 * payload also sets the generation to 0, output to be in "consumer"
6656 * PCM format, copyright asserted, no pre-emphasis and no validity
6659 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0},
6660 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0},
6662 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the
6663 * OUT1 sum bus when acting as an output.
6665 {0x0b, AC_VERB_SET_CONNECT_SEL, 0},
6666 {0x0c, AC_VERB_SET_CONNECT_SEL, 0},
6667 {0x0d, AC_VERB_SET_CONNECT_SEL, 0},
6668 {0x0e, AC_VERB_SET_CONNECT_SEL, 0},
6670 /* Start with output sum widgets muted and their output gains at min */
6671 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6672 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6675 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6676 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6677 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6678 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6679 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6681 /* Unmute retasking pin widget output buffers since the default
6682 * state appears to be output. As the pin mode is changed by the
6683 * user the pin mode control will take care of enabling the pin's
6684 * input/output buffers as needed.
6686 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6687 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6688 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6689 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6690 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6691 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6692 /* Also unmute the mono-out pin widget */
6693 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
6695 /* Mute capture amp left and right */
6696 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6697 /* Set ADC connection select to match default mixer setting (mic1
6700 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6702 /* Do the same for the second ADC: mute capture input amp and
6703 * set ADC connection to mic1 pin
6705 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6706 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6708 /* Mute all inputs to mixer widget (even unconnected ones) */
6709 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */
6710 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */
6711 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */
6712 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */
6713 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */
6714 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */
6715 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */
6716 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */
6722 #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback
6723 #define alc260_pcm_analog_capture alc880_pcm_analog_capture
6725 #define alc260_pcm_digital_playback alc880_pcm_digital_playback
6726 #define alc260_pcm_digital_capture alc880_pcm_digital_capture
6729 * for BIOS auto-configuration
6732 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid,
6733 const char *pfx, int *vol_bits)
6736 unsigned long vol_val, sw_val;
6739 if (nid >= 0x0f && nid < 0x11) {
6740 nid_vol = nid - 0x7;
6741 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6742 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6743 } else if (nid == 0x11) {
6744 nid_vol = nid - 0x7;
6745 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT);
6746 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
6747 } else if (nid >= 0x12 && nid <= 0x15) {
6749 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT);
6750 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
6754 if (!(*vol_bits & (1 << nid_vol))) {
6755 /* first control for the volume widget */
6756 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, vol_val);
6759 *vol_bits |= (1 << nid_vol);
6761 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, sw_val);
6767 /* add playback controls from the parsed DAC table */
6768 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
6769 const struct auto_pin_cfg *cfg)
6775 spec->multiout.num_dacs = 1;
6776 spec->multiout.dac_nids = spec->private_dac_nids;
6777 spec->multiout.dac_nids[0] = 0x02;
6779 nid = cfg->line_out_pins[0];
6782 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
6784 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
6788 err = alc260_add_playback_controls(spec, nid, pfx, &vols);
6793 nid = cfg->speaker_pins[0];
6795 err = alc260_add_playback_controls(spec, nid, "Speaker", &vols);
6800 nid = cfg->hp_pins[0];
6802 err = alc260_add_playback_controls(spec, nid, "Headphone",
6810 /* create playback/capture controls for input pins */
6811 static int alc260_auto_create_input_ctls(struct hda_codec *codec,
6812 const struct auto_pin_cfg *cfg)
6814 return alc_auto_create_input_ctls(codec, cfg, 0x07, 0x04, 0x05);
6817 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec,
6818 hda_nid_t nid, int pin_type,
6821 alc_set_pin_output(codec, nid, pin_type);
6822 /* need the manual connection? */
6824 int idx = nid - 0x12;
6825 snd_hda_codec_write(codec, idx + 0x0b, 0,
6826 AC_VERB_SET_CONNECT_SEL, sel_idx);
6830 static void alc260_auto_init_multi_out(struct hda_codec *codec)
6832 struct alc_spec *spec = codec->spec;
6835 nid = spec->autocfg.line_out_pins[0];
6837 int pin_type = get_pin_type(spec->autocfg.line_out_type);
6838 alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0);
6841 nid = spec->autocfg.speaker_pins[0];
6843 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0);
6845 nid = spec->autocfg.hp_pins[0];
6847 alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0);
6850 #define ALC260_PIN_CD_NID 0x16
6851 static void alc260_auto_init_analog_input(struct hda_codec *codec)
6853 struct alc_spec *spec = codec->spec;
6854 struct auto_pin_cfg *cfg = &spec->autocfg;
6857 for (i = 0; i < cfg->num_inputs; i++) {
6858 hda_nid_t nid = cfg->inputs[i].pin;
6860 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
6861 if (nid != ALC260_PIN_CD_NID &&
6862 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
6863 snd_hda_codec_write(codec, nid, 0,
6864 AC_VERB_SET_AMP_GAIN_MUTE,
6870 #define alc260_auto_init_input_src alc880_auto_init_input_src
6873 * generic initialization of ADC, input mixers and output mixers
6875 static struct hda_verb alc260_volume_init_verbs[] = {
6877 * Unmute ADC0-1 and set the default input to mic-in
6879 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00},
6880 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6881 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00},
6882 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6884 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
6886 * Note: PASD motherboards uses the Line In 2 as the input for
6887 * front panel mic (mic 2)
6889 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
6890 /* mute analog inputs */
6891 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
6892 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
6893 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
6894 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
6895 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
6898 * Set up output mixers (0x08 - 0x0a)
6900 /* set vol=0 to output mixers */
6901 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6902 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6903 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
6904 /* set up input amps for analog loopback */
6905 /* Amp Indices: DAC = 0, mixer = 1 */
6906 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6907 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6908 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6909 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6910 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
6911 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
6916 static int alc260_parse_auto_config(struct hda_codec *codec)
6918 struct alc_spec *spec = codec->spec;
6920 static hda_nid_t alc260_ignore[] = { 0x17, 0 };
6922 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
6926 err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg);
6929 if (!spec->kctls.list)
6930 return 0; /* can't find valid BIOS pin config */
6931 err = alc260_auto_create_input_ctls(codec, &spec->autocfg);
6935 spec->multiout.max_channels = 2;
6937 if (spec->autocfg.dig_outs)
6938 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
6939 if (spec->kctls.list)
6940 add_mixer(spec, spec->kctls.list);
6942 add_verb(spec, alc260_volume_init_verbs);
6944 spec->num_mux_defs = 1;
6945 spec->input_mux = &spec->private_imux[0];
6947 alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);
6952 /* additional initialization for auto-configuration model */
6953 static void alc260_auto_init(struct hda_codec *codec)
6955 struct alc_spec *spec = codec->spec;
6956 alc260_auto_init_multi_out(codec);
6957 alc260_auto_init_analog_input(codec);
6958 alc260_auto_init_input_src(codec);
6959 alc_auto_init_digital(codec);
6960 if (spec->unsol_event)
6961 alc_inithook(codec);
6964 #ifdef CONFIG_SND_HDA_POWER_SAVE
6965 static struct hda_amp_list alc260_loopbacks[] = {
6966 { 0x07, HDA_INPUT, 0 },
6967 { 0x07, HDA_INPUT, 1 },
6968 { 0x07, HDA_INPUT, 2 },
6969 { 0x07, HDA_INPUT, 3 },
6970 { 0x07, HDA_INPUT, 4 },
6982 static const struct alc_fixup alc260_fixups[] = {
6983 [PINFIX_HP_DC5750] = {
6984 .pins = (const struct alc_pincfg[]) {
6985 { 0x11, 0x90130110 }, /* speaker */
6991 static struct snd_pci_quirk alc260_fixup_tbl[] = {
6992 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", PINFIX_HP_DC5750),
6997 * ALC260 configurations
6999 static const char *alc260_models[ALC260_MODEL_LAST] = {
7000 [ALC260_BASIC] = "basic",
7002 [ALC260_HP_3013] = "hp-3013",
7003 [ALC260_HP_DC7600] = "hp-dc7600",
7004 [ALC260_FUJITSU_S702X] = "fujitsu",
7005 [ALC260_ACER] = "acer",
7006 [ALC260_WILL] = "will",
7007 [ALC260_REPLACER_672V] = "replacer",
7008 [ALC260_FAVORIT100] = "favorit100",
7009 #ifdef CONFIG_SND_DEBUG
7010 [ALC260_TEST] = "test",
7012 [ALC260_AUTO] = "auto",
7015 static struct snd_pci_quirk alc260_cfg_tbl[] = {
7016 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER),
7017 SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL),
7018 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER),
7019 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100),
7020 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013),
7021 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_AUTO), /* no quirk */
7022 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013),
7023 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013),
7024 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600),
7025 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013),
7026 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP),
7027 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP),
7028 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP),
7029 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC),
7030 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC),
7031 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC),
7032 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X),
7033 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC),
7034 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V),
7035 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL),
7039 static struct alc_config_preset alc260_presets[] = {
7041 .mixers = { alc260_base_output_mixer,
7042 alc260_input_mixer },
7043 .init_verbs = { alc260_init_verbs },
7044 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7045 .dac_nids = alc260_dac_nids,
7046 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7047 .adc_nids = alc260_dual_adc_nids,
7048 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7049 .channel_mode = alc260_modes,
7050 .input_mux = &alc260_capture_source,
7053 .mixers = { alc260_hp_output_mixer,
7054 alc260_input_mixer },
7055 .init_verbs = { alc260_init_verbs,
7056 alc260_hp_unsol_verbs },
7057 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7058 .dac_nids = alc260_dac_nids,
7059 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7060 .adc_nids = alc260_adc_nids_alt,
7061 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7062 .channel_mode = alc260_modes,
7063 .input_mux = &alc260_capture_source,
7064 .unsol_event = alc260_hp_unsol_event,
7065 .init_hook = alc260_hp_automute,
7067 [ALC260_HP_DC7600] = {
7068 .mixers = { alc260_hp_dc7600_mixer,
7069 alc260_input_mixer },
7070 .init_verbs = { alc260_init_verbs,
7071 alc260_hp_dc7600_verbs },
7072 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7073 .dac_nids = alc260_dac_nids,
7074 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7075 .adc_nids = alc260_adc_nids_alt,
7076 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7077 .channel_mode = alc260_modes,
7078 .input_mux = &alc260_capture_source,
7079 .unsol_event = alc260_hp_3012_unsol_event,
7080 .init_hook = alc260_hp_3012_automute,
7082 [ALC260_HP_3013] = {
7083 .mixers = { alc260_hp_3013_mixer,
7084 alc260_input_mixer },
7085 .init_verbs = { alc260_hp_3013_init_verbs,
7086 alc260_hp_3013_unsol_verbs },
7087 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7088 .dac_nids = alc260_dac_nids,
7089 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt),
7090 .adc_nids = alc260_adc_nids_alt,
7091 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7092 .channel_mode = alc260_modes,
7093 .input_mux = &alc260_capture_source,
7094 .unsol_event = alc260_hp_3013_unsol_event,
7095 .init_hook = alc260_hp_3013_automute,
7097 [ALC260_FUJITSU_S702X] = {
7098 .mixers = { alc260_fujitsu_mixer },
7099 .init_verbs = { alc260_fujitsu_init_verbs },
7100 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7101 .dac_nids = alc260_dac_nids,
7102 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7103 .adc_nids = alc260_dual_adc_nids,
7104 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7105 .channel_mode = alc260_modes,
7106 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources),
7107 .input_mux = alc260_fujitsu_capture_sources,
7110 .mixers = { alc260_acer_mixer },
7111 .init_verbs = { alc260_acer_init_verbs },
7112 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7113 .dac_nids = alc260_dac_nids,
7114 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7115 .adc_nids = alc260_dual_adc_nids,
7116 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7117 .channel_mode = alc260_modes,
7118 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources),
7119 .input_mux = alc260_acer_capture_sources,
7121 [ALC260_FAVORIT100] = {
7122 .mixers = { alc260_favorit100_mixer },
7123 .init_verbs = { alc260_favorit100_init_verbs },
7124 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7125 .dac_nids = alc260_dac_nids,
7126 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids),
7127 .adc_nids = alc260_dual_adc_nids,
7128 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7129 .channel_mode = alc260_modes,
7130 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources),
7131 .input_mux = alc260_favorit100_capture_sources,
7134 .mixers = { alc260_will_mixer },
7135 .init_verbs = { alc260_init_verbs, alc260_will_verbs },
7136 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7137 .dac_nids = alc260_dac_nids,
7138 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7139 .adc_nids = alc260_adc_nids,
7140 .dig_out_nid = ALC260_DIGOUT_NID,
7141 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7142 .channel_mode = alc260_modes,
7143 .input_mux = &alc260_capture_source,
7145 [ALC260_REPLACER_672V] = {
7146 .mixers = { alc260_replacer_672v_mixer },
7147 .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs },
7148 .num_dacs = ARRAY_SIZE(alc260_dac_nids),
7149 .dac_nids = alc260_dac_nids,
7150 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids),
7151 .adc_nids = alc260_adc_nids,
7152 .dig_out_nid = ALC260_DIGOUT_NID,
7153 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7154 .channel_mode = alc260_modes,
7155 .input_mux = &alc260_capture_source,
7156 .unsol_event = alc260_replacer_672v_unsol_event,
7157 .init_hook = alc260_replacer_672v_automute,
7159 #ifdef CONFIG_SND_DEBUG
7161 .mixers = { alc260_test_mixer },
7162 .init_verbs = { alc260_test_init_verbs },
7163 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids),
7164 .dac_nids = alc260_test_dac_nids,
7165 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids),
7166 .adc_nids = alc260_test_adc_nids,
7167 .num_channel_mode = ARRAY_SIZE(alc260_modes),
7168 .channel_mode = alc260_modes,
7169 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources),
7170 .input_mux = alc260_test_capture_sources,
7175 static int patch_alc260(struct hda_codec *codec)
7177 struct alc_spec *spec;
7178 int err, board_config;
7180 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
7186 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST,
7189 if (board_config < 0) {
7190 snd_printd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
7192 board_config = ALC260_AUTO;
7195 if (board_config == ALC260_AUTO)
7196 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1);
7198 if (board_config == ALC260_AUTO) {
7199 /* automatic parse from the BIOS config */
7200 err = alc260_parse_auto_config(codec);
7206 "hda_codec: Cannot set up configuration "
7207 "from BIOS. Using base mode...\n");
7208 board_config = ALC260_BASIC;
7212 err = snd_hda_attach_beep_device(codec, 0x1);
7218 if (board_config != ALC260_AUTO)
7219 setup_preset(codec, &alc260_presets[board_config]);
7221 spec->stream_analog_playback = &alc260_pcm_analog_playback;
7222 spec->stream_analog_capture = &alc260_pcm_analog_capture;
7223 spec->stream_analog_alt_capture = &alc260_pcm_analog_capture;
7225 spec->stream_digital_playback = &alc260_pcm_digital_playback;
7226 spec->stream_digital_capture = &alc260_pcm_digital_capture;
7228 if (!spec->adc_nids && spec->input_mux) {
7229 /* check whether NID 0x04 is valid */
7230 unsigned int wcap = get_wcaps(codec, 0x04);
7231 wcap = get_wcaps_type(wcap);
7233 if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
7234 spec->adc_nids = alc260_adc_nids_alt;
7235 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt);
7237 spec->adc_nids = alc260_adc_nids;
7238 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids);
7241 set_capture_mixer(codec);
7242 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
7244 if (board_config == ALC260_AUTO)
7245 alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
7247 spec->vmaster_nid = 0x08;
7249 codec->patch_ops = alc_patch_ops;
7250 if (board_config == ALC260_AUTO)
7251 spec->init_hook = alc260_auto_init;
7252 #ifdef CONFIG_SND_HDA_POWER_SAVE
7253 if (!spec->loopback.amplist)
7254 spec->loopback.amplist = alc260_loopbacks;
7262 * ALC882/883/885/888/889 support
7264 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
7265 * configuration. Each pin widget can choose any input DACs and a mixer.
7266 * Each ADC is connected from a mixer of all inputs. This makes possible
7267 * 6-channel independent captures.
7269 * In addition, an independent DAC for the multi-playback (not used in this
7272 #define ALC882_DIGOUT_NID 0x06
7273 #define ALC882_DIGIN_NID 0x0a
7274 #define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
7275 #define ALC883_DIGIN_NID ALC882_DIGIN_NID
7276 #define ALC1200_DIGOUT_NID 0x10
7279 static struct hda_channel_mode alc882_ch_modes[1] = {
7284 static hda_nid_t alc882_dac_nids[4] = {
7285 /* front, rear, clfe, rear_surr */
7286 0x02, 0x03, 0x04, 0x05
7288 #define alc883_dac_nids alc882_dac_nids
7291 #define alc882_adc_nids alc880_adc_nids
7292 #define alc882_adc_nids_alt alc880_adc_nids_alt
7293 #define alc883_adc_nids alc882_adc_nids_alt
7294 static hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
7295 static hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
7296 #define alc889_adc_nids alc880_adc_nids
7298 static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
7299 static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
7300 #define alc883_capsrc_nids alc882_capsrc_nids_alt
7301 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7302 #define alc889_capsrc_nids alc882_capsrc_nids
7305 /* FIXME: should be a matrix-type input source selection */
7307 static struct hda_input_mux alc882_capture_source = {
7311 { "Front Mic", 0x1 },
7317 #define alc883_capture_source alc882_capture_source
7319 static struct hda_input_mux alc889_capture_source = {
7322 { "Front Mic", 0x0 },
7328 static struct hda_input_mux mb5_capture_source = {
7337 static struct hda_input_mux macmini3_capture_source = {
7345 static struct hda_input_mux alc883_3stack_6ch_intel = {
7349 { "Front Mic", 0x0 },
7355 static struct hda_input_mux alc883_lenovo_101e_capture_source = {
7363 static struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
7373 static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
7381 static struct hda_input_mux alc883_lenovo_sky_capture_source = {
7385 { "Front Mic", 0x1 },
7390 static struct hda_input_mux alc883_asus_eee1601_capture_source = {
7398 static struct hda_input_mux alc889A_mb31_capture_source = {
7402 /* Front Mic (0x01) unused */
7404 /* Line 2 (0x03) unused */
7405 /* CD (0x04) unused? */
7409 static struct hda_input_mux alc889A_imac91_capture_source = {
7413 { "Line", 0x2 }, /* Not sure! */
7420 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
7427 static struct hda_verb alc882_3ST_ch2_init[] = {
7428 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7429 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7430 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7431 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7438 static struct hda_verb alc882_3ST_ch4_init[] = {
7439 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7440 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7441 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7442 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7443 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7450 static struct hda_verb alc882_3ST_ch6_init[] = {
7451 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7452 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7453 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7454 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7455 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7456 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7460 static struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
7461 { 2, alc882_3ST_ch2_init },
7462 { 4, alc882_3ST_ch4_init },
7463 { 6, alc882_3ST_ch6_init },
7466 #define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
7471 static struct hda_verb alc883_3ST_ch2_clevo_init[] = {
7472 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
7473 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7474 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7475 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7476 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7483 static struct hda_verb alc883_3ST_ch4_clevo_init[] = {
7484 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7485 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7486 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7487 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7488 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7489 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7496 static struct hda_verb alc883_3ST_ch6_clevo_init[] = {
7497 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7498 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7499 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7500 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7501 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7502 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7503 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7507 static struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
7508 { 2, alc883_3ST_ch2_clevo_init },
7509 { 4, alc883_3ST_ch4_clevo_init },
7510 { 6, alc883_3ST_ch6_clevo_init },
7517 static struct hda_verb alc882_sixstack_ch6_init[] = {
7518 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7519 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7520 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7521 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7528 static struct hda_verb alc882_sixstack_ch8_init[] = {
7529 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7530 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7531 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7532 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7536 static struct hda_channel_mode alc882_sixstack_modes[2] = {
7537 { 6, alc882_sixstack_ch6_init },
7538 { 8, alc882_sixstack_ch8_init },
7542 /* Macbook Air 2,1 */
7544 static struct hda_channel_mode alc885_mba21_ch_modes[1] = {
7549 * macbook pro ALC885 can switch LineIn to LineOut without losing Mic
7555 static struct hda_verb alc885_mbp_ch2_init[] = {
7556 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7557 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7558 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7565 static struct hda_verb alc885_mbp_ch4_init[] = {
7566 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7567 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7568 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7569 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
7570 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
7574 static struct hda_channel_mode alc885_mbp_4ch_modes[2] = {
7575 { 2, alc885_mbp_ch2_init },
7576 { 4, alc885_mbp_ch4_init },
7581 * Speakers/Woofer/HP = Front
7584 static struct hda_verb alc885_mb5_ch2_init[] = {
7585 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7586 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7592 * Speakers/HP = Front
7596 static struct hda_verb alc885_mb5_ch6_init[] = {
7597 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7598 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7599 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7603 static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
7604 { 2, alc885_mb5_ch2_init },
7605 { 6, alc885_mb5_ch6_init },
7608 #define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
7613 static struct hda_verb alc883_4ST_ch2_init[] = {
7614 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7615 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7616 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7617 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7618 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7619 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7626 static struct hda_verb alc883_4ST_ch4_init[] = {
7627 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7628 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7629 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7630 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7631 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7632 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7633 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7640 static struct hda_verb alc883_4ST_ch6_init[] = {
7641 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7642 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7643 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7644 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7645 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7646 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7647 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7648 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7655 static struct hda_verb alc883_4ST_ch8_init[] = {
7656 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7657 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7658 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7659 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7660 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7661 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
7662 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7663 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7664 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7668 static struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
7669 { 2, alc883_4ST_ch2_init },
7670 { 4, alc883_4ST_ch4_init },
7671 { 6, alc883_4ST_ch6_init },
7672 { 8, alc883_4ST_ch8_init },
7679 static struct hda_verb alc883_3ST_ch2_intel_init[] = {
7680 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7681 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7682 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7683 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7690 static struct hda_verb alc883_3ST_ch4_intel_init[] = {
7691 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
7692 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7693 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7694 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7695 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7702 static struct hda_verb alc883_3ST_ch6_intel_init[] = {
7703 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7704 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7705 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
7706 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7707 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7708 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
7712 static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
7713 { 2, alc883_3ST_ch2_intel_init },
7714 { 4, alc883_3ST_ch4_intel_init },
7715 { 6, alc883_3ST_ch6_intel_init },
7721 static struct hda_verb alc889_ch2_intel_init[] = {
7722 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7723 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
7724 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
7725 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
7726 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7727 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7734 static struct hda_verb alc889_ch6_intel_init[] = {
7735 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7736 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7737 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7738 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7739 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
7740 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
7747 static struct hda_verb alc889_ch8_intel_init[] = {
7748 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
7749 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
7750 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
7751 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
7752 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
7753 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7754 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
7758 static struct hda_channel_mode alc889_8ch_intel_modes[3] = {
7759 { 2, alc889_ch2_intel_init },
7760 { 6, alc889_ch6_intel_init },
7761 { 8, alc889_ch8_intel_init },
7767 static struct hda_verb alc883_sixstack_ch6_init[] = {
7768 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
7769 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7770 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7771 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7778 static struct hda_verb alc883_sixstack_ch8_init[] = {
7779 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7780 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7781 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7782 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
7786 static struct hda_channel_mode alc883_sixstack_modes[2] = {
7787 { 6, alc883_sixstack_ch6_init },
7788 { 8, alc883_sixstack_ch8_init },
7792 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
7793 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
7795 static struct snd_kcontrol_new alc882_base_mixer[] = {
7796 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7797 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7798 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
7799 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
7800 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
7801 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
7802 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
7803 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
7804 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
7805 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
7806 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7807 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7808 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7809 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7810 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7811 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7812 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7813 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7814 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7815 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7816 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7820 /* Macbook Air 2,1 same control for HP and internal Speaker */
7822 static struct snd_kcontrol_new alc885_mba21_mixer[] = {
7823 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7824 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT),
7829 static struct snd_kcontrol_new alc885_mbp3_mixer[] = {
7830 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7831 HDA_BIND_MUTE ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7832 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7833 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0e, 0x02, HDA_INPUT),
7834 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7835 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7836 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7837 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
7838 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
7839 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
7840 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
7844 static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7845 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7846 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7847 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7848 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7849 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7850 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7851 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7852 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7853 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7854 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7855 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7856 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7857 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7858 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0x00, HDA_INPUT),
7862 static struct snd_kcontrol_new alc885_macmini3_mixer[] = {
7863 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7864 HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
7865 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
7866 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7867 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7868 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7869 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7870 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7871 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7872 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7873 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
7877 static struct snd_kcontrol_new alc885_imac91_mixer[] = {
7878 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
7879 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT),
7884 static struct snd_kcontrol_new alc882_w2jc_mixer[] = {
7885 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7886 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7887 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7888 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7889 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7890 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7891 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7892 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7893 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7897 static struct snd_kcontrol_new alc882_targa_mixer[] = {
7898 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7899 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
7900 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
7901 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7902 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7903 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7904 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7905 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7906 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7907 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7908 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
7909 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
7910 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
7914 /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
7915 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
7917 static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
7918 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7919 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
7920 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7921 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
7922 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7923 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7924 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7925 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7926 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
7927 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
7928 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7929 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7930 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7934 static struct snd_kcontrol_new alc882_asus_a7m_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_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
7938 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
7939 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
7940 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7941 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7942 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7943 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
7944 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7948 static struct snd_kcontrol_new alc882_chmode_mixer[] = {
7950 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7951 .name = "Channel Mode",
7952 .info = alc_ch_mode_info,
7953 .get = alc_ch_mode_get,
7954 .put = alc_ch_mode_put,
7959 static struct hda_verb alc882_base_init_verbs[] = {
7960 /* Front mixer: unmute input/output amp left and right (volume = 0) */
7961 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7962 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7964 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7965 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7967 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7968 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7970 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
7971 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
7973 /* Front Pin: output 0 (0x0c) */
7974 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7975 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7976 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
7977 /* Rear Pin: output 1 (0x0d) */
7978 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7979 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7980 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
7981 /* CLFE Pin: output 2 (0x0e) */
7982 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7983 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7984 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
7985 /* Side Pin: output 3 (0x0f) */
7986 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7987 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7988 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
7989 /* Mic (rear) pin: input vref at 80% */
7990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7991 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7992 /* Front Mic pin: input vref at 80% */
7993 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7994 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7995 /* Line In pin: input */
7996 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7997 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7998 /* Line-2 In: Headphone output (output 0 - 0x0c) */
7999 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8000 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8001 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
8002 /* CD pin widget for input */
8003 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8005 /* FIXME: use matrix-type input source selection */
8006 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8008 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8010 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8011 /* ADC2: mute amp left and right */
8012 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8013 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8014 /* ADC3: mute amp left and right */
8015 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8016 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8021 static struct hda_verb alc882_adc1_init_verbs[] = {
8022 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8023 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8024 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8025 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8026 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8027 /* ADC1: mute amp left and right */
8028 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8029 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8033 static struct hda_verb alc882_eapd_verbs[] = {
8034 /* change to EAPD mode */
8035 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8036 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
8040 static struct hda_verb alc889_eapd_verbs[] = {
8041 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
8042 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
8046 static struct hda_verb alc_hp15_unsol_verbs[] = {
8047 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
8048 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8052 static struct hda_verb alc885_init_verbs[] = {
8053 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8054 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8055 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8057 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8058 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8060 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8061 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8063 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8064 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8066 /* Front HP Pin: output 0 (0x0c) */
8067 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8068 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8069 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8070 /* Front Pin: output 0 (0x0c) */
8071 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8072 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8073 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8074 /* Rear Pin: output 1 (0x0d) */
8075 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8076 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8077 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
8078 /* CLFE Pin: output 2 (0x0e) */
8079 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8080 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8081 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
8082 /* Side Pin: output 3 (0x0f) */
8083 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8084 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8085 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
8086 /* Mic (rear) pin: input vref at 80% */
8087 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8088 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8089 /* Front Mic pin: input vref at 80% */
8090 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8091 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8092 /* Line In pin: input */
8093 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8094 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8096 /* Mixer elements: 0x18, , 0x1a, 0x1b */
8098 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8103 /* ADC2: mute amp left and right */
8104 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8105 /* ADC3: mute amp left and right */
8106 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8111 static struct hda_verb alc885_init_input_verbs[] = {
8112 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8113 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
8114 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
8119 /* Unmute Selector 24h and set the default input to front mic */
8120 static struct hda_verb alc889_init_input_verbs[] = {
8121 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
8122 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8127 #define alc883_init_verbs alc882_base_init_verbs
8130 static struct snd_kcontrol_new alc882_macpro_mixer[] = {
8131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8132 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
8134 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
8135 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
8136 /* FIXME: this looks suspicious...
8137 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
8138 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
8143 static struct hda_verb alc882_macpro_init_verbs[] = {
8144 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8146 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8147 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8148 /* Front Pin: output 0 (0x0c) */
8149 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8150 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8151 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8152 /* Front Mic pin: input vref at 80% */
8153 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8154 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8155 /* Speaker: output */
8156 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8157 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8158 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
8159 /* Headphone output (output 0 - 0x0c) */
8160 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8161 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8162 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8164 /* FIXME: use matrix-type input source selection */
8165 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8166 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8167 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8168 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8169 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8170 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8172 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8173 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8174 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8175 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8177 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8178 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8179 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8180 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8181 /* ADC1: mute amp left and right */
8182 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8183 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8184 /* ADC2: mute amp left and right */
8185 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8186 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8187 /* ADC3: mute amp left and right */
8188 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8189 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8195 static struct hda_verb alc885_mb5_init_verbs[] = {
8197 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8198 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8199 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8200 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8202 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8203 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8204 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8205 /* Surround mixer */
8206 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8207 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8208 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8210 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8211 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8212 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8214 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8215 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8216 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8217 /* Front Pin (0x0c) */
8218 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8219 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8220 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8221 /* LFE Pin (0x0e) */
8222 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8223 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8224 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8226 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8227 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8228 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8229 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8230 /* Front Mic pin: input vref at 80% */
8231 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8232 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8234 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8235 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
8238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
8239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
8244 static struct hda_verb alc885_macmini3_init_verbs[] = {
8246 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8247 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8248 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8249 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8251 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8252 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8253 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8254 /* Surround mixer */
8255 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8257 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8259 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8260 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8261 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8263 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8264 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8265 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8266 /* Front Pin (0x0c) */
8267 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8268 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8269 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8270 /* LFE Pin (0x0e) */
8271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01},
8272 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8273 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02},
8275 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8276 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8277 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
8278 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8280 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8281 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8283 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8284 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8285 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8291 static struct hda_verb alc885_mba21_init_verbs[] = {
8292 /*Internal and HP Speaker Mixer*/
8293 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8296 /*Internal Speaker Pin (0x0c)*/
8297 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8298 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8299 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8300 /* HP Pin: output 0 (0x0e) */
8301 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8302 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8303 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8304 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8305 /* Line in (is hp when jack connected)*/
8306 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8307 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8313 /* Macbook Pro rev3 */
8314 static struct hda_verb alc885_mbp3_init_verbs[] = {
8315 /* Front mixer: unmute input/output amp left and right (volume = 0) */
8316 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8317 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8318 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8320 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8322 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8324 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8325 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8326 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8327 /* Front Pin: output 0 (0x0c) */
8328 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8329 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8330 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8331 /* HP Pin: output 0 (0x0e) */
8332 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4},
8333 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8334 {0x15, AC_VERB_SET_CONNECT_SEL, 0x02},
8335 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8336 /* Mic (rear) pin: input vref at 80% */
8337 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8338 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8339 /* Front Mic pin: input vref at 80% */
8340 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8341 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8342 /* Line In pin: use output 1 when in LineOut mode */
8343 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
8344 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8345 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
8347 /* FIXME: use matrix-type input source selection */
8348 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8349 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
8350 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8351 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8355 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8356 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8357 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8358 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8360 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8361 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8362 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8363 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8364 /* ADC1: mute amp left and right */
8365 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8366 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8367 /* ADC2: mute amp left and right */
8368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8369 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8370 /* ADC3: mute amp left and right */
8371 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8372 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8378 static struct hda_verb alc885_imac91_init_verbs[] = {
8379 /* Internal Speaker Pin (0x0c) */
8380 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8381 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8382 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8383 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) },
8384 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8385 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8387 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8388 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8389 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8390 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)},
8392 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50},
8393 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8394 /* Front Mic pin: input vref at 80% */
8395 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8396 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8398 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8399 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8400 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8401 /* Line-Out mixer: unmute input/output amp left and right (volume = 0) */
8402 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8403 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8404 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
8405 /* 0x24 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8406 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8410 /* 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8411 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8415 /* 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In */
8416 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
8418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
8419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
8420 /* 0x07 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8421 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8422 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
8423 /* 0x08 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8424 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8425 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8426 /* 0x09 [Audio Input] wcaps 0x10011b: Stereo Amp-In */
8427 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
8428 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8432 /* iMac 24 mixer. */
8433 static struct snd_kcontrol_new alc885_imac24_mixer[] = {
8434 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
8435 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
8439 /* iMac 24 init verbs. */
8440 static struct hda_verb alc885_imac24_init_verbs[] = {
8441 /* Internal speakers: output 0 (0x0c) */
8442 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8443 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8444 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
8445 /* Internal speakers: output 0 (0x0c) */
8446 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8447 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8448 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8449 /* Headphone: output 0 (0x0c) */
8450 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8451 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8452 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
8453 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8454 /* Front Mic: input vref at 80% */
8455 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
8456 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
8460 /* Toggle speaker-output according to the hp-jack state */
8461 static void alc885_imac24_setup(struct hda_codec *codec)
8463 struct alc_spec *spec = codec->spec;
8465 spec->autocfg.hp_pins[0] = 0x14;
8466 spec->autocfg.speaker_pins[0] = 0x18;
8467 spec->autocfg.speaker_pins[1] = 0x1a;
8470 #define alc885_mb5_setup alc885_imac24_setup
8471 #define alc885_macmini3_setup alc885_imac24_setup
8473 /* Macbook Air 2,1 */
8474 static void alc885_mba21_setup(struct hda_codec *codec)
8476 struct alc_spec *spec = codec->spec;
8478 spec->autocfg.hp_pins[0] = 0x14;
8479 spec->autocfg.speaker_pins[0] = 0x18;
8484 static void alc885_mbp3_setup(struct hda_codec *codec)
8486 struct alc_spec *spec = codec->spec;
8488 spec->autocfg.hp_pins[0] = 0x15;
8489 spec->autocfg.speaker_pins[0] = 0x14;
8492 static void alc885_imac91_setup(struct hda_codec *codec)
8494 struct alc_spec *spec = codec->spec;
8496 spec->autocfg.hp_pins[0] = 0x14;
8497 spec->autocfg.speaker_pins[0] = 0x18;
8498 spec->autocfg.speaker_pins[1] = 0x1a;
8501 static struct hda_verb alc882_targa_verbs[] = {
8502 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8503 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8505 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8506 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8508 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8509 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8510 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8512 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8516 /* toggle speaker-output according to the hp-jack state */
8517 static void alc882_targa_automute(struct hda_codec *codec)
8519 struct alc_spec *spec = codec->spec;
8520 alc_automute_amp(codec);
8521 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
8522 spec->jack_present ? 1 : 3);
8525 static void alc882_targa_setup(struct hda_codec *codec)
8527 struct alc_spec *spec = codec->spec;
8529 spec->autocfg.hp_pins[0] = 0x14;
8530 spec->autocfg.speaker_pins[0] = 0x1b;
8533 static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
8535 if ((res >> 26) == ALC880_HP_EVENT)
8536 alc882_targa_automute(codec);
8539 static struct hda_verb alc882_asus_a7j_verbs[] = {
8540 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8541 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8543 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8544 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8545 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8547 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8548 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8549 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8551 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8552 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8553 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8557 static struct hda_verb alc882_asus_a7m_verbs[] = {
8558 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8559 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8562 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8563 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
8565 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8566 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8567 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
8569 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
8570 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
8571 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
8575 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
8577 unsigned int gpiostate, gpiomask, gpiodir;
8579 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
8580 AC_VERB_GET_GPIO_DATA, 0);
8583 gpiostate |= (1 << pin);
8585 gpiostate &= ~(1 << pin);
8587 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
8588 AC_VERB_GET_GPIO_MASK, 0);
8589 gpiomask |= (1 << pin);
8591 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
8592 AC_VERB_GET_GPIO_DIRECTION, 0);
8593 gpiodir |= (1 << pin);
8596 snd_hda_codec_write(codec, codec->afg, 0,
8597 AC_VERB_SET_GPIO_MASK, gpiomask);
8598 snd_hda_codec_write(codec, codec->afg, 0,
8599 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
8603 snd_hda_codec_write(codec, codec->afg, 0,
8604 AC_VERB_SET_GPIO_DATA, gpiostate);
8607 /* set up GPIO at initialization */
8608 static void alc885_macpro_init_hook(struct hda_codec *codec)
8610 alc882_gpio_mute(codec, 0, 0);
8611 alc882_gpio_mute(codec, 1, 0);
8614 /* set up GPIO and update auto-muting at initialization */
8615 static void alc885_imac24_init_hook(struct hda_codec *codec)
8617 alc885_macpro_init_hook(codec);
8618 alc_automute_amp(codec);
8622 * generic initialization of ADC, input mixers and output mixers
8624 static struct hda_verb alc883_auto_init_verbs[] = {
8626 * Unmute ADC0-2 and set the default input to mic-in
8628 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
8629 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8630 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
8631 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8634 * Set up output mixers (0x0c - 0x0f)
8636 /* set vol=0 to output mixers */
8637 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8638 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8639 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8640 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
8641 /* set up input amps for analog loopback */
8642 /* Amp Indices: DAC = 0, mixer = 1 */
8643 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8645 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8647 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8649 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8651 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8652 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8654 /* FIXME: use matrix-type input source selection */
8655 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
8657 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8659 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8663 /* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
8664 static struct hda_verb alc889A_mb31_ch2_init[] = {
8665 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8666 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8667 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8668 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8672 /* 4ch mode (Speaker:front, Subwoofer:CLFE, Line:CLFE, Headphones:front) */
8673 static struct hda_verb alc889A_mb31_ch4_init[] = {
8674 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
8675 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8676 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8677 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8681 /* 5ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:rear) */
8682 static struct hda_verb alc889A_mb31_ch5_init[] = {
8683 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as rear */
8684 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Subwoofer on */
8685 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Line as input */
8686 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Line off */
8690 /* 6ch mode (Speaker:front, Subwoofer:off, Line:CLFE, Headphones:Rear) */
8691 static struct hda_verb alc889A_mb31_ch6_init[] = {
8692 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* HP as front */
8693 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Subwoofer off */
8694 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Line as output */
8695 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Line on */
8699 static struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
8700 { 2, alc889A_mb31_ch2_init },
8701 { 4, alc889A_mb31_ch4_init },
8702 { 5, alc889A_mb31_ch5_init },
8703 { 6, alc889A_mb31_ch6_init },
8706 static struct hda_verb alc883_medion_eapd_verbs[] = {
8707 /* eanable EAPD on medion laptop */
8708 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
8709 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
8713 #define alc883_base_mixer alc882_base_mixer
8715 static struct snd_kcontrol_new alc883_mitac_mixer[] = {
8716 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8717 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8718 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8719 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8720 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8721 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8722 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8723 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8724 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8725 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8726 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8727 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8728 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8732 static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8733 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8734 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8735 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8736 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8737 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8738 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8739 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8740 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8741 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8742 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8746 static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8747 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8748 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8749 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8750 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8751 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8752 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8753 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8754 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8755 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8756 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8760 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8761 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8762 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8763 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8764 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8765 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8766 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8767 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8768 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8769 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8770 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8771 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8772 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8773 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8777 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
8778 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8779 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8780 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8781 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8782 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8783 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8784 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8785 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8786 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8787 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8788 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8789 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8790 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8791 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8792 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8793 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8794 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8795 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8796 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8800 static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
8801 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8802 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8803 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8804 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8805 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8807 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8808 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8809 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8810 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8811 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8812 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8813 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8814 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8815 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8816 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
8817 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8818 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8819 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8820 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8824 static struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
8825 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8826 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8827 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8828 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8829 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
8831 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8832 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8833 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8834 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8835 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
8836 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8837 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8838 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8839 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
8840 HDA_CODEC_VOLUME("Mic Boost", 0x1b, 0, HDA_INPUT),
8841 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
8842 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8843 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT),
8844 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8848 static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
8849 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8850 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8851 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8852 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8853 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8854 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8855 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8856 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8857 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8858 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8859 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8860 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8861 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8862 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8863 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8864 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8865 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8866 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
8867 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8871 static struct snd_kcontrol_new alc883_targa_mixer[] = {
8872 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8873 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8874 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8875 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8876 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8877 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
8878 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
8879 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
8880 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
8881 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
8882 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8883 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8884 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8885 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8886 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8887 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8888 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8892 static struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
8893 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8894 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8895 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8896 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8897 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8898 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8899 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8900 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8901 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8902 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8903 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8904 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8908 static struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
8909 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
8910 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
8911 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8912 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
8913 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8917 static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
8918 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8919 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8920 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8921 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8922 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
8923 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8924 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8925 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8929 static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
8930 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8931 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
8932 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8933 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8934 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8935 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8936 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8937 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8938 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8942 static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
8943 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8944 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8945 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8946 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
8947 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
8948 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8949 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8950 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8951 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8955 static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
8956 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8957 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8958 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
8959 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
8960 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
8961 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
8965 static struct hda_verb alc883_medion_wim2160_verbs[] = {
8966 /* Unmute front mixer */
8967 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
8968 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
8970 /* Set speaker pin to front mixer */
8971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
8973 /* Init headphone pin */
8974 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
8975 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
8976 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
8977 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
8982 /* toggle speaker-output according to the hp-jack state */
8983 static void alc883_medion_wim2160_setup(struct hda_codec *codec)
8985 struct alc_spec *spec = codec->spec;
8987 spec->autocfg.hp_pins[0] = 0x1a;
8988 spec->autocfg.speaker_pins[0] = 0x15;
8991 static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
8992 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8993 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8994 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
8995 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
8996 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
8997 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8998 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
8999 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9003 static struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
9004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9005 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9006 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9007 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9008 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9009 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9010 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9011 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9012 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9016 static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
9017 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9018 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9019 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
9020 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
9021 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
9022 0x0d, 1, 0x0, HDA_OUTPUT),
9023 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
9024 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
9025 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
9026 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
9027 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
9028 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
9029 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
9030 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9031 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9032 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9034 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9035 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9036 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
9037 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9041 static struct snd_kcontrol_new alc889A_mb31_mixer[] = {
9043 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
9044 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 0x02, HDA_INPUT),
9045 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT),
9046 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
9047 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x00,
9049 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x02, HDA_INPUT),
9050 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x00, HDA_OUTPUT),
9051 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x02, HDA_INPUT),
9052 /* Output switches */
9053 HDA_CODEC_MUTE("Enable Speaker", 0x14, 0x00, HDA_OUTPUT),
9054 HDA_CODEC_MUTE("Enable Headphones", 0x15, 0x00, HDA_OUTPUT),
9055 HDA_CODEC_MUTE_MONO("Enable LFE", 0x16, 2, 0x00, HDA_OUTPUT),
9057 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT),
9058 HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT),
9060 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT),
9061 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT),
9062 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9063 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9067 static struct snd_kcontrol_new alc883_vaiott_mixer[] = {
9068 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9069 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9070 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9071 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9072 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
9073 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9077 static struct hda_bind_ctls alc883_bind_cap_vol = {
9078 .ops = &snd_hda_bind_vol,
9080 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9081 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9086 static struct hda_bind_ctls alc883_bind_cap_switch = {
9087 .ops = &snd_hda_bind_sw,
9089 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
9090 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
9095 static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
9096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
9098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
9099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
9100 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
9101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9102 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
9103 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9107 static struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
9108 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
9109 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
9111 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9112 /* .name = "Capture Source", */
9113 .name = "Input Source",
9115 .info = alc_mux_enum_info,
9116 .get = alc_mux_enum_get,
9117 .put = alc_mux_enum_put,
9122 static struct snd_kcontrol_new alc883_chmode_mixer[] = {
9124 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9125 .name = "Channel Mode",
9126 .info = alc_ch_mode_info,
9127 .get = alc_ch_mode_get,
9128 .put = alc_ch_mode_put,
9133 /* toggle speaker-output according to the hp-jack state */
9134 static void alc883_mitac_setup(struct hda_codec *codec)
9136 struct alc_spec *spec = codec->spec;
9138 spec->autocfg.hp_pins[0] = 0x15;
9139 spec->autocfg.speaker_pins[0] = 0x14;
9140 spec->autocfg.speaker_pins[1] = 0x17;
9143 /* auto-toggle front mic */
9145 static void alc883_mitac_mic_automute(struct hda_codec *codec)
9147 unsigned char bits = snd_hda_jack_detect(codec, 0x18) ? HDA_AMP_MUTE : 0;
9149 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
9153 static struct hda_verb alc883_mitac_verbs[] = {
9155 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9156 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9158 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9159 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9161 /* enable unsolicited event */
9162 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9163 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */
9168 static struct hda_verb alc883_clevo_m540r_verbs[] = {
9170 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9171 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9173 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
9175 /* enable unsolicited event */
9177 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9178 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9184 static struct hda_verb alc883_clevo_m720_verbs[] = {
9186 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9187 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9189 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
9190 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9192 /* enable unsolicited event */
9193 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9194 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9199 static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
9201 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9202 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9204 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
9205 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9207 /* enable unsolicited event */
9208 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9213 static struct hda_verb alc883_targa_verbs[] = {
9214 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9215 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9217 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9218 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9220 /* Connect Line-Out side jack (SPDIF) to Side */
9221 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9222 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9223 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
9224 /* Connect Mic jack to CLFE */
9225 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9226 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9227 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
9228 /* Connect Line-in jack to Surround */
9229 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9230 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9231 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
9232 /* Connect HP out jack to Front */
9233 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9234 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9235 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9237 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9242 static struct hda_verb alc883_lenovo_101e_verbs[] = {
9243 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9244 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN},
9245 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN},
9249 static struct hda_verb alc883_lenovo_nb0763_verbs[] = {
9250 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9251 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9252 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9253 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9257 static struct hda_verb alc888_lenovo_ms7195_verbs[] = {
9258 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9259 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9260 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9261 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN},
9262 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9266 static struct hda_verb alc883_haier_w66_verbs[] = {
9267 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9268 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9270 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9272 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
9273 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9274 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9275 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9279 static struct hda_verb alc888_lenovo_sky_verbs[] = {
9280 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9281 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9282 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9284 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9285 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9286 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
9287 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9291 static struct hda_verb alc888_6st_dell_verbs[] = {
9292 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9296 static struct hda_verb alc883_vaiott_verbs[] = {
9298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9299 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9301 /* enable unsolicited event */
9302 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9307 static void alc888_3st_hp_setup(struct hda_codec *codec)
9309 struct alc_spec *spec = codec->spec;
9311 spec->autocfg.hp_pins[0] = 0x1b;
9312 spec->autocfg.speaker_pins[0] = 0x14;
9313 spec->autocfg.speaker_pins[1] = 0x16;
9314 spec->autocfg.speaker_pins[2] = 0x18;
9317 static struct hda_verb alc888_3st_hp_verbs[] = {
9318 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
9319 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
9320 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
9321 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9328 static struct hda_verb alc888_3st_hp_2ch_init[] = {
9329 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9330 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9331 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
9332 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9339 static struct hda_verb alc888_3st_hp_4ch_init[] = {
9340 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
9341 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
9342 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9343 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9344 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9351 static struct hda_verb alc888_3st_hp_6ch_init[] = {
9352 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9353 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9354 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
9355 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
9356 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
9357 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
9361 static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9362 { 2, alc888_3st_hp_2ch_init },
9363 { 4, alc888_3st_hp_4ch_init },
9364 { 6, alc888_3st_hp_6ch_init },
9367 /* toggle front-jack and RCA according to the hp-jack state */
9368 static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9370 unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9372 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9373 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9374 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9375 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9378 /* toggle RCA according to the front-jack state */
9379 static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9381 unsigned int present = snd_hda_jack_detect(codec, 0x14);
9383 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9384 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9387 static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9390 if ((res >> 26) == ALC880_HP_EVENT)
9391 alc888_lenovo_ms7195_front_automute(codec);
9392 if ((res >> 26) == ALC880_FRONT_EVENT)
9393 alc888_lenovo_ms7195_rca_automute(codec);
9396 static struct hda_verb alc883_medion_md2_verbs[] = {
9397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9398 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9400 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9402 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9406 /* toggle speaker-output according to the hp-jack state */
9407 static void alc883_medion_md2_setup(struct hda_codec *codec)
9409 struct alc_spec *spec = codec->spec;
9411 spec->autocfg.hp_pins[0] = 0x14;
9412 spec->autocfg.speaker_pins[0] = 0x15;
9415 /* toggle speaker-output according to the hp-jack state */
9416 #define alc883_targa_init_hook alc882_targa_init_hook
9417 #define alc883_targa_unsol_event alc882_targa_unsol_event
9419 static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
9421 unsigned int present;
9423 present = snd_hda_jack_detect(codec, 0x18);
9424 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
9425 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9428 static void alc883_clevo_m720_setup(struct hda_codec *codec)
9430 struct alc_spec *spec = codec->spec;
9432 spec->autocfg.hp_pins[0] = 0x15;
9433 spec->autocfg.speaker_pins[0] = 0x14;
9436 static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
9438 alc_automute_amp(codec);
9439 alc883_clevo_m720_mic_automute(codec);
9442 static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
9445 switch (res >> 26) {
9446 case ALC880_MIC_EVENT:
9447 alc883_clevo_m720_mic_automute(codec);
9450 alc_automute_amp_unsol_event(codec, res);
9455 /* toggle speaker-output according to the hp-jack state */
9456 static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
9458 struct alc_spec *spec = codec->spec;
9460 spec->autocfg.hp_pins[0] = 0x14;
9461 spec->autocfg.speaker_pins[0] = 0x15;
9464 static void alc883_haier_w66_setup(struct hda_codec *codec)
9466 struct alc_spec *spec = codec->spec;
9468 spec->autocfg.hp_pins[0] = 0x1b;
9469 spec->autocfg.speaker_pins[0] = 0x14;
9472 static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
9474 int bits = snd_hda_jack_detect(codec, 0x14) ? HDA_AMP_MUTE : 0;
9476 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9477 HDA_AMP_MUTE, bits);
9480 static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
9482 int bits = snd_hda_jack_detect(codec, 0x1b) ? HDA_AMP_MUTE : 0;
9484 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9485 HDA_AMP_MUTE, bits);
9486 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9487 HDA_AMP_MUTE, bits);
9490 static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
9493 if ((res >> 26) == ALC880_HP_EVENT)
9494 alc883_lenovo_101e_all_automute(codec);
9495 if ((res >> 26) == ALC880_FRONT_EVENT)
9496 alc883_lenovo_101e_ispeaker_automute(codec);
9499 /* toggle speaker-output according to the hp-jack state */
9500 static void alc883_acer_aspire_setup(struct hda_codec *codec)
9502 struct alc_spec *spec = codec->spec;
9504 spec->autocfg.hp_pins[0] = 0x14;
9505 spec->autocfg.speaker_pins[0] = 0x15;
9506 spec->autocfg.speaker_pins[1] = 0x16;
9509 static struct hda_verb alc883_acer_eapd_verbs[] = {
9510 /* HP Pin: output 0 (0x0c) */
9511 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9512 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
9513 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
9514 /* Front Pin: output 0 (0x0c) */
9515 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9516 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9517 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9518 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
9519 /* eanable EAPD on medion laptop */
9520 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
9521 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
9522 /* enable unsolicited event */
9523 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9527 static struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
9528 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
9529 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
9530 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9534 static void alc888_6st_dell_setup(struct hda_codec *codec)
9536 struct alc_spec *spec = codec->spec;
9538 spec->autocfg.hp_pins[0] = 0x1b;
9539 spec->autocfg.speaker_pins[0] = 0x14;
9540 spec->autocfg.speaker_pins[1] = 0x15;
9541 spec->autocfg.speaker_pins[2] = 0x16;
9542 spec->autocfg.speaker_pins[3] = 0x17;
9545 static void alc888_lenovo_sky_setup(struct hda_codec *codec)
9547 struct alc_spec *spec = codec->spec;
9549 spec->autocfg.hp_pins[0] = 0x1b;
9550 spec->autocfg.speaker_pins[0] = 0x14;
9551 spec->autocfg.speaker_pins[1] = 0x15;
9552 spec->autocfg.speaker_pins[2] = 0x16;
9553 spec->autocfg.speaker_pins[3] = 0x17;
9554 spec->autocfg.speaker_pins[4] = 0x1a;
9557 static void alc883_vaiott_setup(struct hda_codec *codec)
9559 struct alc_spec *spec = codec->spec;
9561 spec->autocfg.hp_pins[0] = 0x15;
9562 spec->autocfg.speaker_pins[0] = 0x14;
9563 spec->autocfg.speaker_pins[1] = 0x17;
9566 static struct hda_verb alc888_asus_m90v_verbs[] = {
9567 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9568 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9569 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
9570 /* enable unsolicited event */
9571 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9572 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
9576 static void alc883_mode2_setup(struct hda_codec *codec)
9578 struct alc_spec *spec = codec->spec;
9580 spec->autocfg.hp_pins[0] = 0x1b;
9581 spec->autocfg.speaker_pins[0] = 0x14;
9582 spec->autocfg.speaker_pins[1] = 0x15;
9583 spec->autocfg.speaker_pins[2] = 0x16;
9584 spec->ext_mic.pin = 0x18;
9585 spec->int_mic.pin = 0x19;
9586 spec->ext_mic.mux_idx = 0;
9587 spec->int_mic.mux_idx = 1;
9591 static struct hda_verb alc888_asus_eee1601_verbs[] = {
9592 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
9593 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
9594 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
9595 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9596 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9597 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
9598 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
9599 /* enable unsolicited event */
9600 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9604 static void alc883_eee1601_inithook(struct hda_codec *codec)
9606 struct alc_spec *spec = codec->spec;
9608 spec->autocfg.hp_pins[0] = 0x14;
9609 spec->autocfg.speaker_pins[0] = 0x1b;
9610 alc_automute_pin(codec);
9613 static struct hda_verb alc889A_mb31_verbs[] = {
9614 /* Init rear pin (used as headphone output) */
9615 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
9616 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Connect to front */
9617 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
9618 /* Init line pin (used as output in 4ch and 6ch mode) */
9619 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Connect to CLFE */
9620 /* Init line 2 pin (used as headphone out by default) */
9621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* Use as input */
9622 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Mute output */
9626 /* Mute speakers according to the headphone jack state */
9627 static void alc889A_mb31_automute(struct hda_codec *codec)
9629 unsigned int present;
9631 /* Mute only in 2ch or 4ch mode */
9632 if (snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_CONNECT_SEL, 0)
9634 present = snd_hda_jack_detect(codec, 0x15);
9635 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9636 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9637 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
9638 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9642 static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
9644 if ((res >> 26) == ALC880_HP_EVENT)
9645 alc889A_mb31_automute(codec);
9649 #ifdef CONFIG_SND_HDA_POWER_SAVE
9650 #define alc882_loopbacks alc880_loopbacks
9653 /* pcm configuration: identical with ALC880 */
9654 #define alc882_pcm_analog_playback alc880_pcm_analog_playback
9655 #define alc882_pcm_analog_capture alc880_pcm_analog_capture
9656 #define alc882_pcm_digital_playback alc880_pcm_digital_playback
9657 #define alc882_pcm_digital_capture alc880_pcm_digital_capture
9659 static hda_nid_t alc883_slave_dig_outs[] = {
9660 ALC1200_DIGOUT_NID, 0,
9663 static hda_nid_t alc1200_slave_dig_outs[] = {
9664 ALC883_DIGOUT_NID, 0,
9668 * configuration and preset
9670 static const char *alc882_models[ALC882_MODEL_LAST] = {
9671 [ALC882_3ST_DIG] = "3stack-dig",
9672 [ALC882_6ST_DIG] = "6stack-dig",
9673 [ALC882_ARIMA] = "arima",
9674 [ALC882_W2JC] = "w2jc",
9675 [ALC882_TARGA] = "targa",
9676 [ALC882_ASUS_A7J] = "asus-a7j",
9677 [ALC882_ASUS_A7M] = "asus-a7m",
9678 [ALC885_MACPRO] = "macpro",
9679 [ALC885_MB5] = "mb5",
9680 [ALC885_MACMINI3] = "macmini3",
9681 [ALC885_MBA21] = "mba21",
9682 [ALC885_MBP3] = "mbp3",
9683 [ALC885_IMAC24] = "imac24",
9684 [ALC885_IMAC91] = "imac91",
9685 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
9686 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
9687 [ALC883_3ST_6ch] = "3stack-6ch",
9688 [ALC883_6ST_DIG] = "alc883-6stack-dig",
9689 [ALC883_TARGA_DIG] = "targa-dig",
9690 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
9691 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
9692 [ALC883_ACER] = "acer",
9693 [ALC883_ACER_ASPIRE] = "acer-aspire",
9694 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
9695 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
9696 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
9697 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
9698 [ALC883_MEDION] = "medion",
9699 [ALC883_MEDION_MD2] = "medion-md2",
9700 [ALC883_MEDION_WIM2160] = "medion-wim2160",
9701 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
9702 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
9703 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
9704 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
9705 [ALC888_LENOVO_SKY] = "lenovo-sky",
9706 [ALC883_HAIER_W66] = "haier-w66",
9707 [ALC888_3ST_HP] = "3stack-hp",
9708 [ALC888_6ST_DELL] = "6stack-dell",
9709 [ALC883_MITAC] = "mitac",
9710 [ALC883_CLEVO_M540R] = "clevo-m540r",
9711 [ALC883_CLEVO_M720] = "clevo-m720",
9712 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
9713 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
9714 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
9715 [ALC889A_INTEL] = "intel-alc889a",
9716 [ALC889_INTEL] = "intel-x58",
9717 [ALC1200_ASUS_P5Q] = "asus-p5q",
9718 [ALC889A_MB31] = "mb31",
9719 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
9720 [ALC882_AUTO] = "auto",
9723 static struct snd_pci_quirk alc882_cfg_tbl[] = {
9724 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
9726 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
9727 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
9728 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
9729 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
9730 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
9731 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
9732 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
9733 ALC888_ACER_ASPIRE_4930G),
9734 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
9735 ALC888_ACER_ASPIRE_4930G),
9736 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
9737 ALC888_ACER_ASPIRE_8930G),
9738 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
9739 ALC888_ACER_ASPIRE_8930G),
9740 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
9741 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
9742 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
9743 ALC888_ACER_ASPIRE_6530G),
9744 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
9745 ALC888_ACER_ASPIRE_6530G),
9746 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
9747 ALC888_ACER_ASPIRE_7730G),
9748 /* default Acer -- disabled as it causes more problems.
9749 * model=auto should work fine now
9751 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
9753 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
9755 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
9756 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
9757 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
9758 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
9759 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
9760 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
9762 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
9763 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
9764 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
9765 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
9766 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
9767 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
9768 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
9769 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
9770 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
9771 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
9772 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
9774 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
9775 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
9776 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
9777 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
9778 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
9779 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
9780 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
9781 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
9782 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
9784 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
9785 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
9786 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
9787 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
9788 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
9789 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
9790 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
9791 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
9792 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
9793 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
9794 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
9795 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
9796 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
9797 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
9798 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
9799 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
9800 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
9801 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
9802 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
9803 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
9804 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
9805 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
9806 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
9807 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
9808 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
9809 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
9810 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
9811 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
9812 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
9813 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
9814 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
9816 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
9817 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
9818 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
9819 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
9820 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
9821 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
9822 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
9823 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
9824 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
9825 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
9826 ALC883_FUJITSU_PI2515),
9827 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
9828 ALC888_FUJITSU_XA3530),
9829 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
9830 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9831 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9832 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
9833 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
9834 SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2),
9835 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
9836 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
9837 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
9839 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
9840 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
9841 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
9842 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
9843 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
9844 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
9845 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
9850 /* codec SSID table for Intel Mac */
9851 static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9852 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
9853 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
9854 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
9855 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
9856 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
9857 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
9858 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
9859 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
9860 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
9861 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
9862 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
9863 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
9864 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
9865 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9866 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9867 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9868 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9869 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9870 * so apparently no perfect solution yet
9872 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),
9873 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5),
9874 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),
9878 static struct alc_config_preset alc882_presets[] = {
9879 [ALC882_3ST_DIG] = {
9880 .mixers = { alc882_base_mixer },
9881 .init_verbs = { alc882_base_init_verbs,
9882 alc882_adc1_init_verbs },
9883 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9884 .dac_nids = alc882_dac_nids,
9885 .dig_out_nid = ALC882_DIGOUT_NID,
9886 .dig_in_nid = ALC882_DIGIN_NID,
9887 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9888 .channel_mode = alc882_ch_modes,
9890 .input_mux = &alc882_capture_source,
9892 [ALC882_6ST_DIG] = {
9893 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9894 .init_verbs = { alc882_base_init_verbs,
9895 alc882_adc1_init_verbs },
9896 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9897 .dac_nids = alc882_dac_nids,
9898 .dig_out_nid = ALC882_DIGOUT_NID,
9899 .dig_in_nid = ALC882_DIGIN_NID,
9900 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9901 .channel_mode = alc882_sixstack_modes,
9902 .input_mux = &alc882_capture_source,
9905 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
9906 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9907 alc882_eapd_verbs },
9908 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9909 .dac_nids = alc882_dac_nids,
9910 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
9911 .channel_mode = alc882_sixstack_modes,
9912 .input_mux = &alc882_capture_source,
9915 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
9916 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
9917 alc882_eapd_verbs, alc880_gpio1_init_verbs },
9918 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9919 .dac_nids = alc882_dac_nids,
9920 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
9921 .channel_mode = alc880_threestack_modes,
9923 .input_mux = &alc882_capture_source,
9924 .dig_out_nid = ALC882_DIGOUT_NID,
9927 .mixers = { alc885_mba21_mixer },
9928 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
9930 .dac_nids = alc882_dac_nids,
9931 .channel_mode = alc885_mba21_ch_modes,
9932 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
9933 .input_mux = &alc882_capture_source,
9934 .unsol_event = alc_automute_amp_unsol_event,
9935 .setup = alc885_mba21_setup,
9936 .init_hook = alc_automute_amp,
9939 .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },
9940 .init_verbs = { alc885_mbp3_init_verbs,
9941 alc880_gpio1_init_verbs },
9943 .dac_nids = alc882_dac_nids,
9945 .channel_mode = alc885_mbp_4ch_modes,
9946 .num_channel_mode = ARRAY_SIZE(alc885_mbp_4ch_modes),
9947 .input_mux = &alc882_capture_source,
9948 .dig_out_nid = ALC882_DIGOUT_NID,
9949 .dig_in_nid = ALC882_DIGIN_NID,
9950 .unsol_event = alc_automute_amp_unsol_event,
9951 .setup = alc885_mbp3_setup,
9952 .init_hook = alc_automute_amp,
9955 .mixers = { alc885_mb5_mixer, alc882_chmode_mixer },
9956 .init_verbs = { alc885_mb5_init_verbs,
9957 alc880_gpio1_init_verbs },
9958 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9959 .dac_nids = alc882_dac_nids,
9960 .channel_mode = alc885_mb5_6ch_modes,
9961 .num_channel_mode = ARRAY_SIZE(alc885_mb5_6ch_modes),
9962 .input_mux = &mb5_capture_source,
9963 .dig_out_nid = ALC882_DIGOUT_NID,
9964 .dig_in_nid = ALC882_DIGIN_NID,
9965 .unsol_event = alc_automute_amp_unsol_event,
9966 .setup = alc885_mb5_setup,
9967 .init_hook = alc_automute_amp,
9969 [ALC885_MACMINI3] = {
9970 .mixers = { alc885_macmini3_mixer, alc882_chmode_mixer },
9971 .init_verbs = { alc885_macmini3_init_verbs,
9972 alc880_gpio1_init_verbs },
9973 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9974 .dac_nids = alc882_dac_nids,
9975 .channel_mode = alc885_macmini3_6ch_modes,
9976 .num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes),
9977 .input_mux = &macmini3_capture_source,
9978 .dig_out_nid = ALC882_DIGOUT_NID,
9979 .dig_in_nid = ALC882_DIGIN_NID,
9980 .unsol_event = alc_automute_amp_unsol_event,
9981 .setup = alc885_macmini3_setup,
9982 .init_hook = alc_automute_amp,
9985 .mixers = { alc882_macpro_mixer },
9986 .init_verbs = { alc882_macpro_init_verbs },
9987 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
9988 .dac_nids = alc882_dac_nids,
9989 .dig_out_nid = ALC882_DIGOUT_NID,
9990 .dig_in_nid = ALC882_DIGIN_NID,
9991 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
9992 .channel_mode = alc882_ch_modes,
9993 .input_mux = &alc882_capture_source,
9994 .init_hook = alc885_macpro_init_hook,
9997 .mixers = { alc885_imac24_mixer },
9998 .init_verbs = { alc885_imac24_init_verbs },
9999 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10000 .dac_nids = alc882_dac_nids,
10001 .dig_out_nid = ALC882_DIGOUT_NID,
10002 .dig_in_nid = ALC882_DIGIN_NID,
10003 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
10004 .channel_mode = alc882_ch_modes,
10005 .input_mux = &alc882_capture_source,
10006 .unsol_event = alc_automute_amp_unsol_event,
10007 .setup = alc885_imac24_setup,
10008 .init_hook = alc885_imac24_init_hook,
10010 [ALC885_IMAC91] = {
10011 .mixers = {alc885_imac91_mixer},
10012 .init_verbs = { alc885_imac91_init_verbs,
10013 alc880_gpio1_init_verbs },
10014 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10015 .dac_nids = alc882_dac_nids,
10016 .channel_mode = alc885_mba21_ch_modes,
10017 .num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes),
10018 .input_mux = &alc889A_imac91_capture_source,
10019 .dig_out_nid = ALC882_DIGOUT_NID,
10020 .dig_in_nid = ALC882_DIGIN_NID,
10021 .unsol_event = alc_automute_amp_unsol_event,
10022 .setup = alc885_imac91_setup,
10023 .init_hook = alc_automute_amp,
10026 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
10027 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10028 alc880_gpio3_init_verbs, alc882_targa_verbs},
10029 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10030 .dac_nids = alc882_dac_nids,
10031 .dig_out_nid = ALC882_DIGOUT_NID,
10032 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10033 .adc_nids = alc882_adc_nids,
10034 .capsrc_nids = alc882_capsrc_nids,
10035 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10036 .channel_mode = alc882_3ST_6ch_modes,
10038 .input_mux = &alc882_capture_source,
10039 .unsol_event = alc882_targa_unsol_event,
10040 .setup = alc882_targa_setup,
10041 .init_hook = alc882_targa_automute,
10043 [ALC882_ASUS_A7J] = {
10044 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
10045 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10046 alc882_asus_a7j_verbs},
10047 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10048 .dac_nids = alc882_dac_nids,
10049 .dig_out_nid = ALC882_DIGOUT_NID,
10050 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
10051 .adc_nids = alc882_adc_nids,
10052 .capsrc_nids = alc882_capsrc_nids,
10053 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
10054 .channel_mode = alc882_3ST_6ch_modes,
10056 .input_mux = &alc882_capture_source,
10058 [ALC882_ASUS_A7M] = {
10059 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
10060 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
10061 alc882_eapd_verbs, alc880_gpio1_init_verbs,
10062 alc882_asus_a7m_verbs },
10063 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
10064 .dac_nids = alc882_dac_nids,
10065 .dig_out_nid = ALC882_DIGOUT_NID,
10066 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
10067 .channel_mode = alc880_threestack_modes,
10069 .input_mux = &alc882_capture_source,
10071 [ALC883_3ST_2ch_DIG] = {
10072 .mixers = { alc883_3ST_2ch_mixer },
10073 .init_verbs = { alc883_init_verbs },
10074 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10075 .dac_nids = alc883_dac_nids,
10076 .dig_out_nid = ALC883_DIGOUT_NID,
10077 .dig_in_nid = ALC883_DIGIN_NID,
10078 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10079 .channel_mode = alc883_3ST_2ch_modes,
10080 .input_mux = &alc883_capture_source,
10082 [ALC883_3ST_6ch_DIG] = {
10083 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10084 .init_verbs = { alc883_init_verbs },
10085 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10086 .dac_nids = alc883_dac_nids,
10087 .dig_out_nid = ALC883_DIGOUT_NID,
10088 .dig_in_nid = ALC883_DIGIN_NID,
10089 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10090 .channel_mode = alc883_3ST_6ch_modes,
10092 .input_mux = &alc883_capture_source,
10094 [ALC883_3ST_6ch] = {
10095 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10096 .init_verbs = { alc883_init_verbs },
10097 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10098 .dac_nids = alc883_dac_nids,
10099 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10100 .channel_mode = alc883_3ST_6ch_modes,
10102 .input_mux = &alc883_capture_source,
10104 [ALC883_3ST_6ch_INTEL] = {
10105 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
10106 .init_verbs = { alc883_init_verbs },
10107 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10108 .dac_nids = alc883_dac_nids,
10109 .dig_out_nid = ALC883_DIGOUT_NID,
10110 .dig_in_nid = ALC883_DIGIN_NID,
10111 .slave_dig_outs = alc883_slave_dig_outs,
10112 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
10113 .channel_mode = alc883_3ST_6ch_intel_modes,
10115 .input_mux = &alc883_3stack_6ch_intel,
10117 [ALC889A_INTEL] = {
10118 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10119 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
10120 alc_hp15_unsol_verbs },
10121 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10122 .dac_nids = alc883_dac_nids,
10123 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10124 .adc_nids = alc889_adc_nids,
10125 .dig_out_nid = ALC883_DIGOUT_NID,
10126 .dig_in_nid = ALC883_DIGIN_NID,
10127 .slave_dig_outs = alc883_slave_dig_outs,
10128 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10129 .channel_mode = alc889_8ch_intel_modes,
10130 .capsrc_nids = alc889_capsrc_nids,
10131 .input_mux = &alc889_capture_source,
10132 .setup = alc889_automute_setup,
10133 .init_hook = alc_automute_amp,
10134 .unsol_event = alc_automute_amp_unsol_event,
10138 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
10139 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
10140 alc889_eapd_verbs, alc_hp15_unsol_verbs},
10141 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10142 .dac_nids = alc883_dac_nids,
10143 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10144 .adc_nids = alc889_adc_nids,
10145 .dig_out_nid = ALC883_DIGOUT_NID,
10146 .dig_in_nid = ALC883_DIGIN_NID,
10147 .slave_dig_outs = alc883_slave_dig_outs,
10148 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
10149 .channel_mode = alc889_8ch_intel_modes,
10150 .capsrc_nids = alc889_capsrc_nids,
10151 .input_mux = &alc889_capture_source,
10152 .setup = alc889_automute_setup,
10153 .init_hook = alc889_intel_init_hook,
10154 .unsol_event = alc_automute_amp_unsol_event,
10157 [ALC883_6ST_DIG] = {
10158 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10159 .init_verbs = { alc883_init_verbs },
10160 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10161 .dac_nids = alc883_dac_nids,
10162 .dig_out_nid = ALC883_DIGOUT_NID,
10163 .dig_in_nid = ALC883_DIGIN_NID,
10164 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10165 .channel_mode = alc883_sixstack_modes,
10166 .input_mux = &alc883_capture_source,
10168 [ALC883_TARGA_DIG] = {
10169 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
10170 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10171 alc883_targa_verbs},
10172 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10173 .dac_nids = alc883_dac_nids,
10174 .dig_out_nid = ALC883_DIGOUT_NID,
10175 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10176 .channel_mode = alc883_3ST_6ch_modes,
10178 .input_mux = &alc883_capture_source,
10179 .unsol_event = alc883_targa_unsol_event,
10180 .setup = alc882_targa_setup,
10181 .init_hook = alc882_targa_automute,
10183 [ALC883_TARGA_2ch_DIG] = {
10184 .mixers = { alc883_targa_2ch_mixer},
10185 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10186 alc883_targa_verbs},
10187 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10188 .dac_nids = alc883_dac_nids,
10189 .adc_nids = alc883_adc_nids_alt,
10190 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10191 .capsrc_nids = alc883_capsrc_nids,
10192 .dig_out_nid = ALC883_DIGOUT_NID,
10193 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10194 .channel_mode = alc883_3ST_2ch_modes,
10195 .input_mux = &alc883_capture_source,
10196 .unsol_event = alc883_targa_unsol_event,
10197 .setup = alc882_targa_setup,
10198 .init_hook = alc882_targa_automute,
10200 [ALC883_TARGA_8ch_DIG] = {
10201 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
10202 alc883_chmode_mixer },
10203 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
10204 alc883_targa_verbs },
10205 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10206 .dac_nids = alc883_dac_nids,
10207 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10208 .adc_nids = alc883_adc_nids_rev,
10209 .capsrc_nids = alc883_capsrc_nids_rev,
10210 .dig_out_nid = ALC883_DIGOUT_NID,
10211 .dig_in_nid = ALC883_DIGIN_NID,
10212 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
10213 .channel_mode = alc883_4ST_8ch_modes,
10215 .input_mux = &alc883_capture_source,
10216 .unsol_event = alc883_targa_unsol_event,
10217 .setup = alc882_targa_setup,
10218 .init_hook = alc882_targa_automute,
10221 .mixers = { alc883_base_mixer },
10222 /* On TravelMate laptops, GPIO 0 enables the internal speaker
10223 * and the headphone jack. Turn this on and rely on the
10224 * standard mute methods whenever the user wants to turn
10225 * these outputs off.
10227 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
10228 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10229 .dac_nids = alc883_dac_nids,
10230 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10231 .channel_mode = alc883_3ST_2ch_modes,
10232 .input_mux = &alc883_capture_source,
10234 [ALC883_ACER_ASPIRE] = {
10235 .mixers = { alc883_acer_aspire_mixer },
10236 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
10237 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10238 .dac_nids = alc883_dac_nids,
10239 .dig_out_nid = ALC883_DIGOUT_NID,
10240 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10241 .channel_mode = alc883_3ST_2ch_modes,
10242 .input_mux = &alc883_capture_source,
10243 .unsol_event = alc_automute_amp_unsol_event,
10244 .setup = alc883_acer_aspire_setup,
10245 .init_hook = alc_automute_amp,
10247 [ALC888_ACER_ASPIRE_4930G] = {
10248 .mixers = { alc888_base_mixer,
10249 alc883_chmode_mixer },
10250 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10251 alc888_acer_aspire_4930g_verbs },
10252 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10253 .dac_nids = alc883_dac_nids,
10254 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10255 .adc_nids = alc883_adc_nids_rev,
10256 .capsrc_nids = alc883_capsrc_nids_rev,
10257 .dig_out_nid = ALC883_DIGOUT_NID,
10258 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10259 .channel_mode = alc883_3ST_6ch_modes,
10261 .const_channel_count = 6,
10263 ARRAY_SIZE(alc888_2_capture_sources),
10264 .input_mux = alc888_2_capture_sources,
10265 .unsol_event = alc_automute_amp_unsol_event,
10266 .setup = alc888_acer_aspire_4930g_setup,
10267 .init_hook = alc_automute_amp,
10269 [ALC888_ACER_ASPIRE_6530G] = {
10270 .mixers = { alc888_acer_aspire_6530_mixer },
10271 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10272 alc888_acer_aspire_6530g_verbs },
10273 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10274 .dac_nids = alc883_dac_nids,
10275 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10276 .adc_nids = alc883_adc_nids_rev,
10277 .capsrc_nids = alc883_capsrc_nids_rev,
10278 .dig_out_nid = ALC883_DIGOUT_NID,
10279 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10280 .channel_mode = alc883_3ST_2ch_modes,
10282 ARRAY_SIZE(alc888_2_capture_sources),
10283 .input_mux = alc888_acer_aspire_6530_sources,
10284 .unsol_event = alc_automute_amp_unsol_event,
10285 .setup = alc888_acer_aspire_6530g_setup,
10286 .init_hook = alc_automute_amp,
10288 [ALC888_ACER_ASPIRE_8930G] = {
10289 .mixers = { alc889_acer_aspire_8930g_mixer,
10290 alc883_chmode_mixer },
10291 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10292 alc889_acer_aspire_8930g_verbs,
10293 alc889_eapd_verbs},
10294 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10295 .dac_nids = alc883_dac_nids,
10296 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
10297 .adc_nids = alc889_adc_nids,
10298 .capsrc_nids = alc889_capsrc_nids,
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(alc889_capture_sources),
10306 .input_mux = alc889_capture_sources,
10307 .unsol_event = alc_automute_amp_unsol_event,
10308 .setup = alc889_acer_aspire_8930g_setup,
10309 .init_hook = alc_automute_amp,
10310 #ifdef CONFIG_SND_HDA_POWER_SAVE
10311 .power_hook = alc_power_eapd,
10314 [ALC888_ACER_ASPIRE_7730G] = {
10315 .mixers = { alc883_3ST_6ch_mixer,
10316 alc883_chmode_mixer },
10317 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
10318 alc888_acer_aspire_7730G_verbs },
10319 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10320 .dac_nids = alc883_dac_nids,
10321 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10322 .adc_nids = alc883_adc_nids_rev,
10323 .capsrc_nids = alc883_capsrc_nids_rev,
10324 .dig_out_nid = ALC883_DIGOUT_NID,
10325 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10326 .channel_mode = alc883_3ST_6ch_modes,
10328 .const_channel_count = 6,
10329 .input_mux = &alc883_capture_source,
10330 .unsol_event = alc_automute_amp_unsol_event,
10331 .setup = alc888_acer_aspire_6530g_setup,
10332 .init_hook = alc_automute_amp,
10334 [ALC883_MEDION] = {
10335 .mixers = { alc883_fivestack_mixer,
10336 alc883_chmode_mixer },
10337 .init_verbs = { alc883_init_verbs,
10338 alc883_medion_eapd_verbs },
10339 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10340 .dac_nids = alc883_dac_nids,
10341 .adc_nids = alc883_adc_nids_alt,
10342 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10343 .capsrc_nids = alc883_capsrc_nids,
10344 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10345 .channel_mode = alc883_sixstack_modes,
10346 .input_mux = &alc883_capture_source,
10348 [ALC883_MEDION_MD2] = {
10349 .mixers = { alc883_medion_md2_mixer},
10350 .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs},
10351 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10352 .dac_nids = alc883_dac_nids,
10353 .dig_out_nid = ALC883_DIGOUT_NID,
10354 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10355 .channel_mode = alc883_3ST_2ch_modes,
10356 .input_mux = &alc883_capture_source,
10357 .unsol_event = alc_automute_amp_unsol_event,
10358 .setup = alc883_medion_md2_setup,
10359 .init_hook = alc_automute_amp,
10361 [ALC883_MEDION_WIM2160] = {
10362 .mixers = { alc883_medion_wim2160_mixer },
10363 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
10364 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10365 .dac_nids = alc883_dac_nids,
10366 .dig_out_nid = ALC883_DIGOUT_NID,
10367 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10368 .adc_nids = alc883_adc_nids,
10369 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10370 .channel_mode = alc883_3ST_2ch_modes,
10371 .input_mux = &alc883_capture_source,
10372 .unsol_event = alc_automute_amp_unsol_event,
10373 .setup = alc883_medion_wim2160_setup,
10374 .init_hook = alc_automute_amp,
10376 [ALC883_LAPTOP_EAPD] = {
10377 .mixers = { alc883_base_mixer },
10378 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
10379 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10380 .dac_nids = alc883_dac_nids,
10381 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10382 .channel_mode = alc883_3ST_2ch_modes,
10383 .input_mux = &alc883_capture_source,
10385 [ALC883_CLEVO_M540R] = {
10386 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10387 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
10388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10389 .dac_nids = alc883_dac_nids,
10390 .dig_out_nid = ALC883_DIGOUT_NID,
10391 .dig_in_nid = ALC883_DIGIN_NID,
10392 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
10393 .channel_mode = alc883_3ST_6ch_clevo_modes,
10395 .input_mux = &alc883_capture_source,
10396 /* This machine has the hardware HP auto-muting, thus
10397 * we need no software mute via unsol event
10400 [ALC883_CLEVO_M720] = {
10401 .mixers = { alc883_clevo_m720_mixer },
10402 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
10403 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10404 .dac_nids = alc883_dac_nids,
10405 .dig_out_nid = ALC883_DIGOUT_NID,
10406 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10407 .channel_mode = alc883_3ST_2ch_modes,
10408 .input_mux = &alc883_capture_source,
10409 .unsol_event = alc883_clevo_m720_unsol_event,
10410 .setup = alc883_clevo_m720_setup,
10411 .init_hook = alc883_clevo_m720_init_hook,
10413 [ALC883_LENOVO_101E_2ch] = {
10414 .mixers = { alc883_lenovo_101e_2ch_mixer},
10415 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
10416 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10417 .dac_nids = alc883_dac_nids,
10418 .adc_nids = alc883_adc_nids_alt,
10419 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
10420 .capsrc_nids = alc883_capsrc_nids,
10421 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10422 .channel_mode = alc883_3ST_2ch_modes,
10423 .input_mux = &alc883_lenovo_101e_capture_source,
10424 .unsol_event = alc883_lenovo_101e_unsol_event,
10425 .init_hook = alc883_lenovo_101e_all_automute,
10427 [ALC883_LENOVO_NB0763] = {
10428 .mixers = { alc883_lenovo_nb0763_mixer },
10429 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
10430 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10431 .dac_nids = alc883_dac_nids,
10432 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10433 .channel_mode = alc883_3ST_2ch_modes,
10435 .input_mux = &alc883_lenovo_nb0763_capture_source,
10436 .unsol_event = alc_automute_amp_unsol_event,
10437 .setup = alc883_medion_md2_setup,
10438 .init_hook = alc_automute_amp,
10440 [ALC888_LENOVO_MS7195_DIG] = {
10441 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10442 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
10443 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10444 .dac_nids = alc883_dac_nids,
10445 .dig_out_nid = ALC883_DIGOUT_NID,
10446 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10447 .channel_mode = alc883_3ST_6ch_modes,
10449 .input_mux = &alc883_capture_source,
10450 .unsol_event = alc883_lenovo_ms7195_unsol_event,
10451 .init_hook = alc888_lenovo_ms7195_front_automute,
10453 [ALC883_HAIER_W66] = {
10454 .mixers = { alc883_targa_2ch_mixer},
10455 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
10456 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10457 .dac_nids = alc883_dac_nids,
10458 .dig_out_nid = ALC883_DIGOUT_NID,
10459 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10460 .channel_mode = alc883_3ST_2ch_modes,
10461 .input_mux = &alc883_capture_source,
10462 .unsol_event = alc_automute_amp_unsol_event,
10463 .setup = alc883_haier_w66_setup,
10464 .init_hook = alc_automute_amp,
10466 [ALC888_3ST_HP] = {
10467 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10468 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
10469 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10470 .dac_nids = alc883_dac_nids,
10471 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
10472 .channel_mode = alc888_3st_hp_modes,
10474 .input_mux = &alc883_capture_source,
10475 .unsol_event = alc_automute_amp_unsol_event,
10476 .setup = alc888_3st_hp_setup,
10477 .init_hook = alc_automute_amp,
10479 [ALC888_6ST_DELL] = {
10480 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10481 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
10482 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10483 .dac_nids = alc883_dac_nids,
10484 .dig_out_nid = ALC883_DIGOUT_NID,
10485 .dig_in_nid = ALC883_DIGIN_NID,
10486 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10487 .channel_mode = alc883_sixstack_modes,
10488 .input_mux = &alc883_capture_source,
10489 .unsol_event = alc_automute_amp_unsol_event,
10490 .setup = alc888_6st_dell_setup,
10491 .init_hook = alc_automute_amp,
10494 .mixers = { alc883_mitac_mixer },
10495 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
10496 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10497 .dac_nids = alc883_dac_nids,
10498 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10499 .channel_mode = alc883_3ST_2ch_modes,
10500 .input_mux = &alc883_capture_source,
10501 .unsol_event = alc_automute_amp_unsol_event,
10502 .setup = alc883_mitac_setup,
10503 .init_hook = alc_automute_amp,
10505 [ALC883_FUJITSU_PI2515] = {
10506 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
10507 .init_verbs = { alc883_init_verbs,
10508 alc883_2ch_fujitsu_pi2515_verbs},
10509 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10510 .dac_nids = alc883_dac_nids,
10511 .dig_out_nid = ALC883_DIGOUT_NID,
10512 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10513 .channel_mode = alc883_3ST_2ch_modes,
10514 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10515 .unsol_event = alc_automute_amp_unsol_event,
10516 .setup = alc883_2ch_fujitsu_pi2515_setup,
10517 .init_hook = alc_automute_amp,
10519 [ALC888_FUJITSU_XA3530] = {
10520 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
10521 .init_verbs = { alc883_init_verbs,
10522 alc888_fujitsu_xa3530_verbs },
10523 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10524 .dac_nids = alc883_dac_nids,
10525 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
10526 .adc_nids = alc883_adc_nids_rev,
10527 .capsrc_nids = alc883_capsrc_nids_rev,
10528 .dig_out_nid = ALC883_DIGOUT_NID,
10529 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
10530 .channel_mode = alc888_4ST_8ch_intel_modes,
10532 ARRAY_SIZE(alc888_2_capture_sources),
10533 .input_mux = alc888_2_capture_sources,
10534 .unsol_event = alc_automute_amp_unsol_event,
10535 .setup = alc888_fujitsu_xa3530_setup,
10536 .init_hook = alc_automute_amp,
10538 [ALC888_LENOVO_SKY] = {
10539 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
10540 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
10541 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10542 .dac_nids = alc883_dac_nids,
10543 .dig_out_nid = ALC883_DIGOUT_NID,
10544 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10545 .channel_mode = alc883_sixstack_modes,
10547 .input_mux = &alc883_lenovo_sky_capture_source,
10548 .unsol_event = alc_automute_amp_unsol_event,
10549 .setup = alc888_lenovo_sky_setup,
10550 .init_hook = alc_automute_amp,
10552 [ALC888_ASUS_M90V] = {
10553 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
10554 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
10555 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10556 .dac_nids = alc883_dac_nids,
10557 .dig_out_nid = ALC883_DIGOUT_NID,
10558 .dig_in_nid = ALC883_DIGIN_NID,
10559 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
10560 .channel_mode = alc883_3ST_6ch_modes,
10562 .input_mux = &alc883_fujitsu_pi2515_capture_source,
10563 .unsol_event = alc_sku_unsol_event,
10564 .setup = alc883_mode2_setup,
10565 .init_hook = alc_inithook,
10567 [ALC888_ASUS_EEE1601] = {
10568 .mixers = { alc883_asus_eee1601_mixer },
10569 .cap_mixer = alc883_asus_eee1601_cap_mixer,
10570 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
10571 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10572 .dac_nids = alc883_dac_nids,
10573 .dig_out_nid = ALC883_DIGOUT_NID,
10574 .dig_in_nid = ALC883_DIGIN_NID,
10575 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10576 .channel_mode = alc883_3ST_2ch_modes,
10578 .input_mux = &alc883_asus_eee1601_capture_source,
10579 .unsol_event = alc_sku_unsol_event,
10580 .init_hook = alc883_eee1601_inithook,
10582 [ALC1200_ASUS_P5Q] = {
10583 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
10584 .init_verbs = { alc883_init_verbs },
10585 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10586 .dac_nids = alc883_dac_nids,
10587 .dig_out_nid = ALC1200_DIGOUT_NID,
10588 .dig_in_nid = ALC883_DIGIN_NID,
10589 .slave_dig_outs = alc1200_slave_dig_outs,
10590 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
10591 .channel_mode = alc883_sixstack_modes,
10592 .input_mux = &alc883_capture_source,
10595 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
10596 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
10597 alc880_gpio1_init_verbs },
10598 .adc_nids = alc883_adc_nids,
10599 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
10600 .capsrc_nids = alc883_capsrc_nids,
10601 .dac_nids = alc883_dac_nids,
10602 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10603 .channel_mode = alc889A_mb31_6ch_modes,
10604 .num_channel_mode = ARRAY_SIZE(alc889A_mb31_6ch_modes),
10605 .input_mux = &alc889A_mb31_capture_source,
10606 .dig_out_nid = ALC883_DIGOUT_NID,
10607 .unsol_event = alc889A_mb31_unsol_event,
10608 .init_hook = alc889A_mb31_automute,
10610 [ALC883_SONY_VAIO_TT] = {
10611 .mixers = { alc883_vaiott_mixer },
10612 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
10613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
10614 .dac_nids = alc883_dac_nids,
10615 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
10616 .channel_mode = alc883_3ST_2ch_modes,
10617 .input_mux = &alc883_capture_source,
10618 .unsol_event = alc_automute_amp_unsol_event,
10619 .setup = alc883_vaiott_setup,
10620 .init_hook = alc_automute_amp,
10629 PINFIX_ABIT_AW9D_MAX,
10633 static const struct alc_fixup alc882_fixups[] = {
10634 [PINFIX_ABIT_AW9D_MAX] = {
10635 .pins = (const struct alc_pincfg[]) {
10636 { 0x15, 0x01080104 }, /* side */
10637 { 0x16, 0x01011012 }, /* rear */
10638 { 0x17, 0x01016011 }, /* clfe */
10642 [PINFIX_PB_M5210] = {
10643 .verbs = (const struct hda_verb[]) {
10644 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
10650 static struct snd_pci_quirk alc882_fixup_tbl[] = {
10651 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210),
10652 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
10657 * BIOS auto configuration
10659 static int alc882_auto_create_input_ctls(struct hda_codec *codec,
10660 const struct auto_pin_cfg *cfg)
10662 return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x23, 0x22);
10665 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
10666 hda_nid_t nid, int pin_type,
10671 /* set as output */
10672 alc_set_pin_output(codec, nid, pin_type);
10676 else if (dac >= 0x02 && dac <= 0x05)
10680 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
10683 static void alc882_auto_init_multi_out(struct hda_codec *codec)
10685 struct alc_spec *spec = codec->spec;
10688 for (i = 0; i <= HDA_SIDE; i++) {
10689 hda_nid_t nid = spec->autocfg.line_out_pins[i];
10690 int pin_type = get_pin_type(spec->autocfg.line_out_type);
10692 alc882_auto_set_output_and_unmute(codec, nid, pin_type,
10693 spec->multiout.dac_nids[i]);
10697 static void alc882_auto_init_hp_out(struct hda_codec *codec)
10699 struct alc_spec *spec = codec->spec;
10700 hda_nid_t pin, dac;
10703 for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
10704 pin = spec->autocfg.hp_pins[i];
10707 dac = spec->multiout.hp_nid;
10709 dac = spec->multiout.dac_nids[0]; /* to front */
10710 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
10712 for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
10713 pin = spec->autocfg.speaker_pins[i];
10716 dac = spec->multiout.extra_out_nid[0];
10718 dac = spec->multiout.dac_nids[0]; /* to front */
10719 alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
10723 static void alc882_auto_init_analog_input(struct hda_codec *codec)
10725 struct alc_spec *spec = codec->spec;
10726 struct auto_pin_cfg *cfg = &spec->autocfg;
10729 for (i = 0; i < cfg->num_inputs; i++) {
10730 hda_nid_t nid = cfg->inputs[i].pin;
10731 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
10732 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
10733 snd_hda_codec_write(codec, nid, 0,
10734 AC_VERB_SET_AMP_GAIN_MUTE,
10739 static void alc882_auto_init_input_src(struct hda_codec *codec)
10741 struct alc_spec *spec = codec->spec;
10744 for (c = 0; c < spec->num_adc_nids; c++) {
10745 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS];
10746 hda_nid_t nid = spec->capsrc_nids[c];
10747 unsigned int mux_idx;
10748 const struct hda_input_mux *imux;
10749 int conns, mute, idx, item;
10751 conns = snd_hda_get_connections(codec, nid, conn_list,
10752 ARRAY_SIZE(conn_list));
10755 mux_idx = c >= spec->num_mux_defs ? 0 : c;
10756 imux = &spec->input_mux[mux_idx];
10757 if (!imux->num_items && mux_idx > 0)
10758 imux = &spec->input_mux[0];
10759 for (idx = 0; idx < conns; idx++) {
10760 /* if the current connection is the selected one,
10761 * unmute it as default - otherwise mute it
10763 mute = AMP_IN_MUTE(idx);
10764 for (item = 0; item < imux->num_items; item++) {
10765 if (imux->items[item].index == idx) {
10766 if (spec->cur_mux[c] == item)
10767 mute = AMP_IN_UNMUTE(idx);
10771 /* check if we have a selector or mixer
10772 * we could check for the widget type instead, but
10773 * just check for Amp-In presence (in case of mixer
10774 * without amp-in there is something wrong, this
10775 * function shouldn't be used or capsrc nid is wrong)
10777 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)
10778 snd_hda_codec_write(codec, nid, 0,
10779 AC_VERB_SET_AMP_GAIN_MUTE,
10781 else if (mute != AMP_IN_MUTE(idx))
10782 snd_hda_codec_write(codec, nid, 0,
10783 AC_VERB_SET_CONNECT_SEL,
10789 /* add mic boosts if needed */
10790 static int alc_auto_add_mic_boost(struct hda_codec *codec)
10792 struct alc_spec *spec = codec->spec;
10793 struct auto_pin_cfg *cfg = &spec->autocfg;
10797 for (i = 0; i < cfg->num_inputs; i++) {
10798 if (cfg->inputs[i].type > AUTO_PIN_MIC)
10800 nid = cfg->inputs[i].pin;
10801 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) {
10803 snprintf(label, sizeof(label), "%s Boost",
10804 hda_get_autocfg_input_label(codec, cfg, i));
10805 err = add_control(spec, ALC_CTL_WIDGET_VOL, label, 0,
10806 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
10814 /* almost identical with ALC880 parser... */
10815 static int alc882_parse_auto_config(struct hda_codec *codec)
10817 struct alc_spec *spec = codec->spec;
10818 static hda_nid_t alc882_ignore[] = { 0x1d, 0 };
10821 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
10825 if (!spec->autocfg.line_outs)
10826 return 0; /* can't find valid BIOS pin config */
10828 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
10831 err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
10834 err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
10838 err = alc880_auto_create_extra_out(spec,
10839 spec->autocfg.speaker_pins[0],
10843 err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
10847 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
10849 alc_auto_parse_digital(codec);
10851 if (spec->kctls.list)
10852 add_mixer(spec, spec->kctls.list);
10854 add_verb(spec, alc883_auto_init_verbs);
10855 /* if ADC 0x07 is available, initialize it, too */
10856 if (get_wcaps_type(get_wcaps(codec, 0x07)) == AC_WID_AUD_IN)
10857 add_verb(spec, alc882_adc1_init_verbs);
10859 spec->num_mux_defs = 1;
10860 spec->input_mux = &spec->private_imux[0];
10862 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
10864 err = alc_auto_add_mic_boost(codec);
10868 return 1; /* config found */
10871 /* additional initialization for auto-configuration model */
10872 static void alc882_auto_init(struct hda_codec *codec)
10874 struct alc_spec *spec = codec->spec;
10875 alc882_auto_init_multi_out(codec);
10876 alc882_auto_init_hp_out(codec);
10877 alc882_auto_init_analog_input(codec);
10878 alc882_auto_init_input_src(codec);
10879 alc_auto_init_digital(codec);
10880 if (spec->unsol_event)
10881 alc_inithook(codec);
10884 static int patch_alc882(struct hda_codec *codec)
10886 struct alc_spec *spec;
10887 int err, board_config;
10889 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
10893 codec->spec = spec;
10895 switch (codec->vendor_id) {
10900 /* ALC883 and variants */
10901 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
10905 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST,
10909 if (board_config < 0 || board_config >= ALC882_MODEL_LAST)
10910 board_config = snd_hda_check_board_codec_sid_config(codec,
10911 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
10913 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) {
10914 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
10916 board_config = ALC882_AUTO;
10919 if (board_config == ALC882_AUTO)
10920 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
10922 alc_auto_parse_customize_define(codec);
10924 if (board_config == ALC882_AUTO) {
10925 /* automatic parse from the BIOS config */
10926 err = alc882_parse_auto_config(codec);
10932 "hda_codec: Cannot set up configuration "
10933 "from BIOS. Using base mode...\n");
10934 board_config = ALC882_3ST_DIG;
10938 if (has_cdefine_beep(codec)) {
10939 err = snd_hda_attach_beep_device(codec, 0x1);
10946 if (board_config != ALC882_AUTO)
10947 setup_preset(codec, &alc882_presets[board_config]);
10949 spec->stream_analog_playback = &alc882_pcm_analog_playback;
10950 spec->stream_analog_capture = &alc882_pcm_analog_capture;
10951 /* FIXME: setup DAC5 */
10952 /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/
10953 spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture;
10955 spec->stream_digital_playback = &alc882_pcm_digital_playback;
10956 spec->stream_digital_capture = &alc882_pcm_digital_capture;
10958 if (!spec->adc_nids && spec->input_mux) {
10960 spec->num_adc_nids = 0;
10961 for (i = 0; i < ARRAY_SIZE(alc882_adc_nids); i++) {
10962 const struct hda_input_mux *imux = spec->input_mux;
10964 hda_nid_t items[16];
10965 hda_nid_t nid = alc882_adc_nids[i];
10966 unsigned int wcap = get_wcaps(codec, nid);
10968 wcap = get_wcaps_type(wcap);
10969 if (wcap != AC_WID_AUD_IN)
10971 spec->private_adc_nids[spec->num_adc_nids] = nid;
10972 err = snd_hda_get_connections(codec, nid, &cap, 1);
10975 err = snd_hda_get_connections(codec, cap, items,
10976 ARRAY_SIZE(items));
10979 for (j = 0; j < imux->num_items; j++)
10980 if (imux->items[j].index >= err)
10982 if (j < imux->num_items)
10984 spec->private_capsrc_nids[spec->num_adc_nids] = cap;
10985 spec->num_adc_nids++;
10987 spec->adc_nids = spec->private_adc_nids;
10988 spec->capsrc_nids = spec->private_capsrc_nids;
10991 set_capture_mixer(codec);
10993 if (has_cdefine_beep(codec))
10994 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10996 if (board_config == ALC882_AUTO)
10997 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
10999 spec->vmaster_nid = 0x0c;
11001 codec->patch_ops = alc_patch_ops;
11002 if (board_config == ALC882_AUTO)
11003 spec->init_hook = alc882_auto_init;
11004 #ifdef CONFIG_SND_HDA_POWER_SAVE
11005 if (!spec->loopback.amplist)
11006 spec->loopback.amplist = alc882_loopbacks;
11017 #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
11018 #define ALC262_DIGIN_NID ALC880_DIGIN_NID
11020 #define alc262_dac_nids alc260_dac_nids
11021 #define alc262_adc_nids alc882_adc_nids
11022 #define alc262_adc_nids_alt alc882_adc_nids_alt
11023 #define alc262_capsrc_nids alc882_capsrc_nids
11024 #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
11026 #define alc262_modes alc260_modes
11027 #define alc262_capture_source alc882_capture_source
11029 static hda_nid_t alc262_dmic_adc_nids[1] = {
11034 static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
11036 static struct snd_kcontrol_new alc262_base_mixer[] = {
11037 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11038 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11039 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11040 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11041 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11042 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11043 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11045 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11046 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11047 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11048 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11049 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
11050 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11051 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
11052 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
11056 /* update HP, line and mono-out pins according to the master switch */
11057 static void alc262_hp_master_update(struct hda_codec *codec)
11059 struct alc_spec *spec = codec->spec;
11060 int val = spec->master_sw;
11062 /* HP & line-out */
11063 snd_hda_codec_write_cache(codec, 0x1b, 0,
11064 AC_VERB_SET_PIN_WIDGET_CONTROL,
11066 snd_hda_codec_write_cache(codec, 0x15, 0,
11067 AC_VERB_SET_PIN_WIDGET_CONTROL,
11069 /* mono (speaker) depending on the HP jack sense */
11070 val = val && !spec->jack_present;
11071 snd_hda_codec_write_cache(codec, 0x16, 0,
11072 AC_VERB_SET_PIN_WIDGET_CONTROL,
11073 val ? PIN_OUT : 0);
11076 static void alc262_hp_bpc_automute(struct hda_codec *codec)
11078 struct alc_spec *spec = codec->spec;
11080 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11081 alc262_hp_master_update(codec);
11084 static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11086 if ((res >> 26) != ALC880_HP_EVENT)
11088 alc262_hp_bpc_automute(codec);
11091 static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11093 struct alc_spec *spec = codec->spec;
11095 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11096 alc262_hp_master_update(codec);
11099 static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11102 if ((res >> 26) != ALC880_HP_EVENT)
11104 alc262_hp_wildwest_automute(codec);
11107 #define alc262_hp_master_sw_get alc260_hp_master_sw_get
11109 static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11110 struct snd_ctl_elem_value *ucontrol)
11112 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11113 struct alc_spec *spec = codec->spec;
11114 int val = !!*ucontrol->value.integer.value;
11116 if (val == spec->master_sw)
11118 spec->master_sw = val;
11119 alc262_hp_master_update(codec);
11123 #define ALC262_HP_MASTER_SWITCH \
11125 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11126 .name = "Master Playback Switch", \
11127 .info = snd_ctl_boolean_mono_info, \
11128 .get = alc262_hp_master_sw_get, \
11129 .put = alc262_hp_master_sw_put, \
11132 .iface = NID_MAPPING, \
11133 .name = "Master Playback Switch", \
11134 .private_value = 0x15 | (0x16 << 8) | (0x1b << 16), \
11138 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
11139 ALC262_HP_MASTER_SWITCH,
11140 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11141 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11142 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11143 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11145 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11148 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11149 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11150 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11151 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11152 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11153 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11154 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11155 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11156 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11157 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT),
11158 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT),
11162 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
11163 ALC262_HP_MASTER_SWITCH,
11164 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11165 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11166 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11167 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11168 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0,
11170 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0,
11172 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT),
11173 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT),
11174 HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT),
11175 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11176 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11177 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11178 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11182 static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
11183 HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11184 HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11185 HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT),
11189 /* mute/unmute internal speaker according to the hp jack and mute state */
11190 static void alc262_hp_t5735_setup(struct hda_codec *codec)
11192 struct alc_spec *spec = codec->spec;
11194 spec->autocfg.hp_pins[0] = 0x15;
11195 spec->autocfg.speaker_pins[0] = 0x14;
11198 static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
11199 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11200 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11201 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11202 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11203 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11204 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11205 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11209 static struct hda_verb alc262_hp_t5735_verbs[] = {
11210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11213 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
11217 static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = {
11218 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11219 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
11220 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
11221 HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT),
11222 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
11223 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
11227 static struct hda_verb alc262_hp_rp5700_verbs[] = {
11228 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11229 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11230 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11231 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11232 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11233 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11234 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
11236 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))},
11241 static struct hda_input_mux alc262_hp_rp5700_capture_source = {
11248 /* bind hp and internal speaker mute (with plug check) as master switch */
11249 static void alc262_hippo_master_update(struct hda_codec *codec)
11251 struct alc_spec *spec = codec->spec;
11252 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11253 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
11254 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
11258 mute = spec->master_sw ? 0 : HDA_AMP_MUTE;
11259 snd_hda_codec_amp_stereo(codec, hp_nid, HDA_OUTPUT, 0,
11260 HDA_AMP_MUTE, mute);
11261 /* mute internal speaker per jack sense */
11262 if (spec->jack_present)
11263 mute = HDA_AMP_MUTE;
11265 snd_hda_codec_amp_stereo(codec, line_nid, HDA_OUTPUT, 0,
11266 HDA_AMP_MUTE, mute);
11267 if (speaker_nid && speaker_nid != line_nid)
11268 snd_hda_codec_amp_stereo(codec, speaker_nid, HDA_OUTPUT, 0,
11269 HDA_AMP_MUTE, mute);
11272 #define alc262_hippo_master_sw_get alc262_hp_master_sw_get
11274 static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
11275 struct snd_ctl_elem_value *ucontrol)
11277 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11278 struct alc_spec *spec = codec->spec;
11279 int val = !!*ucontrol->value.integer.value;
11281 if (val == spec->master_sw)
11283 spec->master_sw = val;
11284 alc262_hippo_master_update(codec);
11288 #define ALC262_HIPPO_MASTER_SWITCH \
11290 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
11291 .name = "Master Playback Switch", \
11292 .info = snd_ctl_boolean_mono_info, \
11293 .get = alc262_hippo_master_sw_get, \
11294 .put = alc262_hippo_master_sw_put, \
11297 .iface = NID_MAPPING, \
11298 .name = "Master Playback Switch", \
11299 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
11300 (SUBDEV_SPEAKER(0) << 16), \
11303 static struct snd_kcontrol_new alc262_hippo_mixer[] = {
11304 ALC262_HIPPO_MASTER_SWITCH,
11305 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11306 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11307 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11308 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11309 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11310 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11311 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11312 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11313 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11314 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11315 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11316 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11320 static struct snd_kcontrol_new alc262_hippo1_mixer[] = {
11321 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11322 ALC262_HIPPO_MASTER_SWITCH,
11323 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11324 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11325 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11326 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11327 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11328 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11329 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11330 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11331 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11332 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11336 /* mute/unmute internal speaker according to the hp jack and mute state */
11337 static void alc262_hippo_automute(struct hda_codec *codec)
11339 struct alc_spec *spec = codec->spec;
11340 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
11342 spec->jack_present = snd_hda_jack_detect(codec, hp_nid);
11343 alc262_hippo_master_update(codec);
11346 static void alc262_hippo_unsol_event(struct hda_codec *codec, unsigned int res)
11348 if ((res >> 26) != ALC880_HP_EVENT)
11350 alc262_hippo_automute(codec);
11353 static void alc262_hippo_setup(struct hda_codec *codec)
11355 struct alc_spec *spec = codec->spec;
11357 spec->autocfg.hp_pins[0] = 0x15;
11358 spec->autocfg.speaker_pins[0] = 0x14;
11361 static void alc262_hippo1_setup(struct hda_codec *codec)
11363 struct alc_spec *spec = codec->spec;
11365 spec->autocfg.hp_pins[0] = 0x1b;
11366 spec->autocfg.speaker_pins[0] = 0x14;
11370 static struct snd_kcontrol_new alc262_sony_mixer[] = {
11371 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11372 ALC262_HIPPO_MASTER_SWITCH,
11373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11374 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11375 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11376 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11380 static struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
11381 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11382 ALC262_HIPPO_MASTER_SWITCH,
11383 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11384 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11385 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11386 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11387 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11391 static struct snd_kcontrol_new alc262_tyan_mixer[] = {
11392 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11393 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11394 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
11395 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
11396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
11397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
11398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11399 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11400 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11401 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11402 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11403 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11407 static struct hda_verb alc262_tyan_verbs[] = {
11408 /* Headphone automute */
11409 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11410 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11411 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11413 /* P11 AUX_IN, white 4-pin connector */
11414 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11415 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
11416 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
11417 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
11422 /* unsolicited event for HP jack sensing */
11423 static void alc262_tyan_setup(struct hda_codec *codec)
11425 struct alc_spec *spec = codec->spec;
11427 spec->autocfg.hp_pins[0] = 0x1b;
11428 spec->autocfg.speaker_pins[0] = 0x15;
11432 #define alc262_capture_mixer alc882_capture_mixer
11433 #define alc262_capture_alt_mixer alc882_capture_alt_mixer
11436 * generic initialization of ADC, input mixers and output mixers
11438 static struct hda_verb alc262_init_verbs[] = {
11440 * Unmute ADC0-2 and set the default input to mic-in
11442 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
11443 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11444 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
11445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11446 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
11447 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11449 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
11451 * Note: PASD motherboards uses the Line In 2 as the input for
11452 * front panel mic (mic 2)
11454 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
11455 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11456 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11457 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11458 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11459 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11462 * Set up output mixers (0x0c - 0x0e)
11464 /* set vol=0 to output mixers */
11465 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11466 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11467 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11468 /* set up input amps for analog loopback */
11469 /* Amp Indices: DAC = 0, mixer = 1 */
11470 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11471 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11472 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11473 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11474 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11475 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11477 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11478 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11479 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
11480 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11481 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11482 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
11484 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11485 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11486 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11487 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11488 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11490 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11491 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
11493 /* FIXME: use matrix-type input source selection */
11494 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
11495 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
11496 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11497 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11498 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11499 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11501 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11502 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11503 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11504 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11506 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
11507 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
11508 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
11509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
11514 static struct hda_verb alc262_eapd_verbs[] = {
11515 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
11516 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
11520 static struct hda_verb alc262_hippo1_unsol_verbs[] = {
11521 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11522 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
11523 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
11525 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11526 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11530 static struct hda_verb alc262_sony_unsol_verbs[] = {
11531 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
11532 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11533 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
11535 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11536 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11540 static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
11541 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11542 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
11543 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11544 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11545 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11549 static struct hda_verb alc262_toshiba_s06_verbs[] = {
11550 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
11551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11553 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11554 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
11555 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11556 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
11557 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11561 static void alc262_toshiba_s06_setup(struct hda_codec *codec)
11563 struct alc_spec *spec = codec->spec;
11565 spec->autocfg.hp_pins[0] = 0x15;
11566 spec->autocfg.speaker_pins[0] = 0x14;
11567 spec->ext_mic.pin = 0x18;
11568 spec->ext_mic.mux_idx = 0;
11569 spec->int_mic.pin = 0x12;
11570 spec->int_mic.mux_idx = 9;
11571 spec->auto_mic = 1;
11577 * 0x16 = internal speaker
11578 * 0x18 = external mic
11581 static struct snd_kcontrol_new alc262_nec_mixer[] = {
11582 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
11583 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
11585 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11586 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11587 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11589 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
11590 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
11594 static struct hda_verb alc262_nec_verbs[] = {
11595 /* Unmute Speaker */
11596 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
11599 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11600 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11602 /* External mic to headphone */
11603 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11604 /* External mic to speaker */
11605 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11611 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
11612 * 0x1b = port replicator headphone out
11615 #define ALC_HP_EVENT 0x37
11617 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
11618 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11619 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11620 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11621 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11625 static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
11626 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
11627 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11631 static struct hda_verb alc262_lenovo_3000_init_verbs[] = {
11632 /* Front Mic pin: input vref at 50% */
11633 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
11634 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11638 static struct hda_input_mux alc262_fujitsu_capture_source = {
11642 { "Int Mic", 0x1 },
11647 static struct hda_input_mux alc262_HP_capture_source = {
11651 { "Front Mic", 0x1 },
11658 static struct hda_input_mux alc262_HP_D7000_capture_source = {
11662 { "Front Mic", 0x2 },
11668 /* mute/unmute internal speaker according to the hp jacks and mute state */
11669 static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11671 struct alc_spec *spec = codec->spec;
11674 if (force || !spec->sense_updated) {
11675 spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11676 snd_hda_jack_detect(codec, 0x1b);
11677 spec->sense_updated = 1;
11679 /* unmute internal speaker only if both HPs are unplugged and
11680 * master switch is on
11682 if (spec->jack_present)
11683 mute = HDA_AMP_MUTE;
11685 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11686 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11687 HDA_AMP_MUTE, mute);
11690 /* unsolicited event for HP jack sensing */
11691 static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11694 if ((res >> 26) != ALC_HP_EVENT)
11696 alc262_fujitsu_automute(codec, 1);
11699 static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11701 alc262_fujitsu_automute(codec, 1);
11704 /* bind volumes of both NID 0x0c and 0x0d */
11705 static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11706 .ops = &snd_hda_bind_vol,
11708 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11709 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
11714 /* mute/unmute internal speaker according to the hp jack and mute state */
11715 static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11717 struct alc_spec *spec = codec->spec;
11720 if (force || !spec->sense_updated) {
11721 spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11722 spec->sense_updated = 1;
11724 if (spec->jack_present) {
11725 /* mute internal speaker */
11726 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11727 HDA_AMP_MUTE, HDA_AMP_MUTE);
11728 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11729 HDA_AMP_MUTE, HDA_AMP_MUTE);
11731 /* unmute internal speaker if necessary */
11732 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11733 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11734 HDA_AMP_MUTE, mute);
11735 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11736 HDA_AMP_MUTE, mute);
11740 /* unsolicited event for HP jack sensing */
11741 static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11744 if ((res >> 26) != ALC_HP_EVENT)
11746 alc262_lenovo_3000_automute(codec, 1);
11749 static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11750 int dir, int idx, long *valp)
11754 for (i = 0; i < 2; i++, valp++)
11755 change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11757 *valp ? 0 : HDA_AMP_MUTE);
11761 /* bind hp and internal speaker mute (with plug check) */
11762 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11763 struct snd_ctl_elem_value *ucontrol)
11765 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11766 long *valp = ucontrol->value.integer.value;
11769 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11770 change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11772 alc262_fujitsu_automute(codec, 0);
11776 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11777 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11779 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11780 .name = "Master Playback Switch",
11781 .subdevice = HDA_SUBDEV_AMP_FLAG,
11782 .info = snd_hda_mixer_amp_switch_info,
11783 .get = snd_hda_mixer_amp_switch_get,
11784 .put = alc262_fujitsu_master_sw_put,
11785 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
11788 .iface = NID_MAPPING,
11789 .name = "Master Playback Switch",
11790 .private_value = 0x1b,
11792 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11793 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11794 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11795 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11796 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11797 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11798 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11799 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11803 /* bind hp and internal speaker mute (with plug check) */
11804 static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11805 struct snd_ctl_elem_value *ucontrol)
11807 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11808 long *valp = ucontrol->value.integer.value;
11811 change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11813 alc262_lenovo_3000_automute(codec, 0);
11817 static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11818 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11820 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11821 .name = "Master Playback Switch",
11822 .subdevice = HDA_SUBDEV_AMP_FLAG,
11823 .info = snd_hda_mixer_amp_switch_info,
11824 .get = snd_hda_mixer_amp_switch_get,
11825 .put = alc262_lenovo_3000_master_sw_put,
11826 .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
11828 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11829 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
11830 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11831 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11832 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11833 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
11834 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
11835 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
11839 static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
11840 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11841 ALC262_HIPPO_MASTER_SWITCH,
11842 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
11843 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
11844 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
11845 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11846 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11847 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
11851 /* additional init verbs for Benq laptops */
11852 static struct hda_verb alc262_EAPD_verbs[] = {
11853 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11854 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
11858 static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
11859 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11860 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
11862 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
11863 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
11867 /* Samsung Q1 Ultra Vista model setup */
11868 static struct snd_kcontrol_new alc262_ultra_mixer[] = {
11869 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
11870 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
11871 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
11872 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
11873 HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
11874 HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
11878 static struct hda_verb alc262_ultra_verbs[] = {
11880 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11881 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11882 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
11884 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
11885 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11886 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11887 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
11889 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
11890 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
11891 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
11892 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
11893 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
11895 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
11896 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
11897 /* ADC, choose mic */
11898 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11899 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
11900 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
11901 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
11902 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
11903 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
11904 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
11905 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
11906 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
11907 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
11911 /* mute/unmute internal speaker according to the hp jack and mute state */
11912 static void alc262_ultra_automute(struct hda_codec *codec)
11914 struct alc_spec *spec = codec->spec;
11918 /* auto-mute only when HP is used as HP */
11919 if (!spec->cur_mux[0]) {
11920 spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11921 if (spec->jack_present)
11922 mute = HDA_AMP_MUTE;
11924 /* mute/unmute internal speaker */
11925 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11926 HDA_AMP_MUTE, mute);
11927 /* mute/unmute HP */
11928 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11929 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
11932 /* unsolicited event for HP jack sensing */
11933 static void alc262_ultra_unsol_event(struct hda_codec *codec,
11936 if ((res >> 26) != ALC880_HP_EVENT)
11938 alc262_ultra_automute(codec);
11941 static struct hda_input_mux alc262_ultra_capture_source = {
11945 { "Headphone", 0x7 },
11949 static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
11950 struct snd_ctl_elem_value *ucontrol)
11952 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11953 struct alc_spec *spec = codec->spec;
11956 ret = alc_mux_enum_put(kcontrol, ucontrol);
11959 /* reprogram the HP pin as mic or HP according to the input source */
11960 snd_hda_codec_write_cache(codec, 0x15, 0,
11961 AC_VERB_SET_PIN_WIDGET_CONTROL,
11962 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
11963 alc262_ultra_automute(codec); /* mute/unmute HP */
11967 static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
11968 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
11969 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
11971 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11972 .name = "Capture Source",
11973 .info = alc_mux_enum_info,
11974 .get = alc_mux_enum_get,
11975 .put = alc262_ultra_mux_enum_put,
11978 .iface = NID_MAPPING,
11979 .name = "Capture Source",
11980 .private_value = 0x15,
11985 /* We use two mixers depending on the output pin; 0x16 is a mono output
11986 * and thus it's bound with a different mixer.
11987 * This function returns which mixer amp should be used.
11989 static int alc262_check_volbit(hda_nid_t nid)
11993 else if (nid == 0x16)
11999 static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
12000 const char *pfx, int *vbits, int idx)
12005 vbit = alc262_check_volbit(nid);
12008 if (*vbits & vbit) /* a volume control for this mixer already there */
12012 val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
12014 val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
12015 return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
12018 static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
12019 const char *pfx, int idx)
12026 val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
12028 val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
12029 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
12032 /* add playback controls from the parsed DAC table */
12033 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
12034 const struct auto_pin_cfg *cfg)
12040 spec->multiout.num_dacs = 1; /* only use one dac */
12041 spec->multiout.dac_nids = spec->private_dac_nids;
12042 spec->multiout.dac_nids[0] = 2;
12044 if (!cfg->speaker_pins[0] && !cfg->hp_pins[0])
12046 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
12048 else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
12052 for (i = 0; i < 2; i++) {
12053 err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
12056 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12057 err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
12062 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12063 err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
12070 vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
12071 alc262_check_volbit(cfg->speaker_pins[0]) |
12072 alc262_check_volbit(cfg->hp_pins[0]);
12073 if (vbits == 1 || vbits == 2)
12074 pfx = "Master"; /* only one mixer is used */
12076 for (i = 0; i < 2; i++) {
12077 err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
12081 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
12082 err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
12083 "Speaker", &vbits, i);
12087 if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
12088 err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
12089 "Headphone", &vbits, i);
12097 #define alc262_auto_create_input_ctls \
12098 alc882_auto_create_input_ctls
12101 * generic initialization of ADC, input mixers and output mixers
12103 static struct hda_verb alc262_volume_init_verbs[] = {
12105 * Unmute ADC0-2 and set the default input to mic-in
12107 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12108 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12109 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12110 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12111 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12112 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12114 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12116 * Note: PASD motherboards uses the Line In 2 as the input for
12117 * front panel mic (mic 2)
12119 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12120 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12121 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12122 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12123 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12124 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12127 * Set up output mixers (0x0c - 0x0f)
12129 /* set vol=0 to output mixers */
12130 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12131 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12132 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12134 /* set up input amps for analog loopback */
12135 /* Amp Indices: DAC = 0, mixer = 1 */
12136 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12137 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12138 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12141 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12143 /* FIXME: use matrix-type input source selection */
12144 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12145 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12146 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12147 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12148 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12149 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12151 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12152 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12153 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12154 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12156 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12157 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12158 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12159 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12164 static struct hda_verb alc262_HP_BPC_init_verbs[] = {
12166 * Unmute ADC0-2 and set the default input to mic-in
12168 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12169 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12170 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12171 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12172 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12173 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12175 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12177 * Note: PASD motherboards uses the Line In 2 as the input for
12178 * front panel mic (mic 2)
12180 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12181 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12182 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12183 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12184 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12185 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12186 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12187 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12190 * Set up output mixers (0x0c - 0x0e)
12192 /* set vol=0 to output mixers */
12193 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12194 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12195 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12197 /* set up input amps for analog loopback */
12198 /* Amp Indices: DAC = 0, mixer = 1 */
12199 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12200 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12201 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12202 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12203 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12204 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12206 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
12207 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12208 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
12210 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12211 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12213 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12216 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12217 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12218 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
12219 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12220 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
12222 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12223 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12224 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12225 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12226 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12227 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12230 /* FIXME: use matrix-type input source selection */
12231 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 0b, 12 */
12232 /* Input mixer1: only unmute Mic */
12233 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12234 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12235 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12236 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12237 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12238 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12239 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12240 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12241 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12243 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12244 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12245 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12246 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12247 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12248 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12249 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12250 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12251 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12253 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12254 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8))},
12255 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
12256 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
12257 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
12258 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x05 << 8))},
12259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x06 << 8))},
12260 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x07 << 8))},
12261 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x08 << 8))},
12263 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12268 static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = {
12270 * Unmute ADC0-2 and set the default input to mic-in
12272 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
12273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12274 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
12275 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12276 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
12277 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12279 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
12281 * Note: PASD motherboards uses the Line In 2 as the input for front
12282 * panel mic (mic 2)
12284 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
12285 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
12286 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
12287 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
12288 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
12289 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
12290 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
12291 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
12292 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
12294 * Set up output mixers (0x0c - 0x0e)
12296 /* set vol=0 to output mixers */
12297 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12299 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
12301 /* set up input amps for analog loopback */
12302 /* Amp Indices: DAC = 0, mixer = 1 */
12303 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12304 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12305 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12306 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12307 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
12308 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
12311 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */
12312 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */
12313 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */
12314 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */
12315 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12316 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */
12317 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */
12319 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12320 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12322 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
12323 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
12325 /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */
12326 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12327 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12328 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 },
12329 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12330 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },
12332 /* FIXME: use matrix-type input source selection */
12333 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
12334 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
12335 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/
12336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/
12337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/
12338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/
12339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/
12340 /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12341 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/
12343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12345 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12346 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12347 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12348 /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12349 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12351 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
12352 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},
12353 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))},
12354 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))},
12355 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))},
12356 /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */
12357 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))},
12359 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12364 static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
12366 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
12367 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
12368 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
12370 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
12371 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
12372 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12373 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
12375 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
12376 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
12377 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
12388 static const struct alc_fixup alc262_fixups[] = {
12389 [PINFIX_FSC_H270] = {
12390 .pins = (const struct alc_pincfg[]) {
12391 { 0x14, 0x99130110 }, /* speaker */
12392 { 0x15, 0x0221142f }, /* front HP */
12393 { 0x1b, 0x0121141f }, /* rear HP */
12397 [PINFIX_PB_M5210] = {
12398 .verbs = (const struct hda_verb[]) {
12399 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12405 static struct snd_pci_quirk alc262_fixup_tbl[] = {
12406 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270),
12411 #ifdef CONFIG_SND_HDA_POWER_SAVE
12412 #define alc262_loopbacks alc880_loopbacks
12415 /* pcm configuration: identical with ALC880 */
12416 #define alc262_pcm_analog_playback alc880_pcm_analog_playback
12417 #define alc262_pcm_analog_capture alc880_pcm_analog_capture
12418 #define alc262_pcm_digital_playback alc880_pcm_digital_playback
12419 #define alc262_pcm_digital_capture alc880_pcm_digital_capture
12422 * BIOS auto configuration
12424 static int alc262_parse_auto_config(struct hda_codec *codec)
12426 struct alc_spec *spec = codec->spec;
12428 static hda_nid_t alc262_ignore[] = { 0x1d, 0 };
12430 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
12434 if (!spec->autocfg.line_outs) {
12435 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
12436 spec->multiout.max_channels = 2;
12437 spec->no_analog = 1;
12440 return 0; /* can't find valid BIOS pin config */
12442 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg);
12445 err = alc262_auto_create_input_ctls(codec, &spec->autocfg);
12449 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
12452 alc_auto_parse_digital(codec);
12454 if (spec->kctls.list)
12455 add_mixer(spec, spec->kctls.list);
12457 add_verb(spec, alc262_volume_init_verbs);
12458 spec->num_mux_defs = 1;
12459 spec->input_mux = &spec->private_imux[0];
12461 err = alc_auto_add_mic_boost(codec);
12465 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
12470 #define alc262_auto_init_multi_out alc882_auto_init_multi_out
12471 #define alc262_auto_init_hp_out alc882_auto_init_hp_out
12472 #define alc262_auto_init_analog_input alc882_auto_init_analog_input
12473 #define alc262_auto_init_input_src alc882_auto_init_input_src
12476 /* init callback for auto-configuration model -- overriding the default init */
12477 static void alc262_auto_init(struct hda_codec *codec)
12479 struct alc_spec *spec = codec->spec;
12480 alc262_auto_init_multi_out(codec);
12481 alc262_auto_init_hp_out(codec);
12482 alc262_auto_init_analog_input(codec);
12483 alc262_auto_init_input_src(codec);
12484 alc_auto_init_digital(codec);
12485 if (spec->unsol_event)
12486 alc_inithook(codec);
12490 * configuration and preset
12492 static const char *alc262_models[ALC262_MODEL_LAST] = {
12493 [ALC262_BASIC] = "basic",
12494 [ALC262_HIPPO] = "hippo",
12495 [ALC262_HIPPO_1] = "hippo_1",
12496 [ALC262_FUJITSU] = "fujitsu",
12497 [ALC262_HP_BPC] = "hp-bpc",
12498 [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000",
12499 [ALC262_HP_TC_T5735] = "hp-tc-t5735",
12500 [ALC262_HP_RP5700] = "hp-rp5700",
12501 [ALC262_BENQ_ED8] = "benq",
12502 [ALC262_BENQ_T31] = "benq-t31",
12503 [ALC262_SONY_ASSAMD] = "sony-assamd",
12504 [ALC262_TOSHIBA_S06] = "toshiba-s06",
12505 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
12506 [ALC262_ULTRA] = "ultra",
12507 [ALC262_LENOVO_3000] = "lenovo-3000",
12508 [ALC262_NEC] = "nec",
12509 [ALC262_TYAN] = "tyan",
12510 [ALC262_AUTO] = "auto",
12513 static struct snd_pci_quirk alc262_cfg_tbl[] = {
12514 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
12515 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
12516 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series",
12518 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series",
12520 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series",
12522 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL),
12523 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF),
12524 SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL),
12525 SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF),
12526 SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL),
12527 SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF),
12528 SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL),
12529 SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF),
12530 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC),
12531 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC),
12532 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC),
12533 SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735",
12534 ALC262_HP_TC_T5735),
12535 SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700),
12536 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12537 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
12538 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
12539 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
12540 SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
12541 SND_PCI_QUIRK(0x104d, 0x9035, "Sony VAIO VGN-FW170J", ALC262_AUTO),
12542 SND_PCI_QUIRK(0x104d, 0x9047, "Sony VAIO Type G", ALC262_AUTO),
12543 #if 0 /* disable the quirk since model=auto works better in recent versions */
12544 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
12545 ALC262_SONY_ASSAMD),
12547 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
12548 ALC262_TOSHIBA_RX1),
12549 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
12550 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
12551 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
12552 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
12553 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
12555 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
12556 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
12557 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
12558 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
12559 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
12563 static struct alc_config_preset alc262_presets[] = {
12565 .mixers = { alc262_base_mixer },
12566 .init_verbs = { alc262_init_verbs },
12567 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12568 .dac_nids = alc262_dac_nids,
12570 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12571 .channel_mode = alc262_modes,
12572 .input_mux = &alc262_capture_source,
12575 .mixers = { alc262_hippo_mixer },
12576 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
12577 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12578 .dac_nids = alc262_dac_nids,
12580 .dig_out_nid = ALC262_DIGOUT_NID,
12581 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12582 .channel_mode = alc262_modes,
12583 .input_mux = &alc262_capture_source,
12584 .unsol_event = alc262_hippo_unsol_event,
12585 .setup = alc262_hippo_setup,
12586 .init_hook = alc262_hippo_automute,
12588 [ALC262_HIPPO_1] = {
12589 .mixers = { alc262_hippo1_mixer },
12590 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
12591 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12592 .dac_nids = alc262_dac_nids,
12594 .dig_out_nid = ALC262_DIGOUT_NID,
12595 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12596 .channel_mode = alc262_modes,
12597 .input_mux = &alc262_capture_source,
12598 .unsol_event = alc262_hippo_unsol_event,
12599 .setup = alc262_hippo1_setup,
12600 .init_hook = alc262_hippo_automute,
12602 [ALC262_FUJITSU] = {
12603 .mixers = { alc262_fujitsu_mixer },
12604 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12605 alc262_fujitsu_unsol_verbs },
12606 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12607 .dac_nids = alc262_dac_nids,
12609 .dig_out_nid = ALC262_DIGOUT_NID,
12610 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12611 .channel_mode = alc262_modes,
12612 .input_mux = &alc262_fujitsu_capture_source,
12613 .unsol_event = alc262_fujitsu_unsol_event,
12614 .init_hook = alc262_fujitsu_init_hook,
12616 [ALC262_HP_BPC] = {
12617 .mixers = { alc262_HP_BPC_mixer },
12618 .init_verbs = { alc262_HP_BPC_init_verbs },
12619 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12620 .dac_nids = alc262_dac_nids,
12622 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12623 .channel_mode = alc262_modes,
12624 .input_mux = &alc262_HP_capture_source,
12625 .unsol_event = alc262_hp_bpc_unsol_event,
12626 .init_hook = alc262_hp_bpc_automute,
12628 [ALC262_HP_BPC_D7000_WF] = {
12629 .mixers = { alc262_HP_BPC_WildWest_mixer },
12630 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12631 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12632 .dac_nids = alc262_dac_nids,
12634 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12635 .channel_mode = alc262_modes,
12636 .input_mux = &alc262_HP_D7000_capture_source,
12637 .unsol_event = alc262_hp_wildwest_unsol_event,
12638 .init_hook = alc262_hp_wildwest_automute,
12640 [ALC262_HP_BPC_D7000_WL] = {
12641 .mixers = { alc262_HP_BPC_WildWest_mixer,
12642 alc262_HP_BPC_WildWest_option_mixer },
12643 .init_verbs = { alc262_HP_BPC_WildWest_init_verbs },
12644 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12645 .dac_nids = alc262_dac_nids,
12647 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12648 .channel_mode = alc262_modes,
12649 .input_mux = &alc262_HP_D7000_capture_source,
12650 .unsol_event = alc262_hp_wildwest_unsol_event,
12651 .init_hook = alc262_hp_wildwest_automute,
12653 [ALC262_HP_TC_T5735] = {
12654 .mixers = { alc262_hp_t5735_mixer },
12655 .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs },
12656 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12657 .dac_nids = alc262_dac_nids,
12659 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12660 .channel_mode = alc262_modes,
12661 .input_mux = &alc262_capture_source,
12662 .unsol_event = alc_sku_unsol_event,
12663 .setup = alc262_hp_t5735_setup,
12664 .init_hook = alc_inithook,
12666 [ALC262_HP_RP5700] = {
12667 .mixers = { alc262_hp_rp5700_mixer },
12668 .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs },
12669 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12670 .dac_nids = alc262_dac_nids,
12671 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12672 .channel_mode = alc262_modes,
12673 .input_mux = &alc262_hp_rp5700_capture_source,
12675 [ALC262_BENQ_ED8] = {
12676 .mixers = { alc262_base_mixer },
12677 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
12678 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12679 .dac_nids = alc262_dac_nids,
12681 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12682 .channel_mode = alc262_modes,
12683 .input_mux = &alc262_capture_source,
12685 [ALC262_SONY_ASSAMD] = {
12686 .mixers = { alc262_sony_mixer },
12687 .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs},
12688 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12689 .dac_nids = alc262_dac_nids,
12691 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12692 .channel_mode = alc262_modes,
12693 .input_mux = &alc262_capture_source,
12694 .unsol_event = alc262_hippo_unsol_event,
12695 .setup = alc262_hippo_setup,
12696 .init_hook = alc262_hippo_automute,
12698 [ALC262_BENQ_T31] = {
12699 .mixers = { alc262_benq_t31_mixer },
12700 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
12701 alc_hp15_unsol_verbs },
12702 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12703 .dac_nids = alc262_dac_nids,
12705 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12706 .channel_mode = alc262_modes,
12707 .input_mux = &alc262_capture_source,
12708 .unsol_event = alc262_hippo_unsol_event,
12709 .setup = alc262_hippo_setup,
12710 .init_hook = alc262_hippo_automute,
12713 .mixers = { alc262_ultra_mixer },
12714 .cap_mixer = alc262_ultra_capture_mixer,
12715 .init_verbs = { alc262_ultra_verbs },
12716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12717 .dac_nids = alc262_dac_nids,
12718 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12719 .channel_mode = alc262_modes,
12720 .input_mux = &alc262_ultra_capture_source,
12721 .adc_nids = alc262_adc_nids, /* ADC0 */
12722 .capsrc_nids = alc262_capsrc_nids,
12723 .num_adc_nids = 1, /* single ADC */
12724 .unsol_event = alc262_ultra_unsol_event,
12725 .init_hook = alc262_ultra_automute,
12727 [ALC262_LENOVO_3000] = {
12728 .mixers = { alc262_lenovo_3000_mixer },
12729 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
12730 alc262_lenovo_3000_unsol_verbs,
12731 alc262_lenovo_3000_init_verbs },
12732 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12733 .dac_nids = alc262_dac_nids,
12735 .dig_out_nid = ALC262_DIGOUT_NID,
12736 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12737 .channel_mode = alc262_modes,
12738 .input_mux = &alc262_fujitsu_capture_source,
12739 .unsol_event = alc262_lenovo_3000_unsol_event,
12742 .mixers = { alc262_nec_mixer },
12743 .init_verbs = { alc262_nec_verbs },
12744 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12745 .dac_nids = alc262_dac_nids,
12747 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12748 .channel_mode = alc262_modes,
12749 .input_mux = &alc262_capture_source,
12751 [ALC262_TOSHIBA_S06] = {
12752 .mixers = { alc262_toshiba_s06_mixer },
12753 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
12754 alc262_eapd_verbs },
12755 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12756 .capsrc_nids = alc262_dmic_capsrc_nids,
12757 .dac_nids = alc262_dac_nids,
12758 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
12759 .num_adc_nids = 1, /* single ADC */
12760 .dig_out_nid = ALC262_DIGOUT_NID,
12761 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12762 .channel_mode = alc262_modes,
12763 .unsol_event = alc_sku_unsol_event,
12764 .setup = alc262_toshiba_s06_setup,
12765 .init_hook = alc_inithook,
12767 [ALC262_TOSHIBA_RX1] = {
12768 .mixers = { alc262_toshiba_rx1_mixer },
12769 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
12770 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12771 .dac_nids = alc262_dac_nids,
12773 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12774 .channel_mode = alc262_modes,
12775 .input_mux = &alc262_capture_source,
12776 .unsol_event = alc262_hippo_unsol_event,
12777 .setup = alc262_hippo_setup,
12778 .init_hook = alc262_hippo_automute,
12781 .mixers = { alc262_tyan_mixer },
12782 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
12783 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
12784 .dac_nids = alc262_dac_nids,
12786 .dig_out_nid = ALC262_DIGOUT_NID,
12787 .num_channel_mode = ARRAY_SIZE(alc262_modes),
12788 .channel_mode = alc262_modes,
12789 .input_mux = &alc262_capture_source,
12790 .unsol_event = alc_automute_amp_unsol_event,
12791 .setup = alc262_tyan_setup,
12792 .init_hook = alc_automute_amp,
12796 static int patch_alc262(struct hda_codec *codec)
12798 struct alc_spec *spec;
12802 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
12806 codec->spec = spec;
12808 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
12813 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12814 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0);
12815 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7);
12816 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80);
12819 alc_auto_parse_customize_define(codec);
12821 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
12823 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST,
12827 if (board_config < 0) {
12828 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
12830 board_config = ALC262_AUTO;
12833 if (board_config == ALC262_AUTO)
12834 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1);
12836 if (board_config == ALC262_AUTO) {
12837 /* automatic parse from the BIOS config */
12838 err = alc262_parse_auto_config(codec);
12844 "hda_codec: Cannot set up configuration "
12845 "from BIOS. Using base mode...\n");
12846 board_config = ALC262_BASIC;
12850 if (!spec->no_analog && has_cdefine_beep(codec)) {
12851 err = snd_hda_attach_beep_device(codec, 0x1);
12858 if (board_config != ALC262_AUTO)
12859 setup_preset(codec, &alc262_presets[board_config]);
12861 spec->stream_analog_playback = &alc262_pcm_analog_playback;
12862 spec->stream_analog_capture = &alc262_pcm_analog_capture;
12864 spec->stream_digital_playback = &alc262_pcm_digital_playback;
12865 spec->stream_digital_capture = &alc262_pcm_digital_capture;
12867 if (!spec->adc_nids && spec->input_mux) {
12869 /* check whether the digital-mic has to be supported */
12870 for (i = 0; i < spec->input_mux->num_items; i++) {
12871 if (spec->input_mux->items[i].index >= 9)
12874 if (i < spec->input_mux->num_items) {
12875 /* use only ADC0 */
12876 spec->adc_nids = alc262_dmic_adc_nids;
12877 spec->num_adc_nids = 1;
12878 spec->capsrc_nids = alc262_dmic_capsrc_nids;
12880 /* all analog inputs */
12881 /* check whether NID 0x07 is valid */
12882 unsigned int wcap = get_wcaps(codec, 0x07);
12885 wcap = get_wcaps_type(wcap);
12886 if (wcap != AC_WID_AUD_IN) {
12887 spec->adc_nids = alc262_adc_nids_alt;
12888 spec->num_adc_nids =
12889 ARRAY_SIZE(alc262_adc_nids_alt);
12890 spec->capsrc_nids = alc262_capsrc_nids_alt;
12892 spec->adc_nids = alc262_adc_nids;
12893 spec->num_adc_nids =
12894 ARRAY_SIZE(alc262_adc_nids);
12895 spec->capsrc_nids = alc262_capsrc_nids;
12899 if (!spec->cap_mixer && !spec->no_analog)
12900 set_capture_mixer(codec);
12901 if (!spec->no_analog && has_cdefine_beep(codec))
12902 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12904 if (board_config == ALC262_AUTO)
12905 alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
12907 spec->vmaster_nid = 0x0c;
12909 codec->patch_ops = alc_patch_ops;
12910 if (board_config == ALC262_AUTO)
12911 spec->init_hook = alc262_auto_init;
12912 #ifdef CONFIG_SND_HDA_POWER_SAVE
12913 if (!spec->loopback.amplist)
12914 spec->loopback.amplist = alc262_loopbacks;
12921 * ALC268 channel source setting (2 channel)
12923 #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID
12924 #define alc268_modes alc260_modes
12926 static hda_nid_t alc268_dac_nids[2] = {
12931 static hda_nid_t alc268_adc_nids[2] = {
12936 static hda_nid_t alc268_adc_nids_alt[1] = {
12941 static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 };
12943 static struct snd_kcontrol_new alc268_base_mixer[] = {
12944 /* output mixer control */
12945 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12946 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
12947 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12948 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
12949 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12950 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12951 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12955 static struct snd_kcontrol_new alc268_toshiba_mixer[] = {
12956 /* output mixer control */
12957 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
12958 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
12959 ALC262_HIPPO_MASTER_SWITCH,
12960 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
12961 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
12962 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
12966 /* bind Beep switches of both NID 0x0f and 0x10 */
12967 static struct hda_bind_ctls alc268_bind_beep_sw = {
12968 .ops = &snd_hda_bind_sw,
12970 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
12971 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
12976 static struct snd_kcontrol_new alc268_beep_mixer[] = {
12977 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
12978 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
12982 static struct hda_verb alc268_eapd_verbs[] = {
12983 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
12984 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
12988 /* Toshiba specific */
12989 static struct hda_verb alc268_toshiba_verbs[] = {
12990 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
12994 /* Acer specific */
12995 /* bind volumes of both NID 0x02 and 0x03 */
12996 static struct hda_bind_ctls alc268_acer_bind_master_vol = {
12997 .ops = &snd_hda_bind_vol,
12999 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
13000 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
13005 /* mute/unmute internal speaker according to the hp jack and mute state */
13006 static void alc268_acer_automute(struct hda_codec *codec, int force)
13008 struct alc_spec *spec = codec->spec;
13011 if (force || !spec->sense_updated) {
13012 spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13013 spec->sense_updated = 1;
13015 if (spec->jack_present)
13016 mute = HDA_AMP_MUTE; /* mute internal speaker */
13017 else /* unmute internal speaker if necessary */
13018 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13019 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13020 HDA_AMP_MUTE, mute);
13024 /* bind hp and internal speaker mute (with plug check) */
13025 static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13026 struct snd_ctl_elem_value *ucontrol)
13028 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13029 long *valp = ucontrol->value.integer.value;
13032 change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13034 alc268_acer_automute(codec, 0);
13038 static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13039 /* output mixer control */
13040 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13042 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13043 .name = "Master Playback Switch",
13044 .subdevice = HDA_SUBDEV_AMP_FLAG,
13045 .info = snd_hda_mixer_amp_switch_info,
13046 .get = snd_hda_mixer_amp_switch_get,
13047 .put = alc268_acer_master_sw_put,
13048 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13050 HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13054 static struct snd_kcontrol_new alc268_acer_mixer[] = {
13055 /* output mixer control */
13056 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13058 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13059 .name = "Master Playback Switch",
13060 .subdevice = HDA_SUBDEV_AMP_FLAG,
13061 .info = snd_hda_mixer_amp_switch_info,
13062 .get = snd_hda_mixer_amp_switch_get,
13063 .put = alc268_acer_master_sw_put,
13064 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13066 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13067 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13068 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13072 static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13073 /* output mixer control */
13074 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13076 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13077 .name = "Master Playback Switch",
13078 .subdevice = HDA_SUBDEV_AMP_FLAG,
13079 .info = snd_hda_mixer_amp_switch_info,
13080 .get = snd_hda_mixer_amp_switch_get,
13081 .put = alc268_acer_master_sw_put,
13082 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13084 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13085 HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT),
13089 static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13090 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13091 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13092 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13093 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
13094 {0x23, AC_VERB_SET_CONNECT_SEL, 0x06},
13095 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017},
13099 static struct hda_verb alc268_acer_verbs[] = {
13100 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */
13101 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13102 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13103 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
13104 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13105 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
13106 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13110 /* unsolicited event for HP jack sensing */
13111 #define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13112 #define alc268_toshiba_setup alc262_hippo_setup
13113 #define alc268_toshiba_automute alc262_hippo_automute
13115 static void alc268_acer_unsol_event(struct hda_codec *codec,
13118 if ((res >> 26) != ALC880_HP_EVENT)
13120 alc268_acer_automute(codec, 1);
13123 static void alc268_acer_init_hook(struct hda_codec *codec)
13125 alc268_acer_automute(codec, 1);
13128 /* toggle speaker-output according to the hp-jack state */
13129 static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13131 unsigned int present;
13132 unsigned char bits;
13134 present = snd_hda_jack_detect(codec, 0x15);
13135 bits = present ? HDA_AMP_MUTE : 0;
13136 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13137 HDA_AMP_MUTE, bits);
13138 snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13139 HDA_AMP_MUTE, bits);
13142 static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13145 switch (res >> 26) {
13146 case ALC880_HP_EVENT:
13147 alc268_aspire_one_speaker_automute(codec);
13149 case ALC880_MIC_EVENT:
13150 alc_mic_automute(codec);
13155 static void alc268_acer_lc_setup(struct hda_codec *codec)
13157 struct alc_spec *spec = codec->spec;
13158 spec->ext_mic.pin = 0x18;
13159 spec->ext_mic.mux_idx = 0;
13160 spec->int_mic.pin = 0x12;
13161 spec->int_mic.mux_idx = 6;
13162 spec->auto_mic = 1;
13165 static void alc268_acer_lc_init_hook(struct hda_codec *codec)
13167 alc268_aspire_one_speaker_automute(codec);
13168 alc_mic_automute(codec);
13171 static struct snd_kcontrol_new alc268_dell_mixer[] = {
13172 /* output mixer control */
13173 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13174 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13175 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13176 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13177 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
13178 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
13182 static struct hda_verb alc268_dell_verbs[] = {
13183 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13184 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13185 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13186 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13190 /* mute/unmute internal speaker according to the hp jack and mute state */
13191 static void alc268_dell_setup(struct hda_codec *codec)
13193 struct alc_spec *spec = codec->spec;
13195 spec->autocfg.hp_pins[0] = 0x15;
13196 spec->autocfg.speaker_pins[0] = 0x14;
13197 spec->ext_mic.pin = 0x18;
13198 spec->ext_mic.mux_idx = 0;
13199 spec->int_mic.pin = 0x19;
13200 spec->int_mic.mux_idx = 1;
13201 spec->auto_mic = 1;
13204 static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = {
13205 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT),
13206 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
13207 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT),
13208 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
13209 HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13210 HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT),
13211 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
13212 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
13216 static struct hda_verb alc267_quanta_il1_verbs[] = {
13217 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13218 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
13222 static void alc267_quanta_il1_setup(struct hda_codec *codec)
13224 struct alc_spec *spec = codec->spec;
13225 spec->autocfg.hp_pins[0] = 0x15;
13226 spec->autocfg.speaker_pins[0] = 0x14;
13227 spec->ext_mic.pin = 0x18;
13228 spec->ext_mic.mux_idx = 0;
13229 spec->int_mic.pin = 0x19;
13230 spec->int_mic.mux_idx = 1;
13231 spec->auto_mic = 1;
13235 * generic initialization of ADC, input mixers and output mixers
13237 static struct hda_verb alc268_base_init_verbs[] = {
13238 /* Unmute DAC0-1 and set vol = 0 */
13239 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13240 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13243 * Set up output mixers (0x0c - 0x0e)
13245 /* set vol=0 to output mixers */
13246 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13247 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00},
13249 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13250 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13252 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13253 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
13254 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
13255 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13256 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13257 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13258 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13259 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13261 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13262 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13263 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13264 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13265 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13267 /* set PCBEEP vol = 0, mute connections */
13268 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13269 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13270 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13272 /* Unmute Selector 23h,24h and set the default input to mic-in */
13274 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
13275 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13276 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
13277 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
13283 * generic initialization of ADC, input mixers and output mixers
13285 static struct hda_verb alc268_volume_init_verbs[] = {
13286 /* set output DAC */
13287 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13288 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
13290 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13291 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
13292 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13293 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13294 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
13296 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13297 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13298 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13300 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13301 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
13303 /* set PCBEEP vol = 0, mute connections */
13304 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
13305 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13306 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
13311 static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = {
13312 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13313 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13317 static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
13318 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13319 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13324 static struct snd_kcontrol_new alc268_capture_mixer[] = {
13325 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13326 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
13327 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT),
13328 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT),
13333 static struct hda_input_mux alc268_capture_source = {
13337 { "Front Mic", 0x1 },
13343 static struct hda_input_mux alc268_acer_capture_source = {
13347 { "Internal Mic", 0x1 },
13352 static struct hda_input_mux alc268_acer_dmic_capture_source = {
13356 { "Internal Mic", 0x6 },
13361 #ifdef CONFIG_SND_DEBUG
13362 static struct snd_kcontrol_new alc268_test_mixer[] = {
13363 /* Volume widgets */
13364 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT),
13365 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT),
13366 HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT),
13367 HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT),
13368 HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT),
13369 HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT),
13370 HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT),
13371 HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT),
13372 HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT),
13373 HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT),
13374 HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT),
13375 HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT),
13376 HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT),
13377 /* The below appears problematic on some hardwares */
13378 /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/
13379 HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT),
13380 HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT),
13381 HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT),
13382 HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT),
13384 /* Modes for retasking pin widgets */
13385 ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT),
13386 ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT),
13387 ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT),
13388 ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT),
13390 /* Controls for GPIO pins, assuming they are configured as outputs */
13391 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01),
13392 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02),
13393 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04),
13394 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08),
13396 /* Switches to allow the digital SPDIF output pin to be enabled.
13397 * The ALC268 does not have an SPDIF input.
13399 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01),
13401 /* A switch allowing EAPD to be enabled. Some laptops seem to use
13402 * this output to turn on an external amplifier.
13404 ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02),
13405 ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02),
13411 /* create input playback/capture controls for the given pin */
13412 static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
13413 const char *ctlname, int idx)
13424 case 0x1a: /* ALC259/269 only */
13425 case 0x1b: /* ALC259/269 only */
13426 case 0x21: /* ALC269vb has this pin, too */
13430 snd_printd(KERN_WARNING "hda_codec: "
13431 "ignoring pin 0x%x as unknown\n", nid);
13434 if (spec->multiout.dac_nids[0] != dac &&
13435 spec->multiout.dac_nids[1] != dac) {
13436 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
13437 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
13441 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
13445 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13446 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
13448 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
13449 HDA_COMPOSE_AMP_VAL(nid, 2, idx, HDA_OUTPUT));
13455 /* add playback controls from the parsed DAC table */
13456 static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
13457 const struct auto_pin_cfg *cfg)
13462 spec->multiout.dac_nids = spec->private_dac_nids;
13464 nid = cfg->line_out_pins[0];
13467 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
13471 err = alc268_new_analog_output(spec, nid, name, 0);
13476 nid = cfg->speaker_pins[0];
13478 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, "Speaker",
13479 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
13483 err = alc268_new_analog_output(spec, nid, "Speaker", 0);
13487 nid = cfg->hp_pins[0];
13489 err = alc268_new_analog_output(spec, nid, "Headphone", 0);
13494 nid = cfg->line_out_pins[1] | cfg->line_out_pins[2];
13496 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, "Mono",
13497 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT));
13504 /* create playback/capture controls for input pins */
13505 static int alc268_auto_create_input_ctls(struct hda_codec *codec,
13506 const struct auto_pin_cfg *cfg)
13508 return alc_auto_create_input_ctls(codec, cfg, 0, 0x23, 0x24);
13511 static void alc268_auto_set_output_and_unmute(struct hda_codec *codec,
13512 hda_nid_t nid, int pin_type)
13516 alc_set_pin_output(codec, nid, pin_type);
13517 if (nid == 0x14 || nid == 0x16)
13521 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
13524 static void alc268_auto_init_multi_out(struct hda_codec *codec)
13526 struct alc_spec *spec = codec->spec;
13529 for (i = 0; i < spec->autocfg.line_outs; i++) {
13530 hda_nid_t nid = spec->autocfg.line_out_pins[i];
13531 int pin_type = get_pin_type(spec->autocfg.line_out_type);
13532 alc268_auto_set_output_and_unmute(codec, nid, pin_type);
13536 static void alc268_auto_init_hp_out(struct hda_codec *codec)
13538 struct alc_spec *spec = codec->spec;
13542 for (i = 0; i < spec->autocfg.hp_outs; i++) {
13543 pin = spec->autocfg.hp_pins[i];
13544 alc268_auto_set_output_and_unmute(codec, pin, PIN_HP);
13546 for (i = 0; i < spec->autocfg.speaker_outs; i++) {
13547 pin = spec->autocfg.speaker_pins[i];
13548 alc268_auto_set_output_and_unmute(codec, pin, PIN_OUT);
13550 if (spec->autocfg.mono_out_pin)
13551 snd_hda_codec_write(codec, spec->autocfg.mono_out_pin, 0,
13552 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13555 static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec)
13557 struct alc_spec *spec = codec->spec;
13558 hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0];
13559 hda_nid_t hp_nid = spec->autocfg.hp_pins[0];
13560 hda_nid_t line_nid = spec->autocfg.line_out_pins[0];
13561 unsigned int dac_vol1, dac_vol2;
13563 if (line_nid == 0x1d || speaker_nid == 0x1d) {
13564 snd_hda_codec_write(codec, speaker_nid, 0,
13565 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
13566 /* mute mixer inputs from 0x1d */
13567 snd_hda_codec_write(codec, 0x0f, 0,
13568 AC_VERB_SET_AMP_GAIN_MUTE,
13570 snd_hda_codec_write(codec, 0x10, 0,
13571 AC_VERB_SET_AMP_GAIN_MUTE,
13574 /* unmute mixer inputs from 0x1d */
13575 snd_hda_codec_write(codec, 0x0f, 0,
13576 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13577 snd_hda_codec_write(codec, 0x10, 0,
13578 AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1));
13581 dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */
13582 if (line_nid == 0x14)
13583 dac_vol2 = AMP_OUT_ZERO;
13584 else if (line_nid == 0x15)
13585 dac_vol1 = AMP_OUT_ZERO;
13586 if (hp_nid == 0x14)
13587 dac_vol2 = AMP_OUT_ZERO;
13588 else if (hp_nid == 0x15)
13589 dac_vol1 = AMP_OUT_ZERO;
13590 if (line_nid != 0x16 || hp_nid != 0x16 ||
13591 spec->autocfg.line_out_pins[1] != 0x16 ||
13592 spec->autocfg.line_out_pins[2] != 0x16)
13593 dac_vol1 = dac_vol2 = AMP_OUT_ZERO;
13595 snd_hda_codec_write(codec, 0x02, 0,
13596 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1);
13597 snd_hda_codec_write(codec, 0x03, 0,
13598 AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2);
13601 /* pcm configuration: identical with ALC880 */
13602 #define alc268_pcm_analog_playback alc880_pcm_analog_playback
13603 #define alc268_pcm_analog_capture alc880_pcm_analog_capture
13604 #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
13605 #define alc268_pcm_digital_playback alc880_pcm_digital_playback
13608 * BIOS auto configuration
13610 static int alc268_parse_auto_config(struct hda_codec *codec)
13612 struct alc_spec *spec = codec->spec;
13614 static hda_nid_t alc268_ignore[] = { 0 };
13616 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
13620 if (!spec->autocfg.line_outs) {
13621 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
13622 spec->multiout.max_channels = 2;
13623 spec->no_analog = 1;
13626 return 0; /* can't find valid BIOS pin config */
13628 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg);
13631 err = alc268_auto_create_input_ctls(codec, &spec->autocfg);
13635 spec->multiout.max_channels = 2;
13638 /* digital only support output */
13639 alc_auto_parse_digital(codec);
13640 if (spec->kctls.list)
13641 add_mixer(spec, spec->kctls.list);
13643 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d)
13644 add_mixer(spec, alc268_beep_mixer);
13646 add_verb(spec, alc268_volume_init_verbs);
13647 spec->num_mux_defs = 2;
13648 spec->input_mux = &spec->private_imux[0];
13650 err = alc_auto_add_mic_boost(codec);
13654 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
13659 #define alc268_auto_init_analog_input alc882_auto_init_analog_input
13661 /* init callback for auto-configuration model -- overriding the default init */
13662 static void alc268_auto_init(struct hda_codec *codec)
13664 struct alc_spec *spec = codec->spec;
13665 alc268_auto_init_multi_out(codec);
13666 alc268_auto_init_hp_out(codec);
13667 alc268_auto_init_mono_speaker_out(codec);
13668 alc268_auto_init_analog_input(codec);
13669 alc_auto_init_digital(codec);
13670 if (spec->unsol_event)
13671 alc_inithook(codec);
13675 * configuration and preset
13677 static const char *alc268_models[ALC268_MODEL_LAST] = {
13678 [ALC267_QUANTA_IL1] = "quanta-il1",
13679 [ALC268_3ST] = "3stack",
13680 [ALC268_TOSHIBA] = "toshiba",
13681 [ALC268_ACER] = "acer",
13682 [ALC268_ACER_DMIC] = "acer-dmic",
13683 [ALC268_ACER_ASPIRE_ONE] = "acer-aspire",
13684 [ALC268_DELL] = "dell",
13685 [ALC268_ZEPTO] = "zepto",
13686 #ifdef CONFIG_SND_DEBUG
13687 [ALC268_TEST] = "test",
13689 [ALC268_AUTO] = "auto",
13692 static struct snd_pci_quirk alc268_cfg_tbl[] = {
13693 SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER),
13694 SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER),
13695 SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER),
13696 SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER),
13697 SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER),
13698 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
13699 ALC268_ACER_ASPIRE_ONE),
13700 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
13701 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
13702 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
13703 /* almost compatible with toshiba but with optional digital outs;
13704 * auto-probing seems working fine
13706 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP TX25xx series",
13708 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST),
13709 SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO),
13710 SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA),
13711 SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER),
13712 SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1),
13716 /* Toshiba laptops have no unique PCI SSID but only codec SSID */
13717 static struct snd_pci_quirk alc268_ssid_cfg_tbl[] = {
13718 SND_PCI_QUIRK(0x1179, 0xff0a, "TOSHIBA X-200", ALC268_AUTO),
13719 SND_PCI_QUIRK(0x1179, 0xff0e, "TOSHIBA X-200 HDMI", ALC268_AUTO),
13720 SND_PCI_QUIRK_MASK(0x1179, 0xff00, 0xff00, "TOSHIBA A/Lx05",
13725 static struct alc_config_preset alc268_presets[] = {
13726 [ALC267_QUANTA_IL1] = {
13727 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer,
13728 alc268_capture_nosrc_mixer },
13729 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13730 alc267_quanta_il1_verbs },
13731 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13732 .dac_nids = alc268_dac_nids,
13733 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13734 .adc_nids = alc268_adc_nids_alt,
13736 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13737 .channel_mode = alc268_modes,
13738 .unsol_event = alc_sku_unsol_event,
13739 .setup = alc267_quanta_il1_setup,
13740 .init_hook = alc_inithook,
13743 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13744 alc268_beep_mixer },
13745 .init_verbs = { alc268_base_init_verbs },
13746 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13747 .dac_nids = alc268_dac_nids,
13748 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13749 .adc_nids = alc268_adc_nids_alt,
13750 .capsrc_nids = alc268_capsrc_nids,
13752 .dig_out_nid = ALC268_DIGOUT_NID,
13753 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13754 .channel_mode = alc268_modes,
13755 .input_mux = &alc268_capture_source,
13757 [ALC268_TOSHIBA] = {
13758 .mixers = { alc268_toshiba_mixer, alc268_capture_alt_mixer,
13759 alc268_beep_mixer },
13760 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13761 alc268_toshiba_verbs },
13762 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13763 .dac_nids = alc268_dac_nids,
13764 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13765 .adc_nids = alc268_adc_nids_alt,
13766 .capsrc_nids = alc268_capsrc_nids,
13768 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13769 .channel_mode = alc268_modes,
13770 .input_mux = &alc268_capture_source,
13771 .unsol_event = alc268_toshiba_unsol_event,
13772 .setup = alc268_toshiba_setup,
13773 .init_hook = alc268_toshiba_automute,
13776 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
13777 alc268_beep_mixer },
13778 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13779 alc268_acer_verbs },
13780 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13781 .dac_nids = alc268_dac_nids,
13782 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13783 .adc_nids = alc268_adc_nids_alt,
13784 .capsrc_nids = alc268_capsrc_nids,
13786 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13787 .channel_mode = alc268_modes,
13788 .input_mux = &alc268_acer_capture_source,
13789 .unsol_event = alc268_acer_unsol_event,
13790 .init_hook = alc268_acer_init_hook,
13792 [ALC268_ACER_DMIC] = {
13793 .mixers = { alc268_acer_dmic_mixer, alc268_capture_alt_mixer,
13794 alc268_beep_mixer },
13795 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13796 alc268_acer_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 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13804 .channel_mode = alc268_modes,
13805 .input_mux = &alc268_acer_dmic_capture_source,
13806 .unsol_event = alc268_acer_unsol_event,
13807 .init_hook = alc268_acer_init_hook,
13809 [ALC268_ACER_ASPIRE_ONE] = {
13810 .mixers = { alc268_acer_aspire_one_mixer,
13812 alc268_capture_nosrc_mixer },
13813 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13814 alc268_acer_aspire_one_verbs },
13815 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13816 .dac_nids = alc268_dac_nids,
13817 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13818 .adc_nids = alc268_adc_nids_alt,
13819 .capsrc_nids = alc268_capsrc_nids,
13821 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13822 .channel_mode = alc268_modes,
13823 .unsol_event = alc268_acer_lc_unsol_event,
13824 .setup = alc268_acer_lc_setup,
13825 .init_hook = alc268_acer_lc_init_hook,
13828 .mixers = { alc268_dell_mixer, alc268_beep_mixer,
13829 alc268_capture_nosrc_mixer },
13830 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13831 alc268_dell_verbs },
13832 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13833 .dac_nids = alc268_dac_nids,
13834 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13835 .adc_nids = alc268_adc_nids_alt,
13836 .capsrc_nids = alc268_capsrc_nids,
13838 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13839 .channel_mode = alc268_modes,
13840 .unsol_event = alc_sku_unsol_event,
13841 .setup = alc268_dell_setup,
13842 .init_hook = alc_inithook,
13845 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
13846 alc268_beep_mixer },
13847 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13848 alc268_toshiba_verbs },
13849 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13850 .dac_nids = alc268_dac_nids,
13851 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13852 .adc_nids = alc268_adc_nids_alt,
13853 .capsrc_nids = alc268_capsrc_nids,
13855 .dig_out_nid = ALC268_DIGOUT_NID,
13856 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13857 .channel_mode = alc268_modes,
13858 .input_mux = &alc268_capture_source,
13859 .setup = alc268_toshiba_setup,
13860 .init_hook = alc268_toshiba_automute,
13862 #ifdef CONFIG_SND_DEBUG
13864 .mixers = { alc268_test_mixer, alc268_capture_mixer },
13865 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
13866 alc268_volume_init_verbs },
13867 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
13868 .dac_nids = alc268_dac_nids,
13869 .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt),
13870 .adc_nids = alc268_adc_nids_alt,
13871 .capsrc_nids = alc268_capsrc_nids,
13873 .dig_out_nid = ALC268_DIGOUT_NID,
13874 .num_channel_mode = ARRAY_SIZE(alc268_modes),
13875 .channel_mode = alc268_modes,
13876 .input_mux = &alc268_capture_source,
13881 static int patch_alc268(struct hda_codec *codec)
13883 struct alc_spec *spec;
13885 int i, has_beep, err;
13887 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
13891 codec->spec = spec;
13893 board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST,
13897 if (board_config < 0 || board_config >= ALC268_MODEL_LAST)
13898 board_config = snd_hda_check_board_codec_sid_config(codec,
13899 ALC268_MODEL_LAST, alc268_models, alc268_ssid_cfg_tbl);
13901 if (board_config < 0 || board_config >= ALC268_MODEL_LAST) {
13902 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
13904 board_config = ALC268_AUTO;
13907 if (board_config == ALC268_AUTO) {
13908 /* automatic parse from the BIOS config */
13909 err = alc268_parse_auto_config(codec);
13915 "hda_codec: Cannot set up configuration "
13916 "from BIOS. Using base mode...\n");
13917 board_config = ALC268_3ST;
13921 if (board_config != ALC268_AUTO)
13922 setup_preset(codec, &alc268_presets[board_config]);
13924 spec->stream_analog_playback = &alc268_pcm_analog_playback;
13925 spec->stream_analog_capture = &alc268_pcm_analog_capture;
13926 spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture;
13928 spec->stream_digital_playback = &alc268_pcm_digital_playback;
13931 for (i = 0; i < spec->num_mixers; i++) {
13932 if (spec->mixers[i] == alc268_beep_mixer) {
13939 err = snd_hda_attach_beep_device(codec, 0x1);
13944 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
13945 /* override the amp caps for beep generator */
13946 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
13947 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
13948 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
13949 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
13950 (0 << AC_AMPCAP_MUTE_SHIFT));
13953 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) {
13954 /* check whether NID 0x07 is valid */
13955 unsigned int wcap = get_wcaps(codec, 0x07);
13958 spec->capsrc_nids = alc268_capsrc_nids;
13960 wcap = get_wcaps_type(wcap);
13961 if (spec->auto_mic ||
13962 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
13963 spec->adc_nids = alc268_adc_nids_alt;
13964 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
13965 if (spec->auto_mic)
13966 fixup_automic_adc(codec);
13967 if (spec->auto_mic || spec->input_mux->num_items == 1)
13968 add_mixer(spec, alc268_capture_nosrc_mixer);
13970 add_mixer(spec, alc268_capture_alt_mixer);
13972 spec->adc_nids = alc268_adc_nids;
13973 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
13974 add_mixer(spec, alc268_capture_mixer);
13976 /* set default input source */
13977 for (i = 0; i < spec->num_adc_nids; i++)
13978 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
13979 0, AC_VERB_SET_CONNECT_SEL,
13980 i < spec->num_mux_defs ?
13981 spec->input_mux[i].items[0].index :
13982 spec->input_mux->items[0].index);
13985 spec->vmaster_nid = 0x02;
13987 codec->patch_ops = alc_patch_ops;
13988 if (board_config == ALC268_AUTO)
13989 spec->init_hook = alc268_auto_init;
13995 * ALC269 channel source setting (2 channel)
13997 #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID
13999 #define alc269_dac_nids alc260_dac_nids
14001 static hda_nid_t alc269_adc_nids[1] = {
14006 static hda_nid_t alc269_capsrc_nids[1] = {
14010 static hda_nid_t alc269vb_adc_nids[1] = {
14015 static hda_nid_t alc269vb_capsrc_nids[1] = {
14019 static hda_nid_t alc269_adc_candidates[] = {
14023 #define alc269_modes alc260_modes
14024 #define alc269_capture_source alc880_lg_lw_capture_source
14026 static struct snd_kcontrol_new alc269_base_mixer[] = {
14027 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14028 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14029 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
14030 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
14031 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14032 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14033 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14034 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14035 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14036 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
14037 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14038 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
14042 static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {
14043 /* output mixer control */
14044 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14046 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14047 .name = "Master Playback Switch",
14048 .subdevice = HDA_SUBDEV_AMP_FLAG,
14049 .info = snd_hda_mixer_amp_switch_info,
14050 .get = snd_hda_mixer_amp_switch_get,
14051 .put = alc268_acer_master_sw_put,
14052 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14054 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14055 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14056 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14057 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14058 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14059 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14063 static struct snd_kcontrol_new alc269_lifebook_mixer[] = {
14064 /* output mixer control */
14065 HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
14067 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
14068 .name = "Master Playback Switch",
14069 .subdevice = HDA_SUBDEV_AMP_FLAG,
14070 .info = snd_hda_mixer_amp_switch_info,
14071 .get = snd_hda_mixer_amp_switch_get,
14072 .put = alc268_acer_master_sw_put,
14073 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
14075 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
14076 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
14077 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14078 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
14079 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
14080 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT),
14081 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT),
14082 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT),
14083 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT),
14087 static struct snd_kcontrol_new alc269_laptop_mixer[] = {
14088 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14089 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14090 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
14091 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14095 static struct snd_kcontrol_new alc269vb_laptop_mixer[] = {
14096 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
14097 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
14099 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
14103 static struct snd_kcontrol_new alc269_asus_mixer[] = {
14104 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
14105 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x0, HDA_INPUT),
14109 /* capture mixer elements */
14110 static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = {
14111 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14112 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14113 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14114 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14118 static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {
14119 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
14120 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
14121 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14125 static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = {
14126 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14127 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14128 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14129 HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT),
14133 static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = {
14134 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
14135 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
14136 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
14141 #define alc269_fujitsu_mixer alc269_laptop_mixer
14143 static struct hda_verb alc269_quanta_fl1_verbs[] = {
14144 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14145 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14146 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14147 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14148 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14149 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14153 static struct hda_verb alc269_lifebook_verbs[] = {
14154 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14155 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
14156 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14157 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14158 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14159 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14160 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14161 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
14162 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14163 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14167 /* toggle speaker-output according to the hp-jack state */
14168 static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14170 unsigned int present;
14171 unsigned char bits;
14173 present = snd_hda_jack_detect(codec, 0x15);
14174 bits = present ? HDA_AMP_MUTE : 0;
14175 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14176 HDA_AMP_MUTE, bits);
14177 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14178 HDA_AMP_MUTE, bits);
14180 snd_hda_codec_write(codec, 0x20, 0,
14181 AC_VERB_SET_COEF_INDEX, 0x0c);
14182 snd_hda_codec_write(codec, 0x20, 0,
14183 AC_VERB_SET_PROC_COEF, 0x680);
14185 snd_hda_codec_write(codec, 0x20, 0,
14186 AC_VERB_SET_COEF_INDEX, 0x0c);
14187 snd_hda_codec_write(codec, 0x20, 0,
14188 AC_VERB_SET_PROC_COEF, 0x480);
14191 /* toggle speaker-output according to the hp-jacks state */
14192 static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14194 unsigned int present;
14195 unsigned char bits;
14197 /* Check laptop headphone socket */
14198 present = snd_hda_jack_detect(codec, 0x15);
14200 /* Check port replicator headphone socket */
14201 present |= snd_hda_jack_detect(codec, 0x1a);
14203 bits = present ? HDA_AMP_MUTE : 0;
14204 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14205 HDA_AMP_MUTE, bits);
14206 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14207 HDA_AMP_MUTE, bits);
14209 snd_hda_codec_write(codec, 0x20, 0,
14210 AC_VERB_SET_COEF_INDEX, 0x0c);
14211 snd_hda_codec_write(codec, 0x20, 0,
14212 AC_VERB_SET_PROC_COEF, 0x680);
14214 snd_hda_codec_write(codec, 0x20, 0,
14215 AC_VERB_SET_COEF_INDEX, 0x0c);
14216 snd_hda_codec_write(codec, 0x20, 0,
14217 AC_VERB_SET_PROC_COEF, 0x480);
14220 static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
14222 unsigned int present_laptop;
14223 unsigned int present_dock;
14225 present_laptop = snd_hda_jack_detect(codec, 0x18);
14226 present_dock = snd_hda_jack_detect(codec, 0x1b);
14228 /* Laptop mic port overrides dock mic port, design decision */
14230 snd_hda_codec_write(codec, 0x23, 0,
14231 AC_VERB_SET_CONNECT_SEL, 0x3);
14232 if (present_laptop)
14233 snd_hda_codec_write(codec, 0x23, 0,
14234 AC_VERB_SET_CONNECT_SEL, 0x0);
14235 if (!present_dock && !present_laptop)
14236 snd_hda_codec_write(codec, 0x23, 0,
14237 AC_VERB_SET_CONNECT_SEL, 0x1);
14240 static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec,
14243 switch (res >> 26) {
14244 case ALC880_HP_EVENT:
14245 alc269_quanta_fl1_speaker_automute(codec);
14247 case ALC880_MIC_EVENT:
14248 alc_mic_automute(codec);
14253 static void alc269_lifebook_unsol_event(struct hda_codec *codec,
14256 if ((res >> 26) == ALC880_HP_EVENT)
14257 alc269_lifebook_speaker_automute(codec);
14258 if ((res >> 26) == ALC880_MIC_EVENT)
14259 alc269_lifebook_mic_autoswitch(codec);
14262 static void alc269_quanta_fl1_setup(struct hda_codec *codec)
14264 struct alc_spec *spec = codec->spec;
14265 spec->autocfg.hp_pins[0] = 0x15;
14266 spec->autocfg.speaker_pins[0] = 0x14;
14267 spec->ext_mic.pin = 0x18;
14268 spec->ext_mic.mux_idx = 0;
14269 spec->int_mic.pin = 0x19;
14270 spec->int_mic.mux_idx = 1;
14271 spec->auto_mic = 1;
14274 static void alc269_quanta_fl1_init_hook(struct hda_codec *codec)
14276 alc269_quanta_fl1_speaker_automute(codec);
14277 alc_mic_automute(codec);
14280 static void alc269_lifebook_init_hook(struct hda_codec *codec)
14282 alc269_lifebook_speaker_automute(codec);
14283 alc269_lifebook_mic_autoswitch(codec);
14286 static struct hda_verb alc269_laptop_dmic_init_verbs[] = {
14287 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14288 {0x23, AC_VERB_SET_CONNECT_SEL, 0x05},
14289 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14290 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14291 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14292 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14293 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14297 static struct hda_verb alc269_laptop_amic_init_verbs[] = {
14298 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
14299 {0x23, AC_VERB_SET_CONNECT_SEL, 0x01},
14300 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14301 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x701b | (0x00 << 8))},
14302 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14303 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14307 static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = {
14308 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14309 {0x22, AC_VERB_SET_CONNECT_SEL, 0x06},
14310 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14311 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14312 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14313 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14314 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14318 static struct hda_verb alc269vb_laptop_amic_init_verbs[] = {
14319 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01},
14320 {0x22, AC_VERB_SET_CONNECT_SEL, 0x01},
14321 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 },
14322 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))},
14323 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14324 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14325 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14329 static struct hda_verb alc271_acer_dmic_verbs[] = {
14330 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
14331 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
14332 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14333 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14334 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14335 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14336 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00},
14337 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
14338 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
14339 {0x22, AC_VERB_SET_CONNECT_SEL, 6},
14343 /* toggle speaker-output according to the hp-jack state */
14344 static void alc269_speaker_automute(struct hda_codec *codec)
14346 struct alc_spec *spec = codec->spec;
14347 unsigned int nid = spec->autocfg.hp_pins[0];
14348 unsigned int present;
14349 unsigned char bits;
14351 present = snd_hda_jack_detect(codec, nid);
14352 bits = present ? HDA_AMP_MUTE : 0;
14353 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14354 HDA_AMP_MUTE, bits);
14355 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14356 HDA_AMP_MUTE, bits);
14359 /* unsolicited event for HP jack sensing */
14360 static void alc269_laptop_unsol_event(struct hda_codec *codec,
14363 switch (res >> 26) {
14364 case ALC880_HP_EVENT:
14365 alc269_speaker_automute(codec);
14367 case ALC880_MIC_EVENT:
14368 alc_mic_automute(codec);
14373 static void alc269_laptop_amic_setup(struct hda_codec *codec)
14375 struct alc_spec *spec = codec->spec;
14376 spec->autocfg.hp_pins[0] = 0x15;
14377 spec->autocfg.speaker_pins[0] = 0x14;
14378 spec->ext_mic.pin = 0x18;
14379 spec->ext_mic.mux_idx = 0;
14380 spec->int_mic.pin = 0x19;
14381 spec->int_mic.mux_idx = 1;
14382 spec->auto_mic = 1;
14385 static void alc269_laptop_dmic_setup(struct hda_codec *codec)
14387 struct alc_spec *spec = codec->spec;
14388 spec->autocfg.hp_pins[0] = 0x15;
14389 spec->autocfg.speaker_pins[0] = 0x14;
14390 spec->ext_mic.pin = 0x18;
14391 spec->ext_mic.mux_idx = 0;
14392 spec->int_mic.pin = 0x12;
14393 spec->int_mic.mux_idx = 5;
14394 spec->auto_mic = 1;
14397 static void alc269vb_laptop_amic_setup(struct hda_codec *codec)
14399 struct alc_spec *spec = codec->spec;
14400 spec->autocfg.hp_pins[0] = 0x21;
14401 spec->autocfg.speaker_pins[0] = 0x14;
14402 spec->ext_mic.pin = 0x18;
14403 spec->ext_mic.mux_idx = 0;
14404 spec->int_mic.pin = 0x19;
14405 spec->int_mic.mux_idx = 1;
14406 spec->auto_mic = 1;
14409 static void alc269vb_laptop_dmic_setup(struct hda_codec *codec)
14411 struct alc_spec *spec = codec->spec;
14412 spec->autocfg.hp_pins[0] = 0x21;
14413 spec->autocfg.speaker_pins[0] = 0x14;
14414 spec->ext_mic.pin = 0x18;
14415 spec->ext_mic.mux_idx = 0;
14416 spec->int_mic.pin = 0x12;
14417 spec->int_mic.mux_idx = 6;
14418 spec->auto_mic = 1;
14421 static void alc269_laptop_inithook(struct hda_codec *codec)
14423 alc269_speaker_automute(codec);
14424 alc_mic_automute(codec);
14428 * generic initialization of ADC, input mixers and output mixers
14430 static struct hda_verb alc269_init_verbs[] = {
14432 * Unmute ADC0 and set the default input to mic-in
14434 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14437 * Set up output mixers (0x02 - 0x03)
14439 /* set vol=0 to output mixers */
14440 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14441 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14443 /* set up input amps for analog loopback */
14444 /* Amp Indices: DAC = 0, mixer = 1 */
14445 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14446 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14447 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14448 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14449 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14450 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14453 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14454 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14455 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14456 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14457 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14458 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14460 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14461 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14463 /* FIXME: use Mux-type input source selection */
14464 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14465 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14466 {0x23, AC_VERB_SET_CONNECT_SEL, 0x00},
14469 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14473 static struct hda_verb alc269vb_init_verbs[] = {
14475 * Unmute ADC0 and set the default input to mic-in
14477 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14480 * Set up output mixers (0x02 - 0x03)
14482 /* set vol=0 to output mixers */
14483 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14484 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
14486 /* set up input amps for analog loopback */
14487 /* Amp Indices: DAC = 0, mixer = 1 */
14488 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14489 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14490 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14491 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
14493 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
14495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14496 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
14497 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
14498 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14499 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
14500 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14501 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
14503 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14504 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
14506 /* FIXME: use Mux-type input source selection */
14507 /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */
14508 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
14509 {0x22, AC_VERB_SET_CONNECT_SEL, 0x00},
14512 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
14516 #define alc269_auto_create_multi_out_ctls \
14517 alc268_auto_create_multi_out_ctls
14518 #define alc269_auto_create_input_ctls \
14519 alc268_auto_create_input_ctls
14521 #ifdef CONFIG_SND_HDA_POWER_SAVE
14522 #define alc269_loopbacks alc880_loopbacks
14525 /* pcm configuration: identical with ALC880 */
14526 #define alc269_pcm_analog_playback alc880_pcm_analog_playback
14527 #define alc269_pcm_analog_capture alc880_pcm_analog_capture
14528 #define alc269_pcm_digital_playback alc880_pcm_digital_playback
14529 #define alc269_pcm_digital_capture alc880_pcm_digital_capture
14531 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
14535 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14536 /* NID is set in alc_build_pcms */
14538 .open = alc880_playback_pcm_open,
14539 .prepare = alc880_playback_pcm_prepare,
14540 .cleanup = alc880_playback_pcm_cleanup
14544 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
14548 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
14549 /* NID is set in alc_build_pcms */
14552 #ifdef CONFIG_SND_HDA_POWER_SAVE
14553 static int alc269_mic2_for_mute_led(struct hda_codec *codec)
14555 switch (codec->subsystem_id) {
14562 static int alc269_mic2_mute_check_ps(struct hda_codec *codec, hda_nid_t nid)
14564 /* update mute-LED according to the speaker mute state */
14565 if (nid == 0x01 || nid == 0x14) {
14567 if (snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0) &
14572 /* mic2 vref pin is used for mute LED control */
14573 snd_hda_codec_update_cache(codec, 0x19, 0,
14574 AC_VERB_SET_PIN_WIDGET_CONTROL,
14577 return alc_check_power_status(codec, nid);
14579 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14581 static int alc275_setup_dual_adc(struct hda_codec *codec)
14583 struct alc_spec *spec = codec->spec;
14585 if (codec->vendor_id != 0x10ec0275 || !spec->auto_mic)
14587 if ((spec->ext_mic.pin >= 0x18 && spec->int_mic.pin <= 0x13) ||
14588 (spec->ext_mic.pin <= 0x12 && spec->int_mic.pin >= 0x18)) {
14589 if (spec->ext_mic.pin <= 0x12) {
14590 spec->private_adc_nids[0] = 0x08;
14591 spec->private_adc_nids[1] = 0x11;
14592 spec->private_capsrc_nids[0] = 0x23;
14593 spec->private_capsrc_nids[1] = 0x22;
14595 spec->private_adc_nids[0] = 0x11;
14596 spec->private_adc_nids[1] = 0x08;
14597 spec->private_capsrc_nids[0] = 0x22;
14598 spec->private_capsrc_nids[1] = 0x23;
14600 spec->adc_nids = spec->private_adc_nids;
14601 spec->capsrc_nids = spec->private_capsrc_nids;
14602 spec->num_adc_nids = 2;
14603 spec->dual_adc_switch = 1;
14604 snd_printdd("realtek: enabling dual ADC switchg (%02x:%02x)\n",
14605 spec->adc_nids[0], spec->adc_nids[1]);
14611 /* different alc269-variants */
14613 ALC269_TYPE_NORMAL,
14614 ALC269_TYPE_ALC259,
14615 ALC269_TYPE_ALC271X,
14619 * BIOS auto configuration
14621 static int alc269_parse_auto_config(struct hda_codec *codec)
14623 struct alc_spec *spec = codec->spec;
14625 static hda_nid_t alc269_ignore[] = { 0x1d, 0 };
14627 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
14632 err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg);
14635 if (spec->codec_variant == ALC269_TYPE_NORMAL)
14636 err = alc269_auto_create_input_ctls(codec, &spec->autocfg);
14638 err = alc_auto_create_input_ctls(codec, &spec->autocfg, 0,
14643 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
14645 alc_auto_parse_digital(codec);
14647 if (spec->kctls.list)
14648 add_mixer(spec, spec->kctls.list);
14650 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
14651 add_verb(spec, alc269vb_init_verbs);
14652 alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21);
14654 add_verb(spec, alc269_init_verbs);
14655 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
14658 spec->num_mux_defs = 1;
14659 spec->input_mux = &spec->private_imux[0];
14661 if (!alc275_setup_dual_adc(codec))
14662 fillup_priv_adc_nids(codec, alc269_adc_candidates,
14663 sizeof(alc269_adc_candidates));
14665 /* set default input source */
14666 if (!spec->dual_adc_switch)
14667 select_or_unmute_capsrc(codec, spec->capsrc_nids[0],
14668 spec->input_mux->items[0].index);
14670 err = alc_auto_add_mic_boost(codec);
14674 if (!spec->cap_mixer && !spec->no_analog)
14675 set_capture_mixer(codec);
14680 #define alc269_auto_init_multi_out alc268_auto_init_multi_out
14681 #define alc269_auto_init_hp_out alc268_auto_init_hp_out
14682 #define alc269_auto_init_analog_input alc882_auto_init_analog_input
14685 /* init callback for auto-configuration model -- overriding the default init */
14686 static void alc269_auto_init(struct hda_codec *codec)
14688 struct alc_spec *spec = codec->spec;
14689 alc269_auto_init_multi_out(codec);
14690 alc269_auto_init_hp_out(codec);
14691 alc269_auto_init_analog_input(codec);
14692 alc_auto_init_digital(codec);
14693 alc_init_jacks(codec);
14694 if (spec->unsol_event)
14695 alc_inithook(codec);
14698 #ifdef SND_HDA_NEEDS_RESUME
14699 static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
14701 int val = alc_read_coef_idx(codec, 0x04);
14706 alc_write_coef_idx(codec, 0x04, val);
14709 #ifdef CONFIG_SND_HDA_POWER_SAVE
14710 static int alc269_suspend(struct hda_codec *codec, pm_message_t state)
14712 struct alc_spec *spec = codec->spec;
14714 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017)
14715 alc269_toggle_power_output(codec, 0);
14716 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14717 alc269_toggle_power_output(codec, 0);
14722 if (spec && spec->power_hook)
14723 spec->power_hook(codec);
14726 #endif /* CONFIG_SND_HDA_POWER_SAVE */
14728 static int alc269_resume(struct hda_codec *codec)
14730 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14731 alc269_toggle_power_output(codec, 0);
14735 codec->patch_ops.init(codec);
14737 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14738 alc269_toggle_power_output(codec, 1);
14742 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018)
14743 alc269_toggle_power_output(codec, 1);
14745 snd_hda_codec_resume_amp(codec);
14746 snd_hda_codec_resume_cache(codec);
14747 hda_call_check_power_status(codec, 0x01);
14750 #endif /* SND_HDA_NEEDS_RESUME */
14753 ALC269_FIXUP_SONY_VAIO,
14754 ALC269_FIXUP_DELL_M101Z,
14757 static const struct alc_fixup alc269_fixups[] = {
14758 [ALC269_FIXUP_SONY_VAIO] = {
14759 .verbs = (const struct hda_verb[]) {
14760 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
14764 [ALC269_FIXUP_DELL_M101Z] = {
14765 .verbs = (const struct hda_verb[]) {
14766 /* Enables internal speaker */
14767 {0x20, AC_VERB_SET_COEF_INDEX, 13},
14768 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
14774 static struct snd_pci_quirk alc269_fixup_tbl[] = {
14775 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
14776 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
14782 * configuration and preset
14784 static const char *alc269_models[ALC269_MODEL_LAST] = {
14785 [ALC269_BASIC] = "basic",
14786 [ALC269_QUANTA_FL1] = "quanta",
14787 [ALC269_AMIC] = "laptop-amic",
14788 [ALC269_DMIC] = "laptop-dmic",
14789 [ALC269_FUJITSU] = "fujitsu",
14790 [ALC269_LIFEBOOK] = "lifebook",
14791 [ALC269_AUTO] = "auto",
14794 static struct snd_pci_quirk alc269_cfg_tbl[] = {
14795 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),
14796 SND_PCI_QUIRK(0x1025, 0x047c, "ACER ZGA", ALC271_ACER),
14797 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
14799 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC),
14800 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC),
14801 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC),
14802 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC),
14803 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC),
14804 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC),
14805 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC),
14806 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC),
14807 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC),
14808 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC),
14809 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC),
14810 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC),
14811 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC),
14812 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC),
14813 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC),
14814 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC),
14815 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC),
14816 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC),
14817 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC),
14818 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC),
14819 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC),
14820 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC),
14821 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC),
14822 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC),
14823 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC),
14824 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC),
14825 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC),
14826 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC),
14827 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC),
14828 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC),
14829 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC),
14830 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC),
14831 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC),
14832 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC),
14833 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC),
14834 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),
14835 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901",
14837 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101",
14839 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC),
14840 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC),
14841 SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_AUTO),
14842 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK),
14843 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC),
14844 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU),
14845 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC),
14846 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC),
14847 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC),
14848 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),
14852 static struct alc_config_preset alc269_presets[] = {
14854 .mixers = { alc269_base_mixer },
14855 .init_verbs = { alc269_init_verbs },
14856 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14857 .dac_nids = alc269_dac_nids,
14859 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14860 .channel_mode = alc269_modes,
14861 .input_mux = &alc269_capture_source,
14863 [ALC269_QUANTA_FL1] = {
14864 .mixers = { alc269_quanta_fl1_mixer },
14865 .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs },
14866 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14867 .dac_nids = alc269_dac_nids,
14869 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14870 .channel_mode = alc269_modes,
14871 .input_mux = &alc269_capture_source,
14872 .unsol_event = alc269_quanta_fl1_unsol_event,
14873 .setup = alc269_quanta_fl1_setup,
14874 .init_hook = alc269_quanta_fl1_init_hook,
14877 .mixers = { alc269_laptop_mixer },
14878 .cap_mixer = alc269_laptop_analog_capture_mixer,
14879 .init_verbs = { alc269_init_verbs,
14880 alc269_laptop_amic_init_verbs },
14881 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14882 .dac_nids = alc269_dac_nids,
14884 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14885 .channel_mode = alc269_modes,
14886 .unsol_event = alc269_laptop_unsol_event,
14887 .setup = alc269_laptop_amic_setup,
14888 .init_hook = alc269_laptop_inithook,
14891 .mixers = { alc269_laptop_mixer },
14892 .cap_mixer = alc269_laptop_digital_capture_mixer,
14893 .init_verbs = { alc269_init_verbs,
14894 alc269_laptop_dmic_init_verbs },
14895 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14896 .dac_nids = alc269_dac_nids,
14898 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14899 .channel_mode = alc269_modes,
14900 .unsol_event = alc269_laptop_unsol_event,
14901 .setup = alc269_laptop_dmic_setup,
14902 .init_hook = alc269_laptop_inithook,
14904 [ALC269VB_AMIC] = {
14905 .mixers = { alc269vb_laptop_mixer },
14906 .cap_mixer = alc269vb_laptop_analog_capture_mixer,
14907 .init_verbs = { alc269vb_init_verbs,
14908 alc269vb_laptop_amic_init_verbs },
14909 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14910 .dac_nids = alc269_dac_nids,
14912 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14913 .channel_mode = alc269_modes,
14914 .unsol_event = alc269_laptop_unsol_event,
14915 .setup = alc269vb_laptop_amic_setup,
14916 .init_hook = alc269_laptop_inithook,
14918 [ALC269VB_DMIC] = {
14919 .mixers = { alc269vb_laptop_mixer },
14920 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14921 .init_verbs = { alc269vb_init_verbs,
14922 alc269vb_laptop_dmic_init_verbs },
14923 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14924 .dac_nids = alc269_dac_nids,
14926 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14927 .channel_mode = alc269_modes,
14928 .unsol_event = alc269_laptop_unsol_event,
14929 .setup = alc269vb_laptop_dmic_setup,
14930 .init_hook = alc269_laptop_inithook,
14932 [ALC269_FUJITSU] = {
14933 .mixers = { alc269_fujitsu_mixer },
14934 .cap_mixer = alc269_laptop_digital_capture_mixer,
14935 .init_verbs = { alc269_init_verbs,
14936 alc269_laptop_dmic_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_dmic_setup,
14944 .init_hook = alc269_laptop_inithook,
14946 [ALC269_LIFEBOOK] = {
14947 .mixers = { alc269_lifebook_mixer },
14948 .init_verbs = { alc269_init_verbs, alc269_lifebook_verbs },
14949 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14950 .dac_nids = alc269_dac_nids,
14952 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14953 .channel_mode = alc269_modes,
14954 .input_mux = &alc269_capture_source,
14955 .unsol_event = alc269_lifebook_unsol_event,
14956 .init_hook = alc269_lifebook_init_hook,
14959 .mixers = { alc269_asus_mixer },
14960 .cap_mixer = alc269vb_laptop_digital_capture_mixer,
14961 .init_verbs = { alc269_init_verbs, alc271_acer_dmic_verbs },
14962 .num_dacs = ARRAY_SIZE(alc269_dac_nids),
14963 .dac_nids = alc269_dac_nids,
14964 .adc_nids = alc262_dmic_adc_nids,
14965 .num_adc_nids = ARRAY_SIZE(alc262_dmic_adc_nids),
14966 .capsrc_nids = alc262_dmic_capsrc_nids,
14967 .num_channel_mode = ARRAY_SIZE(alc269_modes),
14968 .channel_mode = alc269_modes,
14969 .input_mux = &alc269_capture_source,
14970 .dig_out_nid = ALC880_DIGOUT_NID,
14971 .unsol_event = alc_sku_unsol_event,
14972 .setup = alc269vb_laptop_dmic_setup,
14973 .init_hook = alc_inithook,
14977 static int alc269_fill_coef(struct hda_codec *codec)
14981 if ((alc_read_coef_idx(codec, 0) & 0x00ff) < 0x015) {
14982 alc_write_coef_idx(codec, 0xf, 0x960b);
14983 alc_write_coef_idx(codec, 0xe, 0x8817);
14986 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x016) {
14987 alc_write_coef_idx(codec, 0xf, 0x960b);
14988 alc_write_coef_idx(codec, 0xe, 0x8814);
14991 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x017) {
14992 val = alc_read_coef_idx(codec, 0x04);
14993 /* Power up output pin */
14994 alc_write_coef_idx(codec, 0x04, val | (1<<11));
14997 if ((alc_read_coef_idx(codec, 0) & 0x00ff) == 0x018) {
14998 val = alc_read_coef_idx(codec, 0xd);
14999 if ((val & 0x0c00) >> 10 != 0x1) {
15000 /* Capless ramp up clock control */
15001 alc_write_coef_idx(codec, 0xd, val | 1<<10);
15003 val = alc_read_coef_idx(codec, 0x17);
15004 if ((val & 0x01c0) >> 6 != 0x4) {
15005 /* Class D power on reset */
15006 alc_write_coef_idx(codec, 0x17, val | 1<<7);
15012 static int patch_alc269(struct hda_codec *codec)
15014 struct alc_spec *spec;
15018 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
15022 codec->spec = spec;
15024 alc_auto_parse_customize_define(codec);
15026 if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010){
15027 if (codec->bus->pci->subsystem_vendor == 0x1025 &&
15028 spec->cdefine.platform_type == 1) {
15029 alc_codec_rename(codec, "ALC271X");
15030 spec->codec_variant = ALC269_TYPE_ALC271X;
15032 alc_codec_rename(codec, "ALC259");
15033 spec->codec_variant = ALC269_TYPE_ALC259;
15036 alc_fix_pll_init(codec, 0x20, 0x04, 15);
15038 alc269_fill_coef(codec);
15040 board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST,
15044 if (board_config < 0) {
15045 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
15047 board_config = ALC269_AUTO;
15050 if (board_config == ALC269_AUTO)
15051 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1);
15053 if (board_config == ALC269_AUTO) {
15054 /* automatic parse from the BIOS config */
15055 err = alc269_parse_auto_config(codec);
15061 "hda_codec: Cannot set up configuration "
15062 "from BIOS. Using base mode...\n");
15063 board_config = ALC269_BASIC;
15067 if (has_cdefine_beep(codec)) {
15068 err = snd_hda_attach_beep_device(codec, 0x1);
15075 if (board_config != ALC269_AUTO)
15076 setup_preset(codec, &alc269_presets[board_config]);
15078 if (board_config == ALC269_QUANTA_FL1) {
15079 /* Due to a hardware problem on Lenovo Ideadpad, we need to
15080 * fix the sample rate of analog I/O to 44.1kHz
15082 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback;
15083 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture;
15084 } else if (spec->dual_adc_switch) {
15085 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15086 /* switch ADC dynamically */
15087 spec->stream_analog_capture = &dualmic_pcm_analog_capture;
15089 spec->stream_analog_playback = &alc269_pcm_analog_playback;
15090 spec->stream_analog_capture = &alc269_pcm_analog_capture;
15092 spec->stream_digital_playback = &alc269_pcm_digital_playback;
15093 spec->stream_digital_capture = &alc269_pcm_digital_capture;
15095 if (!spec->adc_nids) { /* wasn't filled automatically? use default */
15096 if (spec->codec_variant != ALC269_TYPE_NORMAL) {
15097 spec->adc_nids = alc269_adc_nids;
15098 spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids);
15099 spec->capsrc_nids = alc269_capsrc_nids;
15101 spec->adc_nids = alc269vb_adc_nids;
15102 spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids);
15103 spec->capsrc_nids = alc269vb_capsrc_nids;
15107 if (!spec->cap_mixer)
15108 set_capture_mixer(codec);
15109 if (has_cdefine_beep(codec))
15110 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
15112 if (board_config == ALC269_AUTO)
15113 alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
15115 spec->vmaster_nid = 0x02;
15117 codec->patch_ops = alc_patch_ops;
15118 #ifdef CONFIG_SND_HDA_POWER_SAVE
15119 codec->patch_ops.suspend = alc269_suspend;
15121 #ifdef SND_HDA_NEEDS_RESUME
15122 codec->patch_ops.resume = alc269_resume;
15124 if (board_config == ALC269_AUTO)
15125 spec->init_hook = alc269_auto_init;
15126 #ifdef CONFIG_SND_HDA_POWER_SAVE
15127 if (!spec->loopback.amplist)
15128 spec->loopback.amplist = alc269_loopbacks;
15129 if (alc269_mic2_for_mute_led(codec))
15130 codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps;
15137 * ALC861 channel source setting (2/6 channel selection for 3-stack)
15141 * set the path ways for 2 channel output
15142 * need to set the codec line out and mic 1 pin widgets to inputs
15144 static struct hda_verb alc861_threestack_ch2_init[] = {
15145 /* set pin widget 1Ah (line in) for input */
15146 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15147 /* set pin widget 18h (mic1/2) for input, for mic also enable
15150 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15152 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15154 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15155 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15161 * need to set the codec line out and mic 1 pin widgets to outputs
15163 static struct hda_verb alc861_threestack_ch6_init[] = {
15164 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15165 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15166 /* set pin widget 18h (mic1) for output (CLFE)*/
15167 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15169 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15170 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15172 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15174 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15175 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15180 static struct hda_channel_mode alc861_threestack_modes[2] = {
15181 { 2, alc861_threestack_ch2_init },
15182 { 6, alc861_threestack_ch6_init },
15184 /* Set mic1 as input and unmute the mixer */
15185 static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15186 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15187 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15190 /* Set mic1 as output and mute mixer */
15191 static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15192 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15193 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15197 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15198 { 2, alc861_uniwill_m31_ch2_init },
15199 { 4, alc861_uniwill_m31_ch4_init },
15202 /* Set mic1 and line-in as input and unmute the mixer */
15203 static struct hda_verb alc861_asus_ch2_init[] = {
15204 /* set pin widget 1Ah (line in) for input */
15205 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15206 /* set pin widget 18h (mic1/2) for input, for mic also enable
15209 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15211 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c },
15213 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15214 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/
15218 /* Set mic1 nad line-in as output and mute mixer */
15219 static struct hda_verb alc861_asus_ch6_init[] = {
15220 /* set pin widget 1Ah (line in) for output (Back Surround)*/
15221 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15222 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15223 /* set pin widget 18h (mic1) for output (CLFE)*/
15224 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15225 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */
15226 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 },
15227 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 },
15229 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 },
15231 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15232 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/
15237 static struct hda_channel_mode alc861_asus_modes[2] = {
15238 { 2, alc861_asus_ch2_init },
15239 { 6, alc861_asus_ch6_init },
15244 static struct snd_kcontrol_new alc861_base_mixer[] = {
15245 /* output mixer control */
15246 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15247 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15248 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15249 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15250 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15252 /*Input mixer control */
15253 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15254 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15255 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15256 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15257 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15258 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15259 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15260 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15261 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15262 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15267 static struct snd_kcontrol_new alc861_3ST_mixer[] = {
15268 /* output mixer control */
15269 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15270 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15271 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15272 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15273 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15275 /* Input mixer control */
15276 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15277 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15278 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15279 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15280 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15281 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15282 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15283 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15284 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15285 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15289 .name = "Channel Mode",
15290 .info = alc_ch_mode_info,
15291 .get = alc_ch_mode_get,
15292 .put = alc_ch_mode_put,
15293 .private_value = ARRAY_SIZE(alc861_threestack_modes),
15298 static struct snd_kcontrol_new alc861_toshiba_mixer[] = {
15299 /* output mixer control */
15300 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15301 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15302 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15307 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = {
15308 /* output mixer control */
15309 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15310 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15311 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15312 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15313 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */
15315 /* Input mixer control */
15316 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15317 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */
15318 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15319 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15320 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15321 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15322 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15323 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15324 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15325 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT),
15328 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15329 .name = "Channel Mode",
15330 .info = alc_ch_mode_info,
15331 .get = alc_ch_mode_get,
15332 .put = alc_ch_mode_put,
15333 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes),
15338 static struct snd_kcontrol_new alc861_asus_mixer[] = {
15339 /* output mixer control */
15340 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT),
15341 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT),
15342 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT),
15343 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT),
15344 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT),
15346 /* Input mixer control */
15347 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT),
15348 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT),
15349 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15350 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15351 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT),
15352 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT),
15353 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT),
15354 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT),
15355 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT),
15356 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT),
15359 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
15360 .name = "Channel Mode",
15361 .info = alc_ch_mode_info,
15362 .get = alc_ch_mode_get,
15363 .put = alc_ch_mode_put,
15364 .private_value = ARRAY_SIZE(alc861_asus_modes),
15369 /* additional mixer */
15370 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = {
15371 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT),
15372 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT),
15377 * generic initialization of ADC, input mixers and output mixers
15379 static struct hda_verb alc861_base_init_verbs[] = {
15381 * Unmute ADC0 and set the default input to mic-in
15383 /* port-A for surround (rear panel) */
15384 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15385 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 },
15386 /* port-B for mic-in (rear panel) with vref */
15387 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15388 /* port-C for line-in (rear panel) */
15389 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15390 /* port-D for Front */
15391 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15392 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15393 /* port-E for HP out (front panel) */
15394 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15395 /* route front PCM to HP */
15396 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15397 /* port-F for mic-in (front panel) with vref */
15398 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15399 /* port-G for CLFE (rear panel) */
15400 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15401 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15402 /* port-H for side (rear panel) */
15403 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15404 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 },
15406 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15407 /* route front mic to ADC1*/
15408 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15409 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15411 /* Unmute DAC0~3 & spdif out*/
15412 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15413 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15414 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15415 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15416 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15418 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15419 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15420 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15421 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15422 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15424 /* Unmute Stereo Mixer 15 */
15425 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15426 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15427 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15428 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15430 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15431 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15432 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15433 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15434 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15435 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15436 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15437 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15438 /* hp used DAC 3 (Front) */
15439 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15440 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15445 static struct hda_verb alc861_threestack_init_verbs[] = {
15447 * Unmute ADC0 and set the default input to mic-in
15449 /* port-A for surround (rear panel) */
15450 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15451 /* port-B for mic-in (rear panel) with vref */
15452 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15453 /* port-C for line-in (rear panel) */
15454 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15455 /* port-D for Front */
15456 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15457 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15458 /* port-E for HP out (front panel) */
15459 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
15460 /* route front PCM to HP */
15461 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15462 /* port-F for mic-in (front panel) with vref */
15463 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15464 /* port-G for CLFE (rear panel) */
15465 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15466 /* port-H for side (rear panel) */
15467 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15469 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15470 /* route front mic to ADC1*/
15471 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15472 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15473 /* Unmute DAC0~3 & spdif out*/
15474 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15475 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15476 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15477 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15478 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15480 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15481 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15482 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15483 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15484 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15486 /* Unmute Stereo Mixer 15 */
15487 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15488 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15489 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15490 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15492 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15493 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15494 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15495 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15496 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15497 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15498 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15499 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15500 /* hp used DAC 3 (Front) */
15501 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15502 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15506 static struct hda_verb alc861_uniwill_m31_init_verbs[] = {
15508 * Unmute ADC0 and set the default input to mic-in
15510 /* port-A for surround (rear panel) */
15511 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15512 /* port-B for mic-in (rear panel) with vref */
15513 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15514 /* port-C for line-in (rear panel) */
15515 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15516 /* port-D for Front */
15517 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15518 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15519 /* port-E for HP out (front panel) */
15520 /* this has to be set to VREF80 */
15521 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15522 /* route front PCM to HP */
15523 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15524 /* port-F for mic-in (front panel) with vref */
15525 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15526 /* port-G for CLFE (rear panel) */
15527 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15528 /* port-H for side (rear panel) */
15529 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
15531 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15532 /* route front mic to ADC1*/
15533 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15534 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15535 /* Unmute DAC0~3 & spdif out*/
15536 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15537 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15538 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15539 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15540 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15542 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15543 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15544 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15545 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15546 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15548 /* Unmute Stereo Mixer 15 */
15549 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15550 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15551 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15552 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15554 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15555 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15556 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15557 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15558 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15559 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15560 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15561 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15562 /* hp used DAC 3 (Front) */
15563 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15564 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15568 static struct hda_verb alc861_asus_init_verbs[] = {
15570 * Unmute ADC0 and set the default input to mic-in
15572 /* port-A for surround (rear panel)
15573 * according to codec#0 this is the HP jack
15575 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */
15576 /* route front PCM to HP */
15577 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 },
15578 /* port-B for mic-in (rear panel) with vref */
15579 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15580 /* port-C for line-in (rear panel) */
15581 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15582 /* port-D for Front */
15583 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15584 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 },
15585 /* port-E for HP out (front panel) */
15586 /* this has to be set to VREF80 */
15587 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15588 /* route front PCM to HP */
15589 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },
15590 /* port-F for mic-in (front panel) with vref */
15591 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15592 /* port-G for CLFE (rear panel) */
15593 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15594 /* port-H for side (rear panel) */
15595 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15597 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15598 /* route front mic to ADC1*/
15599 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
15600 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15601 /* Unmute DAC0~3 & spdif out*/
15602 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15603 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15604 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15605 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15606 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15607 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15608 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15609 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15610 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15611 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15613 /* Unmute Stereo Mixer 15 */
15614 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15615 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15616 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15617 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */
15619 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15620 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15621 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15622 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15623 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15624 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15625 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15626 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15627 /* hp used DAC 3 (Front) */
15628 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
15629 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15633 /* additional init verbs for ASUS laptops */
15634 static struct hda_verb alc861_asus_laptop_init_verbs[] = {
15635 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */
15636 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */
15641 * generic initialization of ADC, input mixers and output mixers
15643 static struct hda_verb alc861_auto_init_verbs[] = {
15645 * Unmute ADC0 and set the default input to mic-in
15647 /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */
15648 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15650 /* Unmute DAC0~3 & spdif out*/
15651 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15652 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15653 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15654 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
15655 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
15657 /* Unmute Mixer 14 (mic) 1c (Line in)*/
15658 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15659 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15660 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15661 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15663 /* Unmute Stereo Mixer 15 */
15664 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
15665 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
15666 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
15667 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c},
15669 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15670 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15671 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15672 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15673 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15674 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15675 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15676 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15678 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15679 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15680 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15681 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15682 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
15683 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
15684 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
15685 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
15687 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */
15692 static struct hda_verb alc861_toshiba_init_verbs[] = {
15693 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
15698 /* toggle speaker-output according to the hp-jack state */
15699 static void alc861_toshiba_automute(struct hda_codec *codec)
15701 unsigned int present = snd_hda_jack_detect(codec, 0x0f);
15703 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
15704 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
15705 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
15706 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
15709 static void alc861_toshiba_unsol_event(struct hda_codec *codec,
15712 if ((res >> 26) == ALC880_HP_EVENT)
15713 alc861_toshiba_automute(codec);
15716 /* pcm configuration: identical with ALC880 */
15717 #define alc861_pcm_analog_playback alc880_pcm_analog_playback
15718 #define alc861_pcm_analog_capture alc880_pcm_analog_capture
15719 #define alc861_pcm_digital_playback alc880_pcm_digital_playback
15720 #define alc861_pcm_digital_capture alc880_pcm_digital_capture
15723 #define ALC861_DIGOUT_NID 0x07
15725 static struct hda_channel_mode alc861_8ch_modes[1] = {
15729 static hda_nid_t alc861_dac_nids[4] = {
15730 /* front, surround, clfe, side */
15731 0x03, 0x06, 0x05, 0x04
15734 static hda_nid_t alc660_dac_nids[3] = {
15735 /* front, clfe, surround */
15739 static hda_nid_t alc861_adc_nids[1] = {
15744 static struct hda_input_mux alc861_capture_source = {
15748 { "Front Mic", 0x3 },
15755 static hda_nid_t alc861_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
15757 struct alc_spec *spec = codec->spec;
15758 hda_nid_t mix, srcs[5];
15761 if (snd_hda_get_connections(codec, pin, &mix, 1) != 1)
15763 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15766 for (i = 0; i < num; i++) {
15768 type = get_wcaps_type(get_wcaps(codec, srcs[i]));
15769 if (type != AC_WID_AUD_OUT)
15771 for (j = 0; j < spec->multiout.num_dacs; j++)
15772 if (spec->multiout.dac_nids[j] == srcs[i])
15774 if (j >= spec->multiout.num_dacs)
15780 /* fill in the dac_nids table from the parsed pin configuration */
15781 static int alc861_auto_fill_dac_nids(struct hda_codec *codec,
15782 const struct auto_pin_cfg *cfg)
15784 struct alc_spec *spec = codec->spec;
15786 hda_nid_t nid, dac;
15788 spec->multiout.dac_nids = spec->private_dac_nids;
15789 for (i = 0; i < cfg->line_outs; i++) {
15790 nid = cfg->line_out_pins[i];
15791 dac = alc861_look_for_dac(codec, nid);
15794 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
15799 static int alc861_create_out_sw(struct hda_codec *codec, const char *pfx,
15800 hda_nid_t nid, unsigned int chs)
15802 return add_pb_sw_ctrl(codec->spec, ALC_CTL_WIDGET_MUTE, pfx,
15803 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
15806 /* add playback controls from the parsed DAC table */
15807 static int alc861_auto_create_multi_out_ctls(struct hda_codec *codec,
15808 const struct auto_pin_cfg *cfg)
15810 struct alc_spec *spec = codec->spec;
15811 static const char *chname[4] = {
15812 "Front", "Surround", NULL /*CLFE*/, "Side"
15817 if (cfg->line_outs == 1) {
15818 const char *pfx = NULL;
15821 else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
15824 nid = spec->multiout.dac_nids[0];
15825 return alc861_create_out_sw(codec, pfx, nid, 3);
15829 for (i = 0; i < cfg->line_outs; i++) {
15830 nid = spec->multiout.dac_nids[i];
15835 err = alc861_create_out_sw(codec, "Center", nid, 1);
15838 err = alc861_create_out_sw(codec, "LFE", nid, 2);
15842 err = alc861_create_out_sw(codec, chname[i], nid, 3);
15850 static int alc861_auto_create_hp_ctls(struct hda_codec *codec, hda_nid_t pin)
15852 struct alc_spec *spec = codec->spec;
15859 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) {
15860 nid = alc861_look_for_dac(codec, pin);
15862 err = alc861_create_out_sw(codec, "Headphone", nid, 3);
15865 spec->multiout.hp_nid = nid;
15871 /* create playback/capture controls for input pins */
15872 static int alc861_auto_create_input_ctls(struct hda_codec *codec,
15873 const struct auto_pin_cfg *cfg)
15875 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x08, 0);
15878 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec,
15880 int pin_type, hda_nid_t dac)
15882 hda_nid_t mix, srcs[5];
15885 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
15887 snd_hda_codec_write(codec, dac, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15889 if (snd_hda_get_connections(codec, nid, &mix, 1) != 1)
15891 num = snd_hda_get_connections(codec, mix, srcs, ARRAY_SIZE(srcs));
15894 for (i = 0; i < num; i++) {
15896 if (srcs[i] == dac || srcs[i] == 0x15)
15897 mute = AMP_IN_UNMUTE(i);
15899 mute = AMP_IN_MUTE(i);
15900 snd_hda_codec_write(codec, mix, 0, AC_VERB_SET_AMP_GAIN_MUTE,
15905 static void alc861_auto_init_multi_out(struct hda_codec *codec)
15907 struct alc_spec *spec = codec->spec;
15910 for (i = 0; i < spec->autocfg.line_outs; i++) {
15911 hda_nid_t nid = spec->autocfg.line_out_pins[i];
15912 int pin_type = get_pin_type(spec->autocfg.line_out_type);
15914 alc861_auto_set_output_and_unmute(codec, nid, pin_type,
15915 spec->multiout.dac_nids[i]);
15919 static void alc861_auto_init_hp_out(struct hda_codec *codec)
15921 struct alc_spec *spec = codec->spec;
15923 if (spec->autocfg.hp_outs)
15924 alc861_auto_set_output_and_unmute(codec,
15925 spec->autocfg.hp_pins[0],
15927 spec->multiout.hp_nid);
15928 if (spec->autocfg.speaker_outs)
15929 alc861_auto_set_output_and_unmute(codec,
15930 spec->autocfg.speaker_pins[0],
15932 spec->multiout.dac_nids[0]);
15935 static void alc861_auto_init_analog_input(struct hda_codec *codec)
15937 struct alc_spec *spec = codec->spec;
15938 struct auto_pin_cfg *cfg = &spec->autocfg;
15941 for (i = 0; i < cfg->num_inputs; i++) {
15942 hda_nid_t nid = cfg->inputs[i].pin;
15943 if (nid >= 0x0c && nid <= 0x11)
15944 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
15948 /* parse the BIOS configuration and set up the alc_spec */
15949 /* return 1 if successful, 0 if the proper config is not found,
15950 * or a negative error code
15952 static int alc861_parse_auto_config(struct hda_codec *codec)
15954 struct alc_spec *spec = codec->spec;
15956 static hda_nid_t alc861_ignore[] = { 0x1d, 0 };
15958 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
15962 if (!spec->autocfg.line_outs)
15963 return 0; /* can't find valid BIOS pin config */
15965 err = alc861_auto_fill_dac_nids(codec, &spec->autocfg);
15968 err = alc861_auto_create_multi_out_ctls(codec, &spec->autocfg);
15971 err = alc861_auto_create_hp_ctls(codec, spec->autocfg.hp_pins[0]);
15974 err = alc861_auto_create_input_ctls(codec, &spec->autocfg);
15978 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
15980 alc_auto_parse_digital(codec);
15982 if (spec->kctls.list)
15983 add_mixer(spec, spec->kctls.list);
15985 add_verb(spec, alc861_auto_init_verbs);
15987 spec->num_mux_defs = 1;
15988 spec->input_mux = &spec->private_imux[0];
15990 spec->adc_nids = alc861_adc_nids;
15991 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
15992 set_capture_mixer(codec);
15994 alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);
15999 /* additional initialization for auto-configuration model */
16000 static void alc861_auto_init(struct hda_codec *codec)
16002 struct alc_spec *spec = codec->spec;
16003 alc861_auto_init_multi_out(codec);
16004 alc861_auto_init_hp_out(codec);
16005 alc861_auto_init_analog_input(codec);
16006 alc_auto_init_digital(codec);
16007 if (spec->unsol_event)
16008 alc_inithook(codec);
16011 #ifdef CONFIG_SND_HDA_POWER_SAVE
16012 static struct hda_amp_list alc861_loopbacks[] = {
16013 { 0x15, HDA_INPUT, 0 },
16014 { 0x15, HDA_INPUT, 1 },
16015 { 0x15, HDA_INPUT, 2 },
16016 { 0x15, HDA_INPUT, 3 },
16023 * configuration and preset
16025 static const char *alc861_models[ALC861_MODEL_LAST] = {
16026 [ALC861_3ST] = "3stack",
16027 [ALC660_3ST] = "3stack-660",
16028 [ALC861_3ST_DIG] = "3stack-dig",
16029 [ALC861_6ST_DIG] = "6stack-dig",
16030 [ALC861_UNIWILL_M31] = "uniwill-m31",
16031 [ALC861_TOSHIBA] = "toshiba",
16032 [ALC861_ASUS] = "asus",
16033 [ALC861_ASUS_LAPTOP] = "asus-laptop",
16034 [ALC861_AUTO] = "auto",
16037 static struct snd_pci_quirk alc861_cfg_tbl[] = {
16038 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST),
16039 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16040 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP),
16041 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS),
16042 SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP),
16043 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG),
16044 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA),
16045 /* FIXME: the entry below breaks Toshiba A100 (model=auto works!)
16046 * Any other models that need this preset?
16048 /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */
16049 SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST),
16050 SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST),
16051 SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31),
16052 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31),
16053 SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP),
16054 /* FIXME: the below seems conflict */
16055 /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */
16056 SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST),
16057 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST),
16061 static struct alc_config_preset alc861_presets[] = {
16063 .mixers = { alc861_3ST_mixer },
16064 .init_verbs = { alc861_threestack_init_verbs },
16065 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16066 .dac_nids = alc861_dac_nids,
16067 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16068 .channel_mode = alc861_threestack_modes,
16070 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16071 .adc_nids = alc861_adc_nids,
16072 .input_mux = &alc861_capture_source,
16074 [ALC861_3ST_DIG] = {
16075 .mixers = { alc861_base_mixer },
16076 .init_verbs = { alc861_threestack_init_verbs },
16077 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16078 .dac_nids = alc861_dac_nids,
16079 .dig_out_nid = ALC861_DIGOUT_NID,
16080 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16081 .channel_mode = alc861_threestack_modes,
16083 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16084 .adc_nids = alc861_adc_nids,
16085 .input_mux = &alc861_capture_source,
16087 [ALC861_6ST_DIG] = {
16088 .mixers = { alc861_base_mixer },
16089 .init_verbs = { alc861_base_init_verbs },
16090 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16091 .dac_nids = alc861_dac_nids,
16092 .dig_out_nid = ALC861_DIGOUT_NID,
16093 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes),
16094 .channel_mode = alc861_8ch_modes,
16095 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16096 .adc_nids = alc861_adc_nids,
16097 .input_mux = &alc861_capture_source,
16100 .mixers = { alc861_3ST_mixer },
16101 .init_verbs = { alc861_threestack_init_verbs },
16102 .num_dacs = ARRAY_SIZE(alc660_dac_nids),
16103 .dac_nids = alc660_dac_nids,
16104 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes),
16105 .channel_mode = alc861_threestack_modes,
16107 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16108 .adc_nids = alc861_adc_nids,
16109 .input_mux = &alc861_capture_source,
16111 [ALC861_UNIWILL_M31] = {
16112 .mixers = { alc861_uniwill_m31_mixer },
16113 .init_verbs = { alc861_uniwill_m31_init_verbs },
16114 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16115 .dac_nids = alc861_dac_nids,
16116 .dig_out_nid = ALC861_DIGOUT_NID,
16117 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes),
16118 .channel_mode = alc861_uniwill_m31_modes,
16120 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16121 .adc_nids = alc861_adc_nids,
16122 .input_mux = &alc861_capture_source,
16124 [ALC861_TOSHIBA] = {
16125 .mixers = { alc861_toshiba_mixer },
16126 .init_verbs = { alc861_base_init_verbs,
16127 alc861_toshiba_init_verbs },
16128 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16129 .dac_nids = alc861_dac_nids,
16130 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16131 .channel_mode = alc883_3ST_2ch_modes,
16132 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16133 .adc_nids = alc861_adc_nids,
16134 .input_mux = &alc861_capture_source,
16135 .unsol_event = alc861_toshiba_unsol_event,
16136 .init_hook = alc861_toshiba_automute,
16139 .mixers = { alc861_asus_mixer },
16140 .init_verbs = { alc861_asus_init_verbs },
16141 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16142 .dac_nids = alc861_dac_nids,
16143 .dig_out_nid = ALC861_DIGOUT_NID,
16144 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes),
16145 .channel_mode = alc861_asus_modes,
16148 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16149 .adc_nids = alc861_adc_nids,
16150 .input_mux = &alc861_capture_source,
16152 [ALC861_ASUS_LAPTOP] = {
16153 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer },
16154 .init_verbs = { alc861_asus_init_verbs,
16155 alc861_asus_laptop_init_verbs },
16156 .num_dacs = ARRAY_SIZE(alc861_dac_nids),
16157 .dac_nids = alc861_dac_nids,
16158 .dig_out_nid = ALC861_DIGOUT_NID,
16159 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
16160 .channel_mode = alc883_3ST_2ch_modes,
16162 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids),
16163 .adc_nids = alc861_adc_nids,
16164 .input_mux = &alc861_capture_source,
16168 /* Pin config fixes */
16170 PINFIX_FSC_AMILO_PI1505,
16173 static const struct alc_fixup alc861_fixups[] = {
16174 [PINFIX_FSC_AMILO_PI1505] = {
16175 .pins = (const struct alc_pincfg[]) {
16176 { 0x0b, 0x0221101f }, /* HP */
16177 { 0x0f, 0x90170310 }, /* speaker */
16183 static struct snd_pci_quirk alc861_fixup_tbl[] = {
16184 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
16188 static int patch_alc861(struct hda_codec *codec)
16190 struct alc_spec *spec;
16194 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
16198 codec->spec = spec;
16200 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST,
16204 if (board_config < 0) {
16205 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
16207 board_config = ALC861_AUTO;
16210 if (board_config == ALC861_AUTO)
16211 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
16213 if (board_config == ALC861_AUTO) {
16214 /* automatic parse from the BIOS config */
16215 err = alc861_parse_auto_config(codec);
16221 "hda_codec: Cannot set up configuration "
16222 "from BIOS. Using base mode...\n");
16223 board_config = ALC861_3ST_DIG;
16227 err = snd_hda_attach_beep_device(codec, 0x23);
16233 if (board_config != ALC861_AUTO)
16234 setup_preset(codec, &alc861_presets[board_config]);
16236 spec->stream_analog_playback = &alc861_pcm_analog_playback;
16237 spec->stream_analog_capture = &alc861_pcm_analog_capture;
16239 spec->stream_digital_playback = &alc861_pcm_digital_playback;
16240 spec->stream_digital_capture = &alc861_pcm_digital_capture;
16242 if (!spec->cap_mixer)
16243 set_capture_mixer(codec);
16244 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
16246 spec->vmaster_nid = 0x03;
16248 if (board_config == ALC861_AUTO)
16249 alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
16251 codec->patch_ops = alc_patch_ops;
16252 if (board_config == ALC861_AUTO) {
16253 spec->init_hook = alc861_auto_init;
16254 #ifdef CONFIG_SND_HDA_POWER_SAVE
16255 spec->power_hook = alc_power_eapd;
16258 #ifdef CONFIG_SND_HDA_POWER_SAVE
16259 if (!spec->loopback.amplist)
16260 spec->loopback.amplist = alc861_loopbacks;
16267 * ALC861-VD support
16271 * In addition, an independent DAC
16273 #define ALC861VD_DIGOUT_NID 0x06
16275 static hda_nid_t alc861vd_dac_nids[4] = {
16276 /* front, surr, clfe, side surr */
16277 0x02, 0x03, 0x04, 0x05
16280 /* dac_nids for ALC660vd are in a different order - according to
16281 * Realtek's driver.
16282 * This should probably result in a different mixer for 6stack models
16283 * of ALC660vd codecs, but for now there is only 3stack mixer
16284 * - and it is the same as in 861vd.
16285 * adc_nids in ALC660vd are (is) the same as in 861vd
16287 static hda_nid_t alc660vd_dac_nids[3] = {
16288 /* front, rear, clfe, rear_surr */
16292 static hda_nid_t alc861vd_adc_nids[1] = {
16297 static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 };
16300 /* FIXME: should be a matrix-type input source selection */
16301 static struct hda_input_mux alc861vd_capture_source = {
16305 { "Front Mic", 0x1 },
16311 static struct hda_input_mux alc861vd_dallas_capture_source = {
16314 { "Ext Mic", 0x0 },
16315 { "Int Mic", 0x1 },
16319 static struct hda_input_mux alc861vd_hp_capture_source = {
16322 { "Front Mic", 0x0 },
16323 { "ATAPI Mic", 0x1 },
16330 static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = {
16337 static struct hda_verb alc861vd_6stack_ch6_init[] = {
16338 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
16339 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16340 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16341 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16348 static struct hda_verb alc861vd_6stack_ch8_init[] = {
16349 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16350 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16351 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16352 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
16356 static struct hda_channel_mode alc861vd_6stack_modes[2] = {
16357 { 6, alc861vd_6stack_ch6_init },
16358 { 8, alc861vd_6stack_ch8_init },
16361 static struct snd_kcontrol_new alc861vd_chmode_mixer[] = {
16363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
16364 .name = "Channel Mode",
16365 .info = alc_ch_mode_info,
16366 .get = alc_ch_mode_get,
16367 .put = alc_ch_mode_put,
16372 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
16373 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
16375 static struct snd_kcontrol_new alc861vd_6st_mixer[] = {
16376 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16377 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16379 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16380 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
16382 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0,
16384 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0,
16386 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
16387 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
16389 HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT),
16390 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
16392 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16394 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16395 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16396 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16398 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16399 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16400 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16402 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16403 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16405 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16406 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16411 static struct snd_kcontrol_new alc861vd_3st_mixer[] = {
16412 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16413 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16415 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16417 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16418 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16419 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16421 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16423 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16425 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
16426 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
16428 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16429 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16434 static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = {
16435 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16436 /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/
16437 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
16439 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
16441 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
16442 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16443 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16445 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT),
16446 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16447 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16449 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
16450 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
16455 /* Pin assignment: Speaker=0x14, HP = 0x15,
16456 * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d
16458 static struct snd_kcontrol_new alc861vd_dallas_mixer[] = {
16459 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16460 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
16461 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16462 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16463 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
16464 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16465 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16466 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
16467 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16468 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16472 /* Pin assignment: Speaker=0x14, Line-out = 0x15,
16473 * Front Mic=0x18, ATAPI Mic = 0x19,
16475 static struct snd_kcontrol_new alc861vd_hp_mixer[] = {
16476 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
16477 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
16478 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
16479 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT),
16480 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
16481 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
16482 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
16483 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
16489 * generic initialization of ADC, input mixers and output mixers
16491 static struct hda_verb alc861vd_volume_init_verbs[] = {
16493 * Unmute ADC0 and set the default input to mic-in
16495 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16498 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of
16499 * the analog-loopback mixer widget
16501 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
16502 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16503 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16504 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16505 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16506 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16508 /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */
16509 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16510 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16511 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
16512 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
16515 * Set up output mixers (0x02 - 0x05)
16517 /* set vol=0 to output mixers */
16518 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16519 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16520 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16521 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16523 /* set up input amps for analog loopback */
16524 /* Amp Indices: DAC = 0, mixer = 1 */
16525 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16526 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16527 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16528 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16529 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16530 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16531 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16532 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16538 * 3-stack pin configuration:
16539 * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b
16541 static struct hda_verb alc861vd_3stack_init_verbs[] = {
16543 * Set pin mode and muting
16545 /* set front pin widgets 0x14 for output */
16546 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16547 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16548 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16550 /* Mic (rear) pin: input vref at 80% */
16551 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16552 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16553 /* Front Mic pin: input vref at 80% */
16554 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16555 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16556 /* Line In pin: input */
16557 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16558 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16559 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16560 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16561 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16562 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16563 /* CD pin widget for input */
16564 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16570 * 6-stack pin configuration:
16572 static struct hda_verb alc861vd_6stack_init_verbs[] = {
16574 * Set pin mode and muting
16576 /* set front pin widgets 0x14 for output */
16577 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16578 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16579 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
16581 /* Rear Pin: output 1 (0x0d) */
16582 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16583 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16584 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
16585 /* CLFE Pin: output 2 (0x0e) */
16586 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16587 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16588 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
16589 /* Side Pin: output 3 (0x0f) */
16590 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16591 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16592 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
16594 /* Mic (rear) pin: input vref at 80% */
16595 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16596 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16597 /* Front Mic pin: input vref at 80% */
16598 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
16599 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16600 /* Line In pin: input */
16601 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16602 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16603 /* Line-2 In: Headphone output (output 0 - 0x0c) */
16604 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
16605 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16606 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
16607 /* CD pin widget for input */
16608 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16613 static struct hda_verb alc861vd_eapd_verbs[] = {
16614 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16618 static struct hda_verb alc660vd_eapd_verbs[] = {
16619 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
16620 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
16624 static struct hda_verb alc861vd_lenovo_unsol_verbs[] = {
16625 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16626 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16627 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
16628 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16629 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
16633 static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
16635 unsigned int present;
16636 unsigned char bits;
16638 present = snd_hda_jack_detect(codec, 0x18);
16639 bits = present ? HDA_AMP_MUTE : 0;
16641 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
16642 HDA_AMP_MUTE, bits);
16645 static void alc861vd_lenovo_setup(struct hda_codec *codec)
16647 struct alc_spec *spec = codec->spec;
16648 spec->autocfg.hp_pins[0] = 0x1b;
16649 spec->autocfg.speaker_pins[0] = 0x14;
16652 static void alc861vd_lenovo_init_hook(struct hda_codec *codec)
16654 alc_automute_amp(codec);
16655 alc861vd_lenovo_mic_automute(codec);
16658 static void alc861vd_lenovo_unsol_event(struct hda_codec *codec,
16661 switch (res >> 26) {
16662 case ALC880_MIC_EVENT:
16663 alc861vd_lenovo_mic_automute(codec);
16666 alc_automute_amp_unsol_event(codec, res);
16671 static struct hda_verb alc861vd_dallas_verbs[] = {
16672 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16673 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16674 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16675 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
16677 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16678 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
16679 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16680 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16681 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16682 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16683 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16684 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
16686 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16687 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16688 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16689 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16690 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16691 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16692 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
16693 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
16695 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16696 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16697 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
16698 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
16699 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16700 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16701 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16702 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
16704 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
16705 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
16706 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
16707 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
16709 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
16710 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
16711 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
16716 /* toggle speaker-output according to the hp-jack state */
16717 static void alc861vd_dallas_setup(struct hda_codec *codec)
16719 struct alc_spec *spec = codec->spec;
16721 spec->autocfg.hp_pins[0] = 0x15;
16722 spec->autocfg.speaker_pins[0] = 0x14;
16725 #ifdef CONFIG_SND_HDA_POWER_SAVE
16726 #define alc861vd_loopbacks alc880_loopbacks
16729 /* pcm configuration: identical with ALC880 */
16730 #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback
16731 #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture
16732 #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback
16733 #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture
16736 * configuration and preset
16738 static const char *alc861vd_models[ALC861VD_MODEL_LAST] = {
16739 [ALC660VD_3ST] = "3stack-660",
16740 [ALC660VD_3ST_DIG] = "3stack-660-digout",
16741 [ALC660VD_ASUS_V1S] = "asus-v1s",
16742 [ALC861VD_3ST] = "3stack",
16743 [ALC861VD_3ST_DIG] = "3stack-digout",
16744 [ALC861VD_6ST_DIG] = "6stack-digout",
16745 [ALC861VD_LENOVO] = "lenovo",
16746 [ALC861VD_DALLAS] = "dallas",
16747 [ALC861VD_HP] = "hp",
16748 [ALC861VD_AUTO] = "auto",
16751 static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
16752 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
16753 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
16754 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
16755 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
16756 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
16757 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
16758 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
16759 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO),
16760 /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/
16761 SND_PCI_QUIRK(0x1179, 0xff01, "Toshiba A135", ALC861VD_LENOVO),
16762 SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO),
16763 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS),
16764 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG),
16765 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO),
16766 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG),
16770 static struct alc_config_preset alc861vd_presets[] = {
16772 .mixers = { alc861vd_3st_mixer },
16773 .init_verbs = { alc861vd_volume_init_verbs,
16774 alc861vd_3stack_init_verbs },
16775 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16776 .dac_nids = alc660vd_dac_nids,
16777 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16778 .channel_mode = alc861vd_3stack_2ch_modes,
16779 .input_mux = &alc861vd_capture_source,
16781 [ALC660VD_3ST_DIG] = {
16782 .mixers = { alc861vd_3st_mixer },
16783 .init_verbs = { alc861vd_volume_init_verbs,
16784 alc861vd_3stack_init_verbs },
16785 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16786 .dac_nids = alc660vd_dac_nids,
16787 .dig_out_nid = ALC861VD_DIGOUT_NID,
16788 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16789 .channel_mode = alc861vd_3stack_2ch_modes,
16790 .input_mux = &alc861vd_capture_source,
16793 .mixers = { alc861vd_3st_mixer },
16794 .init_verbs = { alc861vd_volume_init_verbs,
16795 alc861vd_3stack_init_verbs },
16796 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16797 .dac_nids = alc861vd_dac_nids,
16798 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16799 .channel_mode = alc861vd_3stack_2ch_modes,
16800 .input_mux = &alc861vd_capture_source,
16802 [ALC861VD_3ST_DIG] = {
16803 .mixers = { alc861vd_3st_mixer },
16804 .init_verbs = { alc861vd_volume_init_verbs,
16805 alc861vd_3stack_init_verbs },
16806 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16807 .dac_nids = alc861vd_dac_nids,
16808 .dig_out_nid = ALC861VD_DIGOUT_NID,
16809 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16810 .channel_mode = alc861vd_3stack_2ch_modes,
16811 .input_mux = &alc861vd_capture_source,
16813 [ALC861VD_6ST_DIG] = {
16814 .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer },
16815 .init_verbs = { alc861vd_volume_init_verbs,
16816 alc861vd_6stack_init_verbs },
16817 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16818 .dac_nids = alc861vd_dac_nids,
16819 .dig_out_nid = ALC861VD_DIGOUT_NID,
16820 .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes),
16821 .channel_mode = alc861vd_6stack_modes,
16822 .input_mux = &alc861vd_capture_source,
16824 [ALC861VD_LENOVO] = {
16825 .mixers = { alc861vd_lenovo_mixer },
16826 .init_verbs = { alc861vd_volume_init_verbs,
16827 alc861vd_3stack_init_verbs,
16828 alc861vd_eapd_verbs,
16829 alc861vd_lenovo_unsol_verbs },
16830 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16831 .dac_nids = alc660vd_dac_nids,
16832 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16833 .channel_mode = alc861vd_3stack_2ch_modes,
16834 .input_mux = &alc861vd_capture_source,
16835 .unsol_event = alc861vd_lenovo_unsol_event,
16836 .setup = alc861vd_lenovo_setup,
16837 .init_hook = alc861vd_lenovo_init_hook,
16839 [ALC861VD_DALLAS] = {
16840 .mixers = { alc861vd_dallas_mixer },
16841 .init_verbs = { alc861vd_dallas_verbs },
16842 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16843 .dac_nids = alc861vd_dac_nids,
16844 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16845 .channel_mode = alc861vd_3stack_2ch_modes,
16846 .input_mux = &alc861vd_dallas_capture_source,
16847 .unsol_event = alc_automute_amp_unsol_event,
16848 .setup = alc861vd_dallas_setup,
16849 .init_hook = alc_automute_amp,
16852 .mixers = { alc861vd_hp_mixer },
16853 .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs },
16854 .num_dacs = ARRAY_SIZE(alc861vd_dac_nids),
16855 .dac_nids = alc861vd_dac_nids,
16856 .dig_out_nid = ALC861VD_DIGOUT_NID,
16857 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16858 .channel_mode = alc861vd_3stack_2ch_modes,
16859 .input_mux = &alc861vd_hp_capture_source,
16860 .unsol_event = alc_automute_amp_unsol_event,
16861 .setup = alc861vd_dallas_setup,
16862 .init_hook = alc_automute_amp,
16864 [ALC660VD_ASUS_V1S] = {
16865 .mixers = { alc861vd_lenovo_mixer },
16866 .init_verbs = { alc861vd_volume_init_verbs,
16867 alc861vd_3stack_init_verbs,
16868 alc861vd_eapd_verbs,
16869 alc861vd_lenovo_unsol_verbs },
16870 .num_dacs = ARRAY_SIZE(alc660vd_dac_nids),
16871 .dac_nids = alc660vd_dac_nids,
16872 .dig_out_nid = ALC861VD_DIGOUT_NID,
16873 .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes),
16874 .channel_mode = alc861vd_3stack_2ch_modes,
16875 .input_mux = &alc861vd_capture_source,
16876 .unsol_event = alc861vd_lenovo_unsol_event,
16877 .setup = alc861vd_lenovo_setup,
16878 .init_hook = alc861vd_lenovo_init_hook,
16883 * BIOS auto configuration
16885 static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16886 const struct auto_pin_cfg *cfg)
16888 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16892 static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec,
16893 hda_nid_t nid, int pin_type, int dac_idx)
16895 alc_set_pin_output(codec, nid, pin_type);
16898 static void alc861vd_auto_init_multi_out(struct hda_codec *codec)
16900 struct alc_spec *spec = codec->spec;
16903 for (i = 0; i <= HDA_SIDE; i++) {
16904 hda_nid_t nid = spec->autocfg.line_out_pins[i];
16905 int pin_type = get_pin_type(spec->autocfg.line_out_type);
16907 alc861vd_auto_set_output_and_unmute(codec, nid,
16913 static void alc861vd_auto_init_hp_out(struct hda_codec *codec)
16915 struct alc_spec *spec = codec->spec;
16918 pin = spec->autocfg.hp_pins[0];
16919 if (pin) /* connect to front and use dac 0 */
16920 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
16921 pin = spec->autocfg.speaker_pins[0];
16923 alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
16926 #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID
16928 static void alc861vd_auto_init_analog_input(struct hda_codec *codec)
16930 struct alc_spec *spec = codec->spec;
16931 struct auto_pin_cfg *cfg = &spec->autocfg;
16934 for (i = 0; i < cfg->num_inputs; i++) {
16935 hda_nid_t nid = cfg->inputs[i].pin;
16936 if (alc_is_input_pin(codec, nid)) {
16937 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
16938 if (nid != ALC861VD_PIN_CD_NID &&
16939 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
16940 snd_hda_codec_write(codec, nid, 0,
16941 AC_VERB_SET_AMP_GAIN_MUTE,
16947 #define alc861vd_auto_init_input_src alc882_auto_init_input_src
16949 #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02)
16950 #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c)
16952 /* add playback controls from the parsed DAC table */
16953 /* Based on ALC880 version. But ALC861VD has separate,
16954 * different NIDs for mute/unmute switch and volume control */
16955 static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec,
16956 const struct auto_pin_cfg *cfg)
16958 static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"};
16959 hda_nid_t nid_v, nid_s;
16962 for (i = 0; i < cfg->line_outs; i++) {
16963 if (!spec->multiout.dac_nids[i])
16965 nid_v = alc861vd_idx_to_mixer_vol(
16967 spec->multiout.dac_nids[i]));
16968 nid_s = alc861vd_idx_to_mixer_switch(
16970 spec->multiout.dac_nids[i]));
16974 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16976 HDA_COMPOSE_AMP_VAL(nid_v, 1, 0,
16980 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL,
16982 HDA_COMPOSE_AMP_VAL(nid_v, 2, 0,
16986 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16988 HDA_COMPOSE_AMP_VAL(nid_s, 1, 2,
16992 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE,
16994 HDA_COMPOSE_AMP_VAL(nid_s, 2, 2,
17000 if (cfg->line_outs == 1 &&
17001 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
17008 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17009 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0,
17013 if (cfg->line_outs == 1 &&
17014 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
17016 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17017 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2,
17026 /* add playback controls for speaker and HP outputs */
17027 /* Based on ALC880 version. But ALC861VD has separate,
17028 * different NIDs for mute/unmute switch and volume control */
17029 static int alc861vd_auto_create_extra_out(struct alc_spec *spec,
17030 hda_nid_t pin, const char *pfx)
17032 hda_nid_t nid_v, nid_s;
17038 if (alc880_is_fixed_pin(pin)) {
17039 nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin));
17040 /* specify the DAC as the extra output */
17041 if (!spec->multiout.hp_nid)
17042 spec->multiout.hp_nid = nid_v;
17044 spec->multiout.extra_out_nid[0] = nid_v;
17045 /* control HP volume/switch on the output mixer amp */
17046 nid_v = alc861vd_idx_to_mixer_vol(
17047 alc880_fixed_pin_idx(pin));
17048 nid_s = alc861vd_idx_to_mixer_switch(
17049 alc880_fixed_pin_idx(pin));
17051 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
17052 HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT));
17055 err = add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, pfx,
17056 HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT));
17059 } else if (alc880_is_multi_pin(pin)) {
17060 /* set manual connection */
17061 /* we have only a switch on HP-out PIN */
17062 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
17063 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
17070 /* parse the BIOS configuration and set up the alc_spec
17071 * return 1 if successful, 0 if the proper config is not found,
17072 * or a negative error code
17073 * Based on ALC880 version - had to change it to override
17074 * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */
17075 static int alc861vd_parse_auto_config(struct hda_codec *codec)
17077 struct alc_spec *spec = codec->spec;
17079 static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
17081 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
17085 if (!spec->autocfg.line_outs)
17086 return 0; /* can't find valid BIOS pin config */
17088 err = alc880_auto_fill_dac_nids(spec, &spec->autocfg);
17091 err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg);
17094 err = alc861vd_auto_create_extra_out(spec,
17095 spec->autocfg.speaker_pins[0],
17099 err = alc861vd_auto_create_extra_out(spec,
17100 spec->autocfg.hp_pins[0],
17104 err = alc861vd_auto_create_input_ctls(codec, &spec->autocfg);
17108 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
17110 alc_auto_parse_digital(codec);
17112 if (spec->kctls.list)
17113 add_mixer(spec, spec->kctls.list);
17115 add_verb(spec, alc861vd_volume_init_verbs);
17117 spec->num_mux_defs = 1;
17118 spec->input_mux = &spec->private_imux[0];
17120 err = alc_auto_add_mic_boost(codec);
17124 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
17129 /* additional initialization for auto-configuration model */
17130 static void alc861vd_auto_init(struct hda_codec *codec)
17132 struct alc_spec *spec = codec->spec;
17133 alc861vd_auto_init_multi_out(codec);
17134 alc861vd_auto_init_hp_out(codec);
17135 alc861vd_auto_init_analog_input(codec);
17136 alc861vd_auto_init_input_src(codec);
17137 alc_auto_init_digital(codec);
17138 if (spec->unsol_event)
17139 alc_inithook(codec);
17143 ALC660VD_FIX_ASUS_GPIO1
17147 static const struct alc_fixup alc861vd_fixups[] = {
17148 [ALC660VD_FIX_ASUS_GPIO1] = {
17149 .verbs = (const struct hda_verb[]) {
17150 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
17151 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
17152 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
17158 static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
17159 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
17163 static int patch_alc861vd(struct hda_codec *codec)
17165 struct alc_spec *spec;
17166 int err, board_config;
17168 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
17172 codec->spec = spec;
17174 board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST,
17178 if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) {
17179 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
17181 board_config = ALC861VD_AUTO;
17184 if (board_config == ALC861VD_AUTO)
17185 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
17187 if (board_config == ALC861VD_AUTO) {
17188 /* automatic parse from the BIOS config */
17189 err = alc861vd_parse_auto_config(codec);
17195 "hda_codec: Cannot set up configuration "
17196 "from BIOS. Using base mode...\n");
17197 board_config = ALC861VD_3ST;
17201 err = snd_hda_attach_beep_device(codec, 0x23);
17207 if (board_config != ALC861VD_AUTO)
17208 setup_preset(codec, &alc861vd_presets[board_config]);
17210 if (codec->vendor_id == 0x10ec0660) {
17211 /* always turn on EAPD */
17212 add_verb(spec, alc660vd_eapd_verbs);
17215 spec->stream_analog_playback = &alc861vd_pcm_analog_playback;
17216 spec->stream_analog_capture = &alc861vd_pcm_analog_capture;
17218 spec->stream_digital_playback = &alc861vd_pcm_digital_playback;
17219 spec->stream_digital_capture = &alc861vd_pcm_digital_capture;
17221 if (!spec->adc_nids) {
17222 spec->adc_nids = alc861vd_adc_nids;
17223 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
17225 if (!spec->capsrc_nids)
17226 spec->capsrc_nids = alc861vd_capsrc_nids;
17228 set_capture_mixer(codec);
17229 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
17231 spec->vmaster_nid = 0x02;
17233 if (board_config == ALC861VD_AUTO)
17234 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
17236 codec->patch_ops = alc_patch_ops;
17238 if (board_config == ALC861VD_AUTO)
17239 spec->init_hook = alc861vd_auto_init;
17240 #ifdef CONFIG_SND_HDA_POWER_SAVE
17241 if (!spec->loopback.amplist)
17242 spec->loopback.amplist = alc861vd_loopbacks;
17251 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
17252 * configuration. Each pin widget can choose any input DACs and a mixer.
17253 * Each ADC is connected from a mixer of all inputs. This makes possible
17254 * 6-channel independent captures.
17256 * In addition, an independent DAC for the multi-playback (not used in this
17259 #define ALC662_DIGOUT_NID 0x06
17260 #define ALC662_DIGIN_NID 0x0a
17262 static hda_nid_t alc662_dac_nids[4] = {
17263 /* front, rear, clfe, rear_surr */
17267 static hda_nid_t alc272_dac_nids[2] = {
17271 static hda_nid_t alc662_adc_nids[2] = {
17276 static hda_nid_t alc272_adc_nids[1] = {
17281 static hda_nid_t alc662_capsrc_nids[2] = { 0x22, 0x23 };
17282 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 };
17286 /* FIXME: should be a matrix-type input source selection */
17287 static struct hda_input_mux alc662_capture_source = {
17291 { "Front Mic", 0x1 },
17297 static struct hda_input_mux alc662_lenovo_101e_capture_source = {
17305 static struct hda_input_mux alc663_capture_source = {
17309 { "Front Mic", 0x1 },
17314 #if 0 /* set to 1 for testing other input sources below */
17315 static struct hda_input_mux alc272_nc10_capture_source = {
17318 { "Autoselect Mic", 0x0 },
17319 { "Internal Mic", 0x1 },
17320 { "In-0x02", 0x2 },
17321 { "In-0x03", 0x3 },
17322 { "In-0x04", 0x4 },
17323 { "In-0x05", 0x5 },
17324 { "In-0x06", 0x6 },
17325 { "In-0x07", 0x7 },
17326 { "In-0x08", 0x8 },
17327 { "In-0x09", 0x9 },
17328 { "In-0x0a", 0x0a },
17329 { "In-0x0b", 0x0b },
17330 { "In-0x0c", 0x0c },
17331 { "In-0x0d", 0x0d },
17332 { "In-0x0e", 0x0e },
17333 { "In-0x0f", 0x0f },
17341 static struct hda_channel_mode alc662_3ST_2ch_modes[1] = {
17348 static struct hda_verb alc662_3ST_ch2_init[] = {
17349 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
17350 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17351 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
17352 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
17359 static struct hda_verb alc662_3ST_ch6_init[] = {
17360 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17361 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17362 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
17363 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17364 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
17365 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
17369 static struct hda_channel_mode alc662_3ST_6ch_modes[2] = {
17370 { 2, alc662_3ST_ch2_init },
17371 { 6, alc662_3ST_ch6_init },
17377 static struct hda_verb alc662_sixstack_ch6_init[] = {
17378 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17379 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
17380 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17387 static struct hda_verb alc662_sixstack_ch8_init[] = {
17388 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17389 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17390 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
17394 static struct hda_channel_mode alc662_5stack_modes[2] = {
17395 { 2, alc662_sixstack_ch6_init },
17396 { 6, alc662_sixstack_ch8_init },
17399 /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
17400 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
17403 static struct snd_kcontrol_new alc662_base_mixer[] = {
17404 /* output mixer control */
17405 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
17406 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17407 HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT),
17408 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17409 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17410 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17411 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17412 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17413 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17415 /*Input mixer control */
17416 HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT),
17417 HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT),
17418 HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT),
17419 HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT),
17420 HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT),
17421 HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT),
17422 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT),
17423 HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT),
17427 static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = {
17428 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17429 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17430 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17431 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17432 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17433 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17434 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17435 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17436 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17437 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17438 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17442 static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = {
17443 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17444 HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT),
17445 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17446 HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT),
17447 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17448 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17449 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT),
17450 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT),
17451 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17452 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
17453 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
17454 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17455 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17456 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17457 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17458 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17459 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17463 static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = {
17464 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17465 HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT),
17466 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17467 HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT),
17468 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17469 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17470 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17471 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17472 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17476 static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = {
17477 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17478 ALC262_HIPPO_MASTER_SWITCH,
17480 HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT),
17481 HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17482 HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17484 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
17485 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17486 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17490 static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = {
17491 ALC262_HIPPO_MASTER_SWITCH,
17492 HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17493 HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17494 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT),
17495 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT),
17496 HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT),
17497 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17498 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17499 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17500 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17504 static struct hda_bind_ctls alc663_asus_bind_master_vol = {
17505 .ops = &snd_hda_bind_vol,
17507 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17508 HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT),
17513 static struct hda_bind_ctls alc663_asus_one_bind_switch = {
17514 .ops = &snd_hda_bind_sw,
17516 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17517 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17522 static struct snd_kcontrol_new alc663_m51va_mixer[] = {
17523 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17524 HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch),
17525 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17526 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17530 static struct hda_bind_ctls alc663_asus_tree_bind_switch = {
17531 .ops = &snd_hda_bind_sw,
17533 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17534 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17535 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17540 static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = {
17541 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17542 HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch),
17543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17545 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17546 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17551 static struct hda_bind_ctls alc663_asus_four_bind_switch = {
17552 .ops = &snd_hda_bind_sw,
17554 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17555 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17556 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17561 static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = {
17562 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17563 HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch),
17564 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17565 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17566 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17567 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17571 static struct snd_kcontrol_new alc662_1bjd_mixer[] = {
17572 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17573 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17574 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17575 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17576 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17577 HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17578 HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17582 static struct hda_bind_ctls alc663_asus_two_bind_master_vol = {
17583 .ops = &snd_hda_bind_vol,
17585 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
17586 HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT),
17591 static struct hda_bind_ctls alc663_asus_two_bind_switch = {
17592 .ops = &snd_hda_bind_sw,
17594 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17595 HDA_COMPOSE_AMP_VAL(0x16, 3, 0, HDA_OUTPUT),
17600 static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = {
17601 HDA_BIND_VOL("Master Playback Volume",
17602 &alc663_asus_two_bind_master_vol),
17603 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17604 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17605 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17606 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17607 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17611 static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = {
17612 HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol),
17613 HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch),
17614 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17615 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17616 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17617 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17621 static struct snd_kcontrol_new alc663_g71v_mixer[] = {
17622 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17623 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17624 HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT),
17625 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17626 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17628 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17629 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17630 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17631 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17635 static struct snd_kcontrol_new alc663_g50v_mixer[] = {
17636 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
17637 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
17638 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17642 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17643 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17644 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
17645 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
17649 static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = {
17650 .ops = &snd_hda_bind_sw,
17652 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17653 HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
17654 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17655 HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
17656 HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT),
17661 static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = {
17662 .ops = &snd_hda_bind_sw,
17664 HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
17665 HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT),
17670 static struct snd_kcontrol_new alc663_mode7_mixer[] = {
17671 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17672 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17673 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17674 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
17675 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17676 HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17677 HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17678 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
17679 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
17683 static struct snd_kcontrol_new alc663_mode8_mixer[] = {
17684 HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch),
17685 HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol),
17686 HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch),
17687 HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT),
17688 HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT),
17689 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
17690 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
17695 static struct snd_kcontrol_new alc662_chmode_mixer[] = {
17697 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17698 .name = "Channel Mode",
17699 .info = alc_ch_mode_info,
17700 .get = alc_ch_mode_get,
17701 .put = alc_ch_mode_put,
17706 static struct hda_verb alc662_init_verbs[] = {
17707 /* ADC: mute amp left and right */
17708 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17709 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
17711 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17712 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17713 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17714 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17715 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17716 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17718 /* Front Pin: output 0 (0x0c) */
17719 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17720 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17722 /* Rear Pin: output 1 (0x0d) */
17723 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17724 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17726 /* CLFE Pin: output 2 (0x0e) */
17727 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17728 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17730 /* Mic (rear) pin: input vref at 80% */
17731 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17732 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17733 /* Front Mic pin: input vref at 80% */
17734 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
17735 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17736 /* Line In pin: input */
17737 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17738 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17739 /* Line-2 In: Headphone output (output 0 - 0x0c) */
17740 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17741 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17742 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
17743 /* CD pin widget for input */
17744 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17746 /* FIXME: use matrix-type input source selection */
17747 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
17749 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17750 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17752 /* always trun on EAPD */
17753 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17754 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17759 static struct hda_verb alc663_init_verbs[] = {
17760 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17761 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17762 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17763 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17764 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17765 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17769 static struct hda_verb alc272_init_verbs[] = {
17770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17771 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17772 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17773 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17774 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17775 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17776 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17777 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17781 static struct hda_verb alc662_sue_init_verbs[] = {
17782 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17783 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17787 static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17788 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17789 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17793 /* Set Unsolicited Event*/
17794 static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17795 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17796 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17800 static struct hda_verb alc663_m51va_init_verbs[] = {
17801 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17802 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17803 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17804 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17805 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17806 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17807 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17808 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17809 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17813 static struct hda_verb alc663_21jd_amic_init_verbs[] = {
17814 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17815 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17816 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17817 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17818 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17819 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17820 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17824 static struct hda_verb alc662_1bjd_amic_init_verbs[] = {
17825 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17826 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17827 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17828 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17829 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17830 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17831 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17832 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17836 static struct hda_verb alc663_15jd_amic_init_verbs[] = {
17837 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17838 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17839 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17840 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17841 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17842 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17843 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17847 static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = {
17848 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17849 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17850 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17851 {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17852 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17853 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17854 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */
17855 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17856 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17857 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17858 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17859 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17863 static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = {
17864 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17865 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17866 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17867 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17868 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17869 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17870 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17871 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17872 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17873 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17874 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17875 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17879 static struct hda_verb alc663_g71v_init_verbs[] = {
17880 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17881 /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */
17882 /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */
17884 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17885 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17886 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17888 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17889 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT},
17890 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17894 static struct hda_verb alc663_g50v_init_verbs[] = {
17895 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17896 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17897 {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */
17899 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17900 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17904 static struct hda_verb alc662_ecs_init_verbs[] = {
17905 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
17906 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17907 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17908 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17912 static struct hda_verb alc272_dell_zm1_init_verbs[] = {
17913 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17914 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17915 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17916 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17917 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17918 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17919 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17920 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17921 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17922 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17923 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17927 static struct hda_verb alc272_dell_init_verbs[] = {
17928 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17929 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17930 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17931 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17932 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17933 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17934 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17935 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17936 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17937 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17938 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17942 static struct hda_verb alc663_mode7_init_verbs[] = {
17943 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17944 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17945 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17946 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17947 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17948 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17949 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
17950 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17951 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17952 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17953 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17954 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17955 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17956 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17957 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17961 static struct hda_verb alc663_mode8_init_verbs[] = {
17962 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17963 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17964 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
17966 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17967 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17968 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17969 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17970 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
17971 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17972 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */
17973 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
17974 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
17975 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17976 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17977 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17981 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
17982 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
17983 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
17987 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
17988 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
17989 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
17993 static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
17995 unsigned int present;
17996 unsigned char bits;
17998 present = snd_hda_jack_detect(codec, 0x14);
17999 bits = present ? HDA_AMP_MUTE : 0;
18001 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18002 HDA_AMP_MUTE, bits);
18005 static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18007 unsigned int present;
18008 unsigned char bits;
18010 present = snd_hda_jack_detect(codec, 0x1b);
18011 bits = present ? HDA_AMP_MUTE : 0;
18013 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18014 HDA_AMP_MUTE, bits);
18015 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18016 HDA_AMP_MUTE, bits);
18019 static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18022 if ((res >> 26) == ALC880_HP_EVENT)
18023 alc662_lenovo_101e_all_automute(codec);
18024 if ((res >> 26) == ALC880_FRONT_EVENT)
18025 alc662_lenovo_101e_ispeaker_automute(codec);
18028 /* unsolicited event for HP jack sensing */
18029 static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18032 if ((res >> 26) == ALC880_MIC_EVENT)
18033 alc_mic_automute(codec);
18035 alc262_hippo_unsol_event(codec, res);
18038 static void alc662_eeepc_setup(struct hda_codec *codec)
18040 struct alc_spec *spec = codec->spec;
18042 alc262_hippo1_setup(codec);
18043 spec->ext_mic.pin = 0x18;
18044 spec->ext_mic.mux_idx = 0;
18045 spec->int_mic.pin = 0x19;
18046 spec->int_mic.mux_idx = 1;
18047 spec->auto_mic = 1;
18050 static void alc662_eeepc_inithook(struct hda_codec *codec)
18052 alc262_hippo_automute(codec);
18053 alc_mic_automute(codec);
18056 static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18058 struct alc_spec *spec = codec->spec;
18060 spec->autocfg.hp_pins[0] = 0x14;
18061 spec->autocfg.speaker_pins[0] = 0x1b;
18064 #define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18066 static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18068 unsigned int present;
18069 unsigned char bits;
18071 present = snd_hda_jack_detect(codec, 0x21);
18072 bits = present ? HDA_AMP_MUTE : 0;
18073 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18074 HDA_AMP_MUTE, bits);
18075 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18076 HDA_AMP_MUTE, bits);
18079 static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18081 unsigned int present;
18082 unsigned char bits;
18084 present = snd_hda_jack_detect(codec, 0x21);
18085 bits = present ? HDA_AMP_MUTE : 0;
18086 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18087 HDA_AMP_MUTE, bits);
18088 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18089 HDA_AMP_MUTE, bits);
18090 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18091 HDA_AMP_MUTE, bits);
18092 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18093 HDA_AMP_MUTE, bits);
18096 static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18098 unsigned int present;
18099 unsigned char bits;
18101 present = snd_hda_jack_detect(codec, 0x15);
18102 bits = present ? HDA_AMP_MUTE : 0;
18103 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18104 HDA_AMP_MUTE, bits);
18105 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18106 HDA_AMP_MUTE, bits);
18107 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18108 HDA_AMP_MUTE, bits);
18109 snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18110 HDA_AMP_MUTE, bits);
18113 static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18115 unsigned int present;
18116 unsigned char bits;
18118 present = snd_hda_jack_detect(codec, 0x1b);
18119 bits = present ? 0 : PIN_OUT;
18120 snd_hda_codec_write(codec, 0x14, 0,
18121 AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18124 static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18126 unsigned int present1, present2;
18128 present1 = snd_hda_jack_detect(codec, 0x21);
18129 present2 = snd_hda_jack_detect(codec, 0x15);
18131 if (present1 || present2) {
18132 snd_hda_codec_write_cache(codec, 0x14, 0,
18133 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18135 snd_hda_codec_write_cache(codec, 0x14, 0,
18136 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18140 static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18142 unsigned int present1, present2;
18144 present1 = snd_hda_jack_detect(codec, 0x1b);
18145 present2 = snd_hda_jack_detect(codec, 0x15);
18147 if (present1 || present2) {
18148 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18149 HDA_AMP_MUTE, HDA_AMP_MUTE);
18150 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18151 HDA_AMP_MUTE, HDA_AMP_MUTE);
18153 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18155 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18160 static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18162 unsigned int present1, present2;
18164 present1 = snd_hda_codec_read(codec, 0x1b, 0,
18165 AC_VERB_GET_PIN_SENSE, 0)
18166 & AC_PINSENSE_PRESENCE;
18167 present2 = snd_hda_codec_read(codec, 0x21, 0,
18168 AC_VERB_GET_PIN_SENSE, 0)
18169 & AC_PINSENSE_PRESENCE;
18171 if (present1 || present2) {
18172 snd_hda_codec_write_cache(codec, 0x14, 0,
18173 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18174 snd_hda_codec_write_cache(codec, 0x17, 0,
18175 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18177 snd_hda_codec_write_cache(codec, 0x14, 0,
18178 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18179 snd_hda_codec_write_cache(codec, 0x17, 0,
18180 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18184 static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18186 unsigned int present1, present2;
18188 present1 = snd_hda_codec_read(codec, 0x21, 0,
18189 AC_VERB_GET_PIN_SENSE, 0)
18190 & AC_PINSENSE_PRESENCE;
18191 present2 = snd_hda_codec_read(codec, 0x15, 0,
18192 AC_VERB_GET_PIN_SENSE, 0)
18193 & AC_PINSENSE_PRESENCE;
18195 if (present1 || present2) {
18196 snd_hda_codec_write_cache(codec, 0x14, 0,
18197 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18198 snd_hda_codec_write_cache(codec, 0x17, 0,
18199 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18201 snd_hda_codec_write_cache(codec, 0x14, 0,
18202 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18203 snd_hda_codec_write_cache(codec, 0x17, 0,
18204 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18208 static void alc663_m51va_unsol_event(struct hda_codec *codec,
18211 switch (res >> 26) {
18212 case ALC880_HP_EVENT:
18213 alc663_m51va_speaker_automute(codec);
18215 case ALC880_MIC_EVENT:
18216 alc_mic_automute(codec);
18221 static void alc663_m51va_setup(struct hda_codec *codec)
18223 struct alc_spec *spec = codec->spec;
18224 spec->ext_mic.pin = 0x18;
18225 spec->ext_mic.mux_idx = 0;
18226 spec->int_mic.pin = 0x12;
18227 spec->int_mic.mux_idx = 9;
18228 spec->auto_mic = 1;
18231 static void alc663_m51va_inithook(struct hda_codec *codec)
18233 alc663_m51va_speaker_automute(codec);
18234 alc_mic_automute(codec);
18237 /* ***************** Mode1 ******************************/
18238 #define alc663_mode1_unsol_event alc663_m51va_unsol_event
18240 static void alc663_mode1_setup(struct hda_codec *codec)
18242 struct alc_spec *spec = codec->spec;
18243 spec->ext_mic.pin = 0x18;
18244 spec->ext_mic.mux_idx = 0;
18245 spec->int_mic.pin = 0x19;
18246 spec->int_mic.mux_idx = 1;
18247 spec->auto_mic = 1;
18250 #define alc663_mode1_inithook alc663_m51va_inithook
18252 /* ***************** Mode2 ******************************/
18253 static void alc662_mode2_unsol_event(struct hda_codec *codec,
18256 switch (res >> 26) {
18257 case ALC880_HP_EVENT:
18258 alc662_f5z_speaker_automute(codec);
18260 case ALC880_MIC_EVENT:
18261 alc_mic_automute(codec);
18266 #define alc662_mode2_setup alc663_mode1_setup
18268 static void alc662_mode2_inithook(struct hda_codec *codec)
18270 alc662_f5z_speaker_automute(codec);
18271 alc_mic_automute(codec);
18273 /* ***************** Mode3 ******************************/
18274 static void alc663_mode3_unsol_event(struct hda_codec *codec,
18277 switch (res >> 26) {
18278 case ALC880_HP_EVENT:
18279 alc663_two_hp_m1_speaker_automute(codec);
18281 case ALC880_MIC_EVENT:
18282 alc_mic_automute(codec);
18287 #define alc663_mode3_setup alc663_mode1_setup
18289 static void alc663_mode3_inithook(struct hda_codec *codec)
18291 alc663_two_hp_m1_speaker_automute(codec);
18292 alc_mic_automute(codec);
18294 /* ***************** Mode4 ******************************/
18295 static void alc663_mode4_unsol_event(struct hda_codec *codec,
18298 switch (res >> 26) {
18299 case ALC880_HP_EVENT:
18300 alc663_21jd_two_speaker_automute(codec);
18302 case ALC880_MIC_EVENT:
18303 alc_mic_automute(codec);
18308 #define alc663_mode4_setup alc663_mode1_setup
18310 static void alc663_mode4_inithook(struct hda_codec *codec)
18312 alc663_21jd_two_speaker_automute(codec);
18313 alc_mic_automute(codec);
18315 /* ***************** Mode5 ******************************/
18316 static void alc663_mode5_unsol_event(struct hda_codec *codec,
18319 switch (res >> 26) {
18320 case ALC880_HP_EVENT:
18321 alc663_15jd_two_speaker_automute(codec);
18323 case ALC880_MIC_EVENT:
18324 alc_mic_automute(codec);
18329 #define alc663_mode5_setup alc663_mode1_setup
18331 static void alc663_mode5_inithook(struct hda_codec *codec)
18333 alc663_15jd_two_speaker_automute(codec);
18334 alc_mic_automute(codec);
18336 /* ***************** Mode6 ******************************/
18337 static void alc663_mode6_unsol_event(struct hda_codec *codec,
18340 switch (res >> 26) {
18341 case ALC880_HP_EVENT:
18342 alc663_two_hp_m2_speaker_automute(codec);
18344 case ALC880_MIC_EVENT:
18345 alc_mic_automute(codec);
18350 #define alc663_mode6_setup alc663_mode1_setup
18352 static void alc663_mode6_inithook(struct hda_codec *codec)
18354 alc663_two_hp_m2_speaker_automute(codec);
18355 alc_mic_automute(codec);
18358 /* ***************** Mode7 ******************************/
18359 static void alc663_mode7_unsol_event(struct hda_codec *codec,
18362 switch (res >> 26) {
18363 case ALC880_HP_EVENT:
18364 alc663_two_hp_m7_speaker_automute(codec);
18366 case ALC880_MIC_EVENT:
18367 alc_mic_automute(codec);
18372 #define alc663_mode7_setup alc663_mode1_setup
18374 static void alc663_mode7_inithook(struct hda_codec *codec)
18376 alc663_two_hp_m7_speaker_automute(codec);
18377 alc_mic_automute(codec);
18380 /* ***************** Mode8 ******************************/
18381 static void alc663_mode8_unsol_event(struct hda_codec *codec,
18384 switch (res >> 26) {
18385 case ALC880_HP_EVENT:
18386 alc663_two_hp_m8_speaker_automute(codec);
18388 case ALC880_MIC_EVENT:
18389 alc_mic_automute(codec);
18394 #define alc663_mode8_setup alc663_m51va_setup
18396 static void alc663_mode8_inithook(struct hda_codec *codec)
18398 alc663_two_hp_m8_speaker_automute(codec);
18399 alc_mic_automute(codec);
18402 static void alc663_g71v_hp_automute(struct hda_codec *codec)
18404 unsigned int present;
18405 unsigned char bits;
18407 present = snd_hda_jack_detect(codec, 0x21);
18408 bits = present ? HDA_AMP_MUTE : 0;
18409 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18410 HDA_AMP_MUTE, bits);
18411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18412 HDA_AMP_MUTE, bits);
18415 static void alc663_g71v_front_automute(struct hda_codec *codec)
18417 unsigned int present;
18418 unsigned char bits;
18420 present = snd_hda_jack_detect(codec, 0x15);
18421 bits = present ? HDA_AMP_MUTE : 0;
18422 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18423 HDA_AMP_MUTE, bits);
18426 static void alc663_g71v_unsol_event(struct hda_codec *codec,
18429 switch (res >> 26) {
18430 case ALC880_HP_EVENT:
18431 alc663_g71v_hp_automute(codec);
18433 case ALC880_FRONT_EVENT:
18434 alc663_g71v_front_automute(codec);
18436 case ALC880_MIC_EVENT:
18437 alc_mic_automute(codec);
18442 #define alc663_g71v_setup alc663_m51va_setup
18444 static void alc663_g71v_inithook(struct hda_codec *codec)
18446 alc663_g71v_front_automute(codec);
18447 alc663_g71v_hp_automute(codec);
18448 alc_mic_automute(codec);
18451 static void alc663_g50v_unsol_event(struct hda_codec *codec,
18454 switch (res >> 26) {
18455 case ALC880_HP_EVENT:
18456 alc663_m51va_speaker_automute(codec);
18458 case ALC880_MIC_EVENT:
18459 alc_mic_automute(codec);
18464 #define alc663_g50v_setup alc663_m51va_setup
18466 static void alc663_g50v_inithook(struct hda_codec *codec)
18468 alc663_m51va_speaker_automute(codec);
18469 alc_mic_automute(codec);
18472 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18473 HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18474 ALC262_HIPPO_MASTER_SWITCH,
18476 HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT),
18477 HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT),
18478 HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT),
18480 HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT),
18481 HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18482 HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18486 static struct snd_kcontrol_new alc272_nc10_mixer[] = {
18487 /* Master Playback automatically created from Speaker and Headphone */
18488 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18489 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
18490 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
18491 HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT),
18493 HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
18494 HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
18495 HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT),
18497 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
18498 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
18499 HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT),
18503 #ifdef CONFIG_SND_HDA_POWER_SAVE
18504 #define alc662_loopbacks alc880_loopbacks
18508 /* pcm configuration: identical with ALC880 */
18509 #define alc662_pcm_analog_playback alc880_pcm_analog_playback
18510 #define alc662_pcm_analog_capture alc880_pcm_analog_capture
18511 #define alc662_pcm_digital_playback alc880_pcm_digital_playback
18512 #define alc662_pcm_digital_capture alc880_pcm_digital_capture
18515 * configuration and preset
18517 static const char *alc662_models[ALC662_MODEL_LAST] = {
18518 [ALC662_3ST_2ch_DIG] = "3stack-dig",
18519 [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig",
18520 [ALC662_3ST_6ch] = "3stack-6ch",
18521 [ALC662_5ST_DIG] = "6stack-dig",
18522 [ALC662_LENOVO_101E] = "lenovo-101e",
18523 [ALC662_ASUS_EEEPC_P701] = "eeepc-p701",
18524 [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20",
18525 [ALC662_ECS] = "ecs",
18526 [ALC663_ASUS_M51VA] = "m51va",
18527 [ALC663_ASUS_G71V] = "g71v",
18528 [ALC663_ASUS_H13] = "h13",
18529 [ALC663_ASUS_G50V] = "g50v",
18530 [ALC663_ASUS_MODE1] = "asus-mode1",
18531 [ALC662_ASUS_MODE2] = "asus-mode2",
18532 [ALC663_ASUS_MODE3] = "asus-mode3",
18533 [ALC663_ASUS_MODE4] = "asus-mode4",
18534 [ALC663_ASUS_MODE5] = "asus-mode5",
18535 [ALC663_ASUS_MODE6] = "asus-mode6",
18536 [ALC663_ASUS_MODE7] = "asus-mode7",
18537 [ALC663_ASUS_MODE8] = "asus-mode8",
18538 [ALC272_DELL] = "dell",
18539 [ALC272_DELL_ZM1] = "dell-zm1",
18540 [ALC272_SAMSUNG_NC10] = "samsung-nc10",
18541 [ALC662_AUTO] = "auto",
18544 static struct snd_pci_quirk alc662_cfg_tbl[] = {
18545 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),
18546 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL),
18547 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),
18548 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),
18549 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3),
18550 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),
18551 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),
18552 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),
18553 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2),
18554 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1),
18555 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1),
18556 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1),
18557 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2),
18558 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7),
18559 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7),
18560 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8),
18561 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3),
18562 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1),
18563 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2),
18564 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2),
18565 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1),
18566 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2),
18567 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6),
18568 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6),
18569 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2),
18570 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1),
18571 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3),
18572 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA),
18573 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2),
18574 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2),
18575 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5),
18576 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6),
18577 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2),
18578 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1),
18579 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2),
18580 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2),
18581 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA),
18582 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/
18583 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),
18584 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),
18585 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1),
18586 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),
18587 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),
18588 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),
18589 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1),
18590 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2),
18591 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2),
18592 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1),
18593 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1),
18594 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3),
18595 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1),
18596 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1),
18597 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V),
18598 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/
18599 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1),
18600 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2),
18601 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA),
18602 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1),
18603 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4),
18604 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG),
18605 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701),
18606 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20),
18607 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
18608 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
18609 ALC662_3ST_6ch_DIG),
18610 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
18611 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
18612 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
18613 ALC662_3ST_6ch_DIG),
18614 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
18615 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
18616 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
18617 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),
18618 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0",
18619 ALC662_3ST_6ch_DIG),
18620 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x",
18625 static struct alc_config_preset alc662_presets[] = {
18626 [ALC662_3ST_2ch_DIG] = {
18627 .mixers = { alc662_3ST_2ch_mixer },
18628 .init_verbs = { alc662_init_verbs },
18629 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18630 .dac_nids = alc662_dac_nids,
18631 .dig_out_nid = ALC662_DIGOUT_NID,
18632 .dig_in_nid = ALC662_DIGIN_NID,
18633 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18634 .channel_mode = alc662_3ST_2ch_modes,
18635 .input_mux = &alc662_capture_source,
18637 [ALC662_3ST_6ch_DIG] = {
18638 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18639 .init_verbs = { alc662_init_verbs },
18640 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18641 .dac_nids = alc662_dac_nids,
18642 .dig_out_nid = ALC662_DIGOUT_NID,
18643 .dig_in_nid = ALC662_DIGIN_NID,
18644 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18645 .channel_mode = alc662_3ST_6ch_modes,
18647 .input_mux = &alc662_capture_source,
18649 [ALC662_3ST_6ch] = {
18650 .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer },
18651 .init_verbs = { alc662_init_verbs },
18652 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18653 .dac_nids = alc662_dac_nids,
18654 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18655 .channel_mode = alc662_3ST_6ch_modes,
18657 .input_mux = &alc662_capture_source,
18659 [ALC662_5ST_DIG] = {
18660 .mixers = { alc662_base_mixer, alc662_chmode_mixer },
18661 .init_verbs = { alc662_init_verbs },
18662 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18663 .dac_nids = alc662_dac_nids,
18664 .dig_out_nid = ALC662_DIGOUT_NID,
18665 .dig_in_nid = ALC662_DIGIN_NID,
18666 .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes),
18667 .channel_mode = alc662_5stack_modes,
18668 .input_mux = &alc662_capture_source,
18670 [ALC662_LENOVO_101E] = {
18671 .mixers = { alc662_lenovo_101e_mixer },
18672 .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18673 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18674 .dac_nids = alc662_dac_nids,
18675 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18676 .channel_mode = alc662_3ST_2ch_modes,
18677 .input_mux = &alc662_lenovo_101e_capture_source,
18678 .unsol_event = alc662_lenovo_101e_unsol_event,
18679 .init_hook = alc662_lenovo_101e_all_automute,
18681 [ALC662_ASUS_EEEPC_P701] = {
18682 .mixers = { alc662_eeepc_p701_mixer },
18683 .init_verbs = { alc662_init_verbs,
18684 alc662_eeepc_sue_init_verbs },
18685 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18686 .dac_nids = alc662_dac_nids,
18687 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18688 .channel_mode = alc662_3ST_2ch_modes,
18689 .unsol_event = alc662_eeepc_unsol_event,
18690 .setup = alc662_eeepc_setup,
18691 .init_hook = alc662_eeepc_inithook,
18693 [ALC662_ASUS_EEEPC_EP20] = {
18694 .mixers = { alc662_eeepc_ep20_mixer,
18695 alc662_chmode_mixer },
18696 .init_verbs = { alc662_init_verbs,
18697 alc662_eeepc_ep20_sue_init_verbs },
18698 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18699 .dac_nids = alc662_dac_nids,
18700 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18701 .channel_mode = alc662_3ST_6ch_modes,
18702 .input_mux = &alc662_lenovo_101e_capture_source,
18703 .unsol_event = alc662_eeepc_unsol_event,
18704 .setup = alc662_eeepc_ep20_setup,
18705 .init_hook = alc662_eeepc_ep20_inithook,
18708 .mixers = { alc662_ecs_mixer },
18709 .init_verbs = { alc662_init_verbs,
18710 alc662_ecs_init_verbs },
18711 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18712 .dac_nids = alc662_dac_nids,
18713 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18714 .channel_mode = alc662_3ST_2ch_modes,
18715 .unsol_event = alc662_eeepc_unsol_event,
18716 .setup = alc662_eeepc_setup,
18717 .init_hook = alc662_eeepc_inithook,
18719 [ALC663_ASUS_M51VA] = {
18720 .mixers = { alc663_m51va_mixer },
18721 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18722 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18723 .dac_nids = alc662_dac_nids,
18724 .dig_out_nid = ALC662_DIGOUT_NID,
18725 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18726 .channel_mode = alc662_3ST_2ch_modes,
18727 .unsol_event = alc663_m51va_unsol_event,
18728 .setup = alc663_m51va_setup,
18729 .init_hook = alc663_m51va_inithook,
18731 [ALC663_ASUS_G71V] = {
18732 .mixers = { alc663_g71v_mixer },
18733 .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18734 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18735 .dac_nids = alc662_dac_nids,
18736 .dig_out_nid = ALC662_DIGOUT_NID,
18737 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18738 .channel_mode = alc662_3ST_2ch_modes,
18739 .unsol_event = alc663_g71v_unsol_event,
18740 .setup = alc663_g71v_setup,
18741 .init_hook = alc663_g71v_inithook,
18743 [ALC663_ASUS_H13] = {
18744 .mixers = { alc663_m51va_mixer },
18745 .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18746 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18747 .dac_nids = alc662_dac_nids,
18748 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18749 .channel_mode = alc662_3ST_2ch_modes,
18750 .unsol_event = alc663_m51va_unsol_event,
18751 .init_hook = alc663_m51va_inithook,
18753 [ALC663_ASUS_G50V] = {
18754 .mixers = { alc663_g50v_mixer },
18755 .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18756 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18757 .dac_nids = alc662_dac_nids,
18758 .dig_out_nid = ALC662_DIGOUT_NID,
18759 .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18760 .channel_mode = alc662_3ST_6ch_modes,
18761 .input_mux = &alc663_capture_source,
18762 .unsol_event = alc663_g50v_unsol_event,
18763 .setup = alc663_g50v_setup,
18764 .init_hook = alc663_g50v_inithook,
18766 [ALC663_ASUS_MODE1] = {
18767 .mixers = { alc663_m51va_mixer },
18768 .cap_mixer = alc662_auto_capture_mixer,
18769 .init_verbs = { alc662_init_verbs,
18770 alc663_21jd_amic_init_verbs },
18771 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18773 .dac_nids = alc662_dac_nids,
18774 .dig_out_nid = ALC662_DIGOUT_NID,
18775 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18776 .channel_mode = alc662_3ST_2ch_modes,
18777 .unsol_event = alc663_mode1_unsol_event,
18778 .setup = alc663_mode1_setup,
18779 .init_hook = alc663_mode1_inithook,
18781 [ALC662_ASUS_MODE2] = {
18782 .mixers = { alc662_1bjd_mixer },
18783 .cap_mixer = alc662_auto_capture_mixer,
18784 .init_verbs = { alc662_init_verbs,
18785 alc662_1bjd_amic_init_verbs },
18786 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18787 .dac_nids = alc662_dac_nids,
18788 .dig_out_nid = ALC662_DIGOUT_NID,
18789 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18790 .channel_mode = alc662_3ST_2ch_modes,
18791 .unsol_event = alc662_mode2_unsol_event,
18792 .setup = alc662_mode2_setup,
18793 .init_hook = alc662_mode2_inithook,
18795 [ALC663_ASUS_MODE3] = {
18796 .mixers = { alc663_two_hp_m1_mixer },
18797 .cap_mixer = alc662_auto_capture_mixer,
18798 .init_verbs = { alc662_init_verbs,
18799 alc663_two_hp_amic_m1_init_verbs },
18800 .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_mode3_unsol_event,
18807 .setup = alc663_mode3_setup,
18808 .init_hook = alc663_mode3_inithook,
18810 [ALC663_ASUS_MODE4] = {
18811 .mixers = { alc663_asus_21jd_clfe_mixer },
18812 .cap_mixer = alc662_auto_capture_mixer,
18813 .init_verbs = { alc662_init_verbs,
18814 alc663_21jd_amic_init_verbs},
18815 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18817 .dac_nids = alc662_dac_nids,
18818 .dig_out_nid = ALC662_DIGOUT_NID,
18819 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18820 .channel_mode = alc662_3ST_2ch_modes,
18821 .unsol_event = alc663_mode4_unsol_event,
18822 .setup = alc663_mode4_setup,
18823 .init_hook = alc663_mode4_inithook,
18825 [ALC663_ASUS_MODE5] = {
18826 .mixers = { alc663_asus_15jd_clfe_mixer },
18827 .cap_mixer = alc662_auto_capture_mixer,
18828 .init_verbs = { alc662_init_verbs,
18829 alc663_15jd_amic_init_verbs },
18830 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18832 .dac_nids = alc662_dac_nids,
18833 .dig_out_nid = ALC662_DIGOUT_NID,
18834 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18835 .channel_mode = alc662_3ST_2ch_modes,
18836 .unsol_event = alc663_mode5_unsol_event,
18837 .setup = alc663_mode5_setup,
18838 .init_hook = alc663_mode5_inithook,
18840 [ALC663_ASUS_MODE6] = {
18841 .mixers = { alc663_two_hp_m2_mixer },
18842 .cap_mixer = alc662_auto_capture_mixer,
18843 .init_verbs = { alc662_init_verbs,
18844 alc663_two_hp_amic_m2_init_verbs },
18845 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18847 .dac_nids = alc662_dac_nids,
18848 .dig_out_nid = ALC662_DIGOUT_NID,
18849 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18850 .channel_mode = alc662_3ST_2ch_modes,
18851 .unsol_event = alc663_mode6_unsol_event,
18852 .setup = alc663_mode6_setup,
18853 .init_hook = alc663_mode6_inithook,
18855 [ALC663_ASUS_MODE7] = {
18856 .mixers = { alc663_mode7_mixer },
18857 .cap_mixer = alc662_auto_capture_mixer,
18858 .init_verbs = { alc662_init_verbs,
18859 alc663_mode7_init_verbs },
18860 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18862 .dac_nids = alc662_dac_nids,
18863 .dig_out_nid = ALC662_DIGOUT_NID,
18864 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18865 .channel_mode = alc662_3ST_2ch_modes,
18866 .unsol_event = alc663_mode7_unsol_event,
18867 .setup = alc663_mode7_setup,
18868 .init_hook = alc663_mode7_inithook,
18870 [ALC663_ASUS_MODE8] = {
18871 .mixers = { alc663_mode8_mixer },
18872 .cap_mixer = alc662_auto_capture_mixer,
18873 .init_verbs = { alc662_init_verbs,
18874 alc663_mode8_init_verbs },
18875 .num_dacs = ARRAY_SIZE(alc662_dac_nids),
18877 .dac_nids = alc662_dac_nids,
18878 .dig_out_nid = ALC662_DIGOUT_NID,
18879 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18880 .channel_mode = alc662_3ST_2ch_modes,
18881 .unsol_event = alc663_mode8_unsol_event,
18882 .setup = alc663_mode8_setup,
18883 .init_hook = alc663_mode8_inithook,
18886 .mixers = { alc663_m51va_mixer },
18887 .cap_mixer = alc272_auto_capture_mixer,
18888 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18889 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18890 .dac_nids = alc662_dac_nids,
18891 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18892 .adc_nids = alc272_adc_nids,
18893 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
18894 .capsrc_nids = alc272_capsrc_nids,
18895 .channel_mode = alc662_3ST_2ch_modes,
18896 .unsol_event = alc663_m51va_unsol_event,
18897 .setup = alc663_m51va_setup,
18898 .init_hook = alc663_m51va_inithook,
18900 [ALC272_DELL_ZM1] = {
18901 .mixers = { alc663_m51va_mixer },
18902 .cap_mixer = alc662_auto_capture_mixer,
18903 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18904 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18905 .dac_nids = alc662_dac_nids,
18906 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18907 .adc_nids = alc662_adc_nids,
18909 .capsrc_nids = alc662_capsrc_nids,
18910 .channel_mode = alc662_3ST_2ch_modes,
18911 .unsol_event = alc663_m51va_unsol_event,
18912 .setup = alc663_m51va_setup,
18913 .init_hook = alc663_m51va_inithook,
18915 [ALC272_SAMSUNG_NC10] = {
18916 .mixers = { alc272_nc10_mixer },
18917 .init_verbs = { alc662_init_verbs,
18918 alc663_21jd_amic_init_verbs },
18919 .num_dacs = ARRAY_SIZE(alc272_dac_nids),
18920 .dac_nids = alc272_dac_nids,
18921 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18922 .channel_mode = alc662_3ST_2ch_modes,
18923 /*.input_mux = &alc272_nc10_capture_source,*/
18924 .unsol_event = alc663_mode4_unsol_event,
18925 .setup = alc663_mode4_setup,
18926 .init_hook = alc663_mode4_inithook,
18932 * BIOS auto configuration
18935 /* convert from MIX nid to DAC */
18936 static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
18940 else if (nid >= 0x0c && nid <= 0x0e)
18941 return nid - 0x0c + 0x02;
18946 /* get MIX nid connected to the given pin targeted to DAC */
18947 static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18953 num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18954 for (i = 0; i < num; i++) {
18955 if (alc662_mix_to_dac(mix[i]) == dac)
18961 /* look for an empty DAC slot */
18962 static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18964 struct alc_spec *spec = codec->spec;
18968 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
18971 for (i = 0; i < num; i++) {
18972 hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18975 for (j = 0; j < spec->multiout.num_dacs; j++)
18976 if (spec->multiout.dac_nids[j] == nid)
18978 if (j >= spec->multiout.num_dacs)
18984 /* fill in the dac_nids table from the parsed pin configuration */
18985 static int alc662_auto_fill_dac_nids(struct hda_codec *codec,
18986 const struct auto_pin_cfg *cfg)
18988 struct alc_spec *spec = codec->spec;
18992 spec->multiout.dac_nids = spec->private_dac_nids;
18993 for (i = 0; i < cfg->line_outs; i++) {
18994 dac = alc662_look_for_dac(codec, cfg->line_out_pins[i]);
18997 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19002 static inline int alc662_add_vol_ctl(struct alc_spec *spec, const char *pfx,
19003 hda_nid_t nid, unsigned int chs)
19005 return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx,
19006 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT));
19009 static inline int alc662_add_sw_ctl(struct alc_spec *spec, const char *pfx,
19010 hda_nid_t nid, unsigned int chs)
19012 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19013 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_INPUT));
19016 #define alc662_add_stereo_vol(spec, pfx, nid) \
19017 alc662_add_vol_ctl(spec, pfx, nid, 3)
19018 #define alc662_add_stereo_sw(spec, pfx, nid) \
19019 alc662_add_sw_ctl(spec, pfx, nid, 3)
19021 /* add playback controls from the parsed DAC table */
19022 static int alc662_auto_create_multi_out_ctls(struct hda_codec *codec,
19023 const struct auto_pin_cfg *cfg)
19025 struct alc_spec *spec = codec->spec;
19026 static const char *chname[4] = {
19027 "Front", "Surround", NULL /*CLFE*/, "Side"
19029 hda_nid_t nid, mix;
19032 for (i = 0; i < cfg->line_outs; i++) {
19033 nid = spec->multiout.dac_nids[i];
19036 mix = alc662_dac_to_mix(codec, cfg->line_out_pins[i], nid);
19041 err = alc662_add_vol_ctl(spec, "Center", nid, 1);
19044 err = alc662_add_vol_ctl(spec, "LFE", nid, 2);
19047 err = alc662_add_sw_ctl(spec, "Center", mix, 1);
19050 err = alc662_add_sw_ctl(spec, "LFE", mix, 2);
19055 if (cfg->line_outs == 1 &&
19056 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
19063 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19066 if (cfg->line_outs == 1 &&
19067 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19069 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19077 /* add playback controls for speaker and HP outputs */
19078 /* return DAC nid if any new DAC is assigned */
19079 static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
19082 struct alc_spec *spec = codec->spec;
19083 hda_nid_t nid, mix;
19088 nid = alc662_look_for_dac(codec, pin);
19090 /* the corresponding DAC is already occupied */
19091 if (!(get_wcaps(codec, pin) & AC_WCAP_OUT_AMP))
19092 return 0; /* no way */
19093 /* create a switch only */
19094 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx,
19095 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT));
19098 mix = alc662_dac_to_mix(codec, pin, nid);
19101 err = alc662_add_vol_ctl(spec, pfx, nid, 3);
19104 err = alc662_add_sw_ctl(spec, pfx, mix, 3);
19110 /* create playback/capture controls for input pins */
19111 #define alc662_auto_create_input_ctls \
19112 alc882_auto_create_input_ctls
19114 static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
19115 hda_nid_t nid, int pin_type,
19119 hda_nid_t srcs[HDA_MAX_CONNECTIONS];
19121 alc_set_pin_output(codec, nid, pin_type);
19122 /* need the manual connection? */
19123 num = snd_hda_get_connections(codec, nid, srcs, ARRAY_SIZE(srcs));
19126 for (i = 0; i < num; i++) {
19127 if (alc662_mix_to_dac(srcs[i]) != dac)
19129 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, i);
19134 static void alc662_auto_init_multi_out(struct hda_codec *codec)
19136 struct alc_spec *spec = codec->spec;
19137 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19140 for (i = 0; i <= HDA_SIDE; i++) {
19141 hda_nid_t nid = spec->autocfg.line_out_pins[i];
19143 alc662_auto_set_output_and_unmute(codec, nid, pin_type,
19144 spec->multiout.dac_nids[i]);
19148 static void alc662_auto_init_hp_out(struct hda_codec *codec)
19150 struct alc_spec *spec = codec->spec;
19153 pin = spec->autocfg.hp_pins[0];
19155 alc662_auto_set_output_and_unmute(codec, pin, PIN_HP,
19156 spec->multiout.hp_nid);
19157 pin = spec->autocfg.speaker_pins[0];
19159 alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT,
19160 spec->multiout.extra_out_nid[0]);
19163 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID
19165 static void alc662_auto_init_analog_input(struct hda_codec *codec)
19167 struct alc_spec *spec = codec->spec;
19168 struct auto_pin_cfg *cfg = &spec->autocfg;
19171 for (i = 0; i < cfg->num_inputs; i++) {
19172 hda_nid_t nid = cfg->inputs[i].pin;
19173 if (alc_is_input_pin(codec, nid)) {
19174 alc_set_input_pin(codec, nid, cfg->inputs[i].type);
19175 if (nid != ALC662_PIN_CD_NID &&
19176 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP))
19177 snd_hda_codec_write(codec, nid, 0,
19178 AC_VERB_SET_AMP_GAIN_MUTE,
19184 #define alc662_auto_init_input_src alc882_auto_init_input_src
19186 static int alc662_parse_auto_config(struct hda_codec *codec)
19188 struct alc_spec *spec = codec->spec;
19190 static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19192 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19196 if (!spec->autocfg.line_outs)
19197 return 0; /* can't find valid BIOS pin config */
19199 err = alc662_auto_fill_dac_nids(codec, &spec->autocfg);
19202 err = alc662_auto_create_multi_out_ctls(codec, &spec->autocfg);
19205 err = alc662_auto_create_extra_out(codec,
19206 spec->autocfg.speaker_pins[0],
19211 spec->multiout.extra_out_nid[0] = err;
19212 err = alc662_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
19217 spec->multiout.hp_nid = err;
19218 err = alc662_auto_create_input_ctls(codec, &spec->autocfg);
19222 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
19224 alc_auto_parse_digital(codec);
19226 if (spec->kctls.list)
19227 add_mixer(spec, spec->kctls.list);
19229 spec->num_mux_defs = 1;
19230 spec->input_mux = &spec->private_imux[0];
19232 add_verb(spec, alc662_init_verbs);
19233 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19234 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19235 add_verb(spec, alc663_init_verbs);
19237 if (codec->vendor_id == 0x10ec0272)
19238 add_verb(spec, alc272_init_verbs);
19240 err = alc_auto_add_mic_boost(codec);
19244 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
19245 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
19246 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21);
19248 alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);
19253 /* additional initialization for auto-configuration model */
19254 static void alc662_auto_init(struct hda_codec *codec)
19256 struct alc_spec *spec = codec->spec;
19257 alc662_auto_init_multi_out(codec);
19258 alc662_auto_init_hp_out(codec);
19259 alc662_auto_init_analog_input(codec);
19260 alc662_auto_init_input_src(codec);
19261 alc_auto_init_digital(codec);
19262 if (spec->unsol_event)
19263 alc_inithook(codec);
19267 ALC662_FIXUP_ASPIRE,
19268 ALC662_FIXUP_IDEAPAD,
19271 static const struct alc_fixup alc662_fixups[] = {
19272 [ALC662_FIXUP_ASPIRE] = {
19273 .pins = (const struct alc_pincfg[]) {
19274 { 0x15, 0x99130112 }, /* subwoofer */
19278 [ALC662_FIXUP_IDEAPAD] = {
19279 .pins = (const struct alc_pincfg[]) {
19280 { 0x17, 0x99130112 }, /* subwoofer */
19286 static struct snd_pci_quirk alc662_fixup_tbl[] = {
19287 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
19288 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
19289 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
19295 static int patch_alc662(struct hda_codec *codec)
19297 struct alc_spec *spec;
19298 int err, board_config;
19300 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19304 codec->spec = spec;
19306 alc_auto_parse_customize_define(codec);
19308 alc_fix_pll_init(codec, 0x20, 0x04, 15);
19310 if (alc_read_coef_idx(codec, 0) == 0x8020)
19311 alc_codec_rename(codec, "ALC661");
19312 else if ((alc_read_coef_idx(codec, 0) & (1 << 14)) &&
19313 codec->bus->pci->subsystem_vendor == 0x1025 &&
19314 spec->cdefine.platform_type == 1)
19315 alc_codec_rename(codec, "ALC272X");
19317 board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST,
19320 if (board_config < 0) {
19321 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19323 board_config = ALC662_AUTO;
19326 if (board_config == ALC662_AUTO) {
19327 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1);
19328 /* automatic parse from the BIOS config */
19329 err = alc662_parse_auto_config(codec);
19335 "hda_codec: Cannot set up configuration "
19336 "from BIOS. Using base mode...\n");
19337 board_config = ALC662_3ST_2ch_DIG;
19341 if (has_cdefine_beep(codec)) {
19342 err = snd_hda_attach_beep_device(codec, 0x1);
19349 if (board_config != ALC662_AUTO)
19350 setup_preset(codec, &alc662_presets[board_config]);
19352 spec->stream_analog_playback = &alc662_pcm_analog_playback;
19353 spec->stream_analog_capture = &alc662_pcm_analog_capture;
19355 spec->stream_digital_playback = &alc662_pcm_digital_playback;
19356 spec->stream_digital_capture = &alc662_pcm_digital_capture;
19358 if (!spec->adc_nids) {
19359 spec->adc_nids = alc662_adc_nids;
19360 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
19362 if (!spec->capsrc_nids)
19363 spec->capsrc_nids = alc662_capsrc_nids;
19365 if (!spec->cap_mixer)
19366 set_capture_mixer(codec);
19368 if (has_cdefine_beep(codec)) {
19369 switch (codec->vendor_id) {
19371 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
19376 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
19379 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
19383 spec->vmaster_nid = 0x02;
19385 codec->patch_ops = alc_patch_ops;
19386 if (board_config == ALC662_AUTO) {
19387 spec->init_hook = alc662_auto_init;
19388 alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0);
19391 #ifdef CONFIG_SND_HDA_POWER_SAVE
19392 if (!spec->loopback.amplist)
19393 spec->loopback.amplist = alc662_loopbacks;
19399 static int patch_alc888(struct hda_codec *codec)
19401 if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){
19402 kfree(codec->chip_name);
19403 codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL);
19404 if (!codec->chip_name) {
19408 return patch_alc662(codec);
19410 return patch_alc882(codec);
19416 #define ALC680_DIGIN_NID ALC880_DIGIN_NID
19417 #define ALC680_DIGOUT_NID ALC880_DIGOUT_NID
19418 #define alc680_modes alc260_modes
19420 static hda_nid_t alc680_dac_nids[3] = {
19421 /* Lout1, Lout2, hp */
19425 static hda_nid_t alc680_adc_nids[3] = {
19427 /* DMIC, MIC, Line-in*/
19432 * Analog capture ADC cgange
19434 static void alc680_rec_autoswitch(struct hda_codec *codec)
19436 struct alc_spec *spec = codec->spec;
19437 struct auto_pin_cfg *cfg = &spec->autocfg;
19439 int type_found = AUTO_PIN_LAST;
19443 for (i = 0; i < cfg->num_inputs; i++) {
19444 nid = cfg->inputs[i].pin;
19445 if (!(snd_hda_query_pin_caps(codec, nid) &
19446 AC_PINCAP_PRES_DETECT))
19448 if (snd_hda_jack_detect(codec, nid)) {
19449 if (cfg->inputs[i].type < type_found) {
19450 type_found = cfg->inputs[i].type;
19458 snd_hda_get_connections(codec, pin_found, &nid, 1);
19460 if (nid != spec->cur_adc)
19461 __snd_hda_codec_cleanup_stream(codec, spec->cur_adc, 1);
19462 spec->cur_adc = nid;
19463 snd_hda_codec_setup_stream(codec, nid, spec->cur_adc_stream_tag, 0,
19464 spec->cur_adc_format);
19467 static int alc680_capture_pcm_prepare(struct hda_pcm_stream *hinfo,
19468 struct hda_codec *codec,
19469 unsigned int stream_tag,
19470 unsigned int format,
19471 struct snd_pcm_substream *substream)
19473 struct alc_spec *spec = codec->spec;
19475 spec->cur_adc = 0x07;
19476 spec->cur_adc_stream_tag = stream_tag;
19477 spec->cur_adc_format = format;
19479 alc680_rec_autoswitch(codec);
19483 static int alc680_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
19484 struct hda_codec *codec,
19485 struct snd_pcm_substream *substream)
19487 snd_hda_codec_cleanup_stream(codec, 0x07);
19488 snd_hda_codec_cleanup_stream(codec, 0x08);
19489 snd_hda_codec_cleanup_stream(codec, 0x09);
19493 static struct hda_pcm_stream alc680_pcm_analog_auto_capture = {
19494 .substreams = 1, /* can be overridden */
19497 /* NID is set in alc_build_pcms */
19499 .prepare = alc680_capture_pcm_prepare,
19500 .cleanup = alc680_capture_pcm_cleanup
19504 static struct snd_kcontrol_new alc680_base_mixer[] = {
19505 /* output mixer control */
19506 HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT),
19507 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
19508 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x4, 0x0, HDA_OUTPUT),
19509 HDA_CODEC_MUTE("Headphone Playback Switch", 0x16, 0x0, HDA_OUTPUT),
19510 HDA_CODEC_VOLUME("Int Mic Boost", 0x12, 0, HDA_INPUT),
19511 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
19512 HDA_CODEC_VOLUME("Line In Boost", 0x19, 0, HDA_INPUT),
19516 static struct hda_bind_ctls alc680_bind_cap_vol = {
19517 .ops = &snd_hda_bind_vol,
19519 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19520 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19521 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19526 static struct hda_bind_ctls alc680_bind_cap_switch = {
19527 .ops = &snd_hda_bind_sw,
19529 HDA_COMPOSE_AMP_VAL(0x07, 3, 0, HDA_INPUT),
19530 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
19531 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
19536 static struct snd_kcontrol_new alc680_master_capture_mixer[] = {
19537 HDA_BIND_VOL("Capture Volume", &alc680_bind_cap_vol),
19538 HDA_BIND_SW("Capture Switch", &alc680_bind_cap_switch),
19543 * generic initialization of ADC, input mixers and output mixers
19545 static struct hda_verb alc680_init_verbs[] = {
19546 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19547 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19548 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
19550 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19551 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19552 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
19553 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
19554 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
19555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
19557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19558 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19559 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19560 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19561 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
19563 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
19564 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19565 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN},
19570 /* toggle speaker-output according to the hp-jack state */
19571 static void alc680_base_setup(struct hda_codec *codec)
19573 struct alc_spec *spec = codec->spec;
19575 spec->autocfg.hp_pins[0] = 0x16;
19576 spec->autocfg.speaker_pins[0] = 0x14;
19577 spec->autocfg.speaker_pins[1] = 0x15;
19578 spec->autocfg.num_inputs = 2;
19579 spec->autocfg.inputs[0].pin = 0x18;
19580 spec->autocfg.inputs[0].type = AUTO_PIN_MIC;
19581 spec->autocfg.inputs[1].pin = 0x19;
19582 spec->autocfg.inputs[1].type = AUTO_PIN_LINE_IN;
19585 static void alc680_unsol_event(struct hda_codec *codec,
19588 if ((res >> 26) == ALC880_HP_EVENT)
19589 alc_automute_amp(codec);
19590 if ((res >> 26) == ALC880_MIC_EVENT)
19591 alc680_rec_autoswitch(codec);
19594 static void alc680_inithook(struct hda_codec *codec)
19596 alc_automute_amp(codec);
19597 alc680_rec_autoswitch(codec);
19600 /* create input playback/capture controls for the given pin */
19601 static int alc680_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
19602 const char *ctlname, int idx)
19620 if (spec->multiout.dac_nids[0] != dac &&
19621 spec->multiout.dac_nids[1] != dac) {
19622 err = add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname,
19623 HDA_COMPOSE_AMP_VAL(dac, 3, idx,
19628 err = add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname,
19629 HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT));
19633 spec->multiout.dac_nids[spec->multiout.num_dacs++] = dac;
19639 /* add playback controls from the parsed DAC table */
19640 static int alc680_auto_create_multi_out_ctls(struct alc_spec *spec,
19641 const struct auto_pin_cfg *cfg)
19646 spec->multiout.dac_nids = spec->private_dac_nids;
19648 nid = cfg->line_out_pins[0];
19651 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
19655 err = alc680_new_analog_output(spec, nid, name, 0);
19660 nid = cfg->speaker_pins[0];
19662 err = alc680_new_analog_output(spec, nid, "Speaker", 0);
19666 nid = cfg->hp_pins[0];
19668 err = alc680_new_analog_output(spec, nid, "Headphone", 0);
19676 static void alc680_auto_set_output_and_unmute(struct hda_codec *codec,
19677 hda_nid_t nid, int pin_type)
19679 alc_set_pin_output(codec, nid, pin_type);
19682 static void alc680_auto_init_multi_out(struct hda_codec *codec)
19684 struct alc_spec *spec = codec->spec;
19685 hda_nid_t nid = spec->autocfg.line_out_pins[0];
19687 int pin_type = get_pin_type(spec->autocfg.line_out_type);
19688 alc680_auto_set_output_and_unmute(codec, nid, pin_type);
19692 static void alc680_auto_init_hp_out(struct hda_codec *codec)
19694 struct alc_spec *spec = codec->spec;
19697 pin = spec->autocfg.hp_pins[0];
19699 alc680_auto_set_output_and_unmute(codec, pin, PIN_HP);
19700 pin = spec->autocfg.speaker_pins[0];
19702 alc680_auto_set_output_and_unmute(codec, pin, PIN_OUT);
19705 /* pcm configuration: identical with ALC880 */
19706 #define alc680_pcm_analog_playback alc880_pcm_analog_playback
19707 #define alc680_pcm_analog_capture alc880_pcm_analog_capture
19708 #define alc680_pcm_analog_alt_capture alc880_pcm_analog_alt_capture
19709 #define alc680_pcm_digital_playback alc880_pcm_digital_playback
19710 #define alc680_pcm_digital_capture alc880_pcm_digital_capture
19713 * BIOS auto configuration
19715 static int alc680_parse_auto_config(struct hda_codec *codec)
19717 struct alc_spec *spec = codec->spec;
19719 static hda_nid_t alc680_ignore[] = { 0 };
19721 err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19726 if (!spec->autocfg.line_outs) {
19727 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
19728 spec->multiout.max_channels = 2;
19729 spec->no_analog = 1;
19732 return 0; /* can't find valid BIOS pin config */
19734 err = alc680_auto_create_multi_out_ctls(spec, &spec->autocfg);
19738 spec->multiout.max_channels = 2;
19741 /* digital only support output */
19742 alc_auto_parse_digital(codec);
19743 if (spec->kctls.list)
19744 add_mixer(spec, spec->kctls.list);
19746 add_verb(spec, alc680_init_verbs);
19748 err = alc_auto_add_mic_boost(codec);
19755 #define alc680_auto_init_analog_input alc882_auto_init_analog_input
19757 /* init callback for auto-configuration model -- overriding the default init */
19758 static void alc680_auto_init(struct hda_codec *codec)
19760 struct alc_spec *spec = codec->spec;
19761 alc680_auto_init_multi_out(codec);
19762 alc680_auto_init_hp_out(codec);
19763 alc680_auto_init_analog_input(codec);
19764 alc_auto_init_digital(codec);
19765 if (spec->unsol_event)
19766 alc_inithook(codec);
19770 * configuration and preset
19772 static const char *alc680_models[ALC680_MODEL_LAST] = {
19773 [ALC680_BASE] = "base",
19774 [ALC680_AUTO] = "auto",
19777 static struct snd_pci_quirk alc680_cfg_tbl[] = {
19778 SND_PCI_QUIRK(0x1043, 0x12f3, "ASUS NX90", ALC680_BASE),
19782 static struct alc_config_preset alc680_presets[] = {
19784 .mixers = { alc680_base_mixer },
19785 .cap_mixer = alc680_master_capture_mixer,
19786 .init_verbs = { alc680_init_verbs },
19787 .num_dacs = ARRAY_SIZE(alc680_dac_nids),
19788 .dac_nids = alc680_dac_nids,
19789 .dig_out_nid = ALC680_DIGOUT_NID,
19790 .num_channel_mode = ARRAY_SIZE(alc680_modes),
19791 .channel_mode = alc680_modes,
19792 .unsol_event = alc680_unsol_event,
19793 .setup = alc680_base_setup,
19794 .init_hook = alc680_inithook,
19799 static int patch_alc680(struct hda_codec *codec)
19801 struct alc_spec *spec;
19805 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
19809 codec->spec = spec;
19811 board_config = snd_hda_check_board_config(codec, ALC680_MODEL_LAST,
19815 if (board_config < 0 || board_config >= ALC680_MODEL_LAST) {
19816 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
19818 board_config = ALC680_AUTO;
19821 if (board_config == ALC680_AUTO) {
19822 /* automatic parse from the BIOS config */
19823 err = alc680_parse_auto_config(codec);
19829 "hda_codec: Cannot set up configuration "
19830 "from BIOS. Using base mode...\n");
19831 board_config = ALC680_BASE;
19835 if (board_config != ALC680_AUTO)
19836 setup_preset(codec, &alc680_presets[board_config]);
19838 spec->stream_analog_playback = &alc680_pcm_analog_playback;
19839 spec->stream_analog_capture = &alc680_pcm_analog_auto_capture;
19840 spec->stream_digital_playback = &alc680_pcm_digital_playback;
19841 spec->stream_digital_capture = &alc680_pcm_digital_capture;
19843 if (!spec->adc_nids) {
19844 spec->adc_nids = alc680_adc_nids;
19845 spec->num_adc_nids = ARRAY_SIZE(alc680_adc_nids);
19848 if (!spec->cap_mixer)
19849 set_capture_mixer(codec);
19851 spec->vmaster_nid = 0x02;
19853 codec->patch_ops = alc_patch_ops;
19854 if (board_config == ALC680_AUTO)
19855 spec->init_hook = alc680_auto_init;
19863 static struct hda_codec_preset snd_hda_preset_realtek[] = {
19864 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
19865 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
19866 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
19867 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
19868 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
19869 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
19870 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
19871 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
19872 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
19873 .patch = patch_alc861 },
19874 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
19875 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
19876 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
19877 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
19878 .patch = patch_alc882 },
19879 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
19880 .patch = patch_alc662 },
19881 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
19882 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
19883 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
19884 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
19885 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
19886 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
19887 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
19888 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
19889 .patch = patch_alc882 },
19890 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
19891 .patch = patch_alc882 },
19892 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
19893 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
19894 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
19895 .patch = patch_alc882 },
19896 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 },
19897 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
19898 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
19899 {} /* terminator */
19902 MODULE_ALIAS("snd-hda-codec-id:10ec*");
19904 MODULE_LICENSE("GPL");
19905 MODULE_DESCRIPTION("Realtek HD-audio codec");
19907 static struct hda_codec_preset_list realtek_list = {
19908 .preset = snd_hda_preset_realtek,
19909 .owner = THIS_MODULE,
19912 static int __init patch_realtek_init(void)
19914 return snd_hda_add_codec_preset(&realtek_list);
19917 static void __exit patch_realtek_exit(void)
19919 snd_hda_delete_codec_preset(&realtek_list);
19922 module_init(patch_realtek_init)
19923 module_exit(patch_realtek_exit)